:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --ink: #15181C;
  --ink-2: #4A525E;
  --line: #E1E4E8;
  --line-2: #C9CED6;
  --brand: #9E1C16;
  --link: #1F5FBF;
  --safe: #1B7A45;
  --minor: #9A5B00;
  --help: #B3261E;
  --radius: 20px;
  font-family: 'Noto Sans JP', system-ui, -apple-system, 'Hiragino Sans', sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #DADDE2; min-height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 端末枠：スマホ画面はそのまま全幅、PCでは中央に390px幅で表示 */
.phone { max-width: 480px; margin: 0 auto; min-height: 100dvh; background: var(--bg); display: flex; flex-direction: column; position: relative; }
.wide { max-width: none; background: #F5F6F8; }

.proto-bar { background: #2B2F36; color: #E6E8EB; font-size: 12px; display: flex; align-items: center; gap: 8px; padding: 6px 12px; flex-wrap: wrap; }
.proto-bar strong { color: #FFD48A; }
.proto-bar a { color: #FFFFFF; text-decoration: none; padding: 4px 8px; border-radius: 6px; border: 1px solid #5B6370; }
.proto-bar a[aria-current="page"] { background: #FFFFFF; color: #2B2F36; }
.proto-bar .spacer { flex: 1; }

/* ヘッダー */
.alert-head { background: var(--brand); color: #FFF; padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.alert-head.training { background: #2F5D9A; }
.alert-head .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill-white { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; background: #FFF; color: var(--brand); padding: 3px 10px 3px 8px; border-radius: 999px; }
.training .pill-white { color: #2F5D9A; }
.alert-head .sub { font-size: 13px; color: #F6D5D3; }
.training .sub { color: #D6E3F5; }
.alert-head .title { font-size: 20px; font-weight: 700; line-height: 1.35; }
.calm-head { background: var(--surface); padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.calm-head h1 { margin: 0; font-size: 22px; font-weight: 900; }
.bar-head { background: var(--surface); padding: 12px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.bar-head h1 { margin: 0; font-size: 18px; font-weight: 700; }
.bar-head .sub { font-size: 13px; color: var(--ink-2); }
.back { width: 44px; height: 44px; margin-left: -12px; display: flex; align-items: center; justify-content: center; color: var(--ink); flex: none; }

main.content { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.lead { font-size: 22px; font-weight: 900; margin: 0; }
.muted { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.section-label { font-size: 13px; font-weight: 700; color: var(--ink-2); padding: 8px 4px 0; }
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.list { background: var(--surface); border-radius: var(--radius); display: flex; flex-direction: column; }
.list > * + * { border-top: 1px solid #EEF0F3; }
.list-row { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.list-row .t { font-size: 15px; font-weight: 700; }
.list-row .s { font-size: 12px; color: var(--ink-2); }
a.list-row { color: var(--ink); text-decoration: none; }

/* 大きな安否ボタン */
.big-safe { width: 100%; aspect-ratio: 5 / 3; min-height: 200px; border: 0; border-radius: 32px; background: #217A46; color: #FFF; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; transition: transform .08s; }
.big-safe:active, .trio > *:active { transform: scale(.97); }
.big-safe .l { font-size: 38px; font-weight: 900; letter-spacing: .1em; }
.big-safe .n { font-size: 14px; color: #D5EEDF; letter-spacing: .04em; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.trio > * { aspect-ratio: 1 / 1; min-height: 96px; border-radius: 28px; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 20px; font-weight: 900; text-decoration: none; transition: transform .08s; }
.b-minor { background: #FFF6E3; color: #8A5300; }
.b-help { background: #FDEBEA; color: #A3221B; }
.b-other { background: #F3EEF2; color: #15181C; }

.sent { color: #FFF; border-radius: 24px; padding: 20px; display: flex; align-items: center; gap: 14px; }
.sent .when { font-size: 13px; opacity: .9; }
.sent .what { font-size: 24px; font-weight: 900; }
.btn-ghost-white { min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid #FFF; background: transparent; color: #FFF; font-size: 13px; }

.seg { display: flex; gap: 8px; }
.seg-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.opt { flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: #FFF; font-size: 14px; }
.opt[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFF; }

.chip-check { min-height: 52px; padding: 0 16px; border-radius: 14px; border: 2px solid #D5D9DF; background: #FFF; font-size: 15px; text-align: left; display: flex; align-items: center; gap: 10px; }
.chip-check .box { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 2px solid #D5D9DF; display: flex; align-items: center; justify-content: center; color: #FFF; font-size: 14px; font-weight: 700; }
.chip-check[aria-pressed="true"] { border-color: var(--link); background: #EAF1FB; }
.chip-check[aria-pressed="true"] .box { border-color: var(--link); background: var(--link); }

.tag { font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; }

.btn { min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line-2); background: #FFF; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.btn-primary { background: var(--link); border-color: var(--link); color: #FFF; }
.btn-outline { border-color: var(--link); color: var(--link); }
.btn-danger { background: var(--help); border-color: var(--help); color: #FFF; }
.btn-text { border: 0; background: transparent; color: var(--link); min-height: 44px; padding: 0 8px; font-size: 14px; font-weight: 400; }
.btn-text.danger { color: var(--help); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; }
.field input, .field select, .field textarea { min-height: 48px; border-radius: 12px; border: 1px solid var(--line-2); padding: 10px 12px; font-size: 16px; font-weight: 400; background: #FFF; }
.field textarea { resize: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #3A414B; min-height: 44px; }
.check input { width: 22px; height: 22px; }
.error { color: var(--help); font-size: 14px; }

.tabbar { position: sticky; bottom: 0; background: #FFF; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); }
.tabbar a { min-height: 52px; text-decoration: none; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; }
.tabbar a[aria-current="page"] { color: var(--brand); font-weight: 700; }

.sticky-foot { position: sticky; bottom: 0; background: #FFF; border-top: 1px solid var(--line); padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #FFF; border-radius: 14px; padding: 12px 16px; font-size: 14px; max-width: calc(100% - 32px); width: 420px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

.qr { width: 120px; height: 120px; flex: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 6px; background: #FFF; }
.invite { display: flex; gap: 14px; align-items: center; }

/* 管理画面 */
.admin-head { background: #1A1D21; color: #FFF; padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.admin-head .t { font-size: 16px; font-weight: 700; }
.admin-head nav { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-head nav a { color: #FFF; text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 8px; border: 1px solid #5B6370; font-size: 14px; }
.admin-head nav a[aria-current="page"] { background: #FFF; color: #1A1D21; }
.admin-wrap { max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; width: 100%; }
.panel { background: #FFF; border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi { background: #FFF; border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi .l { font-size: 13px; color: #5B6370; }
.kpi .v { font-size: 28px; font-weight: 700; }
.kpi .v small { font-size: 15px; color: #5B6370; font-weight: 400; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line-2); background: #FFF; font-size: 14px; }
.filters button[aria-pressed="true"] { background: #1A1D21; border-color: #1A1D21; color: #FFF; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; color: #5B6370; font-size: 12px; font-weight: 500; padding: 10px 8px; border-bottom: 1px solid #E3E6EA; }
table.grid td { padding: 12px 8px; border-bottom: 1px solid #EEF0F3; vertical-align: middle; }
.mini-tag { margin-left: 6px; font-size: 11px; color: #4A5260; background: #EDEFF2; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.banner .badge { font-size: 13px; font-weight: 700; color: #FFF; background: var(--help); padding: 4px 10px; border-radius: 6px; }
.banner .badge.training { background: #2F5D9A; }
.banner .badge.idle { background: #5B6370; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

@media (min-width: 520px) {
  body:not(.is-wide) { padding: 16px 0; }
  .phone:not(.wide) { border-radius: 28px; overflow: clip; min-height: calc(100dvh - 32px); box-shadow: 0 10px 40px rgba(0,0,0,.15); }
}
.panel.banner { flex-direction: row; }
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-wrap { padding: 16px; }
}
.overlay { position: fixed; inset: 0; background: rgba(21,24,28,.5); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.dialog { background: #FFF; color: var(--ink); border-radius: 20px; padding: 20px; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px; }
:root { color-scheme: light; }
