/* PORTABLE FEEDBACK WIDGET — smile (green) / frown (red). See feedback.js */
.feedback-group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: 2px;
}

.feedback-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--color-line);
  border-radius: 6px;
  background: var(--color-surface);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.feedback-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feedback-up {
  color: var(--color-success);
}

.feedback-down {
  color: var(--color-danger);
}

.feedback-up:hover {
  background: #eef7f0;
  border-color: var(--color-success);
}

.feedback-down:hover {
  background: var(--color-red-soft);
  border-color: var(--color-danger);
}

.feedback-btn:active {
  transform: translateY(1px);
}

.feedback-btn:focus-visible {
  outline: 2px solid var(--color-info);
  outline-offset: 2px;
}

.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(17, 19, 24, 0.45);
}

.feedback-modal {
  width: min(440px, 100%);
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel);
  padding: 18px;
}

.feedback-modal--survey {
  width: min(580px, 100%);
}

.feedback-survey {
  width: 100%;
  height: min(72vh, 580px);
  margin-top: 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-control);
  background: var(--color-surface-raised);
}

.feedback-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feedback-modal-head strong {
  font-size: 16px;
  font-weight: 800;
  color: var(--color-ink-strong);
}

.feedback-modal-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: var(--color-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.feedback-modal-close:hover {
  background: var(--color-surface-raised);
  color: var(--color-ink-strong);
}

.feedback-modal-to {
  margin: 8px 0 10px;
  font-size: 13px;
  color: var(--color-muted);
}

.feedback-modal-to span {
  color: var(--color-ink);
  font-weight: 700;
}

.feedback-modal-text {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-control);
  background: var(--color-surface-raised);
  color: var(--color-ink);
  font: inherit;
  font-size: 14px;
}

.feedback-modal-text:focus {
  outline: 2px solid var(--color-info);
  outline-offset: 1px;
}

.feedback-modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.feedback-copy {
  border: 1px solid var(--color-red-cross);
  background: var(--color-red-cross);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: var(--radius-control);
  cursor: pointer;
}

.feedback-copy:hover {
  background: var(--color-red-dark);
  border-color: var(--color-red-dark);
}

.feedback-open {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-info);
  text-decoration: none;
  padding: 9px 6px;
}

.feedback-open:hover {
  text-decoration: underline;
}

.feedback-modal-hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--color-subtle);
}

.feedback-modal-toast {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-success);
}


/* ---------- Major Disaster Timelines ---------- */
:root {
  --lv2: #9aa6b3; --lv3: #4f6f8f; --lv4: #e46b74; --lv5: #d8001b; --lv6: #9f0014; --lv7: #4a0009; --lvU: #c3c9d0;
  --row-h: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; font-family: var(--font-ui); -webkit-text-size-adjust: 100%; }
body { background: var(--color-canvas); color: var(--color-ink); font-size: 14px; }
[hidden] { display: none !important; }
button { cursor: pointer; }

.topbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 58px; padding: 8px 20px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--color-surface); border-bottom: 1px solid var(--color-line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.brand-text { min-width: 0; }
.btn-done { display: none; margin-top: 10px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-text h1 { margin: 0; font-size: 18px; font-weight: 800; color: var(--color-ink-strong); line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { display: block; font-size: 12px; color: var(--color-muted); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.hbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 1px solid var(--color-line);
  border-radius: 6px; background: var(--color-surface); color: var(--color-navy); font-weight: 700; font-size: 13px; }
.hbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hbtn:hover { background: var(--color-surface-raised); border-color: var(--color-subtle); }
.hbtn-quiet { color: var(--color-muted); }
.pill { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-red-cross); color: #fff; font-size: 11px; }

.gate { display: grid; place-items: center; min-height: calc(100vh - 58px); padding: 24px; }
.gate-card { width: min(440px, 100%); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-panel);
  box-shadow: var(--shadow-panel); padding: 28px; text-align: center; }
.gate-mark { width: 44px; height: 44px; }
.gate-card h2 { margin: 12px 0 8px; font-size: 20px; color: var(--color-ink-strong); }
.gate-card p { color: var(--color-muted); line-height: 1.5; margin: 0 0 18px; }
.btn-primary { width: 100%; min-height: 46px; border: 0; border-radius: 6px; background: var(--color-red-cross); color: #fff; font-weight: 800; font-size: 15px; }
.btn-primary:hover { background: var(--color-red-dark); }
.gate-msg { margin-top: 14px !important; font-size: 13px; color: var(--color-danger) !important; min-height: 1em; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: var(--color-surface); border-bottom: 1px solid var(--color-line); flex-wrap: wrap; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--color-canvas); border: 1px solid var(--color-line); border-radius: 8px; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 6px; font-weight: 700; font-size: 13px; color: var(--color-muted); white-space: nowrap; }
.seg button.on { background: var(--color-surface); color: var(--color-ink-strong); box-shadow: 0 1px 3px rgba(17,19,24,.12); }
.seg-sm button { padding: 5px 9px; font-size: 12px; }
.search { position: relative; flex: 1 1 220px; max-width: 420px; }
.search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); fill: none; stroke: var(--color-subtle); stroke-width: 2; }
.search input { width: 100%; min-height: 38px; padding: 0 12px 0 32px; border: 1px solid var(--color-line); border-radius: 6px; background: var(--color-surface); font-size: 16px; color: var(--color-ink); }
.search input:focus { outline: 2px solid var(--color-info); outline-offset: 0; }
.filters-toggle { display: none; }

