/* Job Site Schedule styles, in the Rising PM design language (see rising-pm/apps/web/DESIGN.md):
   navy ink on white cards over a cool grey canvas, hairline borders first, faint navy-tinted shadows,
   6/8/12px radii, Inter throughout, one ocean-blue action color, light mode only.
   Trade colors are the one exception to "one color": the calendar needs them to tell trades apart. */

:root {
  color-scheme: light;
  --canvas: #eef1f5;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --hover: #eef2f8;
  --table-head: #edf3fb;
  --track: #edf1f7;
  --line: #e5edf5;
  --line-strong: #d4dee9;
  --ink: #061b31;
  --ink-2: #273951;
  --ink-3: #64748d;
  --muted: #64748d;
  --quiet: #8291a8;
  --accent: #0570de;
  --accent-hover: #0055bc;
  --accent-pressed: #004196;
  --accent-soft: #e6f1fd;
  --accent-border: #b8d6f7;
  --accent-ink: #ffffff;
  --ok: #0a7c45;
  --ok-soft: #d7f7e3;
  --warn: #a8570a;
  --warn-soft: #fdf0cf;
  --danger: #cd2e1a;
  --danger-soft: #fde4de;
  --neutral: #414552;
  --neutral-soft: #ebeef1;
  --band-top: #e9f2fd;
  --band-mid: #f3f8ff;
  --scrim: rgb(6 27 49 / 0.25);

  --shadow-card: 0 1px 2px 0 #0037700a;
  --shadow-xs: 0 2px 10px 0 #0037700f, 0 1px 4px 0 #003b890a;
  --shadow-sm: 0 5px 14px 0 #00377014, 0 2px 8px 0 #003b890d;
  --shadow-xl: 0 20px 80px -16px #00377024, 0 10px 60px -16px #003b890f;
  --shadow-focus: 0 0 0 3px rgb(5 112 222 / 0.28);

  --f-body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --f-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Trade colors (categorical). */
  --t-framing: #b45f1c;
  --t-masonry: #a33d2c;
  --t-demolition: #5b6474;
  --t-plumbing: #1f6db0;
  --t-hvac: #0b7c78;
  --t-electrical: #9a7400;
  --t-drywall: #7c5fa6;
  --t-roofing: #33536a;
  --t-cabinets: #557d18;
  --t-windows: #1c87c0;
  --t-other: #9c4475;
  --t-inspection: #061b31;
}

/* Base */
* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--f-body);
  font-size: 14px; line-height: 1.45; letter-spacing: -0.003em;
  padding: 12px max(12px, env(safe-area-inset-right, 0px)) 24px max(12px, env(safe-area-inset-left, 0px));
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
::selection { background: var(--accent-soft); }

/* Page frame: one white card on the grey canvas, with the soft blue band behind the title. */
.app {
  max-width: 1440px; margin: 0 auto; display: grid; gap: 16px; align-content: start;
  background: linear-gradient(180deg, var(--band-top) 0, var(--band-mid) 150px, var(--page) 280px) var(--page);
  border: 1px solid rgb(0 0 0 / 0.08); border-radius: 12px; box-shadow: var(--shadow-xs);
  padding: 0 32px 32px; min-height: calc(100vh - 36px);
}

/* Header */
.top {
  position: sticky; top: 0; z-index: 6; margin: 0 -32px; padding: 20px 32px 14px;
  display: grid; gap: 14px; border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-radius: 12px 12px 0 0;
}
.brand-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand h1 { font-family: var(--f-display); font-weight: 700; font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -0.025em; text-wrap: balance; }
.brand p { margin: 2px 0 0; color: var(--ink-3); font-size: 13px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.nav { display: flex; align-items: center; gap: 4px; }
.period { font-weight: 600; font-size: 18px; letter-spacing: -0.012em; margin: 0 8px 0 8px; min-width: 9ch; white-space: nowrap; }
.spacer { flex: 1 1 auto; }

/* Buttons */
.btn {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 6px;
  height: 32px; padding: 0 12px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; box-shadow: var(--shadow-card); transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--quiet); background: var(--surface-2); }
