:root {
  --ink: #1c2430;
  --ink-soft: #5a6676;
  --line: #dde3ea;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --navy: #1f3864;
  --navy-soft: #2f4f8f;
  --accent: #0f766e;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.65;
}

a { color: var(--navy-soft); }

/* ---------- ヘッダー / ナビ ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: rgba(255,255,255,.15);
  display: grid; place-items: center; font-size: 18px; font-weight: 700;
}
.brand-title { font-weight: 700; font-size: 16px; line-height: 1.2; }
.brand-sub { font-size: 12px; opacity: .8; }
.topbar-right { font-size: 13px; opacity: .9; }

.mainnav {
  display: flex; flex-wrap: wrap; gap: 2px;
  background: var(--navy-soft); padding: 0 16px;
  position: sticky; top: 0; z-index: 10;
}
.mainnav a {
  color: #e8eef8; text-decoration: none; padding: 11px 16px;
  font-size: 13.5px; border-bottom: 3px solid transparent;
}
.mainnav a:hover { background: rgba(255,255,255,.1); }
.mainnav a.active { background: var(--bg); color: var(--navy); font-weight: 700; border-bottom-color: var(--accent); }

.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }
.footer { text-align: center; color: var(--ink-soft); font-size: 12px; padding: 16px; }

/* ---------- パネル ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 20px;
}
.panel > h2 { margin: 0 0 4px; font-size: 17px; }
.panel > h2 + .lead { margin-top: 0; }
.lead { color: var(--ink-soft); margin: 0 0 16px; }
h3 { font-size: 15px; margin: 24px 0 8px; }
h3:first-child { margin-top: 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* ---------- メニューカード ---------- */
.menu-card {
  display: block; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 5px solid var(--navy-soft);
  border-radius: var(--radius); padding: 18px 20px;
  transition: transform .08s ease, box-shadow .12s ease;
}
.menu-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(31,56,100,.12); }
.menu-card .num { font-size: 12px; color: var(--accent); font-weight: 700; letter-spacing: .08em; }
.menu-card .name { font-size: 16px; font-weight: 700; margin: 2px 0 6px; }
.menu-card .desc { font-size: 13px; color: var(--ink-soft); }
.menu-card.stats { border-left-color: var(--accent); }

/* ---------- 数値タイル ---------- */
.tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.tile .label { font-size: 12px; color: var(--ink-soft); }
.tile .value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.tile .value small { font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-left: 2px; }
.tile .sub { font-size: 12px; color: var(--ink-soft); }
.tile.danger { border-color: #f3b6ae; background: #fdf3f2; }
.tile.warn { border-color: #f2d091; background: #fffaf0; }

/* ---------- テーブル ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
thead th {
  background: #eef2f7; color: var(--navy); font-weight: 700;
  position: sticky; top: 0; border-bottom: 2px solid #ccd6e4;
}
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; background: #f4f7fa; border-top: 2px solid #ccd6e4; }
table.compact th, table.compact td { padding: 5px 8px; }

.row-danger { background: #fdf3f2 !important; }
.row-warn { background: #fffaf0 !important; }

/* ---------- バッジ ---------- */
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; border: 1px solid transparent;
}
.badge-danger { background: #fee4e2; color: var(--danger); border-color: #fca19a; }
.badge-warn { background: #fef0c7; color: var(--warn); border-color: #f5c97b; }
.badge-note { background: #e0f2fe; color: #026aa2; border-color: #a5dcf7; }
.badge-ok { background: #dcfae6; color: var(--ok); border-color: #96e0b3; }
.badge-muted { background: #eef1f5; color: var(--ink-soft); border-color: var(--line); }

/* ---------- フォーム ---------- */
label { font-size: 13px; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-weight: 700; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
select, input[type=text], input[type=date], input[type=number] {
  font: inherit; padding: 7px 10px; border: 1px solid #c3ccd8;
  border-radius: 6px; background: #fff; min-width: 200px;
}
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.check input { margin-top: 4px; }

.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  padding: 9px 18px; border-radius: 6px; border: 1px solid var(--navy);
  background: var(--navy); color: #fff; text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--navy-soft); }
.btn.secondary { background: #fff; color: var(--navy); }
.btn.secondary:hover { background: #eef2f7; }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: #932016; }
.btn.small { padding: 5px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- アラート ---------- */
.alert {
  padding: 11px 14px; border-radius: 8px; margin-bottom: 14px;
  border: 1px solid; font-size: 13.5px;
}
.alert-success { background: #ecfdf3; border-color: #a6e9c5; color: #05603a; }
.alert-danger  { background: #fef3f2; border-color: #fca19a; color: #912018; }
.alert-warning { background: #fffaeb; border-color: #f5c97b; color: #93370d; }
.alert-info    { background: #eff8ff; border-color: #a5dcf7; color: #026aa2; }
.alert strong { display: block; margin-bottom: 2px; }

/* ---------- 進捗 ---------- */
.progress { height: 8px; background: #e4e9f0; border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .3s; }

.console {
  background: #10161f; color: #d8e0ea; border-radius: 8px;
  padding: 14px 16px; font-family: "Consolas", "Cascadia Mono", monospace;
  font-size: 12.5px; line-height: 1.6; height: 420px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all;
}
.console .err { color: #ff9a8f; }

/* ---------- 棒グラフ ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding-top: 8px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.bars .bar {
  width: 100%; max-width: 46px; background: var(--navy-soft);
  border-radius: 4px 4px 0 0; min-height: 2px; position: relative;
}
.bars .bar.ot { background: var(--warn); }
.bars .bar.empty { background: #e4e9f0; }
.bars .bar-val { font-size: 11px; color: var(--ink-soft); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels div { flex: 1; text-align: center; font-size: 11px; color: var(--ink-soft); }

/* ---------- ヒートバー(到達率) ---------- */
.meter { display: flex; align-items: center; gap: 8px; }
.meter .track { flex: 1; min-width: 70px; height: 7px; background: #e4e9f0; border-radius: 999px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--ok); }
.meter .fill.warn { background: #f79009; }
.meter .fill.danger { background: var(--danger); }
.meter .pct { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 46px; text-align: right; }

/* ---------- タブ ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-weight: 700; font-size: 13.5px; cursor: pointer;
  background: none; border: none; padding: 9px 16px; color: var(--ink-soft);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs button:hover { color: var(--navy); }
.tabs button.active { color: var(--navy); border-bottom-color: var(--accent); }
.tabpane { display: none; }
.tabpane.active { display: block; }

.note { font-size: 12px; color: var(--ink-soft); background: #f7f9fc;
        border-left: 3px solid #ccd6e4; padding: 10px 12px; border-radius: 0 6px 6px 0; }
.note ul { margin: 4px 0 0; padding-left: 18px; }
.muted { color: var(--ink-soft); }
.mono { font-family: "Consolas", monospace; font-size: 12.5px; }
.right { text-align: right; }
.spacer { height: 10px; }
