:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede6;
  --text: #1d2321;
  --muted: #5d6662;
  --line: #dcd9cf;
  --accent: #2f5d50;
  --accent-soft: #dce9e4;
  --warn: #9a5b00;
  --warn-soft: #fbecd2;
  --danger: #a33a2c;
  --danger-soft: #f8e0dc;
  --radius: 12px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141816;
    --surface: #1c2220;
    --surface-2: #242b28;
    --text: #e8ece9;
    --muted: #a3ada8;
    --line: #333c38;
    --accent: #7fc0aa;
    --accent-soft: #233a33;
    --warn: #f0b75c;
    --warn-soft: #3a2e1a;
    --danger: #f08c7c;
    --danger-soft: #3d2220;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141816; --surface: #1c2220; --surface-2: #242b28; --text: #e8ece9; --muted: #a3ada8;
  --line: #333c38; --accent: #7fc0aa; --accent-soft: #233a33; --warn: #f0b75c; --warn-soft: #3a2e1a;
  --danger: #f08c7c; --danger-soft: #3d2220; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.7;
}
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); overflow-wrap: anywhere; }
h1, h2, h3 { line-height: 1.35; margin: 0; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.site-header .wrap:first-child { padding-top: 18px; }
.site-header h1 { font-size: 22px; letter-spacing: .02em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.meta { margin: 4px 0 10px; color: var(--muted); font-size: 12px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  flex: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px;
  padding: 10px 12px; border-bottom: 3px solid transparent; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

main { padding-top: 20px; padding-bottom: 40px; }
.tab-panel h2 { font-size: 19px; margin-bottom: 6px; }
.note { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* 絞り込み */
.filters { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 18px; }
.filters > summary { padding: 12px 16px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary::after { content: "▾"; color: var(--muted); }
.filters[open] > summary::after { content: "▴"; }
.count { color: var(--accent); font-weight: 600; margin-left: auto; margin-right: 10px; }
#filter-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; padding: 0 16px 16px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .06em; margin-bottom: 4px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--text); }
select, input[type="number"] {
  display: block; width: 100%; margin-top: 3px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px;
}
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font: inherit; font-size: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.form-foot { grid-column: 1 / -1; display: flex; gap: 12px; align-items: end; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 12px; }
.form-foot label { margin: 0; flex: 1 1 200px; }
.form-foot label.unknown { flex-basis: 100%; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
button.ghost { font: inherit; font-size: 13px; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 8px 14px; cursor: pointer; }

/* カード */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card summary { list-style: none; cursor: pointer; padding: 14px 16px; display: grid; gap: 8px; }
.card summary::-webkit-details-marker { display: none; }
.card .name { font-size: 16px; }
.card .where { margin: 0; color: var(--muted); font-size: 13px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 14px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 11px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.facts dd small { font-weight: 400; color: var(--muted); }
.flags { display: flex; flex-wrap: wrap; gap: 6px; }
.flag { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.flag.soon { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.flag.warn { background: var(--warn-soft); color: var(--warn); }
.flag.ok { background: var(--accent-soft); color: var(--accent); }
.detail { border-top: 1px solid var(--line); padding: 12px 16px 16px; display: grid; gap: 12px; }
.detail h4 { margin: 0 0 4px; font-size: 13px; color: var(--accent); }
.detail p, .detail ul { margin: 0; font-size: 14px; }
.detail ul { padding-left: 1.2em; }
.stale { color: var(--warn); font-size: 11px; font-weight: 400; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ビザ・エージェント */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.panel h3 { font-size: 16px; margin-bottom: 6px; }
.panel dl { display: grid; grid-template-columns: 7em 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.panel dt { color: var(--muted); }
.panel dd { margin: 0; min-width: 0; }
.regions { margin-top: 8px; font-size: 13px; color: var(--muted); }
.about { padding-left: 1.2em; }
.about li { margin-bottom: 8px; }
.foot { color: var(--muted); font-size: 12px; padding-bottom: 30px; }

@media (max-width: 560px) {
  .site-header { position: static; }
  .panel dl { grid-template-columns: 1fr; }
  .panel dt { margin-top: 6px; }
}
