:root {
    --ink: #172027;
    --ink-soft: #637179;
    --blue: #2e6476;
    --amber: #f2a900;
    --paper: #edf3f4;
    --paper-deep: #dce6e8;
    --white: #fbfdfd;
    --line: #b9c9ce;
    --danger: #b34d3f;
    --shadow: 0 18px 55px rgba(23, 32, 39, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; color-scheme: light; }
body {
    margin: 0; color: var(--ink); background-color: var(--paper);
    background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(46,100,118,.055) 31px 32px);
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;
}
button, input { border-radius: 0; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(242,169,0,.48); outline-offset: 3px; }
.trace-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.trace-header {
    min-height: 102px; display: flex; align-items: center; justify-content: space-between; gap: 30px;
    border-bottom: 1px solid var(--line);
}
.trace-brand { display: flex; align-items: center; gap: 13px; color: var(--ink); text-decoration: none; }
.trace-brand-mark { width: 46px; height: 46px; display: grid; place-items: center; color: var(--white); background: var(--ink); font-size: 21px; font-weight: 800; }
.trace-brand strong { display: block; font-size: 18px; letter-spacing: .12em; }
.trace-brand small, .trace-now small { display: block; margin-top: 4px; color: var(--ink-soft); font: 700 9px/1 Bahnschrift, Consolas, monospace; letter-spacing: .18em; }
.trace-now { display: grid; grid-template-columns: 12px auto; align-items: center; column-gap: 10px; text-align: right; font: 800 20px/1 Bahnschrift, Consolas, monospace; }
.trace-now small { grid-column: 2; }
.trace-now-dot { grid-row: 1 / 3; width: 9px; height: 9px; background: var(--amber); border-radius: 50%; box-shadow: 0 0 0 6px rgba(242,169,0,.13); }

.trace-overview { display: grid; grid-template-columns: minmax(360px, .82fr) minmax(0, 1.18fr); gap: 38px; padding: 56px 0 62px; }
.panel { min-width: 0; padding: 30px; background: rgba(251,253,253,.96); box-shadow: var(--shadow); border-top: 5px solid var(--blue); }
.panel-heading, .focus-heading, .archive-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.panel-heading, .focus-heading { padding-bottom: 20px; border-bottom: 2px solid var(--ink); }
.eyebrow { margin: 0 0 9px; color: var(--blue); font: 800 10px/1 Bahnschrift, Consolas, monospace; letter-spacing: .17em; }
h1, h2 { margin: 0; font-weight: 800; letter-spacing: -.045em; }
h1 { font-size: 30px; }
h2 { font-size: 30px; }
.calendar-nav { min-width: 176px; height: 38px; display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; border: 1px solid var(--line); }
.calendar-nav button, .calendar-foot button { height: 100%; color: var(--ink); background: transparent; border: 0; cursor: pointer; font-weight: 800; }
.calendar-nav strong { text-align: center; font: 800 13px/1 Bahnschrift, Consolas, monospace; }
.calendar-weekdays, .calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.calendar-weekdays { margin: 22px 0 9px; color: var(--ink-soft); text-align: center; font-size: 10px; font-weight: 700; }
.calendar-day { position: relative; aspect-ratio: 1; min-height: 36px; display: grid; place-items: center; color: var(--ink); background: transparent; border: 1px solid transparent; cursor: pointer; font: 700 12px/1 Bahnschrift, Consolas, monospace; }
.calendar-day:hover { border-color: var(--blue); background: var(--white); }
.calendar-day.is-outside { color: #a5b0b5; }
.calendar-day.has-record::before { content: ""; position: absolute; bottom: 5px; width: 4px; height: 4px; background: var(--blue); border-radius: 50%; }
.calendar-day.is-today { box-shadow: inset 0 0 0 1px var(--line); }
.calendar-day.is-selected { color: var(--ink); background: var(--amber); border-color: var(--amber); box-shadow: 0 7px 16px rgba(242,169,0,.25); }
.calendar-day.is-selected::before { background: var(--ink); }
.calendar-foot { min-height: 41px; display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--paper-deep); color: var(--ink-soft); font-size: 11px; }
.calendar-foot strong { color: var(--ink); }
.calendar-foot button { padding: 7px 10px; border: 1px solid var(--line); font-size: 11px; }

