:root {
    --bg: #f2f8f1;
    --bg-deep: #d8ead7;
    --surface: rgba(255, 255, 255, 0.9);
    --surface-strong: #ffffff;
    --text: #061309;
    --muted: #5d6b5f;
    --line: rgba(34, 66, 38, 0.14);
    --brand: #00c85f;
    --brand-strong: #011709;
    --brand-soft: rgba(0, 200, 95, 0.12);
    --blue: #1e4f88;
    --amber: #d87924;
    --danger: #9b3f33;
    --shadow: 0 18px 52px rgba(0, 18, 8, 0.13);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    color-scheme: light;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    position: relative;
    margin: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    font-family: "Segoe UI Variable Text", "Aptos", "Trebuchet MS", sans-serif;
    color: var(--text);
    background:
        linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.15) 1px, transparent 1px),
        linear-gradient(180deg, #fbfef9 0%, var(--bg) 54%, var(--bg-deep) 100%);
    background-size: 44px 44px, 44px 44px, auto;
}

body.is-dialog-open {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(35, 71, 41, 0.16);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

textarea {
    resize: vertical;
    min-height: 112px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: rgba(15, 109, 60, 0.58);
    box-shadow: 0 0 0 4px rgba(15, 109, 60, 0.12);
    transform: translateY(-1px);
}

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.page-shell {
    width: min(1440px, calc(100% - 28px));
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0 34px;
}

.app-header,
.timer-panel,
.entry-panel,
.summary-panel,
.history-panel,
.admin-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.app-header {
    position: relative;
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(200px, 280px) minmax(280px, 1fr) minmax(120px, auto);
    gap: 24px;
    align-items: center;
    margin-bottom: 16px;
    padding: 18px 22px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 253, 247, 0.94) 62%, rgba(232, 248, 238, 0.9));
    overflow: visible;
}

.site-brand {
    color: inherit;
    text-decoration: none;
}

.site-logo-frame {
    display: block;
    width: 100%;
    max-width: 280px;
}

.site-logo-frame img {
    display: block;
    width: 100%;
    height: auto;
}

.header-copy {
    min-width: 0;
}

.eyebrow,
.section-kicker {
    margin: 0 0 6px;
    color: #0f6d3c;
    font-size: 0.77rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-header h1,
.panel-heading h2,
.account-dialog h2 {
    margin: 0;
    font-family: Georgia, "Palatino Linotype", serif;
    letter-spacing: 0;
    color: var(--brand-strong);
}

.app-header h1 {
    font-size: 3rem;
    line-height: 1;
}

.header-copy p:last-child {
    max-width: 620px;
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 1.03rem;
    line-height: 1.5;
}

.header-menu {
    position: relative;
    z-index: 60;
    justify-self: end;
    align-self: start;
}

.menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    border: 1px solid rgba(15, 109, 60, 0.14);
    border-radius: 999px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--brand-strong);
    font-weight: 900;
    box-shadow: 0 12px 24px rgba(0, 18, 8, 0.08);
}

.menu-toggle-icon {
    display: grid;
    gap: 4px;
    width: 18px;
}

