/* SCBM 管理画面（モバイルファースト）— 黒ベース・モノトーン＋エレクトリックブルー */
:root {
  color-scheme: dark;
  --bg: #050506; --card: #0d0e11; --card-2: #14161a; --ink: #f5f7fa; --muted: #8d94a0; --line: #1e2127; --line-2: #2c3039;
  --brand: #3d8bff; --brand-2: #7ab0ff; --brand-soft: rgba(61,139,255,.14); --glow: rgba(61,139,255,.35);
  --primary: #f5f7fa; --primary-ink: #050506;
  --danger: #ff5c6c; --danger-bg: rgba(255,92,108,.12);
  --warn: #ffd23f; --warn-bg: transparent;
  --ok: #37e0a0; --ok-bg: rgba(55,224,160,.11);
  --info: #5fd4ff; --info-bg: rgba(95,212,255,.11);
  --radius: 14px; --tap: 44px;
  --display: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-family: "Helvetica Neue", Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.65; -webkit-font-smoothing: antialiased;
  background: radial-gradient(900px 420px at 50% -160px, rgba(61,139,255,.16), transparent 70%) no-repeat, var(--bg); min-height: 100vh; }
::selection { background: var(--brand); color: #fff; }
a { color: var(--brand-2); text-underline-offset: 3px; }
h2 { font-size: 1.05rem; margin: 1.2rem 0 .6rem; letter-spacing: .02em; }
h3 { font-size: .78rem; margin: 1rem 0 .4rem; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
main { padding: 14px 14px calc(88px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }
main.bare { padding-top: 64px; max-width: 420px; }
main.bare::before { content: "SCBM"; display: block; text-align: center; font-family: var(--display); font-size: 2.6rem; letter-spacing: -.05em; line-height: 1;
  background: linear-gradient(180deg, #fff 30%, #9aa3b2); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 10px; }

/* ヘッダー */
header.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; background: rgba(5,5,6,.78); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); color: var(--ink); padding: 8px 14px; min-height: 56px; border-bottom: 1px solid var(--line); }
header.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--brand) 50%, transparent); opacity: .7; }
header.top a { color: var(--ink); text-decoration: none; }
.brand { font-family: var(--display); font-size: 1.15rem; letter-spacing: -.05em; }
.brand::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-left: 4px; vertical-align: .15em; box-shadow: 0 0 10px var(--glow); }
.back { font-size: 1.9rem; line-height: 1; padding: 0 8px; color: var(--ink) !important; }
.top-title { font-size: .98rem; font-weight: 700; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .02em; }
.pcnav { display: none; }
.more { position: relative; }
.more summary { list-style: none; cursor: pointer; font-size: 1.35rem; padding: 4px 10px; position: relative; border-radius: 10px; }
.more summary:hover { background: var(--card-2); }
.more summary::-webkit-details-marker { display: none; }
.more .dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(61,139,255,.25), 0 0 10px var(--glow); }
.more-menu { position: absolute; right: 0; top: 46px; background: rgba(13,14,17,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); color: var(--ink); border: 1px solid var(--line-2); border-radius: var(--radius); min-width: 230px; box-shadow: 0 24px 50px rgba(0,0,0,.7); padding: 6px; }
.more-menu a, .more-menu .linklike { display: flex; justify-content: space-between; color: var(--ink) !important; padding: 10px 12px; border-radius: 9px; text-decoration: none; width: 100%; text-align: left; }
.more-menu a:hover, .more-menu .linklike:hover { background: var(--card-2); }

/* 下部タブ（スマホ） */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(5,5,6,.86); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; font-size: .7rem; color: var(--muted); text-decoration: none; position: relative; min-height: 58px; justify-content: center; letter-spacing: .04em; }
.tabbar a .ic { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-bottom: 2px; opacity: .7; }
.tabbar a .ic svg { display: block; }
.tabbar a.on { color: var(--ink); font-weight: 700; }
.tabbar a.on .ic { opacity: 1; color: var(--brand-2); }
.tabbar a.on::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 2px; border-radius: 2px; background: var(--brand); box-shadow: 0 0 12px var(--glow); }
.nbadge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; margin-left: 4px; box-shadow: 0 0 10px var(--glow); }
.tabbar .nbadge { position: absolute; top: 3px; left: calc(50% + 6px); margin: 0; }

@media (min-width: 900px) {
  .pcnav { display: flex; gap: 2px; flex-wrap: wrap; }
  .pcnav a { padding: 6px 13px; border-radius: 999px; font-size: .86rem; color: var(--muted) !important; letter-spacing: .03em; transition: color .15s, background .15s; }
  .pcnav a:hover { color: var(--ink) !important; background: var(--card-2); }
  .pcnav a.on { color: var(--primary-ink) !important; background: var(--primary); font-weight: 700; }
  .top-title { flex: 0 1 auto; margin-right: auto; padding-left: 12px; border-left: 1px solid var(--line-2); margin-left: 6px; }
  .tabbar { display: none; }
  main { padding: 24px 20px 48px; }
}

