:root { --accent:#1a6e5a; --bg:#f7f6f2; --warn:#c0392b; --line:#ddd8cc; }
* { box-sizing:border-box; }
body { font-family:"Hiragino Sans","Yu Gothic",sans-serif; margin:0; background:var(--bg); color:#2b2b26; }
nav { background:#1f3a33; padding:10px 18px; display:flex; gap:18px; align-items:center; flex-wrap:wrap; }
nav a { color:#e8e4d8; text-decoration:none; font-size:14px; }
nav a:hover { text-decoration:underline; }
nav .brand { color:#fff; font-weight:bold; margin-right:8px; }
main { padding:20px; max-width:1200px; margin:0 auto; }
h1 { font-size:20px; } h2 { font-size:16px; margin-top:28px; }
table { border-collapse:collapse; width:100%; background:#fff; font-size:13px; }
th, td { border:1px solid var(--line); padding:6px 9px; text-align:left; }
th { background:#efece3; }
td.num, th.num { text-align:right; font-variant-numeric:tabular-nums; }
.badge { background:#888; color:#fff; border-radius:9px; padding:1px 7px; font-size:11px; }
.badge.warn { background:var(--warn); }
.alertbar { background:#fdf0ee; border-bottom:1px solid #ecc; padding:6px 18px; display:flex; gap:16px; flex-wrap:wrap; font-size:13px; }
.alertbar a { color:var(--warn); text-decoration:none; }
.cards-row { display:flex; gap:16px; flex-wrap:wrap; margin:16px 0; }
.kpi { background:#fff; border:1px solid var(--line); border-radius:8px; padding:14px 20px; min-width:170px; }
.kpi .label { font-size:12px; color:#777; }
.kpi .value { font-size:22px; font-weight:bold; margin-top:4px; }
.kpi .value.neg { color:var(--warn); }
.charts { display:flex; gap:24px; flex-wrap:wrap; }
.chart-box { background:#fff; border:1px solid var(--line); border-radius:8px; padding:12px; flex:1; min-width:320px; max-width:560px; }
form.inline { display:inline; }
button, .btn { background:var(--accent); border:none; color:#fff; padding:5px 12px; border-radius:5px; cursor:pointer; font-size:13px; }
button.secondary { background:#999; }
button.danger { background:var(--warn); }
select, input[type=text], input[type=number], input[type=month], input[type=date], input[type=file] {
  padding:4px 6px; border:1px solid var(--line); border-radius:4px; font-size:13px; background:#fff; }
.muted { color:#888; font-size:12px; }
.ok { color:var(--accent); }
.err { color:var(--warn); }
.panel { background:#fff; border:1px solid var(--line); border-radius:8px; padding:14px 18px; margin:14px 0; }
.tag { display:inline-block; background:#e8f0ed; color:var(--accent); border-radius:4px; padding:0 6px; font-size:11px; margin-left:6px; }
.anomaly { background:#fff6e8; border:1px solid #ecd9b0; border-radius:6px; padding:8px 12px; margin:6px 0; font-size:13px; }
.htmx-indicator { display:none; color:var(--accent); font-size:12px; white-space:nowrap; }
.htmx-indicator.htmx-request { display:inline-block; }
.spinner { display:inline-block; width:11px; height:11px; border:2px solid var(--accent);
  border-top-color:transparent; border-radius:50%; vertical-align:-2px;
  animation:spin 0.7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* 閲覧のみ(viewer)ユーザーは編集UIを非表示にして混乱を防ぐ。サーバー側でも403で拒否済み。 */
body.viewer form,
body.viewer button,
body.viewer select,
body.viewer input[type=text],
body.viewer input[type=password],
body.viewer input[type=number],
body.viewer input[type=month],
body.viewer input[type=date],
body.viewer input[type=file] { display:none !important; }
/* 月切替・年度切替の select は残したいので個別に許可 */
body.viewer form.inline select,
body.viewer h1 form select { display:inline-block !important; }
body.viewer h1 form { display:inline !important; }
body.viewer nav a[href="/import"] { display:none; }
