/* 养护日记 — interface styles.
   Colour carries urgency only (red > amber > green > gray); the two specimen
   kinds are told apart by a solid and an outlined tag, never by colour. */

:root {
  --bg: #eef0ec;
  --panel: #ffffff;
  --panel-2: #f6f7f4;
  --side: #f8f9f6;
  --line: #e1e5de;
  --line-2: #cdd3ca;
  --ink: #151d18;
  --ink-2: #4a554d;
  --ink-3: #78837b;
  --ink-4: #a5ada7;
  --brand: #1d6a4b;
  --brand-2: #165239;
  --brand-soft: #e4f1ea;
  --red: #b93a2a;
  --amber: #a85a06;
  --blue: #2b61b6;
  --violet: #6a56a8;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(21, 29, 24, .06), 0 1px 1px rgba(21, 29, 24, .04);
  --shadow-lg: 0 24px 60px rgba(21, 29, 24, .18), 0 4px 14px rgba(21, 29, 24, .08);
  --sans: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  color-scheme: light;
}

.t-red, .note-red { --tone: var(--red); --tone-soft: #fbece9; --tone-line: #f1cbc4; }
.t-amber, .note-amber { --tone: var(--amber); --tone-soft: #fdf1dc; --tone-line: #f0d6a6; }
.t-green, .note-green { --tone: var(--brand); --tone-soft: var(--brand-soft); --tone-line: #bcdbca; }
.t-blue, .note-blue { --tone: var(--blue); --tone-soft: #eaf1fb; --tone-line: #c5d6f0; }
.t-violet, .note-violet { --tone: var(--violet); --tone-soft: #f0edf9; --tone-line: #d6ceee; }
.t-gray, .note-gray { --tone: #5c6760; --tone-soft: #eef0ed; --tone-line: #dde1db; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.55 var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p, dl, dd, ul, fieldset { margin: 0; padding: 0; }
ul { list-style: none; }
fieldset { border: 0; min-width: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
b { font-weight: 650; }
small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ico { flex: none; }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--violet); font-weight: 550; }
.info-text { color: var(--blue); font-weight: 550; }
.hint { font-size: 12.5px; color: var(--ink-3); line-height: 1.6; }
.loading { color: var(--ink-3); padding: 18px 0; text-align: center; }
.form-error { color: var(--red); font-size: 13px; min-height: 0; }
.form-error:empty { display: none; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* Backdrop */
#wallpaper { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--bg); }
.wallpaper-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 2s ease; }
.wallpaper-frame.visible { opacity: 1; }
#root { position: relative; z-index: 1; height: 100%; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--panel); color: var(--ink); font-weight: 550; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
a.btn:hover { text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--panel-2); border-color: #b9c1b7; }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:disabled { opacity: .5; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-2); border-color: var(--brand-2); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #9f2f21; border-color: #9f2f21; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover:not(:disabled) { background: rgba(21, 29, 24, .06); border-color: transparent; }
.btn-danger-text { color: var(--red); }
.btn-sm { height: 30px; padding: 0 10px; border-radius: 8px; font-size: 13px; }
.btn-lg { height: 44px; font-size: 15px; }
.btn.is-busy { opacity: .7; }
.btn-icon { width: 30px; padding: 0; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: rgba(21, 29, 24, .07); color: var(--ink); }
.link { padding: 0; border: 0; background: none; color: var(--brand); font-weight: 550; display: inline-flex; align-items: center; gap: 2px; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--red); }

/* Form controls */
.input {
  width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--panel); outline: none; transition: border-color .12s, box-shadow .12s;
}
.input::placeholder { color: var(--ink-4); }
.input:hover { border-color: #b9c1b7; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea.input { height: auto; padding: 8px 11px; line-height: 1.55; resize: vertical; }
select.input { padding-right: 28px; }
.codes-input { font-family: var(--mono); font-size: 12.5px; }
.input-num { width: 78px; display: inline-block; text-align: center; padding: 0 6px; margin: 0 4px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > legend { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.field > legend { margin-bottom: 6px; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; max-width: 420px; }
.field-inline > span { white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex: none; cursor: pointer; }
input[type=checkbox]:disabled { cursor: default; }
.search { position: relative; display: flex; align-items: center; flex: 1 1 260px; max-width: 380px; }
.search .ico { position: absolute; left: 11px; color: var(--ink-3); pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 11px 0 34px; border: 1px solid var(--line-2); border-radius: 9px;
  background: var(--panel); outline: none;
}
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search-sm input { height: 32px; font-size: 13px; padding-left: 31px; }
.search-sm .ico { left: 9px; }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--line-2); position: relative; transition: background .15s; margin-top: 1px; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch small { display: block; color: var(--ink-3); }

/* Segments, chips, pills, tags */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(21, 29, 24, .07); }
.seg button {
  height: 30px; padding: 0 13px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2);
  font-weight: 550; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed=true] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg em, .chip em { font-style: normal; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.seg-wide { display: grid; grid-template-columns: 1fr 1fr; }
.seg-wide button { height: auto; padding: 9px 12px; flex-direction: column; gap: 0; line-height: 1.4; }
.seg-wide small { color: var(--ink-3); font-weight: 400; font-family: var(--mono); font-size: 11.5px; }
.chipbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 15px; background: var(--panel); color: var(--ink-2); font-size: 13px; font-weight: 550;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed=true] em { color: rgba(255, 255, 255, .7); }
.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--tone-soft); color: var(--tone); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.kind {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 5px; flex: none;
  font-size: 11.5px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.kind-standard { background: #212c26; color: #fff; }
.kind-curing { color: #212c26; box-shadow: inset 0 0 0 1.5px #212c26; background: var(--panel); }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--tone); color: #fff; font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 1;
}
.codes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
code {
  font: 12px/1.5 var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--panel-2); color: var(--ink-2);
}

/* Progress */
.gauge { display: block; position: relative; height: 6px; margin: 6px 0 5px; border-radius: 3px; background: rgba(21, 29, 24, .09); max-width: 240px; }
.gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--tone); min-width: 3px; }
.gauge-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); opacity: .55; }
.gauge-blocked .gauge-fill { background: repeating-linear-gradient(135deg, var(--tone) 0 4px, var(--tone-line) 4px 8px); }
.bar { display: block; height: 4px; margin-top: 6px; border-radius: 2px; background: rgba(21, 29, 24, .09); width: 96px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 2px; background: var(--brand); }