.day-focus { display: flex; flex-direction: column; }
.focus-summary { display: grid; grid-template-columns: auto auto; gap: 4px 8px; align-items: baseline; text-align: right; }
.focus-summary strong { color: var(--ink); font: 800 17px/1 Bahnschrift, Consolas, monospace; }
.focus-summary span { color: var(--ink-soft); font-size: 10px; }
.focus-tasks { height: 350px; margin-top: 20px; padding-right: 8px; overflow-y: auto; scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
.focus-task { display: grid; grid-template-columns: 70px minmax(0,1fr) auto; gap: 15px; padding: 17px 0; border-bottom: 1px solid var(--paper-deep); }
.focus-task:first-child { padding-top: 2px; }
.task-time { color: var(--blue); font: 800 11px/1.4 Bahnschrift, Consolas, monospace; }
.task-copy { min-width: 0; }
.task-copy strong { display: block; overflow-wrap: anywhere; font-size: 15px; }
.task-copy p { margin: 7px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; }
.task-duration { white-space: nowrap; font: 800 11px/1.4 Bahnschrift, Consolas, monospace; }
.task-status { display: inline-block; margin-top: 8px; color: var(--blue); font: 800 9px/1 Bahnschrift, Consolas, monospace; letter-spacing: .12em; }
.append-list { display: grid; gap: 6px; margin-top: 10px; }
.append-line { padding: 7px 9px; color: var(--ink-soft); background: var(--paper); border-left: 2px solid var(--line); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.trace-task-images { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.trace-image-thumb { aspect-ratio: 1; min-width: 0; padding: 0; overflow: hidden; background: var(--paper); border: 1px solid var(--line); cursor: zoom-in; }
.trace-image-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .18s; }
.trace-image-thumb:hover img { transform: scale(1.05); }

.archive-divider { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; color: var(--ink-soft); font: 800 9px/1 Bahnschrift, Consolas, monospace; letter-spacing: .22em; }
.archive-divider span { height: 1px; background: var(--line); }
.trace-archive { padding: 42px 0 58px; }
.archive-heading { align-items: center; margin-bottom: 26px; }
.archive-caption { margin: 9px 0 0; color: var(--ink-soft); font-size: 11px; }
.history-search { width: min(480px, 100%); height: 46px; display: flex; background: var(--white); border: 1px solid var(--line); }
.history-search label { flex: 1; min-width: 0; }
.history-search input { width: 100%; height: 44px; padding: 0 14px; color: var(--ink); background: transparent; border: 0; }
.history-search button { padding: 0 18px; color: var(--white); background: var(--ink); border: 0; cursor: pointer; font-size: 12px; font-weight: 800; }
.history-search .clear-button { color: var(--ink); background: var(--paper-deep); }
.history-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.day-card { height: 360px; display: flex; flex-direction: column; min-width: 0; background: rgba(251,253,253,.96); border: 1px solid #d4dfe1; box-shadow: 0 12px 30px rgba(23,32,39,.08); }
.day-card-head { flex: 0 0 auto; min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 17px 19px; color: var(--white); background: var(--ink); }
.day-card-date strong { display: block; font: 800 18px/1 Bahnschrift, Consolas, monospace; letter-spacing: -.02em; }
.day-card-date span { display: block; margin-top: 7px; color: #c8d3d7; font-size: 10px; }
.day-card-total { text-align: right; }
.day-card-total strong { display: block; font: 800 14px/1 Bahnschrift, Consolas, monospace; }
.day-card-total span { display: block; margin-top: 6px; color: #c8d3d7; font-size: 9px; }
.day-card-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 18px 16px; scrollbar-color: var(--line) transparent; scrollbar-width: thin; }
.archive-task { padding: 15px 0; border-bottom: 1px solid var(--paper-deep); }
.archive-task:last-child { border-bottom: 0; }
.archive-task-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.archive-task time { color: var(--blue); font: 800 10px/1 Bahnschrift, Consolas, monospace; }
.archive-task em { color: var(--ink-soft); font: normal 800 9px/1 Bahnschrift, Consolas, monospace; }
.archive-task strong { display: block; margin-top: 8px; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.archive-task p { margin: 6px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
.pagination { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 32px; }
.pagination button { min-width: 38px; height: 38px; padding: 0 10px; color: var(--ink); background: transparent; border: 1px solid var(--line); cursor: pointer; font: 800 11px/1 Bahnschrift, Consolas, monospace; }
.pagination button:hover:not(:disabled), .pagination button.is-current { color: var(--white); background: var(--ink); border-color: var(--ink); }
.pagination button:disabled { cursor: default; opacity: .38; }
.pagination-info { margin: 0 8px; color: var(--ink-soft); font: 700 10px/1 Bahnschrift, Consolas, monospace; }
.empty-state, .loading-state { min-height: 180px; display: grid; place-content: center; text-align: center; color: var(--ink-soft); }
.empty-state strong { color: var(--ink); font-size: 16px; }
.empty-state span { margin-top: 8px; font-size: 11px; }
.history-grid > .empty-state, .history-grid > .loading-state { grid-column: 1 / -1; min-height: 310px; border: 1px dashed var(--line); background: rgba(251,253,253,.55); }
footer { min-height: 90px; display: flex; align-items: center; justify-content: space-between; gap: 22px; border-top: 1px solid var(--line); color: var(--ink-soft); font: 700 9px/1.5 Bahnschrift, Arial, sans-serif; letter-spacing: .12em; }
footer a { color: var(--blue); font-weight: 800; text-decoration: none; }
.toast { position: fixed; z-index: 20; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 18px; color: var(--white); background: var(--ink); box-shadow: var(--shadow); transform: translateY(24px); opacity: 0; pointer-events: none; transition: .25s; font-size: 13px; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast.is-error { background: var(--danger); }
.image-viewer { width: min(1100px, calc(100% - 34px)); height: min(88vh, 820px); padding: 0; overflow: hidden; color: var(--white); background: rgba(12,17,20,.96); border: 1px solid rgba(255,255,255,.18); box-shadow: 0 28px 100px rgba(0,0,0,.45); }
.image-viewer::backdrop { background: rgba(10,15,18,.82); backdrop-filter: blur(5px); }
.image-viewer > button { position: absolute; z-index: 2; top: 12px; right: 12px; width: 40px; height: 40px; padding: 0; color: var(--white); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.35); cursor: pointer; font-size: 27px; line-height: 1; }
.image-viewer figure { width: 100%; height: 100%; display: grid; grid-template-rows: minmax(0,1fr) auto; gap: 12px; margin: 0; padding: 24px; }
.image-viewer img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.image-viewer figcaption { min-height: 18px; padding-right: 44px; color: #d6dfe2; font-size: 11px; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
    .trace-overview { grid-template-columns: 1fr; }
    .history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .trace-shell { width: min(100% - 28px, 1240px); }
    .trace-header { min-height: 84px; }
    .trace-now small { display: none; }
    .trace-overview { gap: 22px; padding: 30px 0 42px; }
    .panel { padding: 22px; }
    .panel-heading, .focus-heading, .archive-heading { align-items: stretch; flex-direction: column; }
    .calendar-nav, .history-search { width: 100%; }
    .focus-summary { grid-template-columns: auto 1fr auto 1fr; text-align: left; }
    .focus-tasks { height: 330px; }
    .focus-task { grid-template-columns: 58px minmax(0,1fr); }
    .task-duration { grid-column: 2; }
    .history-grid { grid-template-columns: 1fr; }
    .day-card { height: 340px; }
    .trace-task-images { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    footer { flex-direction: column; justify-content: center; text-align: center; }
}
@media (max-width: 430px) {
    .trace-brand small { display: none; }
    .trace-now { font-size: 17px; }
    .calendar-day { min-height: 31px; }
    .history-search button { padding: 0 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
