:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --surface: #fffdfa;
  --sidebar: #22201e;
  --text: #251f1b;
  --muted: #665d55;
  --border: #e4ddd4;
  --accent: #a63e22;
  --accent-dark: #852b14;
  --heat: #f8e9df;
  --green: #31583e;
  --shadow: 0 2px 3px #30251908;
  --radius: 14px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, fieldset:disabled button { cursor: not-allowed; opacity: .55; }
a { color: var(--accent-dark); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p, dl, dd, pre { margin: 0; }
h1, h2, h3 { letter-spacing: -.025em; }
h2 { font-size: 1.18rem; line-height: 1.25; }
h3 { font-size: 1rem; line-height: 1.4; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { flex: none; width: 1.22rem; height: 1.22rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 10; padding: 12px; border-radius: 7px; background: var(--surface); transform: translateY(-150%); }
.skip:focus { transform: none; }

.sidebar {
  position: fixed;
  z-index: 3;
  inset: 0 auto 0 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  padding: 33px 16px 22px;
  background: var(--sidebar);
  color: #f6eee7;
}
.brand { display: flex; align-items: center; gap: 12px; margin: 0 10px 42px; }
.brand-mark {
  position: relative;
  flex: none;
  width: 37px;
  height: 37px;
  border-radius: 10px;
  background: #c75737;
}
.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  width: 5px;
  border-radius: 4px;
  background: #fff6ec;
  transform: skewX(-16deg);
}
.brand-mark::before { height: 14px; top: 14px; left: 11px; }
.brand-mark::after { height: 21px; top: 8px; left: 21px; }
.brand strong { display: block; font-size: 1.43rem; line-height: 1.1; letter-spacing: -.045em; }
.brand strong span { color: #ffac8d; }
.brand small { display: block; margin-top: 4px; color: #c4b7ab; font-size: .75rem; }
.navigation { display: grid; gap: 4px; }
.navigation a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  min-height: 43px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #d8cbc0;
  text-decoration: none;
  font-weight: 550;
  font-size: .94rem;
}
.navigation a:hover { background: #332d28; color: #fff9f3; }
.navigation a[aria-current] { border-color: #5d3d31; background: #432e27; color: #ffd4c1; }
.navigation a:focus-visible { outline-color: #ffad8d; }
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: auto 8px 0;
  padding: 18px 2px 5px;
  border-top: 1px solid #4b413a;
  font-size: .8rem;
  color: #cfc2b6;
}
.local-dot { width: 7px; height: 7px; background: #97b18e; border-radius: 50%; }

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.auth-card { width: min(100%, 420px); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand h1 { font-size: 1.6rem; }
.cloud-context .assistant-grid { grid-template-columns: minmax(0, 1fr); }
.export-links a[aria-disabled="true"] { opacity: .55; }
.row-badge.timer-state { white-space: normal; overflow-wrap: anywhere; }

main { margin-left: 220px; padding: 36px 38px 40px; min-height: 100vh; }
main:has(.timer:not([hidden])) { padding-bottom: 125px; }
.content { width: 100%; max-width: 1380px; margin: 0 auto; }
.page-header { min-height: 70px; margin-bottom: 25px; display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.page-header h1 { font-size: clamp(2.05rem, 3vw, 2.75rem); line-height: 1.06; font-weight: 700; letter-spacing: -.055em; }
.page-description { margin-top: 8px; color: var(--muted); line-height: 1.45; }
.page-header > .button { margin-top: 4px; white-space: nowrap; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  min-height: 42px;
  padding: 8px 13px;
  border: 1px solid #d9d1c7;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.button:not(:disabled):hover { border-color: #c5b7aa; background: #f5eee6; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.primary:not(:disabled):hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.button.quiet { border-color: transparent; background: transparent; color: var(--accent-dark); }
.button.compact { min-height: 36px; padding: 7px 10px; font-size: .82rem; }
.button.icon-button { min-width: 40px; padding: 6px; }
.button.primary .icon { width: 1.06rem; height: 1.06rem; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  gap: 9px 7px;
  padding: 17px 18px;
  min-height: 144px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.metric.emphasis { background: var(--heat); border-color: #eed3c3; }
.metric h2 { grid-row: 1; grid-column: 1; font-size: .88rem; font-weight: 650; letter-spacing: 0; margin-top: 2px; }
.metric > .icon { grid-row: 1; grid-column: 2; color: var(--accent); width: 1.24rem; height: 1.24rem; }
.metric p { grid-column: 1 / -1; align-self: end; font-size: clamp(1.72rem, 2.65vw, 2.25rem); font-weight: 680; line-height: 1.02; letter-spacing: -.06em; }
.metric small { grid-column: 1 / -1; color: var(--muted); font-size: .76rem; line-height: 1.3; }
.metric p, .time-value, .counter-summary dd, .overview-list dd { font-variant-numeric: tabular-nums; }

.today-grid, .assistant-grid, .settings-grid { display: grid; align-items: start; gap: 18px; }
.today-grid { grid-template-columns: minmax(0, 2fr) minmax(265px, 1fr); }
.assistant-grid, .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-header { display: flex; align-items: center; gap: 12px; min-height: 63px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.panel-header.with-actions { justify-content: space-between; }
.panel-header p { color: var(--muted); font-size: .88rem; margin-top: 5px; line-height: 1.4; }
.panel-body { padding: 19px 20px 21px; }
.overview-list { display: grid; padding: 5px 20px 12px; }
.overview-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #eee8df;
  color: var(--muted);
  font-size: .89rem;
}
.overview-list dd { color: var(--text); font-weight: 650; text-align: right; }
.counter-summary { padding: 4px 20px 20px; }
.counter-summary h3 { margin-bottom: 9px; font-size: .87rem; }
.counter-summary dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.counter-summary dl div { display: flex; flex-direction: column-reverse; gap: 2px; padding: 8px 9px; border-radius: 8px; background: #f6f2ec; }
.counter-summary dt { color: var(--muted); font-size: .73rem; }
.counter-summary dd { font-size: 1.13rem; font-weight: 650; }
.empty { display: grid; justify-items: center; gap: 9px; padding: 36px 24px; text-align: center; }
.empty .empty-icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 3px; border-radius: 11px; background: var(--heat); color: var(--accent); }
.empty p { color: var(--muted); font-size: .88rem; line-height: 1.5; max-width: 42ch; }
.empty .button { margin-top: 6px; }
.today-grid .empty { min-height: 284px; align-content: center; }

.segmented { display: flex; gap: 5px; width: fit-content; max-width: 100%; margin-bottom: 16px; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: #eee9e1; }
.segmented button { min-height: 40px; padding: 7px 12px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 650; font-size: .91rem; white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { border-color: #e4d9cb; background: var(--surface); color: var(--text); }
.segmented span { display: inline-block; margin-left: 3px; padding: 2px 5px; border-radius: 5px; background: #eee7de; font-size: .76rem; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 13px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.filters > label { flex: 1 1 110px; min-width: 0; }
.filters > label:has([type="search"]) { flex: 2 1 235px; }
.filters > label:only-child { flex: 0 1 385px; }
label { display: grid; align-content: start; gap: 5px; min-width: 0; font-size: .87rem; font-weight: 640; }
input:not([type="checkbox"]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 41px;
  padding: 8px 10px;
  border: 1px solid #cfc6bb;
  border-radius: 7px;
  background: #fffefa;
  color: var(--text);
}
input[type="file"] { min-height: 42px; font-size: .88rem; }
input[type="file"]::file-selector-button { margin-right: 8px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 5px; background: #f5efe7; color: var(--text); font: inherit; cursor: pointer; }
input::placeholder, textarea::placeholder { color: #756a60; opacity: 1; }
input[type="checkbox"] { width: 17px; height: 17px; flex: none; accent-color: var(--accent); }
textarea { resize: vertical; }
.check-label { display: flex; align-items: start; gap: 8px; line-height: 1.5; font-weight: 500; }
.check-label input { margin: .18em 0 0; }
.field-hint { color: var(--muted); font-size: .84rem; line-height: 1.5; overflow-wrap: anywhere; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .91rem; }
th { color: var(--muted); background: #f8f5f0; font-size: .77rem; font-weight: 650; white-space: nowrap; }
td, th { padding: 11px 10px; vertical-align: middle; }
td { overflow-wrap: anywhere; }
td:first-child, th:first-child { padding-left: 20px; }
td:last-child, th:last-child { padding-right: 20px; }
tbody tr + tr { border-top: 1px solid #ece6dd; }
tbody tr:hover { background: #fdf9f2; }
.row-primary { display: block; color: var(--text); font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
a.row-primary { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; }
.row-secondary { display: block; margin-top: 3px; color: var(--muted); font-size: .79rem; line-height: 1.35; overflow-wrap: anywhere; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-actions .button { white-space: nowrap; }
.row-badge { display: inline-flex; padding: 4px 8px; border-radius: 6px; background: #eee8df; color: #50473d; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.row-badge.active { background: #e6efe2; color: var(--green); }
.row-badge.paused { background: #f7e9d3; color: #67430d; }
.row-badge.timer-state { background: var(--heat); color: var(--accent-dark); }
.table-wrap .progress { display: grid; gap: 5px; min-width: 85px; font-size: .79rem; }
progress { width: 100%; height: 7px; appearance: none; border: 0; border-radius: 5px; background: #ede7df; accent-color: var(--accent); }
progress::-webkit-progress-bar { background: #ede7df; border-radius: 5px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 5px; }
.time-value { white-space: nowrap; }
.session-counts { line-height: 1.4; max-width: 260px; overflow-wrap: anywhere; }

.stack { display: grid; gap: 12px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.context { max-height: 420px; overflow: auto; display: block; padding: 13px 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8f4ee; white-space: pre-wrap; overflow-wrap: anywhere; font: .81rem/1.5 Consolas, monospace; }
.response { padding: 12px; border-left: 3px solid var(--accent); border-radius: 4px; background: #f8f4ee; }
.response p { margin-top: 5px; font-size: .91rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.export-links { justify-items: start; }
.restore-panel { grid-column: 1 / -1; }
.restore-panel .panel-body { max-width: 580px; }
.message { padding: 10px 12px; border: 1px solid #ead7c7; border-radius: 7px; background: #faf1e8; color: #654331; font-size: .87rem; line-height: 1.45; overflow-wrap: anywhere; }
.content > .message { margin-bottom: 14px; }
.message:has(button) { display: flex; align-items: center; gap: 10px; }
.message.error { background: #fbede8; border-color: #efd3ca; color: #842c18; }
.message.success { background: #edf4e8; border-color: #d4e6ce; color: var(--green); }

.timer {
  position: fixed;
  z-index: 2;
  right: 38px;
  bottom: 20px;
  width: max-content;
  max-width: calc(100vw - 263px);
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 10px 12px;
  border: 1px solid #dfcfc0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 30px #32251c24;
}
.timer-info { min-width: 0; display: flex; align-items: center; gap: 9px; }
.timer-info > div { min-width: 0; }
.timer-info strong { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.timer-info small { display: block; margin-top: 2px; color: var(--muted); font-size: .73rem; }
.timer-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #ba572f; }
.timer-dot.paused { background: #8e7561; }
.timer-time { flex: none; font-variant-numeric: tabular-nums; font-size: 1.2rem; font-weight: 700; }
.timer-actions { display: flex; gap: 6px; align-items: center; }

dialog {
  width: min(560px, calc(100% - 28px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 12px 55px #1f19163d;
}
dialog::backdrop { background: #21191480; }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.dialog-header, .dialog-footer { display: flex; justify-content: space-between; gap: 10px; align-items: start; padding: 17px 20px; }
.dialog-header { border-bottom: 1px solid var(--border); }
.dialog-header h2 { font-size: 1.29rem; }
.dialog-header p { margin-top: 4px; font-size: .86rem; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--border); }
.dialog-fields { display: grid; gap: 13px; min-height: 0; overflow-y: auto; padding: 17px 20px; }
dialog .message { margin: 0 20px 8px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px 13px; }
.field-grid .wide { grid-column: 1 / -1; }
.field-grid legend { padding: 0 0 6px; font-size: .87rem; font-weight: 650; }
.noscript { margin: 15px; padding: 12px; color: var(--accent-dark); }

@media (max-width: 1150px) {
  main { padding: 30px 25px 35px; }
  .metric { padding: 15px 13px; }
  .today-grid { grid-template-columns: minmax(0, 1.65fr) minmax(225px, 1fr); gap: 13px; }
  .timer { right: 25px; }
}
@media (max-width: 1010px) {
  .sidebar { width: 180px; padding-left: 11px; padding-right: 11px; }
  main { margin-left: 180px; }
  .timer { max-width: calc(100vw - 222px); }
  .metrics { gap: 10px; }
  .today-grid { grid-template-columns: minmax(0, 1fr); }
  .overview-list { grid-template-columns: 1fr 1fr; gap: 0 20px; }
  .counter-summary dl { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; padding: 13px 13px 7px; }
  .brand { margin: 0 2px 10px; gap: 8px; }
  .brand-mark { transform: scale(.85); transform-origin: left center; margin-right: -5px; }
  .brand strong { font-size: 1.22rem; }
  .brand small { font-size: .69rem; }
  .navigation { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
  .navigation:has(#team-nav:not([hidden])) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .navigation a { justify-content: center; flex-direction: column; min-height: 46px; padding: 4px 2px; gap: 2px; font-size: .74rem; }
  .navigation .icon { width: 1.1rem; height: 1.1rem; }
  .sidebar-footer { display: none; }
  main { min-height: 0; margin: 0; padding: 21px 14px 30px; }
  .page-header { min-height: auto; margin-bottom: 17px; gap: 9px; }
  .page-header h1 { font-size: 2rem; }
  .page-description { margin-top: 6px; font-size: .85rem; }
  .page-header > .button { font-size: .78rem; padding: 7px 8px; }
  .page-header > .button .icon { width: .9rem; height: .9rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 13px; }
  .metric { min-height: 109px; gap: 6px; padding: 11px; }
  .metric h2 { font-size: .78rem; }
  .metric small { font-size: .71rem; }
  .metric > .icon { width: 1.03rem; height: 1.03rem; }
  .panel-header { min-height: auto; padding: 13px; }
  .panel-header.with-actions { flex-wrap: wrap; }
  .panel-header p { font-size: .83rem; }
  .panel-body { padding: 13px; }
  .assistant-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .filters { padding: 10px 13px; gap: 9px; }
  .overview-list { padding-left: 13px; padding-right: 13px; }
  .counter-summary { padding-left: 13px; padding-right: 13px; }
  .today-grid .empty { min-height: 205px; }
  .empty { padding: 20px 13px; }
  .timer { right: 10px; bottom: 10px; width: calc(100% - 20px); max-width: none; gap: 8px; padding: 8px; }
  .timer-info { gap: 6px; }
  .timer-time { font-size: 1rem; }
  .timer .button { min-height: 40px; padding: 5px 7px; }
}
@media (max-width: 510px) {
  .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .table-wrap tbody tr { padding: 10px 13px; }
  .table-wrap tbody td { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: baseline; gap: 5px; padding: 4px 0; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; }
  .table-wrap tbody td:first-child, .table-wrap tbody td:last-child { display: block; padding: 5px 0; }
  .table-wrap td:first-child::before, .table-wrap td:last-child::before { content: none; }
  .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  .counter-summary dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .check-label { font-size: .82rem; }
  :is(input, select, textarea) { font-size: 1rem; }
}
@media (max-width: 355px) {
  .timer { display: grid; grid-template-columns: 1fr auto; }
  .timer-actions { grid-column: 1 / -1; justify-content: end; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
