:root {
  --ink: #2b2522;
  --muted: #6b605a;
  --paper: #ffffff;
  --bg: #fbf7f2;
  --line: #d9cfc6;
  --accent: #e8643c;      /* 朱色系の見出し */
  --accent-dark: #b9431f;
  --band: #f39a2b;        /* オレンジの帯 */
  --salmon: #f6a08c;
  --sky: #a9dcf7;
  --grid: #b9d9a8;        /* 薄い緑系の罫線 */
  --ok: #1f7a3a;
  --warn: #9a5b00;
  --danger: #b3261e;
  --focus: #1a5fb4;
  --radius: 12px;
  --ball-red: #c62828;
  --ball-green: #2e7d32;
  --ball-lightblue: #4fa3d9;
  --ball-white: #f4f4f4;
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { font-size: 16px; line-height: 1.6; }
h1, h2, h3 { line-height: 1.3; }
a { color: var(--focus); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 44px; padding: .5em 1em; border-radius: 10px; border: 2px solid var(--accent-dark);
  background: var(--accent); color: #fff; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  touch-action: manipulation;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-secondary { background: #fff; color: var(--accent-dark); }
.btn-plain { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-danger { background: var(--danger); border-color: #7f1912; }
.btn-ok { background: var(--ok); border-color: #124d24; }
.btn-small { min-height: 36px; padding: .25em .7em; font-size: .9em; }
.btn-block { width: 100%; }

input, select, textarea { font: inherit; padding: .5em .6em; border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); min-height: 44px; max-width: 100%; }
textarea { min-height: 6em; width: 100%; }
label { font-weight: 600; }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.panel h2 { margin: 0 0 .6em; font-size: 1.15em; }
.muted { color: var(--muted); }
.notice { border-left: 6px solid var(--warn); background: #fff6e5; padding: .6em .8em; border-radius: 6px; }
.notice-danger { border-left-color: var(--danger); background: #fdecea; }
.notice-ok { border-left-color: var(--ok); background: #e9f6ec; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack > * + * { margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(150%); max-width: min(92vw, 560px);
  background: #2b2522; color: #fff; padding: 12px 16px; border-radius: 10px; font-weight: 600; z-index: 1000; transition: transform .2s; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-error { background: var(--danger); }
.toast-ok { background: var(--ok); }

.chip { display: inline-flex; align-items: center; gap: .35em; padding: .1em .6em; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: .9em; font-weight: 600; }
.ball { display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%; border: 2px solid #555; vertical-align: -0.2em; }
.ball-red { background: var(--ball-red); }
.ball-green { background: var(--ball-green); }
.ball-lightblue { background: var(--ball-lightblue); }
.ball-white { background: var(--ball-white); }
.ball-null { background: repeating-linear-gradient(45deg, #ddd 0 4px, #fff 4px 8px); }

dialog { border: none; border-radius: 16px; padding: 0; max-width: min(96vw, 640px); width: 100%; }
dialog::backdrop { background: rgba(30, 20, 10, .55); }

.scanner { padding: 12px; }
.scanner-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scanner-head h2 { margin: 0; font-size: 1.1em; }
.scanner-view { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 1 / 1; }
.scanner-view video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame { position: absolute; inset: 15%; border: 4px solid rgba(255, 255, 255, .85); border-radius: 12px; }
.scanner-file { margin-top: 8px; width: 100%; }

table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: #f6efe8; font-size: .9em; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
