/* =========================================================================
   DC Team Hub — スマホ最優先のスタイル
   ビルド不要。このファイル1本だけを読み込む。
   ========================================================================= */

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #1b2733;
  --ink-soft: #5b6b7b;
  --line: #dde3ea;
  --brand: #1d6fa5;
  --brand-dark: #14547e;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --warn: #b7791f;
  --warn-bg: #fdf6e3;
  --ok: #1e7f52;
  --ok-bg: #e8f6ef;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 12px rgba(16, 32, 48, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  padding-bottom: 72px; /* 下部メニューぶん */
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ ヘッダ */

.appbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--brand); color: #fff;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
}
.appbar a { color: #fff; }
.appbar .brand { font-weight: 700; font-size: 16px; letter-spacing: .02em; }
.appbar .spacer { flex: 1; }
.appbar .who { font-size: 12px; opacity: .9; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 14px; }

/* ------------------------------------------------------------------ 見出し */

h1 { font-size: 20px; margin: 4px 0 12px; }
h2 { font-size: 16px; margin: 22px 0 10px; padding-left: 10px; border-left: 4px solid var(--brand); }
h3 { font-size: 14px; margin: 16px 0 8px; color: var(--ink-soft); }

.lead { color: var(--ink-soft); font-size: 13px; margin: 0 0 12px; }

/* ------------------------------------------------------------------ カード */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 14px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.card-list { display: grid; gap: 10px; }

/* 行（タップしやすい大きさ） */
.row {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  color: inherit;
}
a.row:hover { text-decoration: none; border-color: var(--brand); }
.row .row-title { font-weight: 600; }
.row .row-sub { font-size: 12.5px; color: var(--ink-soft); }
.row.alert { border-left: 4px solid var(--danger); }
.row.warn { border-left: 4px solid var(--warn); }

/* ------------------------------------------------------------------ 数字タイル */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; text-align: center; box-shadow: var(--shadow); color: inherit;
}
a.tile:hover { text-decoration: none; border-color: var(--brand); }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.2; }
.tile .t { font-size: 12px; color: var(--ink-soft); }
.tile.danger { background: var(--danger-bg); border-color: #f5c6c0; }
.tile.danger .n { color: var(--danger); }
.tile.warn { background: var(--warn-bg); border-color: #efe0b4; }
.tile.warn .n { color: var(--warn); }
.tile.ok .n { color: var(--ok); }

/* ------------------------------------------------------------------ バッジ */

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px; border: 1px solid transparent;
  white-space: nowrap;
}
.badge.gray { background: #eef1f4; color: var(--ink-soft); border-color: #dde3ea; }
.badge.red { background: var(--danger-bg); color: var(--danger); border-color: #f3c9c3; }
.badge.yellow { background: var(--warn-bg); color: var(--warn); border-color: #eddfb5; }
.badge.green { background: var(--ok-bg); color: var(--ok); border-color: #c7e6d6; }
.badge.blue { background: #e8f1f8; color: var(--brand-dark); border-color: #c8dcec; }

/* ------------------------------------------------------------------ テーブル */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--panel); }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f7f9fb; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

/* ------------------------------------------------------------------ フォーム */

form { margin: 0; }
label { display: block; font-size: 12.5px; color: var(--ink-soft); margin: 10px 0 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 16px; /* iOSで拡大させない */
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 90px; line-height: 1.7; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9d6ea; border-color: var(--brand); }

.field-row { display: grid; gap: 10px; }
@media (min-width: 640px) { .field-row.two { grid-template-columns: 1fr 1fr; } .field-row.three { grid-template-columns: 1fr 1fr 1fr; } }

.btn {
  display: inline-block; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; text-align: center;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.sub { background: #fff; color: var(--brand); }
.btn.ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ------------------------------------------------------------------ お知らせ */

.flash { background: var(--ok-bg); border: 1px solid #c7e6d6; color: #14603d;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px; }
.errors { background: var(--danger-bg); border: 1px solid #f3c9c3; color: var(--danger);
  padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px; }
.errors ul { margin: 4px 0 0; padding-left: 18px; }
.empty { color: var(--ink-soft); font-size: 13px; padding: 14px; text-align: center;
  background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); }

/* ------------------------------------------------------------------ 切替タブ */

.switch { display: inline-flex; border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; background: #fff; margin-bottom: 12px; }
.switch a { padding: 7px 16px; font-size: 13px; color: var(--ink-soft); }
.switch a:hover { text-decoration: none; background: #f2f6f9; }
.switch a.on { background: var(--brand); color: #fff; }

/* ------------------------------------------------------------------ 時系列 */

.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 14px; }
.timeline .item { position: relative; margin-bottom: 14px; }
.timeline .item::before {
  content: ''; position: absolute; left: -21px; top: 7px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff;
}
.timeline .when { font-size: 12px; color: var(--ink-soft); }

/* LINEの吹き出し */
.chat { display: grid; gap: 8px; }
.bubble { max-width: 82%; padding: 9px 12px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble .meta { display: block; font-size: 11px; opacity: .75; margin-top: 4px; }
.bubble.in { background: #fff; border: 1px solid var(--line); justify-self: start; }
.bubble.out { background: #dcf3e3; border: 1px solid #bfe4cd; justify-self: end; }
.bubble.draft { background: #fdf6e3; border: 1px dashed #d8c07a; justify-self: end; }

/* ------------------------------------------------------------------ 下部メニュー */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  /* 項目数を決め打ちしない。数を変えたときに右端が空くのを防ぐ */
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  padding: 8px 2px 10px; text-align: center; font-size: 10.5px; color: var(--ink-soft);
  line-height: 1.3;
}
.tabbar a:hover { text-decoration: none; background: #f4f8fb; }
.tabbar a.on { color: var(--brand); font-weight: 700; box-shadow: inset 0 2px 0 var(--brand); }
.tabbar .ic { display: block; font-size: 17px; line-height: 1.2; }
.tabbar .dot { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 2px;
  background: var(--danger); color: #fff; border-radius: 999px; font-size: 10px; font-weight: 700; }

/* ------------------------------------------------------------------ 小物 */

.muted { color: var(--ink-soft); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.mt { margin-top: 14px; }
.mb0 { margin-bottom: 0; }
.raw {
  background: #fbfcfd; border: 1px solid var(--line); border-radius: 8px; padding: 12px;
  white-space: pre-wrap; word-break: break-word; font-size: 13px; max-height: 380px; overflow: auto;
}
.pager { display: flex; gap: 6px; justify-content: center; margin: 14px 0; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 11px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; font-size: 13px; }
.pager .on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* --------------------------------------------------------------------
   今日画面の一覧（スマホでも押しやすく、1行が長くならないように）
   -------------------------------------------------------------------- */
.row-card {
  display: block;
  padding: 10px 12px;
  margin: 6px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: var(--panel);
}
.row-card:active { border-color: var(--brand); }
.row-card .row-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
}
.row-card .row-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-soft);
  word-break: break-word;
}
.row-card .red { color: var(--danger); font-weight: 700; }

/* 件数のタイルはリンクにしても見た目を変えない */
a.tile { text-decoration: none; color: inherit; }

@media (max-width: 480px) {
  .row-card { padding: 12px; }         /* 指で押せる大きさにする */
  .row-card .row-main strong { display: block; width: 100%; }
}

/* ------------------------------------------------------ 拠出額トラッカー */

/* 言われた額と出した額がずれている行。ここだけは見落とされては困る */
tr.mismatch td { background: var(--danger-bg); }
tr.mismatch td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.red { color: var(--danger); }

/* 定型文（ワンタップコピー） */
.tpl { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.tpl:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.tpl .row-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tpl textarea { font-size: 13px; line-height: 1.7; background: #fbfcfd; }

/* 社員名は折り返さない。表は横スクロールするので、
   狭い画面で「社員 / A / 山田 / 工業」と4行に割れるほうが読みにくい */
tr.mismatch td:first-child, .table-scroll td:first-child { white-space: nowrap; }
.table-scroll td:first-child .small { white-space: nowrap; }

/* 今日画面の「期限未設定」をその場で片付けるフォーム */
.quick-date { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.quick-date input[type=date] { width: auto; margin: 0; }
