:root {
  color-scheme: light;
  --canvas: #fffdf8;
  --paper: #fff;
  --ink: #3b2a20;
  --muted: #6f5b4a;
  --orange: #cc4700;
  --orange-hover: #ad3c00;
  --sun: #ffd34e;
  --sun-soft: #fff3c4;
  --line: #e8d5b3;
  --input: #9b7c60;
  --danger: #a63628;
  --radius: 24px;
  --shadow: 0 10px 28px rgb(101 61 20 / 6%);
  --display: "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { touch-action: manipulation; }
button {
  cursor: pointer; min-height: 46px; padding: 10px 18px;
  border: 1px solid var(--input); border-radius: 14px;
  font-weight: 700; background: var(--paper); color: var(--ink);
}
button:hover:not(:disabled) { background: var(--sun-soft); }
button:active:not(:disabled) { background: #ffe9a4; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
button.primary { min-height: 52px; color: white; background: var(--orange); border-color: var(--orange); }
button.primary:hover:not(:disabled) { background: var(--orange-hover); }
button.quiet { background: transparent; border-color: var(--line); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, #event-log:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 4px;
}
input:not([type=checkbox]), select {
  width: 100%; min-height: 48px; padding: 10px 12px;
  border: 1px solid var(--input); border-radius: 12px;
  background: var(--paper); color: var(--ink); font-size: 1rem;
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--orange); flex-shrink: 0; }
label { display: block; font-weight: 700; margin-bottom: 8px; }
h1, h2, p { margin: 0; }
h1, h2 { font-family: var(--display); }
h1 { font-size: clamp(2rem, 4.6vw, 3rem); letter-spacing: -.035em; line-height: 1.12; }
h2 { font-size: 1.2rem; line-height: 1.3; letter-spacing: -.025em; }
p + p { margin-top: 12px; }
[hidden] { display: none !important; }
.shell { max-width: 1184px; margin: 0 auto; padding: 0 32px; }
.skip { position: absolute; top: -80px; background: white; padding: 12px; z-index: 5; }
.skip:focus { top: 8px; }
.masthead { display: flex; align-items: center; padding: 22px 0; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--display); font-size: 1.45rem; font-weight: 750; line-height: 1.15; letter-spacing: -.03em; }
.brand img { width: 48px; height: 48px; object-fit: contain; }
.brand-sub { display: block; font-family: "Aptos", "Segoe UI", system-ui, sans-serif; font-size: .82rem; letter-spacing: 0; font-weight: 500; margin-top: 4px; color: var(--muted); }
.page-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  flex-wrap: wrap; padding: 14px 26px; margin: 8px 0 22px;
  background: var(--sun-soft); border: 1px solid var(--line); border-radius: var(--radius);
}
.page-heading > div { flex: 1 1 220px; min-width: 0; }
.hero-art { display: block; width: 142px; height: 142px; object-fit: contain; }
.page-heading > button { align-self: flex-start; margin-top: 12px; background: rgb(255 255 255 / 75%); }
.refresh-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; gap: 14px; }
.toolbar button { min-height: 44px; font-size: .85rem; padding: 6px 12px; }
.toggle { display: flex; align-items: center; gap: 7px; margin: 0; font-size: .85rem; font-weight: 500; min-height: 44px; }
.panel { padding: 26px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.priority-panel { margin-bottom: 18px; }
.priority-buttons { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 6rem), 1fr)); gap: 16px; max-width: 720px; margin: 20px auto; }
.priority-button { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 18px 12px; background: var(--canvas); }
.priority-button img { width: min(176px, 100%); height: auto; aspect-ratio: 1; object-fit: contain; }
.priority-title { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; }
.priority-detail { font-size: .9rem; font-weight: 400; color: var(--muted); }
.priority-button:disabled { opacity: .7; border-color: var(--line); }
.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.metric { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: clamp(1.8rem, 3.7vw, 2.5rem); letter-spacing: -.06em; line-height: 1.2; margin-bottom: 12px; overflow-wrap: anywhere; }
.hint { font-size: .85rem; color: var(--muted); line-height: 1.5; }
.fine-print { font-size: .82rem; color: var(--muted); line-height: 1.6; margin-top: 18px; }
.facts { margin: 22px 0 0; display: grid; gap: 8px; font-size: .85rem; }
.facts div { display: flex; justify-content: space-between; gap: 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.badge { font-size: .82rem; line-height: 1.35; font-weight: 700; padding: 6px 10px; border-radius: 10px; background: #f7f2e9; color: var(--muted); max-width: 100%; }
.badge.good { background: var(--sun-soft); color: var(--ink); }
.badge.warn { background: #ffe5b1; color: #65420f; }
.badge.bad { background: #fbe7e4; color: var(--danger); }
.contact-panel { margin-top: 18px; }
.contact-panel .panel-heading { margin-bottom: 14px; }
.contact-strip { display: flex; gap: 4px; height: 40px; }
.contact-strip > span { flex: 1; min-width: 0; border-radius: 4px; }
.contact { background: var(--sun); border: 1px solid var(--input); border-bottom-width: 5px; }
.no-contact { background: white; border: 1px solid var(--input); }
.unknown { background: repeating-linear-gradient(135deg, var(--input), var(--input) 1px, var(--canvas) 1px, var(--canvas) 6px); border: 1px solid var(--input); }
.strip-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: .82rem; color: var(--muted); margin-top: 12px; }
.legend { list-style: none; display: flex; gap: 14px; flex-wrap: wrap; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
.work-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; margin-top: 18px; }
.request-kind { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.request-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.request-summary > div { min-width: 0; }
.confirmed-art { width: 110px; height: 110px; flex-shrink: 0; object-fit: contain; }
.delivery-chain { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 6rem), 1fr)); list-style: none; padding: 0; margin: 26px 0 12px; gap: 8px; }
.delivery-chain li { padding-top: 18px; border-top: 3px solid var(--line); font-size: .85rem; color: var(--muted); }
.delivery-chain li.done { border-color: var(--input); color: var(--ink); }
.delivery-chain strong { display: block; font-size: .85rem; }
.delivery-chain time { display: block; font-size: .82rem; margin-top: 5px; font-variant-numeric: tabular-nums; }
.test-panel { position: relative; isolation: isolate; overflow: hidden; }
.test-panel::before {
  content: ""; position: absolute; z-index: -1; top: -70px; right: -90px; width: 350px; height: 350px;
  background: url('/assets/profile-card-watercolor.webp') center / contain no-repeat; opacity: .19; pointer-events: none;
}
.test-intro { display: flex; align-items: center; gap: 14px; }
.test-intro > div { flex: 1; min-width: 0; }
.test-intro img { width: 112px; height: 112px; object-fit: contain; flex-shrink: 0; }
.test-panel h2 { font-size: 1.35rem; margin-bottom: 12px; }
.test-intro p { font-size: .9rem; color: var(--muted); }
.test-fields { display: grid; gap: 12px; margin: 20px 0 14px; grid-template-columns: 1.3fr 1fr; }
.test-fields label { font-size: .85rem; }
.test-fields select { font-size: .85rem; padding-left: 8px; }
#prepare-test { width: 100%; }
#test-blocker { margin-top: 12px; }
#retry-test, #discard-test { margin-top: 10px; width: 100%; font-size: .85rem; }
.log-panel { margin-top: 18px; }
.log-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.log-tools label { margin: 0; font-size: .85rem; }
.log-tools select { width: auto; font-size: .85rem; min-height: 44px; }
.log-tools p { margin-left: auto; }
.event-log { padding: 0; margin: 0; list-style: none; max-height: 650px; overflow: auto; }
.event-log li { padding: 16px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 158px 1fr auto; gap: 18px; align-items: start; }
.event-log time { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.event-log strong { font-size: .9rem; font-weight: 700; }
.event-log small { display: block; font-size: .82rem; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.event-log .empty { display: block; color: var(--muted); font-size: .9rem; }
.notice { padding: 14px 18px; border-radius: 14px; background: var(--sun-soft); color: var(--ink); margin: 0 0 18px; font-size: .9rem; }
.error { color: var(--danger); font-size: .9rem; min-height: 1em; }
.login-card { max-width: 540px; margin: 28px auto 52px; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 38px; box-shadow: var(--shadow); }
.login-art { display: block; width: 168px; height: 168px; object-fit: contain; margin: 0 auto 18px; }
.login-card h1 { font-size: 2.5rem; margin-bottom: 16px; }
.login-card > p { color: var(--muted); }
.login-card form { margin-top: 26px; }
.login-card .hint { margin: 8px 0 18px; }
.login-card .primary { width: 100%; margin-bottom: 12px; }
footer { display: flex; justify-content: space-between; gap: 16px; padding: 28px 0 36px; color: var(--muted); font-size: .82rem; }
#boot-status { padding: 60px 0; }
dialog { border: 1px solid var(--line); border-radius: 24px; color: var(--ink); background: var(--canvas); padding: 30px; width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow: auto; }
dialog::backdrop { background: rgb(59 42 32 / 55%); }
dialog h2 { font-size: 1.5rem; margin-bottom: 18px; }
.consent { display: flex; align-items: flex-start; gap: 12px; font-size: .9rem; margin: 20px 0; padding: 14px; background: var(--sun-soft); border-radius: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
.stale #freshness { color: var(--danger); font-weight: 700; }
@media (max-width: 700px) {
  .shell { padding: 0 18px; }
  .masthead { flex-wrap: wrap; padding: 18px 0; }
  .brand { min-width: 0; } .brand-sub { overflow-wrap: anywhere; }
  .page-heading { padding: 18px; gap: 12px; }
  .page-heading > div { flex-basis: 155px; }
  .hero-art { width: 94px; height: 94px; }
  .page-heading > button { margin-top: 0; font-size: .85rem; }
  .health-grid, .work-grid { grid-template-columns: 1fr; }
  .panel { padding: 22px; }
  .contact-strip { gap: 2px; height: 32px; }
  .strip-footer { flex-wrap: wrap; }
  .strip-footer .legend { order: 3; width: 100%; gap: 10px; }
  .event-log li { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .event-log time { grid-column: 1 / -1; }
  .test-fields { grid-template-columns: 1fr; }
  .test-intro { flex-wrap: wrap; }
  .test-intro img, .confirmed-art { width: 88px; height: 88px; }
  .request-summary { flex-wrap: wrap; }
  .login-card { margin: 18px auto 32px; padding: 26px; }
  .login-card h1 { font-size: 2.1rem; }
  .log-tools p { margin-left: 0; }
  .toolbar { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  footer { flex-direction: column; gap: 6px; }
  .dialog-actions { flex-wrap: wrap; }
  .facts div { flex-wrap: wrap; } .facts dd { text-align: left; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .12s ease; }
}
