/* 鎌田青果 ラベル遠隔発行 — 「青果市場の朝」：紙と野菜と値札。
   実用が先、その上で美しく。深さは「1pxの境界」と「軽い影」の2段階だけ。8pxグリッド。 */

:root {
  color-scheme: light dark;
  --bg: #f6f2ea;
  --surface: #fffdf8;
  --surface-2: #f9f5ec;
  --desk: #ebe4d6;
  --text: #241f1a;
  --muted: #675f55;
  --line: #e3dbcc;
  --line-strong: #c9bea9;
  --edge: #857a68;

  --accent: #d9452b;
  --accent-strong: #c23a21;
  --accent-ink: #ffffff;
  --accent-soft: #fbe6df;
  --accent-text: #b2331b;

  --ok: #1d6f3f;
  --ok-fill: #1d6f3f;
  --ok-soft: #e1f2e7;
  --warn: #85560a;
  --warn-soft: #fcefc9;
  --info: #1d57b5;
  --info-soft: #e1ebfb;
  --danger: #b42318;
  --danger-soft: #fde7e4;

  --focus: #1d57b5;
  --focus-soft: rgba(29, 87, 181, .22);

  --shadow: 0 1px 2px rgba(70, 45, 20, .08), 0 6px 20px rgba(70, 45, 20, .10);
  --shadow-paper: 0 1px 0 rgba(70, 45, 20, .10), 0 2px 8px rgba(70, 45, 20, .14);

  --r-s: 8px;
  --r: 12px;
  --r-l: 16px;
  --ease: cubic-bezier(.22, .8, .3, 1);
  --t: 180ms;

  --font: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', 'Meiryo', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* アイコン（色ではなく形で状態を伝える） */
  --i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3.2 2'/%3E%3C/svg%3E");
  --i-printer: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9V3.5h10V9'/%3E%3Crect x='3' y='9' width='18' height='8' rx='2'/%3E%3Cpath d='M7 14h10v6.5H7z'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 12.5l5 5L19.5 7'/%3E%3C/svg%3E");
  --i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
  --i-pc-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='4' width='19' height='13' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4M8.5 10.5l2.5 2.5 4.5-5'/%3E%3C/svg%3E");
  --i-pc-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='4' width='19' height='13' rx='2'/%3E%3Cpath d='M8 21h8M12 17v4M3 3l18 18'/%3E%3C/svg%3E");
  --i-pause: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='6' y='5' width='4' height='14' rx='1.2'/%3E%3Crect x='14' y='5' width='4' height='14' rx='1.2'/%3E%3C/svg%3E");
  --i-stop: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M7 12h10'/%3E%3C/svg%3E");
  --i-exit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 4H5.5A1.5 1.5 0 0 0 4 5.5v13A1.5 1.5 0 0 0 5.5 20H10M15 8l4 4-4 4M19 12H9'/%3E%3C/svg%3E");
  --i-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V4.5h6V7M6.5 7l1 13h9l1-13M10 11v5M14 11v5'/%3E%3C/svg%3E");
  --i-inbox: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 13l3-8h12l3 8v6a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 19z'/%3E%3Cpath d='M3 13h5.5l1 2.5h5l1-2.5H21'/%3E%3C/svg%3E");
  --i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5l9.5 16.5h-19z'/%3E%3Cpath d='M12 10v4.5M12 17.5v.01'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151311;
    --surface: #1f1c19;
    --surface-2: #2a2622;
    --desk: #2d2925;
    --text: #f4efe7;
    --muted: #b4aa9d;
    --line: #38332d;
    --line-strong: #5a5248;
    --edge: #82796c;

    --accent: #ff7b5c;
    --accent-strong: #ee5c3f;
    --accent-ink: #1d0d08;
    --accent-soft: #3c1f18;
    --accent-text: #ff9d85;

    --ok: #74d49b;
    --ok-fill: #277a4b;
    --ok-soft: #1b3325;
    --warn: #f1c365;
    --warn-soft: #3a2e12;
    --info: #96bdff;
    --info-soft: #1b2a44;
    --danger: #ff9f95;
    --danger-soft: #3e1b18;

    --focus: #9cc2ff;
    --focus-soft: rgba(156, 194, 255, .28);

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .4);
    --shadow-paper: 0 1px 0 rgba(0, 0, 0, .5), 0 2px 10px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font);
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.35; letter-spacing: .04em; font-feature-settings: "palt"; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num, .tnum { font-variant-numeric: tabular-nums; }

