:root {
      font-size: 16px;
      color-scheme: light;
      --paper: #e9e7dc;
      --paper-deep: #dcd9cb;
      --card: #f6f4e9;
      --ink: #17231d;
      --ink-soft: #34443b;
      --muted: #6f756f;
      --line: rgba(23, 35, 29, .15);
      --acid: #d8fa68;
      --acid-dark: #a9ce32;
      --coral: #ff6e5b;
      --blue: #7d9bff;
      --shadow: 0 1.5rem 4.375rem rgba(34, 40, 35, .10);
      --radius: 1.375rem;
      font-synthesis: none;
    }
    * {
      box-sizing: border-box;
      -webkit-user-select: none;
      user-select: none;
    }
    [hidden] { display: none !important; }
    html { background: var(--paper); }
    html:not(.data-ready) .stats-panel > :not(.section-kicker),
    html:not(.data-ready) .recent-panel > :not(.recent-head),
    html:not(.data-ready) .recent-count,
    html:not(.data-ready) .focus-inner > :not(.status-message) { visibility: hidden; }
    html:not(.auth-ready):not(.auth-error) .auth-button,
    html:not(.auth-ready) [data-admin-only],
    html:not(.auth-ready) .controls { visibility: hidden; }
    html:not(.auth-ready) [data-undo] { display: inline-flex !important; }
    html:not(.data-ready) .controls { visibility: hidden; }
    body {
      margin: 0;
      min-width: 20rem;
      min-height: 100vh;
      background:
        linear-gradient(rgba(23, 35, 29, .035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 35, 29, .035) 1px, transparent 1px),
        var(--paper);
      background-size: 2.375rem 2.375rem;
      color: var(--ink);
      font-family: "Avenir Next", "Segoe UI Variable", "Bahnschrift", system-ui, sans-serif;
      -webkit-font-smoothing: antialiased;
      cursor: default;
    }
    button { font: inherit; }
    button:not(:disabled) { cursor: pointer; }
    button:disabled { cursor: default; }
    button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
    .app-shell {
      width: min(100%, 75rem);
      margin: 0 auto;
      padding: 0.75rem clamp(1rem, 2.2vw, 2rem);
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-template-rows: auto auto auto;
      grid-template-areas: "header header" "focus focus" "stats recent";
      gap: 0.75rem;
    }
    .topbar {
      grid-area: header;
      min-height: 2.75rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1.25rem;
    }
    .brand { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
    .brand h1 {
      margin: 0;
      font-size: clamp(1.5rem, 2vw, 2.125rem);
      line-height: 1;
      letter-spacing: -.055em;
      font-weight: 760;
    }
    .brand-mark { display: block; width: 1.875rem; height: 1.875rem; flex: 0 0 auto; }

    .auth-button {
      min-width: 5.375rem;
      display: inline-flex;
      align-items: center;
      border: 0;
      border-radius: 62.4375rem;
      padding: 0.625rem 1.0625rem;
      background: var(--ink);
      color: var(--card);
      font-weight: 700;
      cursor: pointer;
      box-shadow: 0 0.4375rem 1.25rem rgba(23, 35, 29, .14);
      transition: transform .15s ease, opacity .15s ease, background .15s ease;
    }
    .auth-button:hover { transform: translateY(-2px); background: var(--ink-soft); }
    .auth-button.logout { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
    .auth-button.logout:hover { background: rgba(246, 244, 233, .75); }
    .panel {
      min-width: 0;
      min-height: 0;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: rgba(246, 244, 233, .86);
      box-shadow: var(--shadow);
      backdrop-filter: blur(0.875rem);
    }
    .stats-panel {
      grid-area: stats;
      align-self: stretch;
      display: flex;
      flex-direction: column;
      padding: 0.875rem;
      overflow: hidden;
    }
    .focus-panel { grid-area: focus; position: relative; overflow: visible; z-index: 1; }
    .recent-panel {
      grid-area: recent;
      display: flex;
      flex-direction: column;
      padding: 0.875rem;
      overflow: hidden;
    }
    .section-kicker {
      margin: 0 0 0.5rem;
      color: var(--muted);
      font-size: 0.6875rem;
      font-weight: 800;
      letter-spacing: .14em;
      text-transform: uppercase;
    }
    .duration-toggle {
      border: 0;
      padding: 1px 0;
      background: transparent;
      color: inherit;
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1, "zero" 0;
      cursor: pointer;
    }

    .live-line { display: flex; align-items: center; gap: 0.5rem; color: rgba(246,244,233,.58); font-size: 0.75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
    .live-dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #8d9890; }
    .live-dot.is-active { background: var(--acid); box-shadow: 0 0 0 0.3125rem rgba(216,250,104,.12); }
    .current-name {
      margin: 0.5rem 0 2px;
      min-height: .95em;
      font-size: clamp(1.875rem, 4dvh, 2.875rem);
      line-height: .95;
      letter-spacing: -.065em;
      font-weight: 780;
      white-space: nowrap;
    }
    .current-timer {
      width: fit-content;
      margin-top: 0.625rem;
      border: 0;
      padding: 0;
      background: transparent;
      color: var(--acid);
      font-family: "Avenir Next", "Segoe UI Variable", "Bahnschrift", system-ui, sans-serif;
      font-size: clamp(4rem, min(10vw, 11dvh), 7.5rem);
      max-width: 100%;
      overflow-wrap: anywhere;
      line-height: 1;
      letter-spacing: -.045em;
      font-variant-numeric: tabular-nums;
      font-feature-settings: "tnum" 1, "zero" 0;
      cursor: pointer;
    }

    .activity-button, .stop-button {
      min-height: 3rem;
      border: 0;
      border-radius: 0.875rem;
      font-weight: 800;
      cursor: pointer;
      transition: transform .15s ease, filter .15s ease, opacity .15s ease;
    }
    .activity-button:hover:not(:disabled), .stop-button:hover:not(:disabled) { transform: translateY(-3px); filter: brightness(1.06); }
    .activity-button:active:not(:disabled), .stop-button:active:not(:disabled) { transform: translateY(0); }
    .activity-button:disabled, .stop-button:disabled { opacity: .48; cursor: default; }
    .stop-button { width: 100%; min-height: 3rem; margin-top: 0; background: var(--coral); color: var(--ink); font-size: 1.0625rem; }
    .status-message { margin-top: 0.5rem; color: #ffb6aa; font-size: 0.8125rem; }
    .status-message:empty { display: none; }
    .recent-head { padding: 0 0 0.5rem; display: flex; align-items: center; justify-content: space-between; }
    .recent-head .section-kicker { margin: 0; }
    .recent-head-actions { display: flex; align-items: center; gap: 0.5rem; }
    .recent-count { color: var(--muted); font: 0.6875rem ui-monospace, monospace; }
    .history-undo {
      min-height: 1.75rem;
      display: inline-flex;
      align-items: center;
      gap: 0.3125rem;
      border: 1px solid var(--line);
      border-radius: 62.4375rem;
      padding: 0 0.625rem;
      background: transparent;
      color: var(--ink-soft);
      font-size: 0.6875rem;
      font-weight: 800;
      transition: background .15s ease, opacity .15s ease, transform .15s ease;
    }
    .history-undo:hover:not(:disabled) { background: var(--paper-deep); transform: translateY(-1px); }
    .history-undo:disabled { opacity: .3; }
    .history-title-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
    .history-title-row h2 { min-width: 0; }
    .recent-list { flex: 1; min-height: 0; overflow: hidden; contain: size; }
    .session-row {
      min-height: 4.25rem;
      display: grid;
      grid-template-columns: 0.5625rem minmax(0, 1fr) auto;
      align-items: center;
      gap: 0.6875rem;
      padding: 0.625rem 0.5rem;
      border-top: 1px solid var(--line);
    }
    .session-row:first-child { border-top: 0; }
    .session-color { width: 0.5rem; height: 2.125rem; border-radius: 62.4375rem; background: var(--acid-dark); }
    .session-name { font-size: 0.875rem; font-weight: 750; }
    .session-when { margin-top: 3px; color: var(--muted); font-size: 0.6875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .session-duration { font-size: 0.75rem; font-weight: 750; }
    .session-date-divider {
      min-height: 1.875rem;
      display: flex;
      align-items: center;
      gap: 0.5625rem;
      color: var(--muted);
      font-size: 0.625rem;
      font-weight: 850;
      letter-spacing: .1em;
      text-transform: uppercase;
    }
    .session-date-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
    .show-more,
    .stats-more {
      width: 100%;
      min-height: 2.75rem;
      flex-shrink: 0;
      margin: 0.625rem 0 0;
      border: 0;
      border-radius: 0.875rem;
      background: var(--ink);
      color: var(--card);
      font-weight: 800;
      cursor: pointer;
      box-shadow: 0 0.4375rem 1.125rem rgba(23, 35, 29, .12);
      transition: background .15s ease, letter-spacing .15s ease, transform .15s ease, box-shadow .15s ease;
    }
    .show-more:hover,
    .stats-more:hover {
      background: var(--ink-soft);
      letter-spacing: .02em;
      transform: translateY(-2px);
      box-shadow: 0 0.625rem 1.375rem rgba(23, 35, 29, .16);
    }
    .show-more:active,
    .stats-more:active { transform: translateY(0); box-shadow: 0 0.3125rem 0.875rem rgba(23, 35, 29, .12); }
    .empty-state { padding: 1.5rem 0.75rem; color: var(--muted); font-size: 0.8125rem; text-align: center; }
    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 20;
      display: grid;
      place-items: center;
      padding: 1.5rem;
      background: rgba(15, 23, 19, .72);
      backdrop-filter: blur(0.625rem);
    }
    .history-modal {
      width: min(73.75rem, 96vw);
      height: min(51.25rem, 92dvh);
      display: grid;
      grid-template-columns: minmax(16.875rem, .72fr) minmax(27.5rem, 1.5fr);
      overflow: hidden;
      border-radius: 1.75rem;
      background: var(--paper);
      box-shadow: 0 2.5rem 7.5rem rgba(0,0,0,.35);
    }
    .history-sidebar { padding: 1.875rem; border-right: 1px solid var(--line); background: var(--card); }
    .history-sidebar h2 { margin: 0.375rem 0 0.5rem; font-size: 2.125rem; letter-spacing: -.055em; }
    .history-sidebar p { margin: 0; color: var(--muted); font-size: 0.8125rem; line-height: 1.55; }
    .history-filters { display: grid; gap: 0.5625rem; margin-top: 1.625rem; }
    .date-picker-wrap { position: relative; }
    .date-trigger {
      width: 100%;
      min-height: 3.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      border: 0;
      border-radius: 0.875rem;
      padding: 0 0.9375rem;
      font-weight: 800;
      text-align: left;
      cursor: pointer;
    }
    .show-all-date {
      min-height: 2.75rem;
      border: 0;
      border-radius: 0.8125rem;
      font-weight: 800;
      text-align: left;
      padding: 0 0.9375rem;
      cursor: pointer;
    }

    .calendar {
      position: absolute;
      z-index: 4;
      top: calc(100% + 0.625rem);
      left: 0;
      width: min(20.625rem, calc(100vw - 3rem));
      padding: 0.875rem;
      border: 1px solid var(--line);
      border-radius: 1.0625rem;
      background: var(--card);
      box-shadow: 0 1.375rem 3.4375rem rgba(23,35,29,.20);
    }
    .calendar-head { display: grid; grid-template-columns: 2rem 1fr 2rem; align-items: center; gap: 0.375rem; margin-bottom: 0.625rem; }
    .calendar-title { text-align: center; font-size: 0.8125rem; font-weight: 850; }
    .calendar-nav { width: 2rem; height: 2rem; border: 0; border-radius: 0.5625rem; background: var(--paper-deep); color: var(--ink); cursor: pointer; }
    .calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
    .calendar-weekdays span { padding: 0.3125rem 0; color: var(--muted); font: 0.625rem ui-monospace, monospace; text-align: center; }
    .calendar-day { aspect-ratio: 1; border: 0; border-radius: 0.5625rem; font-size: 0.75rem; cursor: pointer; }

    .calendar-day.today { box-shadow: inset 0 0 0 1px var(--coral); }

    .history-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
    .history-top { min-height: 5.375rem; padding: 1.375rem 1.5625rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
    .history-date-title { font-size: 1.125rem; font-weight: 800; }
    .close-modal { min-width: 4.5rem; height: 2.625rem; border: 0; border-radius: 62.4375rem; padding: 0 0.9375rem; background: var(--ink); color: var(--card); font-size: 0.75rem; font-weight: 800; cursor: pointer; }
    .history-list { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 0.4375rem 1.375rem 1.375rem; }
    .history-row {
      display: grid;
      grid-template-columns: 0.625rem minmax(0, 1fr) auto auto;
      align-items: center;
      gap: 0.875rem;
      min-height: 4.5rem;
      border-bottom: 1px solid var(--line);
    }
    .history-time { color: var(--muted); font: 0.75rem ui-monospace, monospace; }

    .login-modal {
      width: min(25.625rem, calc(100vw - 2rem));
      border: 1px solid rgba(246, 244, 233, .18);
      border-radius: 1.5rem;
      padding: 1.375rem;
      background: var(--card);
      box-shadow: 0 2rem 5.625rem rgba(0,0,0,.36);
    }
    .login-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
    .login-head h2 { margin: 0; font-size: 1.625rem; letter-spacing: -.045em; }
    .login-close { width: 2.125rem; height: 2.125rem; border: 0; border-radius: 50%; background: var(--paper-deep); color: var(--ink); font-size: 1.125rem; }
    .login-field { display: grid; gap: 0.5rem; margin-top: 1.5rem; }
    .login-field span { color: var(--muted); font-size: 0.6875rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
    .login-input {
      width: 100%;
      min-height: 3.25rem;
      border: 1px solid var(--line);
      border-radius: 0.875rem;
      padding: 0 0.9375rem;
      outline: 0;
      background: var(--paper);
      color: var(--ink);
      font: inherit;
      -webkit-user-select: text;
      user-select: text;
      cursor: text;
    }
    .login-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(125,155,255,.2); }
    .login-error { min-height: 1.1875rem; margin-top: 0.625rem; color: #9f3b30; font-size: 0.75rem; }
    .login-submit { width: 100%; min-height: 3.125rem; border: 0; border-radius: 0.875rem; background: var(--ink); color: var(--acid); font-weight: 850; }
    .login-submit:disabled { opacity: .45; }

    .analytics-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 0.8125rem; }
    .toast {
      position: fixed;
      z-index: 40;
      left: 50%;
      bottom: 1.5rem;
      transform: translateX(-50%);
      max-width: min(90vw, 32.5rem);
      padding: 0.6875rem 1rem;
      border-radius: 62.4375rem;
      background: var(--ink);
      color: var(--card);
      box-shadow: 0 1rem 2.8125rem rgba(0,0,0,.25);
      font-size: 0.8125rem;
    }

    @media (max-width: 760px) {
      body { background-size: 1.75rem 1.75rem; }
      .app-shell {
        padding: max(1rem, env(safe-area-inset-top)) 0.75rem max(1.25rem, env(safe-area-inset-bottom));
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
      }
      .topbar { min-height: 3.125rem; }

      .brand { gap: 0.5rem; }
      .brand-mark { width: 1.625rem; height: 1.625rem; }
      .brand h1 { font-size: clamp(1.25rem, 5.6vw, 1.75rem); }
      .auth-button { padding: 0.5625rem 0.8125rem; }
      .focus-panel { order: 1; }
      .stats-panel { order: 2; overflow: visible; }
      .recent-panel { order: 3; height: 25rem; }

      .activity-button { font-size: 0.8125rem; }
      .modal-backdrop { padding: 0.5rem; }
      .history-modal { width: 100%; height: 96dvh; grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); border-radius: 1.375rem; }

      .history-sidebar { padding: 1.25rem; border-right: 0; border-bottom: 1px solid var(--line); }

      .history-sidebar h2 { font-size: 1.6875rem; }
      .history-sidebar p { display: none; }
      .date-picker-wrap { margin-top: 1.0625rem; }
      .calendar { left: 50%; transform: translateX(-50%); }
      .history-top { min-height: 4.0625rem; padding: 0.75rem 1rem; }
      .history-list { padding: 3px 0.8125rem 0.9375rem; }
    }
    .activity-button { background: var(--acid); color: var(--ink); }
    .session-extra { color: #a84336; font-size: 0.625rem; }
    .history-load-more { min-height: 2.75rem; margin: 0.625rem 1.375rem 1.125rem; border: 1px solid var(--line); border-radius: 0.625rem; background: var(--paper-deep); color: var(--ink); font-size: 0.75rem; font-weight: 750; }
    #segments-overlay { z-index: 30; }
    .segments-modal { width: min(47.5rem, 96vw); height: min(47.5rem, 92dvh); display: flex; flex-direction: column; overflow: hidden; border-radius: 1.625rem; background: var(--paper); box-shadow: 0 2.5rem 7.5rem rgba(0,0,0,.35); }
    .segments-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; padding: 1.5625rem; border-bottom: 1px solid var(--line); background: var(--card); }
    .segments-head h2 { margin: 0; font-size: 1.6875rem; letter-spacing: -.05em; }
    .segments-head p:not(.section-kicker) { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.75rem; }
    .segments-list { min-height: 0; overflow: auto; padding: 0.5rem 1.5rem 1.5rem; }
    .segment-row { min-height: 4.125rem; display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 0.75rem; border-bottom: 1px solid var(--line); }
    .segment-row.excluded { opacity: .53; }
    .segment-name { font-size: 0.8125rem; font-weight: 800; }
    .segment-time { margin-top: 3px; color: var(--muted); font-size: 0.6875rem; }
    .segment-edit { min-width: 4.625rem; min-height: 2.125rem; border: 0; border-radius: 0.5625rem; background: rgba(255,110,91,.14); color: #8b3429; font-size: 0.6875rem; font-weight: 800; }
    .segment-edit.restore { background: rgba(216,250,104,.45); color: var(--ink); }

    @media (max-width: 760px) {

      .segments-head { padding: 1.125rem; }
      .segments-list { padding: 0.375rem 0.875rem 1.125rem; }
    }
body.modal-open { overflow: hidden; }
.segments-head-actions { display: flex; align-items: center; gap: 0.5rem; }
.delete-whole { min-height: 2.625rem; border: 0; border-radius: 0.75rem; padding: 0 0.75rem; background: rgba(255,110,91,.15); color: #8b3429; font-size: 0.6875rem; font-weight: 800; }
@media (max-width: 760px) { .segments-head-actions { flex-direction: column-reverse; align-items: stretch; } }

/* Overview: one primary number, three quiet totals, and the current streak. */
.stats-stack { display: flex; flex-direction: column; min-width: 0; }
.stats-hero { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; padding: 2px 0 0.625rem; border-bottom: 1px solid var(--line); margin-bottom: 0.25rem; }
.stats-today { font-size: 0.875rem; font-weight: 750; }
.stats-total { max-width: 100%; font-size: clamp(2rem, 4dvh, 2.75rem); line-height: 1.1; letter-spacing: -.055em; font-weight: 780; overflow-wrap: anywhere; text-align: left; }
.stats-period-row { display: flex; justify-content: space-between; align-items: center; gap: 0.875rem; padding: 0.375rem 0; color: var(--muted); font-size: 0.8125rem; }
.stats-period-value { color: var(--ink); font-size: 1.125rem; font-weight: 700; letter-spacing: -.035em; }
.stats-streak { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.625rem 0 0.25rem; margin-top: 0.25rem; border-top: 1px solid var(--line); font-size: 0.8125rem; }
.stats-streak > span { color: var(--muted); }
.stats-streak strong { font-weight: 750; }

/* Compact reminder control. The panel borrows the calendar's paper and selection styles. */
.action-row { display: flex; align-items: center; gap: 0.75rem; }
.action-row > #start-controls, .action-row > .stop-button { flex: 1; min-width: 7rem; }
.activity-button { width: 100%; }
.action-row > .stop-button { width: auto; }
.reminder-wrap { position: relative; flex: 0 0 auto; }
.reminder-trigger { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.625rem; padding: 0 0.6875rem; border: 1px solid rgba(246,244,233,.22); border-radius: 0.75rem; background: transparent; color: var(--card); font-size: 0.75rem; font-weight: 650; white-space: nowrap; }
.reminder-trigger:hover:not(:disabled), .reminder-trigger[aria-expanded="true"] { background: rgba(246,244,233,.08); border-color: rgba(246,244,233,.45); }
.reminder-trigger:disabled { opacity: .6; }
.reminder-trigger svg, .icon-button svg { width: 1.125rem; height: 1.125rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reminder-popover { position: absolute; z-index: 10; right: 0; bottom: calc(100% + 0.75rem); width: min(14.5rem, calc(100vw - 2rem)); padding: 0.625rem; border: 1px solid var(--line); border-radius: 1.0625rem; background: var(--card); color: var(--ink); box-shadow: 0 1.375rem 3.4375rem rgba(0,0,0,.25); }
.reminder-popover.opens-below { top: calc(100% + 0.75rem); bottom: auto; }
.reminder-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.375rem; }
.reminder-head .icon-button { width: 1.75rem; height: 1.75rem; }
.reminder-head h3 { margin: 0; font-size: 0.875rem; font-weight: 800; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 2.25rem; height: 2.25rem; padding: 0; border: 0; border-radius: 0.625rem; background: transparent; color: var(--ink-soft); font-size: 1.375rem; line-height: 1; }
.icon-button:hover:not(:disabled) { background: var(--paper-deep); }
.icon-button:disabled { opacity: .35; }

.reminder-apply { min-height: 2.25rem; margin: 0; padding: 0 0.5rem; border: 0; border-radius: 0.625rem; background: var(--ink); color: var(--acid); font-size: 0.75rem; font-weight: 750; }
.reminder-notice { position: fixed; z-index: 40; bottom: 1.5rem; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 1.25rem; max-width: calc(100vw - 2rem); padding: 0.625rem 0.75rem 0.625rem 1.25rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--acid); color: var(--ink); box-shadow: var(--shadow); font-size: 0.9375rem; font-weight: 750; }
.reminder-notice .icon-button:hover:not(:disabled) { background: rgba(23,35,29,.08); }
.history-row-actions { display: flex; align-items: center; gap: 0.25rem; }
.delete-session { color: #8b3429; }
.delete-session:hover { background: rgba(255,110,91,.15); }

/* A single series uses a single colour. Labels and interactive values carry the detail. */
.focus-chart { margin: 0; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) 2rem; gap: 0.25rem; }
.focus-svg { display: block; width: 100%; height: 100%; min-height: 0; overflow: visible; }
.focus-rect { fill: var(--acid-dark); }
.focus-grid-line { stroke: var(--line); stroke-width: 1; }
.focus-axis-text { fill: var(--muted); font-size: 0.6875rem; }
.focus-hitbox { fill: transparent; cursor: pointer; }
.focus-hitbox:hover, .focus-hitbox:focus-visible { fill: rgba(23,35,29,.07); outline: none; stroke: var(--ink-soft); stroke-width: 1; }
.chart-detail { min-height: 1.125rem; overflow: hidden; margin-top: 0.25rem; font-size: 0.6875rem; color: var(--muted); line-height: 1.5; }

.focus-day { display: block; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0.25rem; background: var(--paper-deep); }
.focus-day.empty { background: transparent; }
.level-1 { --activity-colour: #d8e9aa; background: var(--activity-colour); }
.level-2 { --activity-colour: #c3e17b; background: var(--activity-colour); }
.level-3 { --activity-colour: #a9ce32; background: var(--activity-colour); }
.level-4 { --activity-colour: #779722; background: var(--activity-colour); }
.activity-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.375rem 0.75rem; min-height: 1.25rem; margin-top: 0.375rem; color: var(--muted); font-size: 0.625rem; }
.activity-legend { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.activity-legend i { display: block; width: 0.625rem; height: 0.625rem; border-radius: 2px; }
.level-0 { --activity-colour: var(--paper-deep); background: var(--activity-colour); }

@media (max-width: 760px) {
  .stats-panel { align-self: stretch; }
  .stats-total { font-size: 2.5rem; }
  .stats-period-row { padding: 0.625rem 0; }
  .history-row { grid-template-columns: 0.375rem minmax(0, 1fr) auto auto; gap: 0.375rem; }
  .history-row-actions { gap: 2px; }
  .history-row .icon-button { width: 2.125rem; height: 2.5rem; }
  .history-row .session-duration { font-size: 0.6875rem; }
  .reminder-trigger { padding: 0 0.5625rem; gap: 0.375rem; font-size: 0.6875rem; }
  .action-row { gap: 0.625rem; }

}

/* The timer anchors the page; the two supporting panels share the row below. */
.focus-inner { border-radius: inherit; min-height: clamp(16.25rem, calc(100dvh - 27.5rem), 23.75rem); padding: clamp(0.875rem, 2dvh, 1.5rem) 1.5rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(ellipse at 50% 0%, rgba(216,250,104,.12), transparent 60%), var(--ink); color: var(--card); }
.controls { width: min(22.5rem, 100%); margin-top: clamp(0.75rem, 2dvh, 1.375rem); }
.action-row { justify-content: center; }
.reminder-popover { text-align: left; }

/* One analytics surface, with annual activity above the period-specific breakdown. */
.analytics-modal { height: min(53.125rem, calc(100dvh - 3rem)); width: min(70rem, 96vw); max-height: calc(100dvh - 3rem); display: flex; flex-direction: column; overflow: hidden; border-radius: 1.75rem; background: var(--card); box-shadow: 0 2.5rem 7.5rem rgba(0,0,0,.35); }
.analytics-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-shrink: 0; padding: 0.75rem 1.25rem; border-bottom: 1px solid var(--line); }
.analytics-header h2 { margin: 0; font-size: 1.625rem; font-weight: 780; letter-spacing: -.045em; }
.analytics-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0.875rem 1.25rem; overscroll-behavior: contain; }
.analytics-activity h3, .analytics-breakdown h3 { margin: 0; font-size: 1rem; font-weight: 800; letter-spacing: -.025em; }
.activity-head, .breakdown-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 0.875rem; flex-wrap: wrap; }
.period-navigation { display: flex; align-items: center; gap: 0.625rem; }
.period-navigation strong { font-size: 0.8125rem; font-weight: 750; text-align: center; }

.activity-meta { display: flex; justify-content: space-between; gap: 0.625rem; flex-wrap: wrap; margin: 0.375rem 0 0.5rem; font-size: 0.6875rem; color: var(--muted); }
.activity-calendar { overflow-x: auto; padding: 3px 3px 0.3125rem; scroll-padding-inline: 2.375rem 0.25rem; overscroll-behavior-x: contain; scrollbar-color: var(--ink-soft) var(--paper-deep); }
.activity-calendar-grid { display: flex; gap: 0.5625rem; min-width: 48.75rem; }
.activity-weekdays { position: sticky; left: 0; z-index: 1; background: var(--card); box-shadow: 0.375rem 0 0 var(--card); display: grid; grid-template-rows: 1.125rem repeat(7, 1fr); gap: 3px; flex: 0 0 1.5625rem; color: var(--muted); font-size: 0.5625rem; }
.activity-weekdays span { display: flex; align-items: center; }
.activity-weeks { display: flex; gap: 3px; flex: 1; min-width: 0; }
.activity-week { flex: 1; min-width: 0; }
.activity-month { height: 1.125rem; margin-bottom: 3px; color: var(--muted); font-size: 0.625rem; white-space: nowrap; }
.activity-week-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.activity-week-days .focus-day { width: 100%; aspect-ratio: 1; border-radius: 3px; }
.focus-day.future { opacity: .3; }
.activity-scroll-controls { display: flex; align-items: center; gap: 0.375rem; }
.activity-scroll-controls span { min-width: 5.75rem; text-align: center; font-variant-numeric: tabular-nums; }
.activity-scroll-controls .calendar-nav { width: 1.875rem; height: 1.75rem; }
.activity-loading { min-height: 8.125rem; display: grid; place-items: center; color: var(--muted); font-size: 0.75rem; }
.analytics-breakdown { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.period-options, .chart-options { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 3px; border-radius: 0.6875rem; background: var(--paper-deep); }
.analytics-period, .chart-option { min-height: 2rem; border: 0; border-radius: 0.5rem; padding: 0 0.75rem; font-size: 0.75rem; font-weight: 700; }

.range-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-left: auto; min-width: 0; }
.range-current { min-height: 2rem; padding: 0 0.5625rem; border: 0; border-radius: 0.5rem; background: transparent; color: var(--ink); font-size: 0.6875rem; text-decoration: underline; text-underline-offset: 3px; }
.breakdown-overview { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.625rem 1.25rem; margin: 0.75rem 0; }
.analytics-summary { width: min(100%, 32rem); min-width: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; min-height: 3rem; }
.analytics-metric { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; }
.analytics-metric > span { color: var(--muted); font-size: 0.6875rem; }
.analytics-metric > strong { max-width: 100%; font-size: 1.5625rem; line-height: 1.1; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.analytics-metric .duration-toggle { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.chart-toolbar { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.chart-toolbar h4 { margin: 0; font-size: 0.8125rem; font-weight: 750; }

.analytics-error { margin-top: 0.625rem; color: #9f3b30; font-size: 0.75rem; }
@media (max-width: 760px) {
  .focus-inner { min-height: 18.75rem; padding: 1.375rem 1.25rem; }
  .current-name { font-size: 2.125rem; }
  .current-timer { font-size: clamp(3.125rem, 12vw, 5.5rem); }
  .controls { margin-top: 1.125rem; }
  .analytics-modal { height: calc(100dvh - 1rem); width: 100%; max-height: calc(100dvh - 1rem); border-radius: 1.375rem; }
  .analytics-header { padding: 0.75rem 0.875rem; }
  .analytics-header h2 { font-size: 1.4375rem; }
  .analytics-scroll { padding: 0.75rem 0.875rem; }
  .breakdown-head { align-items: flex-start; }
  .breakdown-overview { grid-template-columns: minmax(0, 1fr); }
  .chart-toolbar { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .activity-scroll-controls .calendar-nav { width: 2.25rem; height: 2.25rem; }
  .period-options { width: 100%; }
  .analytics-period { flex: 1; padding: 0 0.4375rem; font-size: 0.6875rem; }
  .analytics-summary { gap: 1.375rem; }
  .analytics-metric > strong { max-width: 100%; font-size: 1.375rem; }
  .period-navigation { gap: 0.375rem; }
  .period-navigation strong { font-size: 0.75rem; }
}

/* The same selection language for history, periods, calendar and reminders. */
:is(.show-all-date, .date-trigger, .calendar-day, .analytics-period, .chart-option,
    .reminder-mode button) {
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
:is(.show-all-date, .date-trigger, .calendar-day, .analytics-period, .chart-option,
    .reminder-mode button):hover:not(:disabled, .active, .selected, [aria-pressed="true"]) {
  background: var(--paper-deep);
  box-shadow: inset 0 0 0 1px var(--ink-soft);
}
:is(.show-all-date, .date-trigger, .calendar-day, .analytics-period, .chart-option,
    .reminder-mode button):is(.active, .selected, [aria-pressed="true"]) {
  background: var(--ink);
  color: var(--acid);
  box-shadow: none;
}
:is(.show-all-date, .date-trigger, .calendar-day, .analytics-period, .chart-option,
    .reminder-mode button):disabled,
.calendar-nav:disabled { opacity: .4; cursor: default; }
.calendar-nav:hover:not(:disabled), .range-current:hover:not(:disabled) { background: var(--ink); color: var(--acid); }
.calendar-day.today:not(.selected) { box-shadow: inset 0 0 0 1px var(--coral); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (min-width: 761px) and (max-height: 740px) {
  .focus-inner { padding-block: 0.75rem; }
  .current-name { font-size: 1.625rem; }
  .current-timer { font-size: 4rem; }
  .controls { margin-top: 0.625rem; }
}

/* Fixed result geometry prevents loading and empty periods from moving the dialog. */
#analytics-chart { position: relative; height: clamp(10rem, calc(100dvh - 31.25rem), 18.75rem); }
#analytics-chart[aria-busy="true"], .analytics-summary[aria-busy="true"] { pointer-events: none; }
#analytics-chart.is-loading > *, .analytics-summary[aria-busy="true"] > * { opacity: .35; }
#analytics-chart.is-loading::after { content: "Loading..."; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); font-size: 0.8125rem; }
.is-unavailable { visibility: hidden; pointer-events: none; }
.range-toolbar .period-navigation strong { width: 13.125rem; min-height: 2rem; display: grid; place-items: center; }
.calendar-detail { min-height: 2rem; margin-top: 0.5rem; color: var(--ink-soft); font-size: 0.6875rem; line-height: 1.4; }
.calendar-grid .calendar-day:not(.selected) { background: var(--activity-colour, var(--paper-deep)); }
.calendar-grid .calendar-day:hover:not(.selected) { background: var(--activity-colour, var(--paper-deep)); box-shadow: inset 0 0 0 2px var(--ink); }
.reminder-mode { display: flex; gap: 3px; padding: 3px; border-radius: 0.625rem; background: var(--paper-deep); }
.reminder-mode button { flex: 1; min-height: 1.875rem; border: 0; border-radius: 0.4375rem; font-size: 0.75rem; font-weight: 750; }
.reminder-time { display: grid; grid-template-columns: 3rem auto 3rem minmax(0, 1fr); align-items: end; gap: 0.375rem; margin-top: 0.5rem; }
.reminder-time label { display: grid; gap: 2px; color: var(--ink-soft); font-size: 0.625rem; font-weight: 650; }
.reminder-time > span { align-self: end; padding-bottom: 0.5625rem; font-weight: 750; }
.reminder-time input { appearance: textfield; width: 100%; min-width: 0; height: 2.25rem; border: 1px solid var(--line); border-radius: 0.625rem; padding: 0 0.375rem; background: var(--paper); color: var(--ink); font: inherit; font-size: 1rem; text-align: center; font-variant-numeric: tabular-nums; -webkit-user-select: text; user-select: text; }
.reminder-time input::-webkit-inner-spin-button, .reminder-time input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.reminder-time input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.reminder-time input:disabled { opacity: .4; }
@media (max-width: 760px) {
  #analytics-chart { height: 11.25rem; }
  .range-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr); width: 100%; gap: 0.375rem; }
  .range-toolbar .period-navigation { min-width: 0; }
  .range-toolbar .period-navigation strong { width: auto; flex: 1; min-width: 0; }
  .range-toolbar .calendar-nav { flex: 0 0 auto; }
  .analytics-summary { width: 100%; gap: 0.75rem; }
}

@media (min-width: 761px) {
  :root { font-size: clamp(16px, 1.92dvh, 19.2px); }
}