/* カード・一覧 */
.card { background: linear-gradient(180deg, rgba(255,255,255,.025), transparent 60%), var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > h2:first-child { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } .grid.four { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: linear-gradient(180deg, rgba(255,255,255,.03), transparent 70%), var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; position: relative; overflow: hidden; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); }
.kpi::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 1px; background: linear-gradient(90deg, var(--brand), transparent); box-shadow: 0 0 10px var(--glow); }
.kpi .k { color: var(--muted); font-size: .72rem; letter-spacing: .1em; }
.kpi .v { font-size: 1.55rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--danger); }
.pre { white-space: pre-wrap; word-break: break-word; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; letter-spacing: .04em; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list a.item, .list .item { display: block; padding: 12px 8px; text-decoration: none; color: inherit; border-radius: 10px; transition: background .15s; }
.list a.item:hover { background: rgba(255,255,255,.04); }
.list a.item:hover .t { color: var(--brand-2); }
.item .t { font-weight: 650; }
.item .s { color: var(--muted); font-size: .84rem; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 10px 6px; text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: .72rem; white-space: nowrap; letter-spacing: .1em; }
.tbl tbody tr:hover td { background: rgba(255,255,255,.03); }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* バッジ・お知らせ */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid transparent; white-space: nowrap; letter-spacing: .04em; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: rgba(95,212,255,.25); }
.badge.warn { background: transparent; color: var(--warn); border-color: rgba(255,210,63,.55); }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(55,224,160,.25); }
.badge.accent { background: var(--brand-soft); color: var(--brand-2); border-color: rgba(61,139,255,.35); }
.badge.done { background: rgba(255,255,255,.07); color: #d5dae2; border-color: var(--line-2); }
.badge.muted { background: rgba(255,255,255,.04); color: var(--muted); border-color: var(--line); }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: rgba(255,92,108,.3); }

.alert { display: block; border-radius: var(--radius); padding: 11px 14px; margin: 8px 0; text-decoration: none; color: var(--ink); background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.015)); border: 1px solid var(--line-2); border-left-width: 3px; }
.alert .at { font-weight: 700; font-size: .8rem; letter-spacing: .06em; }
.alert.danger { border-left-color: var(--danger); box-shadow: -6px 0 18px -10px var(--danger); }
.alert.danger .at { color: var(--danger); }
.alert.warn { border-left-color: var(--warn); box-shadow: -6px 0 18px -10px var(--warn); }
.alert.warn .at { color: var(--warn); }
.alert.info { border-left-color: var(--info); box-shadow: -6px 0 18px -10px var(--info); }
.alert.info .at { color: var(--info); }

.flash { border-radius: var(--radius); padding: 11px 14px; margin: 10px 0; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(55,224,160,.3); }
.flash.info { background: var(--info-bg); color: var(--info); border-color: rgba(95,212,255,.3); font-size: .85rem; padding: 7px 12px; }
.flash.error { background: var(--danger-bg); color: var(--danger); border-color: rgba(255,92,108,.35); }
.flash ul { margin: 0; padding-left: 1.2em; }