.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
.filters { position: sticky; top: 58px; max-height: calc(100vh - 58px); overflow-y: auto; padding: 16px; border-right: 1px solid var(--color-line); background: var(--color-surface); min-height: calc(100vh - 120px); }
.fgroup { margin-bottom: 16px; }
.flabel { display: block; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--color-muted); margin-bottom: 7px; }
.fnote { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--color-subtle); }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 10px; border: 1px solid var(--color-line); border-radius: 15px; background: var(--color-surface); color: var(--color-muted); font-weight: 700; font-size: 12px; }
.chip.on { border-color: var(--color-navy); background: var(--color-navy); color: #fff; }
.chip .sw { width: 10px; height: 10px; border-radius: 2px; }
.presets { display: flex; gap: 10px; }
.presets button { border: 0; background: none; padding: 2px 0; color: var(--color-info); font-weight: 600; font-size: 12px; }
.filters select { width: 100%; min-height: 36px; padding: 0 8px; border: 1px solid var(--color-line); border-radius: 6px; background: var(--color-surface); color: var(--color-ink); font-size: 14px; }
.legend { display: grid; gap: 4px; font-size: 12px; color: var(--color-muted); margin: 4px 0 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 8px; border-radius: 2px; display: inline-block; }
.btn-reset { width: 100%; min-height: 36px; border: 1px solid var(--color-line); border-radius: 6px; background: var(--color-surface-raised); color: var(--color-navy); font-weight: 700; }

.content { padding: 16px 20px 40px; min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-panel); padding: 10px 12px; }
.stat b { display: block; font-size: 22px; font-weight: 800; color: var(--color-ink-strong); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--color-muted); font-weight: 600; }
.view { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-panel); padding: 14px; min-height: 300px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.view-head h2 { margin: 0; font-size: 18px; font-weight: 800; color: var(--color-ink-strong); }
.view-head .sub { font-size: 12px; color: var(--color-muted); }
.empty { padding: 40px 10px; text-align: center; color: var(--color-muted); }
.print-head { display: none; }

/* Gantt (one year) */
.gantt { --label-w: 300px; }
.g-months, .g-row { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); }
.g-months { position: sticky; top: 58px; z-index: 5; background: var(--color-surface); border-bottom: 1px solid var(--color-line); }
.g-months .g-track { position: relative; height: 24px; }
.g-month { position: absolute; top: 4px; font-size: 11px; font-weight: 700; color: var(--color-muted); transform: translateX(4px); }
.g-row { min-height: var(--row-h); align-items: center; cursor: pointer; break-inside: avoid; }
.g-row:nth-child(even) { background: #fafbfc; }
.g-row:hover { background: var(--color-map-blue); }
.g-label { display: flex; align-items: center; gap: 6px; padding-right: 10px; font-size: 12px; white-space: nowrap; overflow: hidden; }
.g-label .nm { overflow: hidden; text-overflow: ellipsis; color: var(--color-ink); }
.g-label .dt { color: var(--color-subtle); font-size: 11px; flex: none; font-variant-numeric: tabular-nums; }
.lvtag { flex: none; display: inline-grid; place-items: center; width: 18px; height: 16px; border-radius: 3px; font-size: 10px; font-weight: 800; color: #fff; }
.g-track { position: relative; height: var(--row-h); }
.g-bar { position: absolute; top: 5px; height: calc(var(--row-h) - 10px); border-radius: 3px; min-width: 3px; }
.g-bar.noend { background: transparent !important; border: 2px dashed currentColor; }
.g-bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.g-bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.g-bar.approx { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 3px, transparent 3px 6px); }
.year-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.year-tabs button { border: 1px solid var(--color-line); background: var(--color-surface); border-radius: 6px; padding: 6px 12px; font-weight: 800; font-size: 13px; color: var(--color-muted); }
.year-tabs button.on { background: var(--color-red-cross); border-color: var(--color-red-cross); color: #fff; }

/* Lanes (stacked / strip) */
.band { margin-bottom: 18px; break-inside: avoid; }
.band-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.band-head b { font-size: 16px; font-weight: 800; color: var(--color-ink-strong); }
.band-head span { font-size: 12px; color: var(--color-muted); }
.axis { position: relative; height: 18px; border-bottom: 1px solid var(--color-line); }
.axis span { position: absolute; top: 2px; font-size: 10.5px; font-weight: 700; color: var(--color-muted); transform: translateX(3px); white-space: nowrap; }
.lanes { position: relative; }
.lane-bar { position: absolute; height: 6px; border-radius: 2px; cursor: pointer; min-width: 2px; }
.lane-bar.noend { background: transparent !important; border: 1.5px dashed currentColor; }
.lane-bar:hover { outline: 2px solid var(--color-ink-strong); z-index: 2; }
.strip-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.strip-inner { min-width: 900px; }
.conc svg { display: block; width: 100%; height: 120px; }

/* Compare */
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.cmp-card { border: 1px solid var(--color-line); border-radius: var(--radius-panel); padding: 12px; break-inside: avoid; }
.cmp-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 800; color: var(--color-ink-strong); }
.cmp-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; margin: 0; font-size: 13px; }
.cmp-card dt { color: var(--color-muted); }
.cmp-card dd { margin: 0; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.cmp-chart { margin: 8px 0 18px; break-inside: avoid; }
.cmp-chart h3, .cmp-table h3 { margin: 0 0 6px; font-size: 14px; font-weight: 800; color: var(--color-ink-strong); }
.cmp-chart svg { width: 100%; height: 220px; display: block; }
.cmp-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--color-muted); margin-top: 4px; }
.cmp-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.cmp-tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 6px 8px; border-bottom: 1px solid var(--color-line); text-align: left; white-space: nowrap; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--color-muted); background: var(--color-surface-raised); position: sticky; top: 0; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl td.nm { white-space: normal; min-width: 220px; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--color-map-blue); }
.tbl th[data-sort] { cursor: pointer; }
.tbl th[data-sort]:hover { color: var(--color-ink-strong); }
.mini { color: var(--color-subtle); font-weight: 500; }

