:root {
  --navy: #0c2b64;
  --navy-2: #1a3d80;
  --navy-soft: #e8eef8;
  --green: #5fa83a;
  --green-soft: #e7f4df;
  --red: #b3372f;
  --red-soft: #fbeceb;
  --yellow: #a26b00;
  --yellow-soft: #fdf5e2;
  --gray: #6b7280;
  --gray-soft: #eef0f3;
  --line: #dfe3ea;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1c2433;
  --muted: #5d6677;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 64, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--navy-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 80px 16px; text-align: center; color: var(--muted); }

/* ---- header ---- */
.hdr { background: var(--navy); color: #fff; border-bottom: 4px solid var(--green); position: sticky; top: 0; z-index: 20; }
.hdr-in { max-width: 1180px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hdr .org { font-size: 11px; opacity: .8; line-height: 1.3; }
.hdr .ttl { font-size: 17px; font-weight: 700; line-height: 1.3; }
.hdr .brand { cursor: pointer; min-width: 0; }
.hdr .sp { flex: 1; }
.hdr .nav { display: flex; gap: 6px; flex-wrap: wrap; }
.hdr .nav a, .hdr .nav button {
  color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.45); background: transparent;
  padding: 4px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.hdr .nav a:hover, .hdr .nav button:hover { background: rgba(255,255,255,.12); }
.hdr .user { font-size: 13px; opacity: .92; cursor: pointer; white-space: nowrap; }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; margin-left: 4px; }
.pill.red { background: var(--red); color: #fff; }
.pill.green { background: var(--green); color: #fff; }
.pill.yellow { background: #e0a100; color: #fff; }

main { max-width: 1180px; margin: 0 auto; padding: 18px 16px 80px; }
h2.sec { font-size: 13px; color: var(--muted); font-weight: 700; margin: 22px 0 8px; }
h1.page { font-size: 20px; margin: 4px 0 14px; color: var(--navy); }

/* ---- cards / tiles ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; text-decoration: none; color: inherit; cursor: pointer; }
.stat .num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: 12px; font-weight: 700; }
.stat .go { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stat.red { background: var(--red-soft); border-color: #f1c9c5; color: var(--red); }
.stat.yellow { background: var(--yellow-soft); border-color: #efdcae; color: var(--yellow); }
.stat.navy .num, .stat.navy .lbl { color: var(--navy); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tile { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; text-decoration: none; color: inherit; box-shadow: var(--shadow); min-height: 118px; }
.tile:hover { border-color: var(--navy-2); }
.tile .ic { width: 30px; height: 30px; border-radius: 7px; background: var(--navy-soft); color: var(--navy); display: grid; place-items: center; margin-bottom: 8px; }
.tile .ic svg { width: 17px; height: 17px; }
.tile b { display: block; color: var(--navy); font-size: 14px; }
.tile p { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.tile.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.tile.primary b, .tile.primary p { color: #fff; }
.tile.primary .ic { background: rgba(255,255,255,.15); color: #fff; }
.tile .pill { position: absolute; top: 10px; right: 10px; }

/* ---- buttons / forms ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 7px 14px; cursor: pointer; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--text); min-height: 36px; }
.btn:hover { border-color: var(--navy-2); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.green { background: var(--green); color: #fff; border-color: var(--green); }
.btn.danger { color: var(--red); border-color: #efc6c2; }
.btn.small { padding: 3px 10px; font-size: 12px; min-height: 28px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.rec { background: var(--red); color: #fff; border-color: var(--red); font-size: 16px; padding: 14px 22px; border-radius: 40px; }
.btn.rec.on { animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(179,55,47,.5);} 70% { box-shadow: 0 0 0 14px rgba(179,55,47,0);} 100% { box-shadow: 0 0 0 0 rgba(179,55,47,0);} }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: #fff; min-height: 38px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9db6e6; border-color: var(--navy-2); }
label.f { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.fld { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.fld .no { display: inline-block; background: var(--navy-soft); color: var(--navy); font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 6px; margin-right: 6px; }
.fld .req { font-size: 11px; color: var(--muted); margin-top: 4px; }
.fld .req .ok { color: var(--green); font-weight: 700; }
.fld .req .ng { color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.subttl { border-left: 4px solid var(--green); padding-left: 8px; font-weight: 700; color: var(--navy); margin: 18px 0 8px; font-size: 14px; }
.savebar { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 12px 0 6px; margin-top: 12px; }

/* ---- badges ---- */
.bdg { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--navy-soft); color: var(--navy); font-weight: 500; white-space: nowrap; }
.bdg.green { background: var(--green-soft); color: #3b7a1e; }
.bdg.red { background: var(--red-soft); color: var(--red); }
.bdg.yellow { background: var(--yellow-soft); color: var(--yellow); }
.bdg.gray { background: var(--gray-soft); color: var(--gray); }
.bdg.purple { background: #f1eafb; color: #6a3fa0; }

/* ---- list cards ---- */
.lc { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; cursor: pointer; }
.lc.facility { border-left-color: var(--green); }
.lc:hover { border-color: var(--navy-2); }
.lc .nm { font-weight: 700; font-size: 15px; }
.lc .meta { font-size: 12px; color: var(--muted); }
.lc .go { font-size: 13px; color: var(--navy); font-weight: 700; white-space: nowrap; }
.lc.st-expired { border-left-color: var(--red); }
.lc.st-soon { border-left-color: #e0a100; }
.lc.st-valid { border-left-color: var(--green); }
.lc.st-none, .lc.st-history { border-left-color: #b9bec8; }

.kana-row { display: flex; gap: 4px; flex-wrap: wrap; }
.kana-row .chip { min-width: 36px; text-align: center; padding: 4px 8px; }

/* ---- tabs ---- */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 14px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tabs button { border: 0; background: transparent; padding: 9px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button.on { color: var(--navy); font-weight: 700; border-bottom-color: var(--navy); }

/* ---- tables ---- */
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th { background: var(--navy); color: #fff; font-weight: 500; text-align: left; padding: 7px 9px; white-space: nowrap; position: sticky; top: 0; }
.tbl td { border-top: 1px solid var(--line); padding: 7px 9px; vertical-align: top; }
.tbl tr:nth-child(even) td { background: #f8f9fc; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 700; background: var(--navy-soft) !important; }
.in { color: #2a6f14; }
.out { color: var(--red); }

/* ---- two-pane ---- */
.split { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; }
.qitem { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 6px; cursor: pointer; }
.qitem.on { border-color: var(--navy); box-shadow: 0 0 0 2px #c9d6f0; }
.preview { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #f8f9fb; max-height: 460px; object-fit: contain; }

/* ---- modal / toast ---- */
.mask { position: fixed; inset: 0; background: rgba(10, 20, 40, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; padding: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 12px; color: var(--navy); font-size: 17px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; }
#toast div { background: #1d2a44; color: #fff; padding: 10px 18px; border-radius: 8px; margin-top: 6px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
#toast div.err { background: var(--red); }

/* ---- auth ---- */
.auth { max-width: 420px; margin: 8vh auto; padding: 0 16px; }
.auth .card { padding: 24px; }
.auth h1 { font-size: 18px; color: var(--navy); margin: 0 0 4px; }

.empty { text-align: center; color: var(--muted); padding: 26px; background: #fff; border: 1px dashed var(--line); border-radius: 8px; }
.note { background: var(--navy-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: var(--navy); }
.warn { background: var(--yellow-soft); color: #6d4a00; border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.alert { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
pre.json { white-space: pre-wrap; word-break: break-all; font-size: 11px; background: #f6f7fa; padding: 8px; border-radius: 6px; max-height: 240px; overflow: auto; }
.body-text { white-space: pre-wrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.kpi .v { font-size: 20px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi .k { font-size: 12px; color: var(--muted); }
.acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- print ---- */
.print-page { background: #fff; max-width: 1000px; margin: 0 auto; padding: 24px; }
.print-page h1 { font-size: 20px; text-align: center; margin: 0 0 4px; }
.print-page .sub { text-align: center; font-size: 12px; color: #444; margin-bottom: 14px; }
.print-page table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 12px; }
.print-page th, .print-page td { border: 1px solid #888; padding: 4px 6px; vertical-align: top; }
.print-page th { background: #eef1f6; text-align: left; width: 22%; }
.print-page td.num { text-align: right; }
.print-page h2 { font-size: 14px; border-bottom: 2px solid #333; margin: 14px 0 6px; }
@media print {
  .no-print, .hdr, #toast { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .print-page { padding: 0; max-width: none; }
  @page { size: A4; margin: 12mm; }
  .landscape { page: land; }
  @page land { size: A4 landscape; }
}

/* ---- mobile ---- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .hdr .nav a:not(:first-child) { display: none; }
  .hdr .ttl { font-size: 15px; }
  table.tbl.wide { min-width: 720px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile p { display: none; }
  .tile { min-height: 84px; }
  .form-grid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .lc { flex-wrap: wrap; }
  .hide-sp { display: none; }
}