/* ---------- ヘッダー ---------- */
header.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 3px 0 var(--accent);
}
header.bar .brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
header.bar .mark { flex: none; width: 32px; height: 32px; }
header.bar h1 { font-size: 18px; margin: 0; font-weight: 800; letter-spacing: .06em; line-height: 1.2; white-space: nowrap; }
header.bar .brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .04em; margin-top: 2px; }
header.bar .who { color: var(--muted); font-size: 14px; white-space: nowrap; }
header.bar > h1 { flex: 1; }

/* 接続状態（常にヘッダーで見える。色だけでなく形と文言） */
.conn {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 40px; padding: 0 14px 0 12px; border-radius: 999px;
  font-size: 14px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  border: 1.5px solid var(--line-strong); color: var(--muted); background: var(--surface-2);
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.conn::before, .status::before, .ico::before {
  content: ''; flex: none; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--i, none) center / contain no-repeat; mask: var(--i, none) center / contain no-repeat;
}
.conn { --i: var(--i-pc-off); }
.conn.on { --i: var(--i-pc-on); color: var(--ok); background: var(--ok-soft); border-color: var(--ok); }
.conn.off { --i: var(--i-pc-off); color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }
.conn.lg { min-height: 48px; font-size: 16px; padding: 0 18px 0 14px; }
.conn.lg::before { width: 22px; height: 22px; }

/* ---------- レイアウト ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 16px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 20px; margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin: 0 0 16px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.card h2 .step {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 800; letter-spacing: 0;
}
.muted { color: var(--muted); font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* ---------- フォーム ---------- */
label { display: grid; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
input, select, button, textarea { font: inherit; letter-spacing: inherit; color: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; min-height: 52px; padding: 10px 14px; border: 1.5px solid var(--edge); border-radius: var(--r);
  background: var(--surface-2); color: var(--text); font-size: 18px; font-weight: 500;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
  appearance: none; -webkit-appearance: none;
}
select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 20px;
}
input[type=file] { font-size: 15px; padding: 8px 0; color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .65; font-weight: 400; }
input:not([type=checkbox]):not([type=file]):hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible, input:focus, select:focus, textarea:focus {
  outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--focus); box-shadow: 0 0 0 5px var(--focus-soft); background: var(--surface);
}
input[inputmode=numeric], .bignum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
textarea { min-height: 120px; resize: vertical; font-size: 16px; line-height: 1.6; }
input[type=checkbox] { accent-color: var(--accent-strong); width: 24px; height: 24px; flex: none; }

button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: var(--r); border: 1.5px solid var(--edge);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 16px; cursor: pointer;
  transition: transform 120ms var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), opacity var(--t);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