/* Surfaces */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.note {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin-bottom: 10px;
  border: 1px solid var(--tone-line); border-radius: 10px; background: var(--tone-soft); font-size: 13px; line-height: 1.6;
}
.note > .ico { color: var(--tone); margin-top: 2px; }
.note > span, .note > div { flex: 1; min-width: 0; }
.note .link { flex: none; }
.empty { padding: 56px 24px; text-align: center; color: var(--ink-3); }
.empty .ico { color: var(--ink-4); }
.empty h2 { margin: 10px 0 4px; font-size: 16px; color: var(--ink); }
.plain-list { list-style: disc; padding-left: 18px; line-height: 1.8; }

/* Tables */
/* clip keeps the rounded corners without creating a scroll box, so the header sticks to the page. */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: clip; }
.table-compact, .table-scroll { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  position: sticky; top: 0; z-index: 1; padding: 9px 14px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 550; color: var(--ink-3); background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.table td { padding: 11px 14px; border-bottom: 1px solid #edf0eb; vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { border-top: 1px solid var(--line); background: var(--panel-2); font-size: 12.5px; }
.table .r { text-align: right; }
.table .c { text-align: center; width: 44px; }
.table-compact .table { font-size: 13px; }
.table-compact .table td { padding: 8px 12px; }
.table-compact .table th { padding: 8px 12px; }
.table-scroll { max-height: 360px; }
.row-off td { color: var(--ink-4); }
.row-off b { font-weight: 500; }
.row-ready td { background: #fdf7ea; }
.cell-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.cell-line { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; white-space: nowrap; }
.cell-link { padding: 0; border: 0; background: none; text-align: left; }
.cell-link:hover b { color: var(--brand); text-decoration: underline; }
.table-reports td:nth-child(3) { min-width: 336px; }
.table .n { font-size: 14px; }

/* Dialogs */
.dlg { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; overflow: visible; color: inherit; }
.dlg::backdrop { background: rgba(17, 24, 20, .44); backdrop-filter: blur(2px); }
.dlg-box:focus { outline: none; }
.dlg-box {
  display: flex; flex-direction: column; width: min(var(--w), calc(100vw - 32px)); max-height: min(88dvh, 940px);
  border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .16s ease-out;
}
.dlg-sm { --w: 440px; }
.dlg-md { --w: 660px; }
.dlg-lg { --w: 880px; }
.dlg-xl { --w: 1140px; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.dlg-title { flex: 1; min-width: 0; }
.dlg-head h2 { font-size: 17px; line-height: 1.4; }
.dlg-sub { margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.dlg-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px; }
.dlg-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--panel-2); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dlg-sheet { margin: 0 0 0 auto; height: 100dvh; }
.dlg-sheet .dlg-box { height: 100%; max-height: none; border-radius: 16px 0 0 16px; animation: slide .2s ease-out; }
.dlg-sheet .dlg-body { background: var(--panel-2); }
.confirm-text { line-height: 1.7; color: var(--ink-2); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes slide { from { transform: translateX(32px); opacity: 0; } }

/* Toasts */
#toasts { position: fixed; left: 50%; bottom: 24px; z-index: 2147483647; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; pointer-events: auto;
  background: #1c2620; color: #fff; box-shadow: var(--shadow-lg); font-weight: 550; animation: pop .16s ease-out; max-width: 100%;
}
.toast-error { background: var(--red); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .2s; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(380px, 100%); padding: 32px 30px 24px; display: flex; flex-direction: column; gap: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.login-card .brand { margin-bottom: 8px; }
.login-foot { text-align: center; font-size: 12px; color: var(--ink-4); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand b { display: block; font-size: 16px; line-height: 1.3; letter-spacing: .02em; }
.brand small { display: block; color: var(--ink-3); font-size: 11.5px; }
.mark {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 19px; font-weight: 700; line-height: 1;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .14);
}

/* Shell */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100dvh; background: var(--bg); }
.side { display: flex; flex-direction: column; min-height: 0; padding: 18px 12px 12px; background: var(--side); border-right: 1px solid var(--line); }
.side .brand { padding: 0 8px 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 9px; color: var(--ink-2); font-weight: 550; }
.nav-item:hover { background: rgba(21, 29, 24, .05); color: var(--ink); text-decoration: none; }
.nav-item span { flex: 1; }
.nav-item.is-active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.nav-item.is-active .ico { color: var(--brand); }
.side-add { margin: 14px 0 4px; width: 100%; }
.side-projects { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 8px; font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: .06em; }
.side-head .link { font-size: 12px; letter-spacing: 0; }
.side-projects .search { flex: none; max-width: none; margin-bottom: 6px; }
.projects { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -4px; padding: 0 4px; }
.projects button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 5px 10px; flex: none;
  border: 0; border-radius: 8px; background: transparent; text-align: left; color: var(--ink-2); font-size: 13.5px;
}
.projects button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.projects button small { color: var(--ink-4); }
.projects button:hover { background: rgba(21, 29, 24, .05); color: var(--ink); }
.projects button[aria-pressed=true] { background: var(--brand-soft); color: var(--brand-2); font-weight: 650; }
.projects button[aria-pressed=true] small { color: var(--brand); }
.projects-empty { padding: 12px 10px; font-size: 13px; }
.projects-sheet { max-height: 56dvh; margin-top: 10px; }
.side-foot { padding: 10px 8px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.sync { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); }
.sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #3f9a6e; flex: none; }
.sync.is-warn { color: var(--amber); }
.sync.is-warn::before { background: var(--amber); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#view { flex: 1; min-height: 0; overflow: auto; outline: none; scroll-padding-top: 12px; }
.mobile-bar, .tabbar { display: none; }

/* Pages */
.page { max-width: 1200px; margin: 0 auto; padding: 28px 32px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; line-height: 1.3; letter-spacing: .01em; }
.page-sub { margin-top: 2px; color: var(--ink-3); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar .select { width: auto; min-width: 116px; }
.range { display: flex; align-items: center; gap: 6px; color: var(--ink-3); }
.range .input { width: 148px; }

/* 待送检 */
.overview { padding: 6px 16px 14px; margin-bottom: 22px; }
.stats { display: flex; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 6px; padding: 10px 22px 10px 0; margin-right: 22px; border: 0; border-right: 1px solid var(--line); background: none; color: var(--ink-2); text-align: left; }
.stat:last-child { border-right: 0; }
.stat b { font-size: 28px; line-height: 1.1; font-weight: 700; color: var(--tone); letter-spacing: -.01em; }
.stat span { font-size: 13px; }
.stat:hover:not(:disabled) span { color: var(--ink); text-decoration: underline; }
.stat:disabled b { color: var(--ink-4); }
.strip { display: grid; grid-template-columns: repeat(15, minmax(52px, 1fr)); gap: 4px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); overflow-x: auto; }
.strip-cell {
  display: flex; flex-direction: column; align-items: center; gap: 1px; min-height: 76px; padding: 7px 2px 6px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--ink);
}
.strip-wd { font-size: 11px; color: var(--ink-3); }
.strip-d { font-size: 15px; font-weight: 650; line-height: 1.35; }
.strip-n { display: flex; flex-direction: column; gap: 2px; margin-top: 3px; min-height: 16px; }
.strip-n i { font-style: normal; font-size: 10.5px; line-height: 15px; padding: 0 5px; border-radius: 4px; font-weight: 650; white-space: nowrap; }
.m-standard { background: #212c26; color: #fff; }
.m-curing { box-shadow: inset 0 0 0 1.2px #212c26; color: #212c26; background: var(--panel); }
.strip-cell:disabled { color: var(--ink-4); }
.strip-cell:disabled .strip-wd { color: var(--ink-4); }
.strip-cell.is-weekend:disabled { background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(21, 29, 24, .028) 5px 10px); }
.strip-cell.has { background: var(--panel-2); border-color: var(--line); }
.strip-cell.has:hover { border-color: var(--ink-3); }
.strip-cell.is-today { border-color: var(--brand); }
.strip-cell.is-today .strip-wd { color: var(--brand); font-weight: 650; }
.strip-overdue.has { background: #fbece9; border-color: #f1cbc4; }
.strip-overdue.has .strip-d { color: var(--red); }
.strip-overdue .strip-d { font-size: 14px; }
.strip-cell[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: #fff; }
.strip-cell[aria-pressed=true] .strip-wd, .strip-cell[aria-pressed=true] .strip-d { color: #fff; }
.filter-note { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 8px 12px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 13px; width: fit-content; }
.filter-note .link { color: #bfe6d2; margin-left: 6px; }
.calm { display: flex; gap: 12px; align-items: center; padding: 16px 18px; margin-bottom: 20px; }
.calm .ico { color: var(--brand); }
.calm p { color: var(--ink-3); font-size: 13px; }
.sect { margin-bottom: 22px; scroll-margin-top: 12px; }
.sect-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; padding: 0 4px; }
.sect-toggle { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 0; border: 0; background: none; color: var(--ink); border-radius: 6px; }
.sect-toggle h2 { font-size: 15px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--tone); flex: none; }
.sect-count { color: var(--ink-3); font-size: 13px; }
.chev { display: inline-grid; color: var(--ink-3); transition: transform .15s; }
.sect-toggle[aria-expanded=false] .chev { transform: rotate(-90deg); }
.items { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.item {
  display: grid; grid-template-columns: 34px minmax(0, 1.5fr) minmax(230px, 1fr) 76px auto; align-items: center; column-gap: 14px;
  padding: 12px 14px 12px 10px; box-shadow: inset 3px 0 0 var(--tone); position: relative;
}
.item + .item { border-top: 1px solid var(--line); }
.item.is-selected { background: #f4faf6; }
.item-check { display: grid; place-items: center; align-self: stretch; cursor: pointer; margin-left: 4px; }
.item-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 2px 0; border: 0; background: none; text-align: left; border-radius: 6px; }
.item-title { display: flex; align-items: flex-start; gap: 8px; }
.item-title .kind { margin-top: 1px; }
.item-title b { font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.item-main:hover .item-title b { color: var(--brand-2); }
.item-meta { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sched { display: flex; flex-direction: column; min-width: 0; }
.item-headline { font-size: 13.5px; font-weight: 650; color: var(--tone); }
.item-sub { font-size: 12px; color: var(--ink-3); }
.item-count { text-align: center; line-height: 1.25; }
.item-count b { display: block; font-size: 18px; font-weight: 700; }
.item-count span { font-size: 11.5px; color: var(--ink-3); }
.item-act { display: flex; align-items: center; gap: 8px; }
.item.is-open .item-act .chev { transform: rotate(180deg); }
.item-groups { grid-column: 2 / -1; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.grp-list { display: flex; flex-direction: column; }
.grp { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 6px 0; font-size: 13px; }
.grp > .check, .grp-name { min-width: 72px; font-weight: 600; }
.grp.is-done .grp-name { color: var(--ink-3); }
.grp-state { display: inline-flex; align-items: center; gap: 6px; }
.grp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 12.5px; }
.bulkbar {
  position: sticky; bottom: 18px; z-index: 5; display: flex; align-items: center; gap: 10px; width: fit-content; margin: 18px auto 0;
  padding: 8px 8px 8px 18px; border-radius: 14px; background: #1c2620; color: #fff; box-shadow: var(--shadow-lg);
}
.bulkbar .btn-ghost { color: #d5ddd7; }
.bulkbar .btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.pick-list { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; max-height: 220px; overflow: auto; }
.pick-list li { display: flex; align-items: center; gap: 8px; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }

/* Part detail */
.rec-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.rec-meta dt { font-size: 12px; color: var(--ink-3); }
.rec-meta dd { margin-top: 3px; font-weight: 650; }
.rec-notes { margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); white-space: pre-wrap; font-size: 13px; color: var(--ink-2); }
.rec-meta + .note, .rec-notes + .note { margin-top: 12px; }
.note + .rec-sect { margin-top: 2px; }
.rec-sect { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: inset 3px 0 0 var(--tone, transparent); }
.rec-sect-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.rec-sect-head h3 { font-size: 15px; }
.rec-sect-head .kind { margin-top: 2px; }
.rec-sched { flex: 1; min-width: 200px; display: flex; flex-direction: column; font-size: 13px; }
.rec-sched b { font-size: 14.5px; color: var(--tone); }
.rec-sect .grp-list { margin-top: 10px; }
.grp-detail { display: block; padding: 10px 0; border-top: 1px solid #edf0eb; }
.grp-top { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.grp-info { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 7px; font-size: 12.5px; }
.grp-report { color: var(--ink-2); }
.rec-total { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rec-total b { font-size: 28px; line-height: 1.2; font-weight: 700; }
.rec-total .muted { margin-left: 8px; font-size: 13px; }
.rec-sect .note { margin: 10px 0 0; }
.fold { margin-top: 12px; border-top: 1px solid #edf0eb; }
.fold > summary { padding: 10px 0 2px; cursor: pointer; font-weight: 550; color: var(--ink-2); font-size: 13px; }
.fold > summary:hover { color: var(--ink); }
.fold[open] > summary { margin-bottom: 8px; }
.rec-more { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: transparent; border-style: dashed; font-size: 13px; }
.quick-import { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; }
.preview-count { margin-bottom: 8px; font-size: 13px; color: var(--ink-2); }

/* Import */
.paste-input { font-family: var(--mono); font-size: 12.5px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px; border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--panel-2); cursor: pointer; text-align: center; }
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .ico { color: var(--brand); }
.table-edit td { padding: 5px 5px; vertical-align: top; }
.table-edit .input { height: 32px; font-size: 13px; padding: 0 8px; border-radius: 7px; min-width: 76px; }
.table-edit textarea.input { height: auto; padding: 5px 8px; min-width: 132px; }
.table-edit .col-part .input { min-width: 180px; }
.table-edit .col-project .input { min-width: 130px; }

/* Ledger */
.table-ledger tbody tr { cursor: pointer; }
.table-ledger tbody tr:hover td { background: #f7f9f5; }
.table-ledger tbody tr:focus-visible { outline-offset: -2px; }
.table-ledger .col-serial { color: var(--ink-3); width: 56px; }
.table-ledger .col-part { min-width: 220px; }
.table-ledger .col-part b { font-size: 14px; overflow-wrap: anywhere; }
.table-ledger .col-temp { min-width: 130px; }

/* Weather */
.table-weather .col-range { width: 34%; min-width: 180px; }
.range-scale { display: flex; justify-content: space-between; font-weight: 400; }
.range-track { display: block; position: relative; height: 10px; margin-top: 6px; border-radius: 5px; background: rgba(21, 29, 24, .06); }
.range-bar { position: absolute; top: 0; bottom: 0; border-radius: 5px; background: linear-gradient(90deg, #7fb8a0, #e0a458); min-width: 4px; }
.range-dot { position: absolute; top: -2px; width: 3px; height: 14px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); }
.table-weather .col-source { color: var(--ink-3); font-size: 12.5px; }

/* Settings */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.panel { padding: 20px; }
.panel h2 { display: flex; align-items: center; gap: 8px; font-size: 16px; margin-bottom: 12px; }
.panel h2 .ico { color: var(--brand); }
.panel > .muted { font-size: 13px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#rulesPanel, #projectsPanel { grid-row: span 2; }
.rules { display: flex; flex-direction: column; gap: 16px; }
.rules fieldset { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.rules legend { padding: 0 6px; font-weight: 650; font-size: 13px; }
.rule-line { line-height: 2.5; }
.inline-form { display: flex; gap: 8px; margin-bottom: 12px; }
#projectsPanel .hint { margin-top: 10px; }
#projectsPanel .link + .link { margin-left: 10px; }
.switch + .faint { margin-top: 16px; font-size: 12px; }

/* Backdrop mode: the app floats as a window over the wallpaper. */
body.has-wallpaper .app { margin: 14px; height: calc(100dvh - 28px); border-radius: 18px; overflow: hidden; background: transparent; box-shadow: 0 30px 80px rgba(10, 18, 13, .32); }
body.has-wallpaper .side { background: rgba(248, 249, 246, .80); -webkit-backdrop-filter: blur(28px) saturate(1.3); backdrop-filter: blur(28px) saturate(1.3); }
body.has-wallpaper .main { background: rgba(238, 240, 236, .93); -webkit-backdrop-filter: blur(28px); backdrop-filter: blur(28px); }
body.has-wallpaper .login-card { background: rgba(255, 255, 255, .90); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); border-color: rgba(255, 255, 255, .7); }

@media (max-width: 1180px) {
  .app { grid-template-columns: 224px minmax(0, 1fr); }
  .page { padding: 24px 22px 44px; }
  .item { grid-template-columns: 34px minmax(0, 1.3fr) minmax(200px, 1fr) 64px auto; column-gap: 12px; }
  .settings { grid-template-columns: 1fr; }
  #rulesPanel, #projectsPanel { grid-row: auto; }
}

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  body.has-wallpaper .app { margin: 0; height: 100dvh; border-radius: 0; box-shadow: none; }
  body.has-wallpaper .main { background: rgba(238, 240, 236, .95); }
  .side { display: none; }
  .mobile-bar {
    display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 10px 0 14px; flex: none;
    background: var(--side); border-bottom: 1px solid var(--line);
  }
  .mobile-bar .mark { width: 32px; height: 32px; font-size: 17px; border-radius: 9px; }
  .project-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); font-weight: 600; }
  .project-pick span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); flex: none; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--side); border-top: 1px solid var(--line); }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0 3px; border-radius: 9px; color: var(--ink-3); font-size: 11px; font-weight: 550; }
  .tab:hover { text-decoration: none; }
  .tab.is-active { color: var(--brand); }
  .tab-icon { position: relative; display: grid; }
  .tab-icon .badge { position: absolute; top: -5px; left: 13px; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10.5px; border: 1.5px solid var(--side); }
  .page { padding: 18px 14px 32px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 21px; }
  .page-ledger .page-actions .btn { flex: 1 1 auto; }
  .overview { padding: 4px 12px 12px; }
  .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
  .stat { flex-direction: column; align-items: flex-start; gap: 0; margin-right: 0; padding: 8px 10px; }
  .stat:first-child { padding-left: 0; }
  .stat b { font-size: 24px; }
  .strip { grid-template-columns: repeat(15, 54px); margin-inline: -12px; padding-inline: 12px; scrollbar-width: none; }
  .item { grid-template-columns: 30px minmax(0, 1fr) auto; row-gap: 10px; padding: 12px 12px 12px 8px; }
  .item-check { grid-row: 1; align-self: start; padding-top: 3px; }
  .item-main { grid-column: 2 / -1; }
  .item-meta { white-space: normal; }
  .item-sched { grid-column: 2 / -1; }
  .item-count { grid-column: 2; display: flex; align-items: baseline; gap: 4px; text-align: left; }
  .item-count b { display: inline; }
  .item-act { grid-column: 3; }
  .item-groups { grid-column: 1 / -1; margin-top: 2px; }
  .bulkbar { bottom: 10px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .range .input { width: 136px; }
  .form-grid { grid-template-columns: 1fr; }
  .rec-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dlg { margin: auto 0 0; width: 100vw; max-width: 100vw; }
  .dlg-box { width: 100vw; max-height: 92dvh; border-radius: 18px 18px 0 0; animation-name: rise; }
  .dlg-sheet { height: auto; margin: auto 0 0; }
  .dlg-sheet .dlg-box { height: 94dvh; border-radius: 18px 18px 0 0; animation-name: rise; }
  .dlg-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .dlg-foot .btn { flex: 1 1 auto; }
  .dlg-foot .grow { display: none; }
  .grp-top { gap: 6px; }
  .grp-detail .grp-name { min-width: 52px; }
  #toasts { bottom: 76px; }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }

  /* The ledger turns into cards: the part on top, labelled values below. */
  .table-ledger thead { display: none; }
  .table-ledger, .table-ledger tbody { display: block; }
  .table-ledger tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table-ledger tbody tr:last-child { border-bottom: 0; }
  .table-ledger td { display: block; padding: 0; border: 0; }
  .table-ledger .col-part { grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  .table-ledger .col-serial { width: auto; }
  .table-ledger td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
  .page-reports .table-wrap, .page-weather .table-wrap { overflow-x: auto; }
  .table-reports, .table-weather { min-width: 720px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