/* Modals */
.overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(17,19,24,.45); }
.modal { width: min(460px, 100%); max-height: 88vh; overflow-y: auto; background: var(--color-surface); border-radius: var(--radius-panel); box-shadow: var(--shadow-panel); padding: 18px; }
.modal-wide { width: min(680px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-head strong { font-size: 17px; font-weight: 800; color: var(--color-ink-strong); line-height: 1.3; }
.modal-close { border: 0; background: transparent; font-size: 24px; line-height: 1; color: var(--color-muted); padding: 0 6px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--color-muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--color-ink); }
.help-body { font-size: 14px; line-height: 1.55; color: var(--color-ink); }
.help-body h3 { font-size: 14px; margin: 14px 0 4px; color: var(--color-ink-strong); }
.help-body ul { padding-left: 18px; margin: 4px 0; }
.help-body p { margin: 4px 0; }
.help-foot { margin-top: 16px !important; color: var(--color-subtle); font-size: 12px; }

/* Phone */
@media (max-width: 820px) {
  .topbar { padding: 8px 12px; }
  .brand-sub { display: none; }
  .brand-text h1 { font-size: 16px; }
  .hbtn span { display: none; }
  .hbtn { padding: 0 7px; min-height: 34px; }
  .feedback-btn { width: 34px; height: 34px; }
  .top-actions { gap: 4px; }
  .brand-mark { width: 24px; height: 24px; }
  .t-long { display: none; }
  .btn-done { display: block; }
  .g-month { font-size: 9.5px; transform: translateX(1px); }
  .filters-toggle { display: inline-flex; }
  .filters-toggle span { display: inline; }
  .toolbar { padding: 10px 12px; position: sticky; top: 58px; z-index: 40; }
  .toolbar .views { order: 3; width: 100%; }
  .search { max-width: none; }
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; display: none; max-height: none; min-height: 0; border-right: 0; border-bottom: 1px solid var(--color-line); }
  .filters.open { display: block; }
  .content { padding: 12px 10px 40px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat { padding: 7px 8px; }
  .stat b { font-size: 16px; }
  .stat span { font-size: 11px; }
  .stat .mini { display: none; }
  .view { padding: 10px; }
  .gantt { --label-w: 128px; }
  .g-label .dt { display: none; }
  .g-months { top: 160px; }
  .kv { grid-template-columns: 100px 1fr; }
}

/* Print */
@page { size: landscape; margin: 9mm; }
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 11px; }
  .topbar, .toolbar, .filters, .overlay, .feedback-overlay, .year-tabs, .presets { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  .view { border: 0; padding: 0; }
  .print-head { display: block; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 2px solid #d8001b; }
  .print-head h1 { margin: 0; font-size: 17px; color: #111318; }
  .print-head p { margin: 2px 0 0; font-size: 10.5px; color: #444; }
  .stats { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .stat { padding: 5px 8px; }
  .stat b { font-size: 15px; }
  .g-months { position: static; }
  .gantt { --label-w: 260px; --row-h: 14px; }
  .g-label { font-size: 9px; }
  .g-label .dt { font-size: 8.5px; }
  .lvtag { width: 14px; height: 11px; font-size: 8px; }
  .g-bar { top: 3px; height: 8px; }
  .g-row:hover { background: none; }
  .g-track, .lanes { background-image: none !important; }
  .strip-inner { min-width: 0; }
  .tbl th { position: static; }
  .cmp-chart svg { height: 180px; }
}
