:root {
  color-scheme: light;
  --bg: #f5f7f6; --surface: #fff; --surface-soft: #eef4f1; --text: #19302b;
  --muted: #5e716a; --line: #dce6e1; --brand: #087f68; --brand-hover: #076653;
  --brand-soft: #e3f4ed; --positive: #08774f; --negative: #ae3b3b; --negative-soft: #fbeaea;
  --warning: #88600b; --warning-soft: #fff4d8; --shadow: 0 5px 24px #15382b08;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111b19; --surface: #1b2824; --surface-soft: #22372f; --text: #e7f1ec;
  --muted: #a4b9b0; --line: #34473e; --brand: #5ed4b4; --brand-hover: #83e4c9;
  --brand-soft: #213e33; --positive: #70d8a9; --negative: #ffa6a6; --negative-soft: #44292c;
  --warning: #f2cf7d; --warning-soft: #3c3522; --shadow: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
a { color: var(--brand); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(24px, 4vw, 32px); line-height: 1.2; margin-bottom: 8px; letter-spacing: -.7px; }
h2 { font-size: 18px; line-height: 1.35; letter-spacing: -.25px; margin-bottom: 16px; }
h3 { font-size: 15px; margin-bottom: 10px; }
p { margin-bottom: 12px; }
small, .small { font-size: 12px; }
strong { font-weight: 650; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.positive { color: var(--positive); }
.negative { color: var(--negative); }
.mono { font-variant-numeric: tabular-nums; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.app-shell { max-width: 1040px; margin: auto; padding: max(20px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right)) calc(110px + max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px))) max(24px, env(safe-area-inset-left)); min-height: 100dvh; }
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 30px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); }
.brand-mark { width: 40px; height: 40px; color: var(--brand); flex-shrink: 0; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.5px; }
.brand small { display: block; color: var(--muted); font-size: 11px; }
.connection { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.connection::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.connection.offline::before { background: var(--negative); }
.page-head { margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.page-head p { color: var(--muted); margin-bottom: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.5px; font-size: 10px; font-weight: 700; color: var(--brand); margin-bottom: 8px; }
.card { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); padding: 24px; box-shadow: var(--shadow); }
.stack { display: grid; gap: 20px; }
.grid { display: grid; gap: 16px; }
.two-columns { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat { padding: 20px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.stat-value { font-size: clamp(22px, 3.4vw, 28px); font-weight: 650; letter-spacing: -.8px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat-hint { color: var(--muted); font-size: 11px; margin-top: 8px; }
.section-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-line h2, .section-line h3 { margin: 0; }
.button { border: 1px solid transparent; border-radius: 12px; padding: 12px 17px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; background: var(--surface-soft); color: var(--text); font-weight: 600; text-decoration: none; transition: background .15s, transform .15s; }
.button:hover { filter: brightness(.97); }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .button.primary { color: #102a21; }
.button.primary:hover { background: var(--brand-hover); }
.button.outline { border-color: var(--line); background: var(--surface); }
.button.danger { background: var(--negative-soft); color: var(--negative); }
.button.quiet { background: transparent; color: var(--brand); padding: 8px 10px; min-height: 40px; font-size: 13px; }
.button.icon-only { padding: 10px; min-width: 44px; }
.button.small { min-height: 38px; padding: 7px 12px; font-size: 12px; }
.button[aria-busy="true"]::after { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions.grow > .button { flex: 1; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; font-size: 11px; font-weight: 600; background: var(--surface-soft); color: var(--muted); }
.badge.working, .badge.closed, .badge.workday { background: var(--brand-soft); color: var(--positive); }
.badge.paused, .badge.vacation { color: var(--warning); background: var(--warning-soft); }
.badge.holiday { color: #306a9d; background: #e9f2fc; }
.badge.permission { color: #79539d; background: #f0eaf7; }
:root[data-theme="dark"] .badge.holiday { color: #a6cdf6; background: #253646; }
:root[data-theme="dark"] .badge.permission { color: #d5b6ef; background: #382e42; }
.badge.working::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.hero { position: relative; overflow: hidden; }
.hero-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.clock-label { margin-top: 30px; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
.clock-digits { font-size: clamp(50px, 10vw, 72px); font-weight: 650; letter-spacing: -3px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.clock-digits small { font-size: 16px; font-weight: 400; letter-spacing: 0; margin-left: 8px; color: var(--muted); }
.progress-track { height: 6px; border-radius: 6px; overflow: hidden; background: var(--surface-soft); margin: 22px 0 12px; }
.progress-fill { height: 100%; border-radius: inherit; background: var(--brand); transition: width .5s; }
.progress-caption { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); margin-bottom: 26px; }
.hero .actions { margin-top: 20px; }
.detail-pairs { display: grid; gap: 14px; }
.detail-pair { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.detail-pair:last-child { border: 0; padding-bottom: 0; }
.detail-pair > :first-child { color: var(--muted); font-size: 13px; }
.detail-pair > :last-child { text-align: right; font-variant-numeric: tabular-nums; }
.help-text { font-size: 12px; color: var(--muted); margin: 0; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 60px 1fr; gap: 15px; padding: 0 0 22px 16px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand); position: absolute; left: 0; top: 7px; }
.timeline li:not(:last-child)::after { content: ""; width: 1px; height: calc(100% - 6px); background: var(--line); position: absolute; left: 3px; top: 16px; }
.timeline time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.timeline p { font-size: 13px; margin-bottom: 2px; }
.timeline small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.bottom-nav { display: flex; position: fixed; bottom: max(14px, env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); width: min(460px, calc(100% - 30px)); padding: 7px; gap: 4px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 8px 36px #102a2120; z-index: 20; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; padding: 9px 5px; border-radius: 13px; color: var(--muted); font-size: 10px; font-weight: 600; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.banner { border: 1px solid var(--line); background: var(--warning-soft); color: var(--warning); padding: 13px 16px; border-radius: 12px; font-size: 13px; margin-bottom: 20px; }
.banner.error { background: var(--negative-soft); color: var(--negative); }
.inline-note { padding: 12px 14px; border-radius: 12px; background: var(--surface-soft); font-size: 12px; color: var(--muted); }
.inline-note.warning { background: var(--warning-soft); color: var(--warning); }
.loading-screen, .empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.loading-screen h1, .empty-state h2 { color: var(--text); margin-top: 20px; }
.empty-state > .icon { width: 36px; height: 36px; color: var(--brand); }
.welcome { max-width: 470px; margin: 8vh auto 0; padding: 35px; text-align: center; }
.welcome .brand-mark { width: 64px; height: 64px; margin-bottom: 22px; }
.welcome p { color: var(--muted); }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid var(--line); border-right-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 36px); background: var(--text); color: var(--surface); border-radius: 12px; padding: 12px 18px; font-size: 13px; box-shadow: var(--shadow); z-index: 100; text-align: center; }
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.calendar-title { display: flex; align-items: center; gap: 10px; }
.calendar-title h2 { margin: 0; min-width: 160px; text-align: center; text-transform: capitalize; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.weekday { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; padding-bottom: 10px; }
.calendar-day { border: 1px solid transparent; background: var(--bg); color: var(--text); min-height: 84px; border-radius: 11px; padding: 9px 5px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.calendar-day:hover { border-color: var(--brand); }
.calendar-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.calendar-day.holiday { background: #e9f2fc; }
.calendar-day.vacation { background: var(--warning-soft); }
.calendar-day.permission { background: #f0eaf7; }
:root[data-theme="dark"] .calendar-day.holiday { background: #253646; }
:root[data-theme="dark"] .calendar-day.permission { background: #382e42; }
.calendar-day.rest .number { color: var(--muted); }
.calendar-day .number { font-size: 14px; font-weight: 600; }
.calendar-day .hours { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.calendar-day .day-dot { width: 5px; height: 5px; background: var(--brand); border-radius: 50%; }
.calendar-day .day-dot.incomplete { background: var(--warning); }
.calendar-day.future .number { color: var(--muted); }
.calendar-legend { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 18px; }
.calendar-legend .badge { font-size: 10px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row p { margin: 0; }
.list-row small { color: var(--muted); }
.list-button { background: none; color: var(--text); border: 0; width: 100%; text-align: left; }
.controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea, .control { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--bg); padding: 10px 12px; font-size: 14px; }
.field textarea { min-height: 76px; resize: vertical; }
.field small { color: var(--muted); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.full { grid-column: 1 / -1; }
.checkbox-label { display: flex; align-items: center; gap: 9px; padding: 10px 0; font-size: 13px; }
.checkbox-label input { width: 18px; height: 18px; accent-color: var(--brand); }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; font-weight: 600; color: var(--muted); }
td.numeric, th.numeric { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }
.chart { height: 150px; display: flex; gap: 5px; align-items: end; padding-top: 15px; }
.chart-group { flex: 1; height: 100%; display: flex; align-items: end; gap: 2px; position: relative; min-width: 0; }
.chart-bar { width: 50%; min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; }
.chart-bar.target { background: var(--line); }
.chart-labels { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 10px; color: var(--muted); }
.chart-key { display: flex; gap: 14px; font-size: 11px; color: var(--muted); margin-top: 15px; }
.chart-key span::before { content: ""; width: 8px; height: 8px; display: inline-block; margin-right: 5px; background: var(--brand); border-radius: 2px; }
.chart-key .target::before { background: var(--line); }
.schedule-grid { display: grid; grid-template-columns: 1fr 100px 100px; gap: 10px; align-items: center; }
.schedule-grid .control { min-height: 40px; padding: 8px; }
.schedule-grid .day-name { font-size: 13px; }
.schedule-grid .head { font-size: 10px; color: var(--muted); }
.audit-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.audit-item:last-child { border: 0; }
.audit-item .section-line { margin-bottom: 4px; }
.audit-diff { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); padding: 12px; border-radius: 10px; font-size: 11px; max-height: 220px; overflow: auto; }
dialog { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100% - 28px)); max-height: min(88dvh, 850px); box-shadow: 0 25px 100px #0003; }
dialog.wide { width: min(760px, calc(100% - 28px)); }
dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
dialog::backdrop { background: #0d2119a0; backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 20px 22px 12px; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 8px 22px 20px; overflow: auto; min-height: 0; flex: 1 1 auto; }
.dialog-head, .dialog-footer { flex-shrink: 0; }
.dialog-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 16px 22px 20px; border-top: 1px solid var(--line); }
body.modal-open { overflow: hidden; }
.pause-editor { border: 1px solid var(--line); padding: 14px; border-radius: 12px; margin-top: 12px; }
.pause-editor .field-grid { gap: 10px; }
.comparison { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; background: var(--surface-soft); padding: 16px; border-radius: 12px; text-align: center; margin: 14px 0; }
.comparison strong { display: block; font-size: 23px; margin-top: 5px; font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .4; } }
@media (max-width: 700px) {
  .app-shell { padding: max(18px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right)) calc(110px + max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px))) max(16px, env(safe-area-inset-left)); }
  .app-header { padding-bottom: 26px; }
  .two-columns { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 20px; border-radius: 17px; }
  .stat { padding: 17px; }
  .stack { gap: 16px; }
  .calendar-card { padding: 17px 12px; }
  .calendar-grid { gap: 3px; }
  .calendar-day { min-height: 70px; padding: 7px 2px; }
  .calendar-day .hours { font-size: 9px; }
  .calendar-title h2 { min-width: 120px; font-size: 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .schedule-grid { grid-template-columns: 1fr 76px 76px; gap: 8px; }
  .dialog-head { padding: 18px 18px 10px; }
  .dialog-body { padding: 8px 18px 18px; }
  .dialog-footer { padding: 14px 18px 18px; }
  .controls .field { flex: 1; min-width: 130px; }
  .chart { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
