/* 样式 Styles — shared by every screen */
/* Layout: a phone-width work-order app, centered; "login as" picker on top, tabs per role below */
:root {
  --bg: #eef0ec;
  --surface: #ffffff;
  --ink: #1d2a26;
  --muted: #5f6d68;
  --line: #d6dbd6;
  --grid: #e6e9e5;
  --accent: #e8a317;      /* job-site amber */
  --accent-ink: #2a1d00;
  --brand: #1f4d43;       /* deep work-green */
  --brand-ink: #ffffff;
  --bar: #2e6b5d;
  --todo: #6b7a75;
  --doing: #c27c00;
  --doing-bg: #fff3d9;
  --done: #2f7d4f;
  --done-bg: #e2f2e7;
  --danger: #b4382f;
  --danger-bg: #fbe7e5;
  --f-display: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --f-body: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #121815; --surface: #1b2420; --ink: #e6ece9; --muted: #9aa8a2; --line: #2d3a35; --grid: #26322d;
  --accent: #f0b43a; --accent-ink: #231800; --brand: #3d8a77; --brand-ink: #ffffff; --bar: #5fb39d;
  --todo: #9aa8a2; --doing: #f0b43a; --doing-bg: #3a2e12; --done: #6cc28d; --done-bg: #1a3324; --danger: #ec7a70; --danger-bg: #3a1c19;
  color-scheme: dark;
} }
:root[data-theme="dark"] {
  --bg: #121815; --surface: #1b2420; --ink: #e6ece9; --muted: #9aa8a2; --line: #2d3a35; --grid: #26322d;
  --accent: #f0b43a; --accent-ink: #231800; --brand: #3d8a77; --brand-ink: #ffffff; --bar: #5fb39d;
  --todo: #9aa8a2; --doing: #f0b43a; --doing-bg: #3a2e12; --done: #6cc28d; --done-bg: #1a3324; --danger: #ec7a70; --danger-bg: #3a1c19;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55; padding-inline: 16px; padding-block: 16px 40px; }
.app { max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--f-display); font-weight: 900; font-size: 20px; letter-spacing: .02em; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); letter-spacing: 0; }
.login { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.login select { width: auto; padding: 6px 10px; }

.note { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.linkbtn { border: 0; background: none; color: var(--brand); text-decoration: underline; padding: 0; font-size: 12.5px; }

.who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.who label { font-size: 13px; color: var(--muted); }
select, input[type=text], input[type=password], textarea { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; }
.who select { width: auto; }
textarea { min-height: 84px; resize: vertical; }

.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 0; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.count { font-family: var(--f-mono); font-size: 12px; background: var(--line); border-radius: 999px; padding: 0 7px; margin-left: 4px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%; min-width: 0; }
button.card:hover { border-color: var(--brand); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.wo { font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .03em; }
.card h3 { margin: 0; font-size: 16.5px; font-weight: 700; text-wrap: balance; }
.meta { font-size: 13px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.pill { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pill.todo { color: var(--todo); border: 1px solid var(--line); }
.pill.doing { color: var(--doing); background: var(--doing-bg); }
.pill.done { color: var(--done); background: var(--done-bg); }
.pill.role { color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.pill.role.admin { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.clip { font-size: 12px; color: var(--muted); }

.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs img, .thumbs .add { width: 68px; height: 68px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.thumbs img { cursor: zoom-in; }
.thumbs .add { display: grid; place-items: center; color: var(--muted); font-size: 12px; text-align: center; line-height: 1.3; border-style: dashed; cursor: pointer; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; }
.day { font-weight: 700; font-size: 13px; color: var(--muted); letter-spacing: .04em; margin-top: 6px; display: flex; justify-content: space-between; }

.btn { border: 0; border-radius: 10px; padding: 12px 16px; font-weight: 700; font-size: 16px; width: 100%; }
.btn.start { background: var(--brand); color: var(--brand-ink); }
.btn.finish { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); font-weight: 500; font-size: 14px; }
.btn.small { width: auto; padding: 7px 12px; font-size: 13.5px; }
.btn.danger { background: var(--danger); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.sheet-wrap { position: fixed; inset: 0; background: rgba(10,16,14,.5); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet { background: var(--bg); width: 100%; max-width: 480px; max-height: 92%; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { margin: 0; font-size: 20px; text-wrap: balance; }
.sec-label { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .08em; margin-bottom: 6px; }
.desc { white-space: pre-wrap; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.timeline { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13.5px; }
.timeline dt { color: var(--muted); }
.timeline dd { margin: 0; font-family: var(--f-mono); }
.hint { font-size: 12.5px; color: var(--danger); }
.close { align-self: flex-end; border: 0; background: none; color: var(--muted); font-size: 14px; }

.form { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 0; }
.stat b { display: block; font-family: var(--f-mono); font-size: 22px; font-variant-numeric: tabular-nums; }
.stat b small { font-size: 12px; font-family: var(--f-body); color: var(--muted); font-weight: 500; }
.stat span { font-size: 12px; color: var(--muted); }

/* Accounts */
.acct { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.acct-name { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.confirm { background: var(--danger-bg); border-radius: 8px; padding: 10px; font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.confirm .acts { display: flex; gap: 8px; }

/* Stats chart */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; position: relative; }
.chart-card h4 { margin: 0 0 8px; font-size: 14px; }
.chart-card svg { width: 100%; height: auto; display: block; }
.chart-card text { font-family: var(--f-mono); font-size: 10px; fill: var(--muted); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 5px 9px; border-radius: 6px; white-space: nowrap; transform: translate(-50%, -100%); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 12px; color: var(--muted); font-weight: 500; }
td.num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 14px; z-index: 30; max-width: calc(100% - 32px); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 20; padding: 16px; cursor: zoom-out; }
.lightbox img { max-height: 90%; border-radius: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: no-preference) { .sheet { animation: up .2s ease-out; } @keyframes up { from { transform: translateY(24px); opacity: .6; } } }

.controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.controls select { width: auto; padding: 6px 10px; font-size: 13.5px; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.form label.check input { width: 18px; height: 18px; accent-color: var(--brand); }
[hidden] { display: none !important; }
.me-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.me-line b { color: var(--ink); }
.demo { display: flex; flex-direction: column; gap: 6px; }
.demo button { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.pw-row { display: flex; gap: 8px; }
.pw-row input { flex: 1; min-width: 0; }

/* Production additions */
.acct .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.confirm.alt { background: var(--bg); }
.pill.cat { color: var(--ink); background: var(--bg); border: 1px solid var(--line); font-weight: 500; }
