/* 工数管理システム 共通スタイル（デザイン指針 04_デザイン指針.md に準拠） */
:root {
  --accent: #1f6b48;          /* システムカラー: 深緑（2026-09-09 決定） */
  --accent-dark: #185338;
  --accent-tint: #e9f0ed;
  --danger: #b3261e;
  --danger-tint: #fbeeed;
  --text: #1f1f1f;
  --text-sub: #555;
  --line: #d0d4da;
  --line-strong: #8a8f98;
  --surface: #f4f5f7;
  --surface-2: #e9ecf0;
  --zebra: #fafbfc;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "BIZ UDPGothic", "Meiryo", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text); background: #fff;
  font-feature-settings: "palt" 0;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; }
p { margin: 0 0 8px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.sub { color: var(--text-sub); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }

/* ---- 全体レイアウト ---- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.brand { padding: 14px 16px 12px; font-weight: 700; font-size: 15px; background: var(--accent); color: #fff; border-bottom: 1px solid var(--accent-dark); }
.brand:hover { text-decoration: none; }
.nav { padding: 8px 0; }
.nav a {
  display: block; padding: 8px 16px 8px 13px; color: var(--text); border-left: 3px solid transparent;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { border-left-color: var(--accent); font-weight: 700; background: var(--accent-tint); }
.nav .group { padding: 12px 16px 4px; font-size: 11px; color: var(--text-sub); font-weight: 700; letter-spacing: .04em; }
.userbox { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; }
.userbox .name { font-weight: 700; font-size: 13px; }
.userbox form { display: inline; }
.userbox button { background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 12px; }
.userbox button:hover { text-decoration: underline; }
.main { flex: 1; min-width: 0; padding: 20px 28px 40px; }

/* ---- 見出し ---- */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 2px solid var(--accent); margin-bottom: 16px; }
.page-title { font-size: 18px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.section { margin-top: 20px; }
.section-title {
  font-size: 14px; padding-left: 9px; border-left: 3px solid var(--accent); margin-bottom: 8px;
  display: flex; align-items: center; gap: 12px;
}
.section-title .actions { margin-left: auto; font-weight: 400; font-size: 13px; display: flex; gap: 12px; }

/* ---- 表 ---- */
.table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.table th { background: var(--accent-tint); text-align: left; font-weight: 700; padding: 6px 10px; border-bottom: 2px solid var(--accent); white-space: nowrap; }
.table td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: var(--zebra); }
.table tr.subrow td { background: #fff; color: var(--text-sub); }
.table tr.grouprow td { font-weight: 700; }
.table td.empty { text-align: center; color: var(--text-sub); padding: 24px; }
.table .num, .table th.num { text-align: right; }
.table a.rowlink { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-strong); }
.table a.rowlink:hover { color: var(--accent); }
.table td.muted { color: var(--text-sub); }
.table td.weekend { background: var(--surface) !important; }
.table .sat { color: #1f4e8c; } .table .sun { color: var(--danger); }
.table.compact th, .table.compact td { padding: 4px 8px; }

/* ---- ボタン ---- */
.btn {
  display: inline-block; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 3px; background: #fff;
  color: var(--text); font: inherit; font-size: 13px; line-height: 1.4; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-tint); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-link { border: none; background: none; padding: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-block { display: block; width: 100%; text-align: center; padding: 9px; }

/* ---- フォーム ---- */
.field { margin-bottom: 12px; }
.field label, .label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 3px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 3px; font: inherit; font-size: 14px;
  background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input.w-auto, select.w-auto { width: auto; }
.help { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.errorlist { list-style: none; margin: 3px 0 0; padding: 0; color: var(--danger); font-size: 12px; }
.error { color: var(--danger); font-size: 13px; }
.radios { display: flex; gap: 16px; }
.radios label { font-weight: 400; font-size: 14px; display: inline-flex; align-items: center; gap: 4px; }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { margin-bottom: 0; flex: 1 1 160px; }
.form-row .field.narrow { flex: 0 0 auto; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.checkbox label { font-weight: 400; display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }

/* ---- 面・通知・状態 ---- */
.panel { border: 1px solid var(--line); padding: 14px 16px; background: #fff; }
.panel.gray { background: var(--surface); }
.notice { padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-tint); margin-bottom: 12px; }
.notice.error { border-left-color: var(--danger); background: var(--danger-tint); color: var(--text); font-size: 14px; }
.status { border-left: 4px solid var(--accent); background: var(--accent-tint); padding: 12px 16px; }
.status.warn { border-left-color: var(--danger); background: var(--danger-tint); }
.status .head { font-weight: 700; font-size: 13px; }
.status .elapsed { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.topbar { border-bottom: 1px solid var(--line); padding: 6px 28px; background: var(--accent-tint); font-size: 13px; display: flex; gap: 12px; align-items: center; }
.topbar.warn { background: var(--danger-tint); }
.topbar .spacer { margin-left: auto; }

/* ---- 2カラム ---- */
.cols { display: flex; gap: 24px; align-items: flex-start; }
.cols > .col-fixed { flex: 0 0 auto; }
.cols > .col { flex: 1; min-width: 0; }
.summary { display: flex; gap: 24px; align-items: baseline; }
.summary .value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
/* 100%積み上げ横棒（作業区分別の割合）
   色はデザインのアクセントとは独立した、色覚多様性を検証済みの分類用パレット（固定順）。 */
.stack-wrap { margin-top: 4px; }
.stack { display: flex; width: 100%; height: 28px; border: 1px solid var(--text-sub); background: #fff; padding: 2px; gap: 2px; }
.stack .seg { height: 100%; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; white-space: nowrap; color: #fff; min-width: 2px; }
.stack .seg.light { color: var(--text); }
.stack-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-sub); margin-top: 3px; font-variant-numeric: tabular-nums; }
.stack-axis span { position: relative; padding-top: 4px; }
.stack-axis span::before { content: ""; position: absolute; top: 0; height: 4px; border-left: 1px solid var(--text-sub); }
.stack-axis span:first-child::before { left: 0; } .stack-axis span:last-child::before { right: 0; }
.stack-axis span:nth-child(2)::before, .stack-axis span:nth-child(3)::before, .stack-axis span:nth-child(4)::before { left: 50%; }
.legend { border-collapse: collapse; margin-top: 10px; }
.legend td { padding: 2px 12px 2px 0; font-size: 13px; }
.legend .swatch { display: inline-block; width: 12px; height: 12px; vertical-align: -1px; }
.c0 { background: #2a78d6; } .c1 { background: #eb6834; } .c2 { background: #1baf7a; } .c3 { background: #eda100; }
.c4 { background: #e87ba4; } .c5 { background: #008300; } .c6 { background: #4a3aa7; } .c7 { background: #e34948; }
.c8, .c9, .c10, .c11 { background: #8a8f98; }
/* 時間＋分 入力 */
.hm-input { display: flex; align-items: center; gap: 6px; }
.hm-input input { width: 70px; text-align: right; }
.hm-input span { font-size: 13px; }

/* ---- ログイン ---- */
.login-wrap { max-width: 380px; margin: 60px auto; }
.login-wrap .title { font-size: 20px; margin-bottom: 4px; }
.divider { border-top: 1px solid var(--line); margin: 20px 0; }
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; }

/* ---- 日付ナビ ---- */
.datenav { display: flex; align-items: center; gap: 10px; }
.datenav .current { font-size: 18px; font-weight: 700; }


/* ---- タイマー（メイン画面） ---- */
.timer-wrap { max-width: 640px; margin: 8px auto 0; }
.wb { display: grid; grid-template-columns: 420px minmax(440px, 1fr); gap: 32px; align-items: start; max-width: 1480px; margin: 12px auto 0; }
.wb-side { min-width: 0; }
.tcard { border: 1px solid var(--line); border-top: 4px solid var(--accent); background: #fff; padding: 20px 24px 24px; }
.tcard.is-running { border-top-color: var(--accent); background: var(--accent-tint); }
.tcard.is-stale { border-top-color: var(--danger); background: var(--danger-tint); }
.tcard.is-record { border-top-color: var(--accent); }
.tcard-head { display: flex; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px; }
.tcard-head.warn { border-bottom-color: var(--danger); }
.tcard-head .sub { margin-left: auto; }
.tcard-title { font-size: 15px; font-weight: 700; }
.tcard-body { padding: 4px 0 8px; }
.tcard-body.center { text-align: center; padding: 20px 0 24px; }
.tcard-cat { font-size: 22px; font-weight: 700; }
.tcard-elapsed { font-size: 56px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; margin-top: 8px; }
.tcard-foot { margin-top: 12px; text-align: right; }
.btn-big { display: block; width: 100%; padding: 14px; font-size: 17px; margin-top: 12px; }
.btn-big:disabled { background: var(--surface-2); border-color: var(--line); color: var(--text-sub); cursor: not-allowed; }
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cat { position: relative; display: block; }
.cat input { position: absolute; opacity: 0; width: 0; height: 0; }
.cat span { display: block; border: 1px solid var(--line-strong); border-radius: 3px; padding: 12px 6px; text-align: center; font-weight: 700; cursor: pointer; background: #fff; white-space: nowrap; font-size: 13px; }
.ico { display: inline-block; width: 18px; height: 18px; vertical-align: -4px; margin-right: 6px; }
.ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cat span:hover { background: var(--surface); }
.cat input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-detail { min-height: 20px; margin: 10px 0 0; }
.tcard textarea { resize: vertical; }

.tcard-sub { display: inline-block; margin-left: 10px; font-size: 15px; font-weight: 400; color: var(--text-sub); }

/* ---- 作業台: 今日のタイムライン・合計 ---- */
.tl { position: relative; height: 34px; border: 1px solid var(--text-sub); background: #fff; margin: 6px 0 2px; }
.tl-seg { position: absolute; top: 3px; bottom: 3px; border-right: 2px solid #fff; }
.tl-seg.tl-running { opacity: .55; background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.5) 0 4px, transparent 4px 8px); }
.tl-now { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--danger); }
.tl-axis { position: relative; height: 16px; font-size: 11px; color: var(--text-sub); }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; margin-top: 6px; align-items: center; }
.tl-legend .swatch { display: inline-block; width: 11px; height: 11px; vertical-align: -1px; margin-right: 4px; }
.kpis { display: flex; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 14px; }
.kpi { flex: 1; padding: 8px 12px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: none; }
.kpi .k { font-size: 12px; font-weight: 700; color: var(--text-sub); }
.kpi .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- 幅による切替（デザイン指針: 1120未満で縦積み、560未満で集中表示） ---- */
/* ノートPCなど中間サイズでは全体を少し縮小（ブラウザ90%相当） */
@media (min-width: 1120px) and (max-width: 1599px) { body { zoom: 0.9; } .app { min-height: calc(100vh / 0.9); } }
@media (max-width: 1119px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .brand { padding: 8px 12px; font-size: 13px; }
  .sidebar .nav { padding: 2px 6px; display: flex; flex-wrap: wrap; gap: 2px; }
  .sidebar .nav a { padding: 5px 9px; font-size: 13px; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar .nav a.active { border-bottom-color: var(--accent); }
  .sidebar .nav .group { display: none; }
  .sidebar .userbox { display: flex; gap: 8px; align-items: baseline; padding: 2px 12px 6px; border-top: none; margin-top: 0; }
  .sidebar .userbox .name { font-size: 12px; }
  .main { padding: 14px 16px 24px; }
  .wb { grid-template-columns: 1fr; }
  .kpis { flex-wrap: wrap; }
  .kpi { flex: 1 1 45%; border-bottom: 1px solid var(--line); }
  .cols { flex-direction: column; }
  .topbar { padding: 6px 16px; }
}
@media (max-width: 559px) {
  .wb-side { display: none; }
  .tcard { border-top-width: 6px; overflow: hidden; }
  .tcard.is-running { box-shadow: inset 0 0 0 3px var(--accent); }
  .cat span { padding: 18px 8px; font-size: 15px; }
  .tcard-elapsed { font-size: clamp(40px, 12vw, 72px); }
  .tcard-cat { font-size: 24px; }
}