button:hover:not(:disabled) { border-color: var(--muted); background: var(--surface-2); }
button:active:not(:disabled) { transform: scale(.97); background: var(--desk); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button.primary { background: var(--accent-strong); color: var(--accent-ink); border-color: var(--accent-strong); font-weight: 800; letter-spacing: .06em; box-shadow: 0 1px 0 rgba(0,0,0,.12); }
button.primary:hover:not(:disabled) { background: var(--accent-strong); filter: brightness(1.06); border-color: var(--accent-strong); }
button.primary:active:not(:disabled) { filter: brightness(.92); background: var(--accent-strong); }
button.big { min-height: 60px; font-size: 19px; width: 100%; border-radius: var(--r); }
button.sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
button.danger-o { color: var(--danger); }
button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
button.primary:disabled { background: var(--line); color: var(--muted); border-color: var(--line); opacity: 1; }
button .ico { width: 20px; height: 20px; display: inline-block; }
.iconbtn { width: 48px; padding: 0; flex: none; --i: var(--i-exit); }
.iconbtn::before { content: ''; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
button.trash { width: 48px; padding: 0; --i: var(--i-trash); color: var(--muted); }
button.trash::before { content: ''; width: 22px; height: 22px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }

.row { display: flex; gap: 16px; align-items: end; }
.row > * { flex: 1; }

/* ---------- バナー ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 10px; background: var(--warn-soft); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); padding: 10px 14px; border-radius: var(--r);
  font-size: 14px; font-weight: 600; margin-bottom: 12px; line-height: 1.5;
}
.banner::before { content: ''; flex: none; width: 20px; height: 20px; margin-top: 1px; background: currentColor; -webkit-mask: var(--i-alert) center / contain no-repeat; mask: var(--i-alert) center / contain no-repeat; }
.banner.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); font-weight: 800; }

/* ---------- 候補・チップ ---------- */
.suggest { border: 1.5px solid var(--line-strong); border-radius: var(--r); max-height: 288px; overflow: auto; margin-top: 8px; background: var(--surface); box-shadow: var(--shadow); animation: pop var(--t) var(--ease); }
.suggest button { display: flex; width: 100%; gap: 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; justify-content: flex-start; text-align: left; padding: 0 16px; min-height: 52px; font-size: 17px; font-weight: 500; }
.suggest button:last-child { border-bottom: 0; }
.suggest .code { color: var(--accent-text); min-width: 3em; font-weight: 800; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chips button { min-height: 48px; padding: 0 16px; border-radius: 999px; font-size: 15px; font-weight: 600; background: var(--surface-2); }
.chips:empty { display: none; }

/* ---------- ラベルのプレビュー：紙として机に置く ---------- */
.preview {
  display: flex; justify-content: center; align-items: center; padding: 24px 16px; min-height: 120px;
  background: var(--desk); border-radius: var(--r); border: 1px solid var(--line);
  background-image: radial-gradient(color-mix(in srgb, var(--text) 7%, transparent) 1px, transparent 1px); background-size: 16px 16px;
}
.preview svg { width: 190px; height: auto; display: block; box-shadow: var(--shadow-paper); background: #fff; animation: paper var(--t) var(--ease); }
.preview > .muted { text-align: center; max-width: 16em; }
.err { color: var(--danger); font-size: 14px; font-weight: 600; min-height: 1.4em; }
/* 事前印刷が逆さまのロール：見本をプリンターに入る向きで表示している旨の注記と、向きの切替（表示だけ。印刷には影響しない） */
.orient-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin-top: 6px; }
.orient-note[hidden] { display: none; }
.orient-btn { min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); margin-bottom: 8px; }
.orient-btn[hidden] { display: none; }
.preview.flip svg { transform: rotate(180deg); }

/* ---------- 表 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; z-index: 1; border-bottom: 1.5px solid var(--line-strong); }
tbody tr { transition: background var(--t); }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 状態バッジ（形＋文言） ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 12px 0 8px; min-height: 28px; border-radius: 999px;
  font-size: 13px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; border: 1.5px solid currentColor;
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.status::before { width: 16px; height: 16px; }
.status.queued { color: var(--warn); background: var(--warn-soft); --i: var(--i-clock); }
.status.printing { color: var(--info); background: var(--info-soft); --i: var(--i-printer); }
.status.printing::before { animation: blink 1.1s ease-in-out infinite; }
.status.done { color: var(--ok); background: var(--ok-soft); --i: var(--i-check); }
.status.canceled { color: var(--muted); background: var(--surface-2); --i: var(--i-x); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.status.lg { min-height: 36px; font-size: 16px; padding: 0 14px 0 10px; }
.status.lg::before { width: 20px; height: 20px; }

/* ---------- タブ（セグメント） ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; padding: 4px; background: var(--desk); border-radius: calc(var(--r) + 4px); width: fit-content; max-width: 100%; border: 1px solid var(--line); }
.tabs button { border: 0; background: transparent; min-height: 48px; border-radius: var(--r); font-weight: 700; color: var(--muted); }
.tabs button:hover:not(:disabled) { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(70,45,20,.18), 0 0 0 1px var(--line); }

/* ---------- 現場の指示カード ---------- */
.jobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.job {
  display: grid; grid-template-columns: 132px 1fr; gap: 20px; margin: 0; padding: 16px; position: relative;
  animation: slide-in 240ms var(--ease) both; transition: border-color var(--t), box-shadow var(--t);
}
.job::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; background: var(--line-strong); }
.job.s-queued::before { background: var(--warn); }
.job.s-printing { border-color: var(--info); box-shadow: var(--shadow); }
.job.s-printing::before { background: var(--info); }
.job.s-done::before { background: var(--ok); }
.job .paper svg { width: 132px; height: auto; display: block; box-shadow: var(--shadow-paper); background: #fff; }
.job .body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.job .big { font-size: 24px; font-weight: 800; line-height: 1.25; letter-spacing: .04em; overflow-wrap: anywhere; }
.job .meta { color: var(--muted); font-size: 13px; }
.job .origin { font-size: 15px; font-weight: 500; }
.job .origin b { font-size: 20px; font-weight: 800; }
.job .qty { font-size: 32px; font-weight: 800; line-height: 1.2; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.job .qty small { font-size: 16px; font-weight: 600; margin-left: 2px; }
.job .autonow { color: var(--info); font-weight: 800; font-size: 14px; }
.job .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.job .actions button { min-height: 44px; padding: 0 16px; }
.job .actions button.primary { flex: 1 1 96px; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--ok-fill); border-radius: 4px; transition: width 400ms var(--ease); }
.s-printing .progress > div { background: var(--info); background-image: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); background-size: 60px 100%; background-repeat: no-repeat; animation: sheen 1.4s linear infinite; }

/* ---------- トースト ---------- */
#toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(160%);
  display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--bg);
  padding: 14px 20px; border-radius: var(--r); font-weight: 700; font-size: 15px; box-shadow: var(--shadow);
  transition: transform 240ms var(--ease), opacity 200ms; opacity: 0; max-width: calc(100% - 32px); width: max-content; z-index: 50; pointer-events: none;
}
#toast::before { content: ''; flex: none; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--i-check) center / contain no-repeat; mask: var(--i-check) center / contain no-repeat; }
#toast.show { transform: translateX(-50%); opacity: 1; }
#toast.error { background: var(--danger); color: #fff; }
#toast.error::before { -webkit-mask-image: var(--i-alert); mask-image: var(--i-alert); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #toast.error { background: #ffb4ab; color: #410002; } }

