:root {
  --bg: #12181c;
  --panel: #182129;
  --panel-2: #1c2733;
  --border: #2a3844;
  --accent: #4fb8c9;
  --accent-dark: #1f6a63;
  --cyan: #6fe0e8;
  --yellow: #f4d94e;
  --text: #eaf6f8;
  --text-dim: #a9c7cf;
  --danger: #e05263;
  --radius: 10px;
}

* { box-sizing: border-box; touch-action: manipulation; }

html {
  overscroll-behavior-y: none; /* 引っ張って更新(プルツーリロード)を無効化する */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
  min-height: 100vh;
  min-height: 100dvh; /* スマホ実機でアドレスバー分ずれないようにする(対応ブラウザのみ上書き) */
  touch-action: manipulation; /* ダブルタップでの拡大(ズーム)を無効化する */
  overscroll-behavior-y: none; /* 引っ張って更新(プルツーリロード)を無効化する */
}

/* 乗務員表示画面(driver.html)専用: 画面全体を縦横比1:2(横長)の固定フレームに収める */
body.driver-frame-body {
  background: #05070a;
  display: flex;
  align-items: center;
  justify-content: center;
}
#deviceFrame {
  position: relative;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #0c1216;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  flex: 0 0 auto;
  gap: 12px;
}

.topbar-left {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.topbar-logout-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.topbar-username {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.topbar-dutynumber {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.topbar-dutynumber:empty { display: none; }

#topbarCodeLine {
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
#topbarCodeLine:empty { display: none; }

.topbar .user-info {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 90px;
}
body.driver-frame-body .container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-width: none;
  width: 100%;
  padding-bottom: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 12px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.5px;
}

button, .btn {
  background: var(--accent);
  color: #0d1117;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  position: relative;
  box-shadow:
    0 3px 0 rgba(0,0,0,0.4),
    0 5px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.25);
  transition: transform 0.06s ease, box-shadow 0.06s ease, background 0.15s ease;
}

button:active, .btn:active {
  transform: translateY(3px);
  box-shadow:
    0 0 0 rgba(0,0,0,0.4),
    inset 0 2px 5px rgba(0,0,0,0.45);
}

button:hover { background: var(--cyan); }

button.secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}
button.secondary:hover { background: #2b3546; }

button.danger { background: var(--danger); color: white; }
button.danger:hover { background: #f0687a; }

input, select {
  background: #0f1319;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  width: 100%;
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
  margin-top: 10px;
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel-2);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}
.list-item:hover { border-color: var(--accent-dark); }
.list-item.selected { border-color: var(--accent); background: #23343c; }

.list-item .meta { font-size: 12px; color: var(--text-dim); }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.pill.active { background: var(--accent); color: #0d1117; border-color: var(--accent); }

.error { color: var(--danger); font-size: 13px; margin-top: 8px; }

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  width: 320px;
}
.login-box h1 {
  text-align: center;
  font-size: 20px;
  margin-bottom: 4px;
}
.login-box .sub {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ---- 乗務員表示画面 ---- */
.stop-table { display: flex; flex-direction: column; gap: 8px; }

.stop-row {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 62px;
  min-width: 0;
  overflow: hidden;
  background: var(--panel-2);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.stop-row.next {
  padding: 14px 18px;
  min-height: 76px;
  background: linear-gradient(135deg, #2c4870, #1c3252);
  border-color: #6f8fc4;
  box-shadow: 0 0 0 1px #6f8fc4 inset, 0 4px 16px rgba(0,0,0,0.35);
}
.stop-row.passed { opacity: 0.4; }
.stop-row.empty { opacity: 0.15; border-style: dashed; }

/* 1段目: 通し番号 + 停留所名(左寄せ) */
.stop-row-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.stop-seq {
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.stop-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}
.stop-row.next .stop-name { color: var(--yellow); font-size: 19px; }
/* 通過済みはそのまま、未通過(次の停留所を除く)の地点名はさらに大きくする */
.stop-row:not(.passed):not(.next) .stop-name { font-size: 17px; }

/* 2段目: 時刻(右寄せ) + 通過ボタン/カウントダウンなど */
.stop-row-bottom {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.stop-time {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
  text-align: right;
}
.stop-row.next .stop-time { color: var(--yellow); font-size: 24px; }
/* 通過済みはそのまま、未通過(次の停留所を除く)の時刻はさらに大きくする */
.stop-row:not(.passed):not(.next) .stop-time { font-size: 22px; }
.stop-time small { color: var(--text-dim); font-size: 12px; font-weight: 400; }
.stop-countdown {
  font-size: 12px;
  color: var(--accent);
  text-align: right;
  flex-shrink: 0;
}
.stop-row.next .stop-countdown { color: var(--yellow); font-weight: 700; }

/* 1行目の右横に表示する「位置 / 全体数」の進捗バッジ */
.stop-progress {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  font-variant-numeric: tabular-nums;
}

/* 運行画面(4件表示)のときだけ、縦の高さを1:1.5:1:1の比率で分け合う。
   2番目(次の停留所)だけ大きく表示される。一覧表示(list-mode)では適用しない。 */
#stopTable.window-mode {
  flex: 1 1 auto;
  min-height: 0;
}
#stopTable.window-mode .stop-row {
  flex: 1 1 0;
  min-height: 0;
}
#stopTable.window-mode .stop-row:nth-child(2) {
  flex: 1.5 1 0;
}

.clock {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-dim);
}

.clockbox {
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, #3f6ea0, #254a75);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 12px;
  padding: 14px 12px;
  line-height: 1.25;
  min-width: 140px;
}
.clockbox-date { font-size: 17px; opacity: 0.9; color: #eaf6f8; }
.clockbox-time { font-size: 27px; font-weight: 700; color: #fff; }
.clockbox-secbar { display: flex; gap: 5px; justify-content: center; margin-top: 5px; }
.clockbox-secbar .seg { width: 12px; height: 12px; background: rgba(255,255,255,0.18); }
.clockbox-secbar .seg.filled { background: var(--yellow); box-shadow: 0 0 5px rgba(244,217,78,0.7); }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.tabs button { flex: 1; }
.tabs button.secondary { opacity: 0.6; }

.hidden { display: none !important; }

.small-btn { padding: 6px 10px; font-size: 12px; }

/* ---- 運行指示・整理券・方向幕 ---- */
.instruction-box {
  background: var(--panel-2);
  border: 1px solid var(--cyan);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.instruction-box .pill {
  margin-right: 8px;
  background: var(--cyan);
  color: #0d1117;
  border-color: var(--cyan);
}
.badge-row { display: flex; gap: 8px; margin-bottom: 12px; }
.info-badge {
  flex: 1;
  background: linear-gradient(180deg, #3f6ea0, #254a75);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 8px;
  padding: 6px 10px;
  text-align: center;
}
.info-badge span { display: block; font-size: 10px; color: #dce6f2; letter-spacing: 0.08em; }
.info-badge strong { font-size: 15px; color: #fff; }

/* ---- 通過ボタン・実績表示 ---- */
.advance-btn {
  background: var(--yellow);
  color: var(--bg);
  font-weight: 900;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  flex-shrink: 0;
}
.advance-btn:hover { background: #ffd94d; }
.advance-btn:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 rgba(0,0,0,0.4), inset 0 2px 5px rgba(0,0,0,0.45);
}

.diff-ontime { color: var(--yellow) !important; }
.diff-early { color: #8fd6ff !important; }
.diff-late { color: #ff9d6b !important; }
.diff-skipped { color: var(--text-dim) !important; font-weight: 400 !important; }

.all-done {
  text-align: center;
  padding: 40px 0;
  font-size: 20px;
  font-weight: 900;
  color: var(--text-dim);
}

/* ---- 下部操作ボタン列(物理端末風) ---- */
.bottom-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 8px;
  background: #0c1216;
  border-top: 1px solid var(--border);
  z-index: 20;
}
.bb-btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 1px;
  font-size: clamp(7px, 1.15vw, 11px);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bb-btn:hover { background: #24313f; }
.bb-btn.bb-primary {
  background: var(--accent-dark);
  border-color: var(--accent);
  color: var(--text);
}
.bb-btn.bb-primary:hover { background: #266a63; }
.bb-btn.bb-active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* 一覧モード(スクロール表示専用、編集不可) */
.stop-table.list-mode {
  padding-right: 4px;
}

/* ---- 運行画面(便選択後)を固定レイアウト化: 上部の見出しは固定し、
   停留所の行部分だけがスクロールするようにする ---- */
#viewCard.pinned {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 0;
}
#viewCard.pinned h2 { flex: 0 0 auto; }
#viewCard.pinned #runScreen {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row; /* 横画面: 本文(左) + サイドバー(右) */
  gap: 10px;
}
#viewCard.pinned .sub-screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* 本文側(左5/6): 運行指示の帯 + 停留所リスト */
#runMain {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#runInstruction:empty { display: none; }
#viewCard.pinned .stop-table {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}

/* サイドバー側(右1/6): 本文の停留所4行(1:1.5:1:1)と高さを揃えて4段に分ける */
#runSidebar {
  flex: 0 0 16.6667%;
  max-width: 16.6667%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.sidebar-row {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  text-align: center;
  overflow: hidden;
}
/* 本文の停留所リスト(1:1.5:1:1)と同じ比率にすることで、定刻差の枠の上下が
   本文2行目(次の停留所)と正確に揃うようにする */
#sidebarProgressRow { flex: 1 1 0; }
#sidebarDiffRow { flex: 1.5 1 0; }
#sidebarTicketRow { flex: 1 1 0; position: relative; }
#sidebarArriveRow { flex: 1 1 0; }

/* 回送表示中は、整理券の枠いっぱいに赤字で重ねて表示する */
.kaiso-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel-2);
  color: var(--danger);
  font-weight: 900;
  font-size: clamp(11px, 1.6vw, 16px);
  line-height: 1.3;
  border-radius: 8px;
}
.kaiso-label.hidden { display: none; }

/* 1段目: 停留所の進捗(現在位置 / 全体数) */
/* 2段目: 現在時刻と、次の停留所(本文2行目)の定刻との差。ラベルは付けず、値のみ大きく表示する */
.sidebar-label { font-size: 11px; color: var(--text-dim); }
.sidebar-value {
  font-size: clamp(13px, 1.8vw, 18px);
  font-weight: 800;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
#sidebarDiffRow {
  transition: background 0.15s ease;
  overflow: hidden;
  /* 分後・0分(通常時): 隣の行(次の停留所)と同じ配色 */
  background: linear-gradient(135deg, #2c4870, #1c3252);
  border-color: #6f8fc4;
}
.sidebar-diff-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
#sidebarDiffNumber {
  font-size: clamp(18px, 3.6vh, 30px);
  font-weight: 900;
  white-space: nowrap;
  text-align: center;
  line-height: 1.15;
  color: #fff;
}
#sidebarDiffNumber.mid { font-size: clamp(15px, 2.8vh, 24px); }
#sidebarDiffNumber.long { font-size: clamp(12px, 2.1vh, 18px); }
#sidebarDiffUnit {
  display: block;
  width: 100%;
  text-align: right;
  white-space: nowrap;
  font-weight: 900;
  /* 数字より10pt(約13px)小さくする */
  font-size: clamp(10px, 2vh, 17px);
  color: #fff;
  line-height: 1.2;
}
#sidebarDiffUnit:empty { display: none; }
/* 分前(定刻をまだ過ぎていない場合)は、行全体を黄色にして赤文字で強調する */
#sidebarDiffRow.overdue { background: var(--yellow); border-color: var(--yellow); }
#sidebarDiffRow.overdue #sidebarDiffNumber,
#sidebarDiffRow.overdue #sidebarDiffUnit { color: #d21f3c; }

/* 4段目: 到着ボタン。全停留所を通過するまでは薄く、押せない状態にする */
#sidebarArriveRow {
  padding: 0;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.arrive-status {
  flex-shrink: 0;
  font-size: 10px;
  text-align: center;
  color: var(--text-dim);
  min-height: 1.2em;
}
.arrive-status.sending { color: var(--accent); }
.arrive-status.ok { color: var(--cyan); }
.arrive-status.error { color: var(--danger); }

.arrive-btn-sidebar {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  font-weight: 700;
  font-size: clamp(9px, 1.1vw, 14px);
  letter-spacing: -0.5px;
  padding: 2px 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.arrive-btn-sidebar:not(:disabled) {
  opacity: 1;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #ff9d3d, #e6790f);
  border: 1px solid #ffb35c;
  box-shadow:
    0 3px 0 rgba(0,0,0,0.4),
    0 5px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.3);
}
.arrive-btn-sidebar:not(:disabled):hover { background: linear-gradient(180deg, #ffab57, #f2860f); }
.arrive-btn-sidebar:not(:disabled):active {
  transform: translateY(3px);
  box-shadow: 0 0 0 rgba(0,0,0,0.4), inset 0 2px 5px rgba(0,0,0,0.45);
}

/* ---- サブ画面共通(メニュー・10KEYなど) ---- */
.sub-screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.sub-screen-header::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent 70%);
}
.sub-screen-header .back-btn {
  background: var(--accent-dark);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.sub-screen-header h3 { margin: 0; font-size: 16px; font-weight: 700; }

/* ---- メニュー画面 ---- */
.menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  overflow-y: auto;
}
.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(180deg, #1c2733, #14202a);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  min-height: 90px;
  text-align: center;
  line-height: 1.3;
}
.menu-btn:hover { border-color: var(--accent); }
.menu-btn .icon { font-size: 26px; }

/* ---- 10KEY(系統番号入力)画面 ---- */
/* 全体: 左(表示欄+数字パッド) / 右(クリア・削除・決定を縦に並べた列) */
.tenkey-body { display: flex; gap: 12px; flex: 1 1 auto; min-height: 0; }

.tenkey-main { display: flex; flex-direction: column; gap: 12px; flex: 1 1 auto; min-width: 0; min-height: 0; }

.tenkey-display-row { flex: 0 0 auto; }
.tenkey-display {
  width: 100%;
  height: 44px;
  background: #fff;
  color: #6b7787;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 15px;
  display: flex;
  align-items: center;
  overflow: hidden;
  box-sizing: border-box;
}
.tenkey-display.has-value {
  color: #14181f;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: 3px;
}

/* 数字パッド: 表示欄と同じ幅(親要素いっぱい)に配置する */
.tenkey-pad {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 10px;
}
.tenkey-pad button {
  background: linear-gradient(180deg, #2c4870, #1c3252);
  border: 1px solid #6f8fc4;
  border-radius: 8px;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}
.tenkey-pad button:hover { background: linear-gradient(180deg, #385a8a, #234066); }
.tenkey-pad .zero-btn { grid-column: 1 / span 3; }

/* 右側の縦列: クリア・削除・決定を上から順に並べる */
.tenkey-side { display: flex; flex-direction: column; gap: 10px; width: 90px; flex-shrink: 0; }
.tenkey-side button {
  flex: 1;
  background: linear-gradient(180deg, #1c2733, #14202a);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
}
.tenkey-clear-btn {
  background: linear-gradient(180deg, #1c2733, #14202a);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.tenkey-side .decide-btn {
  background: linear-gradient(180deg, var(--accent-dark), #123a35);
  border-color: var(--accent);
  font-size: 15px;
}

.error-box {
  padding: 24px 16px;
  text-align: center;
  color: var(--danger);
  font-size: 16px;
  font-weight: 700;
  background: var(--panel-2);
  border: 1px solid var(--danger);
  border-radius: 10px;
  margin-top: 10px;
}

/* ---- 画面切替(緊急連絡)画面 ---- */
.emergency-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.emergency-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  position: relative;
  box-shadow:
    0 3px 0 rgba(0,0,0,0.4),
    0 5px 8px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.emergency-item:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 rgba(0,0,0,0.4), inset 0 2px 5px rgba(0,0,0,0.45);
}
.emergency-item .icon { font-size: 26px; flex-shrink: 0; }
.emergency-item .label { color: inherit; flex: 1; }
.emergency-item .sub { font-size: 12px; font-weight: 500; opacity: 0.85; flex-shrink: 0; }

.emergency-item.call {
  background: linear-gradient(180deg, #7a2530, #4d151c);
  border: 1px solid var(--danger);
  color: #ffe1e5;
}
.emergency-item.neutral {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