.btn.icon { width: 32px; padding: 0; justify-content: center; font-size: 17px; line-height: 1; }
.btn.primary {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 1px 2px rgb(0 55 112 / 0.25);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { background: var(--accent-pressed); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line-strong)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.select {
  height: 32px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; padding: 0 28px 0 10px;
  font-size: 13px; font-weight: 500; color: var(--ink-2); max-width: 100%; box-shadow: var(--shadow-card);
}
.select:hover { border-color: var(--quiet); }
.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.seg button { border: 0; background: transparent; height: 26px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--ink-3); border-radius: 4px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px #0037701a, 0 0 0 1px var(--line); }

/* Banner */
.banner { border: 1px solid color-mix(in srgb, var(--warn) 30%, var(--line)); background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 14px; font-size: 13px; font-weight: 500; }

/* Needs-attention strip: stat cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.stat {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px;
  display: grid; gap: 2px; box-shadow: var(--shadow-card); transition: border-color .12s, box-shadow .12s;
}
.stat .k { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.stat .v { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.stat .s { font-size: 12px; color: var(--ink-3); }
.stat.alert .v { color: var(--danger); }
.stat.warnish .v { color: var(--warn); }
.stat.clickable:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.stat:not(.clickable) { cursor: default; }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-3); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--t); display: inline-block; }
.legend .tag { display: inline-block; }

/* Trade color binding */
.t-framing { --t: var(--t-framing); } .t-masonry { --t: var(--t-masonry); } .t-demolition { --t: var(--t-demolition); }
.t-plumbing { --t: var(--t-plumbing); } .t-hvac { --t: var(--t-hvac); } .t-electrical { --t: var(--t-electrical); }
.t-drywall { --t: var(--t-drywall); } .t-roofing { --t: var(--t-roofing); } .t-cabinets { --t: var(--t-cabinets); }
.t-windows { --t: var(--t-windows); } .t-other { --t: var(--t-other); } .t-inspection { --t: var(--t-inspection); }
.bar.t-inspection { font-weight: 600; }

/* Month grid */
.month { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-card); }
.dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--table-head); border-bottom: 1px solid var(--line); }
.dow div { padding: 0 10px; height: 36px; display: flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: 30px repeat(3, 24px) 22px; position: relative; }
.week + .week { border-top: 1px solid var(--line); }
.cell { grid-row: 1 / -1; border: 0; border-left: 1px solid var(--line); background: transparent; text-align: left; padding: 5px 6px; display: flex; align-items: flex-start; z-index: 0; min-width: 0; transition: background .12s; }
.cell:first-of-type { border-left: 0; }
.cell:hover { background: var(--surface-2); }
.cell.out { background: #fbfcfe; color: var(--ink-3); }
.cell.past .num { color: var(--ink-3); }
.num { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 999px; }
.cell.today .num { background: var(--accent); color: var(--accent-ink); }
.bar {
  position: relative; z-index: 1; margin: 1px 3px; min-width: 0; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--t) 28%, transparent);
  background: color-mix(in srgb, var(--t) 11%, var(--surface)); color: color-mix(in srgb, var(--t) 72%, var(--ink));
  display: flex; align-items: center; gap: 5px; padding: 0 6px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-align: left;
  box-shadow: inset 3px 0 0 var(--t);
}
.bar:hover { background: color-mix(in srgb, var(--t) 18%, var(--surface)); }
.bar .code { font-family: var(--f-mono); font-size: 10px; font-weight: 600; flex: none; opacity: .85; }
.bar .ttl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar.cl { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; border-left-style: dashed; box-shadow: none; }
.bar.cr { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; border-right-style: dashed; }
.bar.st-done { opacity: .5; }
.bar.st-done .ttl { text-decoration: line-through; }
.bar.st-delayed { border-color: var(--danger); background-image: repeating-linear-gradient(135deg, transparent 0 5px, color-mix(in srgb, var(--danger) 16%, transparent) 5px 8px); }
.bar .live { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.bar .tags, .card-tags { display: inline-flex; gap: 3px; flex: none; }
.bar .nowo { flex: none; font-family: var(--f-mono); font-size: 10px; border: 1px solid currentColor; border-radius: 3px; padding: 0 3px; line-height: 1.3; opacity: .8; }
.more { grid-row: 5; font-size: 11px; font-weight: 500; color: var(--ink-3); padding: 0 8px; pointer-events: none; z-index: 1; white-space: nowrap; overflow: hidden; }

/* Small status tags */
.tag { font-family: var(--f-mono); font-size: 10px; font-weight: 600; padding: 0 4px; border-radius: 3px; line-height: 1.5; background: var(--neutral-soft); color: var(--neutral); }
.tag.media { background: var(--accent-soft); color: var(--accent-hover); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.arch { background: var(--danger-soft); color: var(--danger); }
.logmark { margin-left: auto; font-family: var(--f-mono); font-size: 10px; font-weight: 600; padding: 0 4px; border-radius: 3px; background: var(--neutral-soft); color: var(--neutral); line-height: 1.5; }
.cell.today .logmark { background: var(--accent-soft); color: var(--accent-hover); }

/* Week list */
.weeklist { display: grid; gap: 12px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-card); }
.day-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px; min-height: 44px; border-bottom: 1px solid var(--line); background: var(--table-head); }
.day-h h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.012em; }
.day-h h3 small { font-size: 12px; color: var(--ink-3); font-weight: 500; margin-left: 8px; letter-spacing: 0; }
.day-h .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.day.today .day-h { background: var(--accent-soft); }
.day.today .day-h h3 { color: var(--accent-hover); }
.day.past { opacity: .9; }
.day-items { padding: 12px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.empty-day { color: var(--ink-3); font-size: 13px; padding: 2px 4px; }

/* Work card */
.card {
  position: relative; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 12px 16px; display: grid; gap: 6px;
  background: var(--surface); cursor: pointer; min-width: 0; overflow: hidden; box-shadow: var(--shadow-card); transition: border-color .12s, box-shadow .12s;
}
.card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--t); }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.card.st-done { opacity: .7; }
.card-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; font-size: 12px; font-weight: 500; border-radius: 4px; padding: 0 6px; background: var(--neutral-soft); color: var(--neutral); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.trade { background: color-mix(in srgb, var(--t) 12%, var(--surface)); color: color-mix(in srgb, var(--t) 75%, var(--ink)); }
.chip .code { font-family: var(--f-mono); font-size: 10px; font-weight: 600; }
.chip.sub { background: var(--ink-2); color: #fff; }
.chip.obs { background: var(--surface); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip.media { background: var(--accent-soft); color: var(--accent-hover); }
.chip.arch { background: var(--danger-soft); color: var(--danger); }
.chip.arch.ok { background: var(--ok-soft); color: var(--ok); }
.pill { height: 20px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 0 7px; border-radius: 4px; margin-left: auto; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.scheduled { color: var(--neutral); background: var(--neutral-soft); }
.pill.progress { color: var(--accent-hover); background: var(--accent-soft); }
.pill.done { color: var(--ok); background: var(--ok-soft); }
.pill.delayed { color: var(--danger); background: var(--danger-soft); }
.card-title { font-weight: 600; font-size: 14px; letter-spacing: -0.006em; overflow-wrap: anywhere; }
.st-done .card-title { text-decoration: line-through; }
.card-meta { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.late { color: var(--danger); font-weight: 600; }
.card-sub { font-size: 12px; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-sub b { color: var(--ink-2); font-weight: 600; }
.card-sub a { color: var(--accent); font-weight: 600; text-decoration: none; }
.card-sub a:hover { text-decoration: underline; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.money { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.money.none { color: var(--ink-3); font-weight: 400; font-size: 12px; }
.wo { display: inline-flex; align-items: center; gap: 6px; height: 24px; font-size: 12px; font-weight: 500; padding: 0 8px; border-radius: 4px; }
.wo.missing { color: var(--warn); background: var(--warn-soft); }
.wo.has { color: var(--ok); background: var(--ok-soft); }
.wo input { width: 14px; height: 14px; margin: 0; accent-color: var(--ok); }
.waitline { font-size: 12px; color: var(--warn); font-weight: 600; overflow-wrap: anywhere; }

/* Materials */
.matlist { margin: 2px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 12px; color: var(--ink-3); }
.matlist li { display: flex; gap: 6px; flex-wrap: wrap; overflow-wrap: anywhere; }
.matlist .nm { color: var(--ink-2); }
.ms { font-weight: 600; }
.ms.needed, .ms.ordered, .matline .ms.needed, .matline .ms.ordered { color: var(--warn); }
.ms.delivered, .matline .ms.delivered { color: var(--ok); }
.matline .ms { font-weight: 600; }
.mrows { display: grid; gap: 8px; }
.mrow { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, .8fr) minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.mrow input, .mrow select { width: 100%; height: 34px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px; padding: 0 8px; font-size: 13px; min-width: 0; }
.mrow input:focus, .mrow select:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.mrow .x { border: 0; background: transparent; font-size: 18px; color: var(--quiet); width: 30px; height: 34px; border-radius: 6px; }
.mrow .x:hover { color: var(--danger); background: var(--danger-soft); }
.mhead { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, .8fr) minmax(0, 1.2fr) minmax(0, 1.4fr) 30px; gap: 6px; padding: 0 9px; font-size: 12px; color: var(--ink-3); font-weight: 500; }
.madd { justify-self: start; }

/* Dependencies, architect, visits, media */
.deps { display: flex; flex-wrap: wrap; gap: 6px; }
.dep { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; font-size: 12px; font-weight: 500; padding: 2px 4px 2px 8px; border-radius: 4px; max-width: 100%; overflow-wrap: anywhere; }
.dep.wait { color: var(--warn); background: var(--warn-soft); }
.dep.ok { color: var(--ok); background: var(--ok-soft); }
.dep .x { border: 0; background: transparent; font-size: 16px; line-height: 1; padding: 0 4px; color: inherit; }
.arch-box, .visit-box, .media-box, .newproj { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.arch-box { border-color: color-mix(in srgb, var(--danger) 25%, var(--line)); }
.arch-state { font-size: 12px; font-weight: 600; }
.arch-state.open { color: var(--danger); } .arch-state.ok { color: var(--ok); }
.visit-box .lbl { font-size: 13px; font-weight: 600; color: var(--ink); }
.row3 { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 10px; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Daily logs */
.logrow { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; background: var(--surface); }
.logrow b { display: block; font-weight: 600; }
.logrow .hint { display: block; }

/* Empty / loading */
.state { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 28px 24px; display: grid; gap: 10px; justify-items: start; }
.state h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.012em; }
.state p { margin: 0; color: var(--ink-3); max-width: 62ch; }

/* Side panel (sheet) */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); z-index: 21;
  display: flex; flex-direction: column; box-shadow: var(--shadow-xl); border-left: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.sheet-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 20px; min-height: 56px; border-bottom: 1px solid var(--line); }
.sheet-h h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.012em; }
.sheet-b { flex: 1 1 auto; overflow-y: auto; padding: 20px; display: grid; gap: 16px; align-content: start; }
.sheet-f { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.sheet-f .left { margin-right: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Form fields */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .lbl { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.field input[type="text"], .field input[type="date"], .field input[type="time"], .field select, .field textarea {
  width: 100%; min-height: 34px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 6px;
  padding: 6px 10px; font-size: 14px; min-width: 0; box-shadow: var(--shadow-card);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--quiet); }
.field textarea { resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--shadow-focus); }
.field input:disabled, .field select:disabled, .field textarea:disabled { background: var(--surface-2); color: var(--ink-2); box-shadow: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.radio-seg label { display: flex; align-items: center; justify-content: center; min-height: 28px; font-size: 13px; font-weight: 500; color: var(--ink-3); cursor: pointer; border-radius: 4px; }
.radio-seg input { position: absolute; opacity: 0; pointer-events: none; }
.radio-seg label:has(input:checked) { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px #0037701a, 0 0 0 1px var(--line); }
.radio-seg label:has(input:focus-visible) { box-shadow: var(--shadow-focus); }
.money-in { position: relative; }
.money-in span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.money-in input { padding-left: 22px !important; font-variant-numeric: tabular-nums; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.check-row:hover { border-color: var(--line-strong); }
.check-row input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.hint { font-size: 12px; color: var(--ink-3); }
a.hint { color: var(--accent); font-weight: 500; text-decoration: none; }
.err { color: var(--danger); font-size: 13px; font-weight: 500; }
.list { display: grid; gap: 8px; }
.proj { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.proj-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-lbl { font-size: 13px; font-weight: 600; color: var(--ink); margin-top: 6px; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 40; font-size: 13px; font-weight: 500; max-width: calc(100% - 32px); box-shadow: var(--shadow-sm); }

/* Phones */
@media (max-width: 767px) {
  body { padding: 0; }
  .app { border-radius: 0; border: 0; padding: 0 16px 24px; min-height: 100vh; }
  .top { margin: 0 -16px; padding: 14px 16px 12px; border-radius: 0; }
  .period { font-size: 16px; min-width: 0; }
  .controls .select { flex: 1 1 140px; }
  .week { grid-template-rows: 28px repeat(3, 18px) 16px; }
  .bar { font-size: 11px; padding: 0 3px; margin: 1px; border-radius: 3px; box-shadow: none; }
  .bar .ttl, .bar .nowo { display: none; }
  .bar .tag { font-size: 0; width: 5px; height: 5px; padding: 0; border-radius: 50%; }
  .bar .code { font-size: 10px; }
  .checks { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr 1fr; }
  .row3 > :nth-child(2) { grid-column: 1 / -1; grid-row: 1; }
  .mhead { display: none; }
  .mrow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px; }
  .mrow .mn { grid-column: 1 / 3; }
  .mrow .x { grid-column: 3; grid-row: 1; }
  .mrow .mq { grid-column: 1; } .mrow .ms-sel { grid-column: 2; } .mrow .md { grid-column: 1 / 3; }
  .logmark { font-size: 0; width: 6px; height: 6px; padding: 0; border-radius: 50%; background: var(--quiet); }
  .more { font-size: 11px; padding: 0 4px; }
  .num { width: 20px; height: 20px; font-size: 11px; }
  .dow div { padding: 0 4px; font-size: 11px; }
  .row2 { grid-template-columns: 1fr; }
  .day-items { grid-template-columns: 1fr; }
}
@media (pointer: coarse) {
  .btn, .select { height: 40px; }
  .btn.icon { width: 40px; }
  .seg button { height: 34px; }
  .field input[type="text"], .field input[type="date"], .field input[type="time"], .field select { min-height: 40px; }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: slide .18s cubic-bezier(0.2, 0.8, 0.2, 1); }
  @keyframes slide { from { transform: translateX(16px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
