/* WAKU-WAKU 業務システム */
:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #f8f9f6;
  --ink: #1d2a2c;
  --ink-2: #3a4a4d;
  --muted: #667578;
  --line: #e1e5de;
  --line-strong: #cdd3ca;

  --primary: #1f7a6d;
  --primary-hover: #17665b;
  --primary-soft: #e2f1ee;
  --primary-ink: #ffffff;
  --side: #183f39;
  --side-2: #1f4f47;
  --side-ink: #dcebe7;

  --danger: #c2412d;
  --danger-soft: #fdece8;
  --warn: #a8660b;
  --warn-soft: #fdf2df;
  --info: #2a67b1;
  --info-soft: #e7f0fb;
  --ok: #2d7f4f;
  --ok-soft: #e4f3ea;

  --fac1: #d06a16;
  --fac1-soft: #fcefe2;
  --fac2: #7552c2;
  --fac2-soft: #efeafb;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 40, 35, .05), 0 2px 8px rgba(20, 40, 35, .04);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  overflow-wrap: anywhere;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
p { margin: 0 0 .6em; }
img { max-width: 100%; }
[hidden] { display: none !important; }
mark { background: #ffe58a; color: inherit; padding: 0 1px; border-radius: 2px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .92em; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.num-danger { color: var(--danger); font-weight: 700; }
.num-warn { color: var(--warn); font-weight: 700; }
.stack > * + * { margin-top: 14px; }
.inline { display: inline; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column;
  padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2fa58f, #1f7a6d); color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 13px; line-height: 1.35; }
.brand-sub { font-size: 11px; opacity: .7; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: 11px; letter-spacing: .08em; opacity: .55; padding: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--side-ink); font-size: 14px; text-decoration: none;
}
.nav a:hover { background: rgba(255,255,255,.07); }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.nav a .icon { opacity: .85; }
.nav-badge { margin-left: auto; background: #e8563f; color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.12); margin-top: 12px; padding-top: 12px; }
.me { display: flex; gap: 10px; align-items: center; padding: 4px 6px 8px; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-weight: 600; font-size: 14px; color: #fff; }
.me-role { font-size: 12px; opacity: .7; }
.foot-links { display: flex; flex-direction: column; gap: 2px; }
.foot-links a, .foot-links .linklike {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border-radius: 8px; font-size: 13px;
  color: var(--side-ink); background: none; border: 0; cursor: pointer; font-family: inherit; text-align: left;
}
.foot-links a:hover, .foot-links .linklike:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.foot-links .icon { width: 16px; height: 16px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; min-height: 60px;
  background: rgba(244, 245, 241, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 19px; font-weight: 700; }
.topbar .menu-btn { display: none; }
.alert-pill {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  background: var(--danger-soft); color: var(--danger); border: 1px solid #f4c7bd;
  padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.alert-pill:hover { text-decoration: none; background: #fbdcd4; }
.content { padding: 22px 28px 60px; max-width: 1320px; width: 100%; }
.scrim { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 25, 22, .4); z-index: 40; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 16px 16px 60px; }
}
/* 車内タブレットは幅に関係なくメニューを引き出し式にする */
.mode-driver .shell { grid-template-columns: 1fr; }
.mode-driver .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); }
.mode-driver.nav-open .sidebar { transform: none; }
.mode-driver.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 25, 22, .4); z-index: 40; }
.mode-driver .topbar .menu-btn { display: inline-grid; }
.mode-driver .topbar { padding: 8px 16px; min-height: 52px; }
.mode-driver .content { max-width: none; padding: 14px 16px 40px; }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; min-height: 38px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: #b9c1b6; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); border-color: transparent; }
.btn-danger-ghost { background: transparent; border-color: #efc4bb; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-lg { min-height: 46px; padding: 11px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: rgba(0,0,0,.05); }
.icon-btn.danger { color: var(--danger); }
.file-btn { cursor: pointer; }

input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink);
  width: 100%; padding: 9px 11px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: #fff;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--primary); margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.req { font-style: normal; font-size: 11px; color: #fff; background: var(--danger); border-radius: 4px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.inline-field input { width: auto; }