/* ---------- ダイアログ ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--r-l); padding: 24px; max-width: min(520px, calc(100% - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog[open] { animation: pop 200ms var(--ease); }
dialog::backdrop { background: rgba(20, 12, 6, .5); backdrop-filter: blur(2px); animation: fade 200ms; }
dialog h2 { margin: 0 0 8px; font-size: 18px; }

/* ---------- スケルトン・空の状態 ---------- */
.skel { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--line) 0%, color-mix(in srgb, var(--line) 40%, var(--surface)) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel.l1 { height: 16px; width: 60%; margin: 6px 0; } .skel.l2 { height: 12px; width: 85%; margin: 6px 0; }
.skelrow { padding: 16px 0; border-bottom: 1px solid var(--line); }
.skelcard { height: 240px; border-radius: var(--r-l); }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); padding: 40px 16px; }
.empty::before { content: ''; width: 56px; height: 56px; background: var(--line-strong); -webkit-mask: var(--i-inbox) center / contain no-repeat; mask: var(--i-inbox) center / contain no-repeat; margin-bottom: 8px; }
.empty b { color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: .06em; }
.empty span { font-size: 14px; }

/* ---------- ログイン ---------- */
.loginwrap { min-height: 100svh; display: grid; align-content: center; justify-items: center; gap: 24px; padding: 32px 16px; max-width: 420px; margin: 0 auto; }
.loginwrap .brand-hero { display: grid; justify-items: center; gap: 12px; text-align: center; animation: slide-in 400ms var(--ease) both; }
.loginwrap .brand-hero svg { width: 220px; height: auto; display: block; }
.loginwrap .tagline { font-size: 15px; color: var(--muted); letter-spacing: .12em; margin: 0; font-weight: 500; }
.login { width: 100%; display: grid; gap: 16px; margin: 0; box-shadow: var(--shadow); animation: slide-in 400ms 80ms var(--ease) both; }
.login h2 { margin: 0; font-size: 16px; color: var(--muted); font-weight: 700; }
.login input[name=pin] { font-size: 28px; letter-spacing: .4em; text-align: center; min-height: 64px; font-weight: 700; }
.mk-a { fill: var(--accent); } .mk-b { fill: var(--surface); } .mk-t { fill: var(--text); }

/* ---------- トップのメニュー ---------- */
.menu { display: grid; gap: 16px; max-width: 520px; margin: 24px auto; }
.menu a {
  display: grid; grid-template-columns: 56px 1fr; gap: 4px 16px; align-items: center; padding: 20px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-l); color: inherit; text-decoration: none; min-height: 88px;
  transition: transform 140ms var(--ease), box-shadow var(--t), border-color var(--t);
  animation: slide-in 300ms var(--ease) both;
}
.menu a:nth-child(2) { animation-delay: 60ms; } .menu a:nth-child(3) { animation-delay: 120ms; }
.menu a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.menu a:active { transform: scale(.98); }
.menu a .mi { grid-row: 1 / 3; width: 56px; height: 56px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; }
.menu a .mi svg { width: 28px; height: 28px; }
.menu a b { display: block; font-size: 18px; font-weight: 800; letter-spacing: .06em; align-self: end; }
.menu a span.muted { align-self: start; }
.hero-title { text-align: center; margin: 32px 0 0; }
.hero-title svg { width: 240px; height: auto; }

/* ---------- 動き ---------- */
@keyframes slide-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes paper { from { opacity: .45; } to { opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes sheen { from { background-position: -60px 0; } to { background-position: 400px 0; } }
@keyframes tick { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok-fill) 55%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media (max-width: 600px) {
  main { padding: 12px; }
  .card { padding: 16px; border-radius: var(--r-l); }
  .job { grid-template-columns: 96px 1fr; gap: 12px; }
  .job .paper svg { width: 96px; }
  .jobs { grid-template-columns: 1fr; }
}
