:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #fff;
  --ink: #172033;
  --muted: #697386;
  --line: #e2e7ef;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #c2413b;
  --orange-bg: #fff1db;
  --orange-ink: #a45b00;
  --green-bg: #dcfce7;
  --green-ink: #147a3d;
  --gray-bg: #e8ebf0;
  --gray-ink: #606a78;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: var(--primary); }

.shell { width: min(100% - 28px, 900px); margin: 0 auto; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 58px; display: flex; align-items: center; justify-content: space-between; }
.brand { color: var(--ink); font-size: 1.05rem; font-weight: 750; text-decoration: none; }
.header-link { font-size: .9rem; text-decoration: none; }
.page { padding: 24px 0 56px; }
.page-heading, .detail-heading { margin-bottom: 18px; }
.eyebrow { margin: 0 0 4px; color: var(--primary); font-size: .75rem; font-weight: 700; letter-spacing: .08em; }
h1, h2 { line-height: 1.25; margin: 0 0 10px; }
h1 { font-size: clamp(1.45rem, 5vw, 2rem); }
h2 { font-size: 1.15rem; }
.muted, .help-text { color: var(--muted); font-size: .9rem; }
.help-text { margin: 5px 0 0; }
.panel, .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; box-shadow: 0 3px 14px rgba(23, 32, 51, .04); }
.auth-card { width: min(100%, 420px); margin: 12vh auto 0; }
.stack-form { display: grid; gap: 12px; }
.field { min-width: 0; }
.field-row { display: grid; gap: 12px; }
label { display: block; margin-bottom: 5px; font-weight: 650; font-size: .92rem; }
.required { color: var(--danger); }
input, textarea, select, button { font: inherit; }
input, textarea, select { width: 100%; border: 1px solid #cbd3df; border-radius: 9px; padding: 10px 11px; color: var(--ink); background: #fff; }
input, select { min-height: 44px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(37, 99, 235, .17); border-color: var(--primary); }
.button { min-height: 44px; border: 0; border-radius: 9px; padding: 9px 15px; cursor: pointer; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { color: #234; background: #eaf0fb; }
.button-danger { color: #fff; background: var(--danger); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.button-row form { flex: 1 1 150px; }
.button-row .button { width: 100%; }
.flash { border-radius: 9px; padding: 10px 12px; margin-bottom: 14px; }
.flash-success { color: #14532d; background: var(--green-bg); border: 1px solid #bbf7d0; }
.flash-error, .field-error { color: #a12c26; }
.flash-error { background: #fff0ef; border: 1px solid #ffd0cc; }
.field-error { margin: 5px 0 0; font-size: .85rem; }
.other-submitter.is-hidden { display: none; }
.tasks-section { margin-top: 26px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-heading h2 { margin: 0; }
.status-filter { min-width: 115px; }
.status-filter select { padding: 7px 9px; min-height: 40px; }
.status-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin: -2px 0 12px; }
.status-tab { color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; font-size: .8rem; text-decoration: none; }
.status-tab.is-active { color: var(--primary); border-color: #9db9f5; background: #eef4ff; font-weight: 700; }
.task-list, .record-list { display: grid; gap: 10px; }
.task-card, .record-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.task-card-top, .record-top, .detail-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-title { color: var(--ink); font-size: 1rem; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.task-title:hover { color: var(--primary); }
.task-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--muted); font-size: .84rem; margin-top: 8px; }
.task-meta-secondary { margin-top: 5px; }
.status-badge { display: inline-flex; align-items: center; white-space: nowrap; border-radius: 999px; padding: 3px 8px; font-size: .75rem; font-weight: 700; }
.status-pending { color: var(--orange-ink); background: var(--orange-bg); }
.status-confirmed { color: var(--green-ink); background: var(--green-bg); }
.status-cancelled { color: var(--gray-ink); background: var(--gray-bg); }
.empty-state { color: var(--muted); border: 1px dashed #cbd3df; border-radius: 12px; padding: 22px 14px; text-align: center; }
.back-link { display: inline-block; margin-bottom: 16px; text-decoration: none; font-size: .9rem; }
.detail-title-row h1 { overflow-wrap: anywhere; }
.content-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: #f8fafc; border-radius: 9px; padding: 13px; margin: 10px 0 15px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.facts div { background: #f8fafc; border-radius: 8px; padding: 8px 10px; }
.facts dt { color: var(--muted); font-size: .78rem; }
.facts dd { margin: 2px 0 0; font-size: .9rem; font-weight: 650; }
.record-top time { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.record-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 0; }
.audio-link { display: inline-block; margin-top: 6px; }
.log-result { font-weight: 700; }
.log-ok { color: var(--green-ink); }
.log-failed { color: var(--danger); }
.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: 390px) {
  .facts { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .status-filter { width: 100%; }
}

@media (min-width: 640px) {
  .shell { width: min(100% - 48px, 900px); }
  .page { padding-top: 34px; }
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel, .auth-card { padding: 24px; }
}
.attachment-preview { display: block; max-width: 100%; max-height: 220px; object-fit: contain; margin: 10px 0; }
#attachment-list progress { display: block; width: 100%; margin-top: 12px; }
#attachment-list button { margin-right: 12px; }