.help { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.form-card { padding: 22px; }
.form-card.narrow { max-width: 720px; }
.form-section { font-size: 15px; font-weight: 700; margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section:first-child, form > .form-section:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section small { font-weight: 400; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; margin-bottom: 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.field-allergy textarea { border-color: #efc4bb; background: #fffaf8; }
.field-med textarea { border-color: #bcd3ee; background: #fafcff; }
.field-trait textarea { border-color: #ecd6ad; background: #fffdf7; }
.danger-zone { margin-top: 14px; text-align: right; }
@media (max-width: 1100px) {
  .form-grid.cols-5, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .form-grid.cols-5 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--primary); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 { margin-bottom: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; }
.back-link .icon { width: 16px; height: 16px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { display: inline; }
.empty { color: var(--muted); font-size: 14px; padding: 10px 2px; margin: 0; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--ink-2); }
.empty-state h2 { font-size: 17px; margin-bottom: 8px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar > select { width: auto; min-width: 130px; }
.toolbar-end { margin-left: auto; }
.toolbar > p { margin: 0; }
.search-box { position: relative; flex: 1 1 280px; min-width: 200px; }
.search-box .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 36px; }

.flash { padding: 11px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.flash-ok { background: var(--ok-soft); border-color: #bfe0cc; color: #1f5e39; }
.flash-error { background: var(--danger-soft); border-color: #f1c3b9; color: #8e2c1c; }
.alert { display: flex; gap: 8px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; border: 1px solid; }
.alert .icon { margin-top: 2px; }
.alert-danger { background: var(--danger-soft); border-color: #f1c3b9; color: #8e2c1c; }
.alert-warn { background: var(--warn-soft); border-color: #efd6a8; color: #7a4a06; }
.alert-info { background: var(--info-soft); border-color: #c4d8f1; color: #1e4c85; }

/* ---------- Badges ---------- */
.fac { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: #eef0ec; color: #55625f; }
.fac-1 { background: var(--fac1-soft); color: var(--fac1); }
.fac-2 { background: var(--fac2-soft); color: var(--fac2); }
.fac-bg-1 { background: var(--fac1) !important; }
.fac-bg-2 { background: var(--fac2) !important; }
.kind { display: inline-flex; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.kind-interview { background: #e6effb; color: #245b9e; }
.kind-support { background: #e4f3ea; color: #2a6e46; }
.kind-meeting { background: #f3ebfa; color: #6b3f98; }
.kind-other { background: #eef0ec; color: #55625f; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #eef1ec; color: var(--ink-2); white-space: nowrap; }
.chip .icon { width: 13px; height: 13px; }
.chip-info { background: var(--info-soft); color: var(--info); font-weight: 600; }
.chip-soft { background: var(--primary-soft); color: var(--primary); }
.chip-link { background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink-2); padding: 3px 11px; font-size: 13px; }
.chip-link:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.dir { display: inline-flex; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.dir-pickup { background: #e4f3ea; color: #2a6e46; }
.dir-dropoff { background: #fdf0df; color: #99590c; }
.role { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: #eef0ec; }
.role-admin { background: #fde9e4; color: #a03a26; }
.role-office { background: #e6effb; color: #245b9e; }
.role-instructor { background: #e4f3ea; color: #2a6e46; }
.role-driver { background: #fdf0df; color: #99590c; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #3d8a7d; color: #fff; font-weight: 700; font-size: 14px; }
.avatar-lg { width: 44px; height: 44px; font-size: 18px; }
.avatar-xl { width: 60px; height: 60px; font-size: 24px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.card.table-wrap { padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbf8; }
.row-link { cursor: pointer; }
.row-muted td { color: var(--muted); }
.strong-link { font-weight: 600; color: var(--ink); }
.handover-inline { color: #7a4a06; margin-top: 2px; }
.perm-table .yes { color: var(--primary); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0; }
.pager-info { font-size: 13px; color: var(--muted); }

/* ---------- Tabs / segmented ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs a { padding: 9px 14px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { font-size: 11.5px; background: #eef1ec; border-radius: 999px; padding: 0 7px; margin-left: 3px; color: var(--muted); }
.seg { display: inline-flex; background: #e8ebe5; border-radius: 10px; padding: 3px; }
.seg a { padding: 6px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.seg a:hover { text-decoration: none; }
.seg a.active { background: #fff; color: var(--primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---------- Login ---------- */
.bare-main { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 20% -10%, #d8ece6 0%, transparent 60%), var(--bg); }
.login-wrap { width: 100%; max-width: 440px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 10px 40px rgba(20, 50, 44, .10); padding: 28px; }
.login-card.wide { max-width: 520px; }
.login-wrap:has(.wide) { max-width: 520px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-name { font-size: 17px; }
.login-brand .brand-sub { font-size: 12px; color: var(--muted); opacity: 1; }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); margin-top: 16px; }
.check-list { list-style: none; margin: 0 0 16px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.check-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.check-list .mark { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff; }
.check-list .ok .mark { background: var(--ok); }
.check-list .ng .mark { background: var(--danger); }
.check-list .ng { color: var(--danger); font-weight: 600; }
.check-list small { flex-basis: 100%; padding-left: 24px; font-weight: 400; color: var(--ink-2); }
.demo-box { margin-top: 22px; border-top: 1px dashed var(--line-strong); padding-top: 16px; }
.demo-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.demo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.demo-account { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; font: inherit; text-align: left; }
.demo-account:hover { border-color: var(--primary); background: var(--primary-soft); }
.demo-account strong { font-size: 13px; }
.demo-account span { font-family: var(--mono); font-size: 12px; color: var(--primary); }
.demo-account small { font-size: 11px; color: var(--muted); line-height: 1.35; }
@media (max-width: 440px) { .demo-grid { grid-template-columns: 1fr; } }

/* ---------- Home ---------- */
.greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.greeting-date { color: var(--muted); font-size: 14px; }
.greeting-name { font-size: 21px; font-weight: 700; }
.quick-search { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 8px 8px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.quick-search input { border: 0; box-shadow: none !important; padding: 8px 4px; font-size: 16px; }
.quick-search > .icon { color: var(--muted); width: 20px; height: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); box-shadow: var(--shadow); }
a.stat:hover { border-color: var(--primary); text-decoration: none; }
.stat-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 600; margin-left: 2px; color: var(--muted); }
.stat-note { font-size: 12px; color: var(--danger); font-weight: 600; }
.stat-danger { border-color: #f1c3b9; background: #fffaf8; }
.stat-danger .stat-value { color: var(--danger); }
.stat-warn .stat-value { color: var(--warn); }
.stat-ok .stat-value { color: var(--ok); }

.handover-list { list-style: none; margin: 0; padding: 0; }
.handover-list li + li { border-top: 1px solid var(--line); }
.handover-list a { display: block; padding: 10px 2px; color: var(--ink); }
.handover-list a:hover { text-decoration: none; background: #fcfbf7; }
.handover-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.handover-meta strong { color: var(--ink); font-size: 14px; }
.handover-text { font-size: 14px; margin-top: 3px; padding-left: 10px; border-left: 3px solid #f0c77a; }
.handover-by { font-size: 12px; color: var(--muted); text-align: right; }

.route-mini-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.route-mini { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; color: var(--ink); background: var(--surface-2); }
.route-mini:hover { border-color: var(--primary); text-decoration: none; }
.route-mini-head { display: flex; align-items: center; gap: 6px; }
.route-mini-name { font-weight: 700; font-size: 14px; }
.route-mini-foot { font-size: 12.5px; color: var(--muted); }
.progress { display: block; height: 6px; border-radius: 99px; background: #e5e9e2; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }

/* ---------- Tasks ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row form { display: contents; }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; color: var(--ink); }
.task-main:hover { text-decoration: none; }
.task-main:hover .task-title { color: var(--primary); }
.task-title { font-weight: 600; font-size: 14.5px; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-status-form select { width: auto; min-height: 32px; padding: 3px 8px; font-size: 13px; }
.task-list-full .task-row { padding: 12px 6px; }
.check-btn { width: 24px; height: 24px; flex: none; border-radius: 7px; border: 2px solid #b8c1b5; background: #fff; cursor: pointer; padding: 0; position: relative; }
.check-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.check-btn.checked { background: var(--primary); border-color: var(--primary); }
.check-btn.checked::after, .check-btn:hover::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.check-btn:not(.checked):hover::after { border-color: var(--primary); }
.check-btn.disabled { cursor: default; opacity: .4; }
.check-btn.disabled:hover::after { display: none; }
.due { font-weight: 600; font-size: 12.5px; }
.due-normal { color: var(--ink-2); }
.due-none { color: var(--muted); font-weight: 400; }
.due-soon { color: var(--warn); }
.due-today { color: #fff; background: var(--warn); border-radius: 5px; padding: 0 6px; }
.due-overdue { color: #fff; background: var(--danger); border-radius: 5px; padding: 0 6px; }
.task-row.due-overdue { background: linear-gradient(90deg, #fff4f1, transparent 60%); }

/* ---------- Children ---------- */
.hint-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 16px; font-size: 13px; }
.result-count { font-size: 14px; color: var(--ink-2); }
.child-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.child-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.child-card.inactive { opacity: .65; }
.child-card-head { display: flex; gap: 12px; align-items: center; color: var(--ink); }
.child-card-head:hover { text-decoration: none; }
.child-card-head:hover strong { color: var(--primary); }
.child-card-name { display: flex; flex-direction: column; min-width: 0; }
.child-card-name strong { font-size: 17px; }
.kana { font-size: 11.5px; color: var(--muted); }
.child-card-sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.child-flags { display: flex; flex-direction: column; gap: 5px; }
.flag { font-size: 13px; padding: 5px 9px; border-radius: 8px; line-height: 1.5; }
.flag > span { font-size: 11px; font-weight: 700; margin-right: 6px; padding: 0 5px; border-radius: 4px; }
.flag-allergy { background: #fff1ee; color: #7d2a1c; }
.flag-allergy > span { background: var(--danger); color: #fff; }
.flag-med { background: #eef4fc; color: #1f4577; }
.flag-med > span { background: var(--info); color: #fff; }
.flag-trait { background: #fdf7ea; color: #624208; }
.flag-trait > span { background: #c88a1a; color: #fff; }
.match-list { list-style: none; margin: 0; padding: 8px 0 0; border-top: 1px dashed var(--line-strong); display: flex; flex-direction: column; gap: 4px; }
.match-list a { display: flex; gap: 8px; font-size: 13px; color: var(--ink-2); }
.match-list a:hover { text-decoration: none; color: var(--ink); }
.match-label { flex: none; font-size: 11px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border-radius: 4px; padding: 1px 6px; height: fit-content; white-space: nowrap; }

.child-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .child-layout { grid-template-columns: minmax(0, 1fr); } }
.child-layout > * { min-width: 0; }
.profile-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.profile-name { font-size: 22px; font-weight: 700; line-height: 1.3; }
.profile-sub { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-top: 3px; }
.important { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.imp { border-radius: 10px; padding: 10px 12px; border: 1px solid; }
.imp-label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; margin-bottom: 3px; }
.imp-label .icon { width: 15px; height: 15px; }
.imp-body { font-size: 14px; }
.imp-allergy { background: #fff5f2; border-color: #f4cdc3; }
.imp-allergy .imp-label { color: var(--danger); }
.imp-med { background: #f3f8fe; border-color: #cadcf2; }
.imp-med .imp-label { color: var(--info); }
.imp-trait { background: #fefaf0; border-color: #eedcb4; }
.imp-trait .imp-label { color: #9a6810; }
.kv { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 6px 10px; font-size: 14px; margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; }
.notes { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 10px; }
.notes-label { font-size: 12px; font-weight: 700; color: var(--muted); }
.updated { font-size: 12px; color: var(--muted); }
.plain-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.plain-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: #dfe4dc; }
.tl-month { font-size: 13px; font-weight: 700; color: var(--muted); margin: 6px 0 8px -18px; padding-left: 0; background: var(--bg); position: relative; }
.tl-item { position: relative; margin-bottom: 14px; }
.tl-dot { position: absolute; left: -18px; top: 16px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 2px #cfd6cc; background: #9aa69b; }
.kind-dot-interview { background: #3a78c2; box-shadow: 0 0 0 2px #c4d8f1; }
.kind-dot-support { background: #3a9160; box-shadow: 0 0 0 2px #c3e3cf; }
.kind-dot-meeting { background: #8a58bd; box-shadow: 0 0 0 2px #dfcdf1; }
.tl-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.tl-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-author { color: var(--muted); }
.tl-edit { margin-left: auto; color: var(--muted); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.tl-edit:hover { background: var(--surface-2); color: var(--primary); }
.tl-title { font-size: 15.5px; margin-top: 6px; }
.tl-title a { color: var(--ink); }
.tl-body { font-size: 14px; margin-top: 6px; }
.tl-handover { margin-top: 10px; background: #fff8e8; border-left: 3px solid #e7a93a; border-radius: 0 8px 8px 0; padding: 8px 12px; font-size: 14px; }
.tl-label { display: block; font-size: 11.5px; font-weight: 700; color: #9a6810; }
.tl-todos { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 14px; }
.tl-todos li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-todos li.done a { text-decoration: line-through; color: var(--muted); }
.todo-box { width: 14px; height: 14px; border: 2px solid #b8c1b5; border-radius: 4px; flex: none; }
.tl-todos li.done .todo-box { background: var(--primary); border-color: var(--primary); }
.tl-transcript { margin-top: 10px; font-size: 13.5px; }
.tl-transcript summary { cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 600; }
.tl-transcript > div { margin-top: 8px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; color: var(--ink-2); max-height: 420px; overflow: auto; }

/* ---------- Record view / editor ---------- */
.record-view .record-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 14px; }
.record-badges { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.record-head h2 { font-size: 20px; margin-bottom: 4px; }
.record-sections { display: flex; flex-direction: column; gap: 18px; }
.record-sections h3 { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.prose { font-size: 15px; }
.section-handover .prose { background: #fff8e8; border-left: 3px solid #e7a93a; border-radius: 0 8px 8px 0; padding: 10px 14px; }

.meta-card { padding: 16px 18px; }
.meta-card .form-grid { margin-bottom: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.split-right > .card { margin-bottom: 14px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; font-weight: 700; }
.transcript { font-size: 14px; line-height: 1.7; min-height: 420px; background: #fcfcfa; }
.move-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 10px; background: var(--surface-2); border-radius: 10px; font-size: 13px; color: var(--muted); }
.move-summary { border-color: #b9dccf; color: #20695c; }
.move-handover { border-color: #ecd09a; color: #875a0c; }
.move-todo { border-color: #c4d8f1; color: #245b9e; }
.card-handover { border-color: #eedcb4; background: #fffdf8; }
.todo-list { display: flex; flex-direction: column; gap: 8px; }
.todo-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px 36px; gap: 6px; align-items: center; }
@media (max-width: 640px) { .todo-row { grid-template-columns: 1fr 1fr; } .todo-row input[name="todo_title[]"] { grid-column: span 2; } }
.existing-tasks { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.flash-fill { animation: flashfill 1.2s ease; }
@keyframes flashfill { 0% { background: #fff3c4; } 100% { background: #fff; } }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: rgba(244, 245, 241, .95); backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 12px 0; margin-top: 6px; }

/* ---------- Transport ---------- */
.transport-toolbar { gap: 12px; }
.date-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-nav input[type="date"] { width: auto; }
.date-label { font-size: 15px; margin-left: 4px; }
.popover { position: relative; }
.popover > summary { list-style: none; }
.popover > summary::-webkit-details-marker { display: none; }
.popover-body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 300px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.14); padding: 16px; }
.sync-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-bottom: 14px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: #b3bab1; flex: none; }
.sync-dot.on { background: #2fb36a; box-shadow: 0 0 0 0 rgba(47, 179, 106, .5); animation: pulse 2s infinite; }
.sync-dot.off { background: var(--danger); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47,179,106,.45); } 70% { box-shadow: 0 0 0 8px rgba(47,179,106,0); } 100% { box-shadow: 0 0 0 0 rgba(47,179,106,0); } }

.board-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.board-summary .pill { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.board-summary .pill strong { font-size: 15px; margin-left: 4px; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
@media (max-width: 480px) { .board-grid { grid-template-columns: 1fr; } }
.route-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.route-card.complete { opacity: .8; }
.route-card-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.route-card-head.fac-line-1 { border-top: 4px solid var(--fac1); }
.route-card-head.fac-line-2 { border-top: 4px solid var(--fac2); }
.route-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.route-title strong { font-size: 16px; }
.route-title .edit { margin-left: auto; }
.route-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.route-note { font-size: 13px; background: var(--warn-soft); color: #7a4a06; border-radius: 8px; padding: 5px 9px; }
.route-progress { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.route-progress .progress { flex: 1; }
.stop-list { list-style: none; margin: 0; padding: 0; }
.stop { display: grid; grid-template-columns: 28px 52px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.stop:last-child { border-bottom: 0; }
.stop-seq { width: 24px; height: 24px; border-radius: 50%; background: #eef1ec; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.stop-time { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.stop-who { min-width: 0; }
.stop-who strong { display: block; }
.stop-who .place { font-size: 12.5px; color: var(--muted); }
.stop-who .note { font-size: 12px; color: #7a4a06; }
.stop-side { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.st { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.st-pending { background: #eef1ec; color: var(--muted); }
.st-boarded { background: #e4f3ea; color: #23693f; }
.st-dropped { background: #e6effb; color: #245b9e; }
.st-absent { background: #f1f1f1; color: #8a8a8a; text-decoration: line-through; }
.stop.is-absent strong { color: var(--muted); text-decoration: line-through; }
.stop.changed { animation: changed 2.4s ease; }
@keyframes changed { 0%, 30% { background: #fff3c4; } 100% { background: transparent; } }
.ev { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: #eef1ec; }
.ev-board { background: #e4f3ea; color: #23693f; }
.ev-drop { background: #e6effb; color: #245b9e; }
.ev-absent { background: #f1f1f1; color: #666; }
.ev-undo { background: #fdf0df; color: #99590c; }

/* ---------- Driver tablet ---------- */
.driver { max-width: 980px; margin: 0 auto; }
.driver-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.driver-date { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.driver-sync { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.route-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.route-tab { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 170px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; font: inherit; text-align: left; }
.route-tab.active { border-color: var(--primary); background: var(--primary-soft); }
.route-tab .rt-top { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.route-tab .rt-name { font-weight: 700; font-size: 15px; }
.route-tab .rt-prog { font-size: 12px; color: var(--muted); }
.route-tab .mine { font-size: 11px; font-weight: 700; color: #fff; background: var(--primary); border-radius: 4px; padding: 0 5px; }
.dr-head { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.dr-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dr-title strong { font-size: 20px; }
.dr-meta { color: var(--muted); font-size: 14px; margin-top: 2px; }
.dr-note { margin-top: 8px; background: var(--warn-soft); color: #7a4a06; border-radius: 10px; padding: 8px 12px; font-size: 15px; font-weight: 600; }
.dr-progress { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 14px; font-weight: 600; }
.dr-progress .progress { flex: 1; height: 10px; }
.dr-bulk { margin-top: 12px; }
.dr-bulk .btn { width: 100%; min-height: 56px; font-size: 18px; }
.dr-stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dr-stop { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.dr-stop.next { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.dr-stop.is-done { background: #f7faf8; }
.dr-stop.is-absent { background: #f5f5f5; }
.dr-stop.changed { animation: changed 3s ease; }
.dr-seq { width: 44px; height: 44px; border-radius: 50%; background: #eef1ec; display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.dr-stop.next .dr-seq { background: var(--primary); color: #fff; }
.dr-who strong { font-size: 21px; display: block; line-height: 1.3; }
.dr-stop.is-absent .dr-who strong { text-decoration: line-through; color: var(--muted); }
.dr-place { font-size: 15px; color: var(--ink-2); }
.dr-time { font-family: var(--mono); font-weight: 700; margin-right: 8px; }
.dr-memo { font-size: 14px; color: #7a4a06; font-weight: 600; margin-top: 2px; }
.dr-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 150px; }
.dr-main-btn { min-height: 64px; font-size: 20px; border-radius: 14px; }
.dr-status { text-align: center; font-size: 16px; font-weight: 700; padding: 8px 10px; border-radius: 12px; }
.dr-status small { display: block; font-size: 13px; font-weight: 600; font-family: var(--mono); }
.dr-status.st-boarded { background: #e4f3ea; color: #23693f; }
.dr-status.st-dropped { background: #e6effb; color: #245b9e; }
.dr-status.st-absent { background: #eee; color: #777; text-decoration: none; }
.dr-sub-row { display: flex; gap: 6px; }
.dr-sub-row .btn { flex: 1; }
.btn-absent { color: #666; }
.btn-board { background: #2d8f56; border-color: #2d8f56; color: #fff; }
.btn-board:hover { background: #247647; border-color: #247647; }
.btn-drop { background: #2a67b1; border-color: #2a67b1; color: #fff; }
.btn-drop:hover { background: #215896; border-color: #215896; }
@media (max-width: 640px) {
  .dr-stop { grid-template-columns: 40px minmax(0, 1fr); }
  .dr-actions { grid-column: 1 / -1; }
  .dr-who strong { font-size: 19px; }
}
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; background: #1d2a2c; color: #fff; padding: 14px 22px; border-radius: 14px; font-size: 16px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: calc(100% - 32px); }
.toast.warn { background: #b4531c; }

/* ---------- Route editor ---------- */
.stops-table td { padding: 6px 8px; vertical-align: middle; }
.stops-table th { padding: 8px; }
.stops-table select { min-width: 150px; }
.stops-table input[type="time"] { width: 120px; }
.seq-cell { width: 40px; }
.seq { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #eef1ec; font-weight: 700; font-size: 13px; }
.row-tools { text-align: right; }
.audit-act { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: #eef1ec; }
.audit-child, .audit-record { background: #fde9e4; color: #a03a26; }
.audit-login { background: #e6effb; color: #245b9e; }

@media print {
  .sidebar, .topbar, .toolbar, .actions, .sticky-actions, .tabs { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; }
}