/* フォーム */
form.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field .lbl { font-size: .78rem; font-weight: 600; color: var(--muted); letter-spacing: .08em; }
.hint { color: var(--muted); font-size: .78rem; }
input, select, textarea { font: inherit; font-size: 16px; width: 100%; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #08090b; min-height: var(--tap); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #5b616c; }
input[type=checkbox] { width: auto; min-height: auto; transform: scale(1.3); margin-right: 8px; accent-color: var(--brand); }
textarea { min-height: 110px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(61,139,255,.22); }
.check { display: flex; align-items: center; min-height: var(--tap); }

/* ボタン（メインは白、補助は枠線） */
.btn, button { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 18px; border-radius: 10px; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); text-decoration: none; cursor: pointer; font-weight: 700; letter-spacing: .04em; transition: background .15s, color .15s, border-color .15s, box-shadow .15s, transform .05s; }
.btn:hover, button:hover { background: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.08), 0 8px 24px rgba(61,139,255,.18); }
.btn:active, button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.sub, button.sub { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.sub:hover, button.sub:hover { background: var(--card-2); border-color: #454b56; box-shadow: none; }
.btn.danger, button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover, button.danger:hover { background: #ff7381; box-shadow: 0 8px 24px rgba(255,92,108,.25); }
.btn.block, button.block { width: 100%; }
.btn.sm, button.sm { min-height: 34px; padding: 0 12px; font-size: .84rem; }
button.linklike { background: none; border: 0; padding: 0; min-height: 0; font-weight: 400; color: var(--brand-2); letter-spacing: 0; }
button.linklike:hover { background: none; box-shadow: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fab { position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 15; border-radius: 999px; background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 10px 30px rgba(61,139,255,.45); padding: 0 22px; }
.fab:hover { background: #5a9cff; box-shadow: 0 12px 34px rgba(61,139,255,.55); }
@media (min-width: 900px) { .fab { bottom: 28px; } }

/* タブ・詳細 */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 8px 0; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 0 0 auto; padding: 6px 14px; border-radius: 999px; background: transparent; border: 1px solid var(--line-2); text-decoration: none; color: var(--muted); font-size: .86rem; letter-spacing: .03em; transition: color .15s, border-color .15s; }
.tabs a:hover { color: var(--ink); border-color: #454b56; }
.tabs a.on { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 700; }
dl.kv { display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .8rem; letter-spacing: .06em; }
dl.kv dd { margin: 0; word-break: break-word; }
details.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
details.box > summary { cursor: pointer; font-weight: 600; min-height: 32px; color: var(--ink); }
details.box > summary::marker { color: var(--brand); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.bar { height: 10px; background: linear-gradient(90deg, #1f5fd6, var(--brand) 60%, var(--brand-2)); border-radius: 5px; min-width: 2px; box-shadow: 0 0 12px rgba(61,139,255,.3); }
.bar.neg { background: var(--danger); opacity: .85; box-shadow: none; }
code { background: #181b20; color: #e3e8ef; padding: 1px 5px; border-radius: 5px; font-size: .86em; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.qr { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; background: #181b20; padding: 8px; border-radius: 8px; }
hr { border: 0; border-top: 1px solid var(--line); }

/* スマホではKPIを3列に詰めて表示 */
@media (max-width: 699px) {
  .grid.three:has(> .kpi) { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .grid.three > .kpi { padding: 10px 9px 9px; }
  .grid.three > .kpi::before { left: 9px; right: 9px; }
  .grid.three > .kpi .k { font-size: .64rem; line-height: 1.3; letter-spacing: .03em; }
  .grid.three > .kpi .v { font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* コピー完了・小さなフォームの並び */
button.copied, .btn.copied { background: var(--ok); border-color: var(--ok); color: #04140d; }
.actions form { margin: 0; }

/* 予定：月のカレンダー */
.cal-head { margin: 8px 0 4px; }
.cal-head strong { font-size: 1.1rem; letter-spacing: .04em; }
.cal-legend { gap: 12px; color: var(--muted); margin-bottom: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.dot.scbm { background: var(--danger); }
.dot.tentative { background: repeating-linear-gradient(135deg, var(--danger) 0 2px, transparent 2px 4px); box-shadow: inset 0 0 0 1px var(--danger); }
.dot.busy { background: var(--warn); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 6px 0 14px; }
.cal-wd { background: var(--card-2); text-align: center; font-size: .72rem; color: var(--muted); padding: 6px 0; letter-spacing: .08em; }
.cal-wd.sun, .cal-day.sun .cal-num { color: #ff7a85; }
.cal-wd.sat, .cal-day.sat .cal-num { color: var(--brand-2); }
.cal-day { background: var(--card); min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; overflow: hidden; min-width: 0; transition: background .15s; }
.cal-day:hover { background: var(--card-2); }
.cal-day.out { opacity: .4; }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--brand); }
.cal-num { font-size: .78rem; font-weight: 700; line-height: 22px; min-width: 22px; text-align: center; align-self: flex-start; }
.cal-day.today .cal-num { background: var(--brand); color: #fff !important; border-radius: 999px; box-shadow: 0 0 10px var(--glow); }
.chip { display: block; font-size: .68rem; line-height: 1.35; padding: 1px 4px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 2px solid transparent; }
.chip b { font-weight: 700; }
/* 現場・SCBM は赤、仮押さえは赤のしま模様（点線）、ほかの Googleカレンダーは黄色 */
.chip.scbm { background: rgba(255,92,108,.22); color: #ffd6da; border-left-color: var(--danger); }
.chip.scbm.tentative { background: repeating-linear-gradient(135deg, rgba(255,92,108,.16) 0 4px, rgba(255,92,108,.05) 4px 8px); color: #ff9aa4; border-left: 2px dashed var(--danger); }
.chip.busy { background: rgba(255,210,63,.13); color: #ffe89a; border-left-color: var(--warn); }
.more-n { font-size: .66rem; color: var(--muted); padding-left: 4px; }
@media (max-width: 699px) {
  .cal-day { min-height: 78px; padding: 3px 2px; }
  /* スマホは幅が狭いので、予定名を2行まで折り返して読めるようにする */
  .chip { font-size: .58rem; line-height: 1.25; padding: 1px 2px; white-space: normal; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .chip b { display: none; }
  .cal-legend { gap: 8px; }
}