.menu-toggle-icon span {
    display: block;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.header-menu-panel[hidden],
.menu-account-actions .button[hidden] {
    display: none !important;
}

.header-menu-panel {
    position: absolute;
    z-index: 120;
    top: calc(100% + 10px);
    right: 0;
    display: grid;
    gap: 14px;
    width: min(320px, calc(100vw - 44px));
    border: 1px solid rgba(15, 109, 60, 0.14);
    border-radius: var(--radius);
    padding: 16px;
    background: #ffffff;
    box-shadow: 0 24px 58px rgba(0, 18, 8, 0.18);
}

.menu-account-summary {
    display: grid;
    gap: 6px;
}

.menu-section-label {
    color: #0f6d3c;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.account-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.account-status.is-signed-in {
    color: var(--brand-strong);
}

.menu-account-actions {
    display: grid;
    gap: 10px;
}

.menu-account-actions .button {
    min-height: 42px;
    padding: 10px 14px;
}

.menu-links {
    display: grid;
    gap: 4px;
    padding-top: 10px;
    border-top: 1px solid rgba(15, 109, 60, 0.1);
}

.menu-links a {
    border-radius: var(--radius);
    padding: 10px 12px;
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.menu-links a:hover,
.menu-links a:focus-visible {
    background: rgba(0, 216, 100, 0.1);
    outline: none;
}

.form-actions,
.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px 16px;
    font-weight: 900;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button-primary {
    background: var(--brand);
    color: var(--brand-ink, #001006);
    box-shadow: 0 12px 24px rgba(0, 150, 72, 0.24);
}

.button-soft {
    border-color: rgba(15, 109, 60, 0.16);
    background: rgba(0, 216, 100, 0.1);
    color: #07562e;
}

.button-ghost {
    border-color: rgba(35, 71, 41, 0.12);
    background: rgba(255, 255, 255, 0.62);
    color: var(--muted);
}

.button-danger {
    border-color: rgba(155, 63, 51, 0.22);
    background: #fff2ed;
    color: var(--danger);
    box-shadow: 0 12px 24px rgba(155, 63, 51, 0.12);
}

.compact-button {
    min-height: 36px;
    padding: 8px 12px;
    font-size: 0.86rem;
}

.app-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.92fr) minmax(430px, 1.08fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.admin-header {
    grid-template-columns: minmax(200px, 280px) minmax(280px, 1fr) auto;
}

.admin-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.admin-header-actions form {
    margin: 0;
}

.admin-login-layout {
    display: grid;
    place-items: start center;
}

.admin-login-panel {
    width: min(520px, 100%);
}

.admin-layout {
    display: grid;
    grid-template-columns: minmax(360px, 0.72fr) minmax(520px, 1.28fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.admin-status {
    margin: 0 0 16px;
    border: 1px solid rgba(15, 109, 60, 0.16);
    border-radius: var(--radius);
    padding: 12px 14px;
    background: rgba(0, 216, 100, 0.08);
    color: #07562e;
    font-weight: 900;
}

.admin-status.is-error {
    border-color: rgba(155, 63, 51, 0.18);
    background: #fff2ed;
    color: var(--danger);
}

.admin-stat-grid,
.admin-records-panel {
    grid-column: 1 / -1;
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.admin-pattern-form {
    display: grid;
    gap: 14px;
}

.admin-record-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.admin-wide-field {
    grid-column: 1 / -1;
}

.admin-record-list {
    display: grid;
    gap: 10px;
}

.admin-record-row {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(120px, 0.35fr) minmax(190px, 0.55fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid rgba(35, 71, 41, 0.1);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255, 255, 255, 0.74);
}

.admin-record-row h3 {
    margin: 0;
    color: var(--brand-strong);
    font-size: 1rem;
}

.admin-record-row p {
    margin: 4px 0 0;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.35;
}

.admin-record-row strong {
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 1.2rem;
}

.admin-record-row > span {
    color: var(--muted);
    font-weight: 800;
}

.timer-panel,
.entry-panel,
.summary-panel,
.history-panel,
.admin-panel {
    padding: 18px;
}

.timer-panel {
    position: static;
}

.summary-panel,
.history-panel {
    grid-column: 1 / -1;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}

.panel-heading h2 {
    font-size: 1.6rem;
    line-height: 1.1;
}

.run-pill,
.save-scope {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    border-radius: 999px;
    padding: 6px 12px;
    background: rgba(30, 79, 136, 0.1);
    color: var(--blue);
    font-size: 0.84rem;
    font-weight: 900;
    white-space: nowrap;
}

.run-pill.is-running {
    background: rgba(0, 200, 95, 0.16);
    color: #07562e;
}

.timer-face {
    display: grid;
    gap: 12px;
    padding: 22px;
    border: 1px solid rgba(0, 40, 16, 0.08);
    border-radius: var(--radius);
    background:
        linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
        linear-gradient(145deg, #032313, #0b3a22 58%, #09213d);
    background-size: 28px 28px, 28px 28px, auto;
    color: #f4fff8;
}

.timer-display {
    min-height: 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 5.6rem;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    text-align: center;
    overflow-wrap: anywhere;
}

.timer-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: rgba(244, 255, 248, 0.74);
    font-size: 0.92rem;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.control-button {
    min-height: 70px;
    border: 1px solid rgba(35, 71, 41, 0.12);
    border-radius: var(--radius);
    background: var(--surface-strong);
    color: var(--brand-strong);
    display: grid;
    place-items: center;
    gap: 6px;
    font-weight: 900;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.control-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 18, 8, 0.12);
    border-color: rgba(15, 109, 60, 0.24);
}

.control-start {
    background: var(--brand);
}

.control-toggle.is-running {
    border-color: rgba(155, 63, 51, 0.18);
    background: #fff2ed;
    color: var(--danger);
}

.control-stop {
    background: #fff2ed;
    color: var(--danger);
}

.control-svg {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.control-svg[hidden] {
    display: none;
}

.control-svg-fill {
    fill: currentColor;
    stroke: none;
}

.result-form {
    display: grid;
    gap: 14px;
}

.autocomplete-shell {
    position: relative;
}

.autocomplete-menu {
    position: absolute;
    z-index: 70;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    display: grid;
    gap: 6px;
    max-height: 230px;
    overflow: auto;
    border: 1px solid rgba(15, 109, 60, 0.18);
    border-radius: var(--radius);
    padding: 8px;
    background: #ffffff;
    box-shadow: 0 18px 42px rgba(0, 18, 8, 0.18);
}

.autocomplete-menu[hidden] {
    display: none !important;
}

.autocomplete-menu button {
    width: 100%;
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 10px 12px;
    background: rgba(0, 216, 100, 0.08);
    color: var(--text);
    font-weight: 800;
    text-align: left;
}

.autocomplete-menu button:hover,
.autocomplete-menu button:focus-visible {
    background: rgba(0, 216, 100, 0.16);
    outline: none;
}

.autocomplete-menu span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.autocomplete-menu-notes span {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.form-row,
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 14px;
}

.inline-status {
    min-height: 22px;
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

.inline-status.is-error {
    color: var(--danger);
}

.inline-status.is-success {
    color: #0f6d3c;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.metric-card {
    min-height: 92px;
    border: 1px solid rgba(35, 71, 41, 0.1);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255, 255, 255, 0.74);
}

.metric-card span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric-card strong {
    display: block;
    margin-top: 8px;
    color: var(--brand-strong);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 1.35rem;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

.trend-list {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

.trend-empty,
.history-empty {
    border: 1px dashed rgba(35, 71, 41, 0.2);
    border-radius: var(--radius);
    padding: 18px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.58);
    font-weight: 700;
}

.trend-row {
    display: grid;
    gap: 9px;
    border: 1px solid rgba(35, 71, 41, 0.1);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.trend-row-header,
.trend-removed-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.trend-row-header code {
    color: var(--text);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 1.05rem;
}

.trend-note {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    line-height: 1.4;
    white-space: pre-wrap;
}

.trend-track {
    height: 32px;
    border-radius: var(--radius);
    background: rgba(30, 79, 136, 0.09);
    overflow: hidden;
}

.trend-bar {
    height: 100%;
    min-width: 34px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--brand), #72eda7);
}

.trend-bar.is-best {
    background: linear-gradient(90deg, var(--blue), #55a9d7);
}

.trend-remove {
    justify-self: start;
}

.trend-removed-notice {
    border: 1px solid rgba(15, 109, 60, 0.14);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: rgba(0, 216, 100, 0.08);
    color: var(--muted);
    font-weight: 800;
}

.progress-graph {
    position: relative;
    overflow: visible;
    border: 1px solid rgba(35, 71, 41, 0.1);
    border-radius: var(--radius);
    padding: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(244, 253, 247, 0.92)),
        rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.progress-graph-heading,
.progress-graph-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-weight: 900;
}

.progress-graph-heading span {
    color: var(--brand-strong);
}

.progress-graph-change,
.progress-graph-footer {
    font-size: 0.82rem;
}

.progress-graph-change {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 5px 10px;
    background: rgba(30, 79, 136, 0.1);
    color: var(--blue);
}

.progress-graph-change.is-faster {
    background: rgba(0, 200, 95, 0.14);
    color: #07562e;
}

.progress-graph-change.is-slower {
    background: rgba(216, 121, 36, 0.13);
    color: #8a480d;
}

.progress-graph-stage {
    position: relative;
    margin-top: 10px;
}

.progress-graph-canvas {
    display: block;
    width: 100%;
    height: auto;
}

.progress-graph-grid {
    stroke: rgba(35, 71, 41, 0.11);
    stroke-width: 1;
    stroke-dasharray: 3 9;
}

.progress-graph-best-line {
    stroke: rgba(30, 79, 136, 0.44);
    stroke-width: 2;
    stroke-dasharray: 7 9;
}

.progress-graph-area {
    fill: url(#progressGraphArea);
}

.progress-graph-line {
    fill: none;
    stroke: url(#progressGraphLine);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.progress-graph-line.is-single {
    stroke-width: 4;
    stroke-dasharray: 8 8;
    opacity: 0.7;
}

.progress-graph-point-wrap {
    cursor: pointer;
    outline: none;
}

.progress-graph-hover-line {
    stroke: rgba(0, 67, 31, 0.28);
    stroke-width: 2;
    stroke-dasharray: 4 7;
    opacity: 0;
    transition: opacity 160ms ease;
}

.progress-graph-hit {
    fill: transparent;
    pointer-events: all;
}

.progress-graph-point {
    fill: #ffffff;
    stroke: var(--brand);
    stroke-width: 4;
    filter: drop-shadow(0 6px 10px rgba(0, 70, 31, 0.18));
    transform-box: fill-box;
    transform-origin: center;
    transition: fill 160ms ease, stroke-width 160ms ease, transform 160ms ease;
}

.progress-graph-point-wrap.is-best .progress-graph-point {
    stroke: var(--blue);
    fill: #d9f0ff;
}

.progress-graph-point-wrap:hover .progress-graph-hover-line,
.progress-graph-point-wrap:focus-visible .progress-graph-hover-line,
.progress-graph-point-wrap.is-active .progress-graph-hover-line {
    opacity: 1;
}

.progress-graph-point-wrap:hover .progress-graph-point,
.progress-graph-point-wrap:focus-visible .progress-graph-point,
.progress-graph-point-wrap.is-active .progress-graph-point {
    fill: #eafff2;
    stroke-width: 5;
    transform: scale(1.32);
}

.progress-graph-axis {
    fill: var(--muted);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 13px;
    font-weight: 900;
}

.progress-graph-tooltip {
    position: absolute;
    z-index: 4;
    display: grid;
    gap: 4px;
    min-width: 190px;
    max-width: min(280px, calc(100% - 24px));
    border: 1px solid rgba(0, 92, 44, 0.18);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 42px rgba(0, 18, 8, 0.2);
    color: var(--text);
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 14px));
}

.progress-graph-tooltip[hidden] {
    display: none !important;
}

.progress-graph-tooltip.is-left {
    transform: translate(-92%, calc(-100% - 14px));
}

.progress-graph-tooltip.is-right {
    transform: translate(-8%, calc(-100% - 14px));
}

.progress-graph-tooltip.is-below {
    transform: translate(-50%, 18px);
}

.progress-graph-tooltip.is-below.is-left {
    transform: translate(-92%, 18px);
}

.progress-graph-tooltip.is-below.is-right {
    transform: translate(-8%, 18px);
}

.progress-graph-tooltip strong {
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 1.15rem;
}

.progress-graph-tooltip span,
.progress-graph-tooltip em {
    color: var(--muted);
    font-size: 0.84rem;
    font-style: normal;
    font-weight: 800;
    line-height: 1.35;
}

.history-list {
    display: grid;
    gap: 10px;
}

.history-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.result-card {
    display: grid;
    grid-template-columns: minmax(220px, 1.15fr) minmax(120px, 0.7fr) minmax(170px, 1fr) auto;
    gap: 14px;
    align-items: center;
    border: 1px solid rgba(35, 71, 41, 0.1);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(255, 255, 255, 0.74);
}

.result-main {
    min-width: 0;
}

.result-title {
    margin: 0;
    color: var(--brand-strong);
    font-size: 1rem;
    font-weight: 900;
    overflow-wrap: anywhere;
}

.result-note,
.result-date {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.35;
}

.result-note {
    white-space: pre-wrap;
}

.result-time {
    color: var(--brand-strong);
    font-family: "Cascadia Mono", "Consolas", monospace;
    font-size: 1.45rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.result-change {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    border-radius: 999px;
    padding: 5px 10px;
    background: rgba(30, 79, 136, 0.09);
    color: var(--blue);
    font-size: 0.85rem;
    font-weight: 900;
}

.result-change.is-faster {
    background: rgba(0, 200, 95, 0.14);
    color: #07562e;
}

.result-change.is-slower {
    background: rgba(216, 121, 36, 0.13);
    color: #8a480d;
}

.source-pill {
    display: inline-flex;
    margin-top: 7px;
    border-radius: 999px;
    padding: 4px 8px;
    background: rgba(15, 109, 60, 0.1);
    color: #0f6d3c;
    font-size: 0.76rem;
    font-weight: 900;
}

.delete-button {
    min-height: 38px;
    border: 1px solid rgba(155, 63, 51, 0.18);
    border-radius: var(--radius);
    padding: 8px 12px;
    background: #fff7f4;
    color: var(--danger);
    font-weight: 900;
    justify-self: end;
}

.dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(6, 19, 9, 0.38);
    backdrop-filter: blur(8px);
}

.dialog-backdrop[hidden] {
    display: none !important;
}

.account-dialog {
    position: relative;
    width: min(520px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow: auto;
    border: 1px solid rgba(0, 92, 44, 0.18);
    border-radius: var(--radius);
    padding: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 80px rgba(0, 18, 8, 0.24);
}

.account-dialog form {
    display: grid;
    gap: 13px;
    margin-top: 16px;
}

.confirm-dialog {
    width: min(440px, 100%);
}

.confirm-message {
    margin: 12px 0 18px;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.5;
}

.confirm-actions {
    justify-content: end;
}

.dialog-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(35, 71, 41, 0.12);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.74);
    color: var(--muted);
}

.dialog-close::before,
.dialog-close::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    top: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.dialog-close::before {
    transform: rotate(45deg);
}

.dialog-close::after {
    transform: rotate(-45deg);
}

.pattern-box {
    display: grid;
    gap: 10px;
    border: 1px solid rgba(35, 71, 41, 0.12);
    border-radius: var(--radius);
    padding: 12px;
    background: rgba(0, 216, 100, 0.06);
}

.pattern-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    color: var(--muted);
    font-weight: 900;
}

.pattern-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, clamp(52px, 15vw, 64px));
    grid-template-rows: repeat(3, clamp(52px, 15vw, 64px));
    gap: clamp(10px, 3vw, 16px);
    justify-content: center;
    width: max-content;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid rgba(15, 109, 60, 0.16);
    border-radius: 18px;
    padding: clamp(12px, 3vw, 18px);
    background:
        linear-gradient(145deg, rgba(232, 255, 241, 0.74), rgba(255, 255, 255, 0.96)),
        rgba(255, 255, 255, 0.92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.pattern-lines {
    position: absolute;
    inset: clamp(12px, 3vw, 18px);
    z-index: 1;
    width: calc(100% - (clamp(12px, 3vw, 18px) * 2));
    height: calc(100% - (clamp(12px, 3vw, 18px) * 2));
    overflow: visible;
    pointer-events: none;
}

.pattern-lines polyline {
    fill: none;
    stroke: var(--brand);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 5.5;
}

.pattern-dot {
    position: relative;
    z-index: 2;
    display: grid;
    place-items: center;
    width: clamp(52px, 15vw, 64px);
    height: clamp(52px, 15vw, 64px);
    padding: 0;
    border: 1px solid rgba(15, 109, 60, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--brand-strong);
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(7, 35, 18, 0.08);
    touch-action: none;
    transition: transform 150ms ease, background 150ms ease, color 150ms ease;
}

.pattern-dot span {
    display: grid;
    place-items: center;
    width: clamp(34px, 10vw, 42px);
    height: clamp(34px, 10vw, 42px);
    border-radius: 999px;
    background: rgba(210, 242, 225, 0.9);
}

.pattern-dot.is-selected {
    border-color: rgba(0, 126, 61, 0.7);
    background: var(--brand);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 193, 94, 0.18), 0 14px 30px rgba(0, 119, 57, 0.2);
    transform: scale(0.94);
}

.pattern-dot.is-selected span {
    background: transparent;
}

@media (max-width: 1120px) {
    .app-header {
        grid-template-columns: minmax(190px, 240px) 1fr;
    }

    .header-menu {
        grid-column: 2;
        grid-row: 1;
        align-self: center;
    }

    .header-copy {
        grid-column: 1 / -1;
    }

    .app-layout {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-header-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .timer-panel {
        position: static;
    }
}

@media (max-width: 820px) {
    body {
        touch-action: pan-y;
    }

    .page-shell {
        width: min(100% - 18px, 720px);
        padding-top: 12px;
    }

    .app-header {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 14px;
        padding: 20px;
        max-width: 100%;
        min-width: 0;
    }

    .site-brand {
        align-self: start;
    }

    .site-logo-frame {
        width: min(220px, 100%);
    }

    .app-header h1 {
        font-size: 2.35rem;
    }

    .header-copy {
        grid-column: 1 / -1;
    }

    .header-menu {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        align-self: start;
        width: auto;
    }

    .menu-toggle {
        width: auto;
        justify-content: flex-start;
    }

    .header-menu-panel {
        left: auto;
        right: 0;
        width: min(300px, calc(100vw - 44px));
    }

    .timer-panel,
    .entry-panel,
    .summary-panel,
    .history-panel,
    .admin-panel {
        min-width: 0;
        max-width: 100%;
    }

    .form-actions,
    .dialog-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .timer-panel,
    .entry-panel,
    .summary-panel,
    .history-panel,
    .admin-panel {
        padding: 14px;
    }

    .timer-face {
        padding: 16px 12px;
    }

    .timer-display {
        min-height: 84px;
        font-size: 3.25rem;
    }

    .timer-meta,
    .panel-heading,
    .trend-row,
    .result-card,
    .admin-record-row {
        grid-template-columns: 1fr;
    }

    .panel-heading {
        display: grid;
    }

    .control-grid,
    .metric-grid,
    .filter-grid,
    .form-row,
    .admin-record-form,
    .admin-stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .progress-graph {
        overflow: hidden;
    }

    .admin-record-form {
        grid-template-columns: 1fr;
    }

    .admin-wide-field {
        grid-column: auto;
    }

    .result-card {
        justify-items: stretch;
    }

    .delete-button {
        width: auto;
        justify-self: start;
    }
}

@media (max-width: 480px) {
    .control-grid,
    .metric-grid,
    .form-row,
    .admin-stat-grid {
        grid-template-columns: 1fr;
    }

    .timer-display {
        font-size: 2.8rem;
    }

    .pattern-grid {
        grid-template-columns: repeat(3, 52px);
    }

    .pattern-dot {
        width: 52px;
        height: 52px;
    }
}
