/* 看板・テント業務管理モック｜配色は要件定義書 第5章の初期値 */
:root {
  --bg: #F5F7FA;
  --panel: #FFFFFF;
  --text: #1F2937;
  --sub: #64748B;
  --line: #DCE3EB;
  --primary: #2563EB;
  --primary-weak: #EAF1FE;
  --ok: #15803D;
  --ok-weak: #E8F5EC;
  --warn: #B45309;
  --warn-weak: #FDF3E4;
  --danger: #B91C1C;
  --danger-weak: #FCEBEB;
  --night: #7C3AED;
  --night-weak: #F1EBFE;
  --neutral-weak: #EEF2F6;
  --radius: 8px;
  --radius-in: 6px;
  --sidebar: 224px;
  --header: 64px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06);
  font-family: "IBM Plex Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); min-height: 100vh; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
code { background: var(--neutral-weak); padding: 1px 4px; border-radius: 4px; font-size: 12px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--panel); padding: 8px 16px; }
.skip:focus { left: 8px; }

.muted { color: var(--sub); }
.small { font-size: 12px; }
.pad { padding: 8px 4px; margin: 0; }
.spacer { flex: 1 1 auto; }
.nowrap { white-space: nowrap; }
.text-danger { color: var(--danger); }
.text-warn { color: var(--warn); }
.text-ok { color: var(--ok); }
.pre { white-space: pre-wrap; word-break: break-word; }
.sun { color: var(--danger); }
.sat { color: var(--primary); }

/* ---------- レイアウト ---------- */
.app { display: flex; min-height: 100vh; background: linear-gradient(to right, #1E293B var(--sidebar), transparent var(--sidebar)); }
.sidebar {
  width: var(--sidebar); flex: 0 0 var(--sidebar); background: #1E293B; color: #E2E8F0;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; z-index: 30;
}
.brand { height: var(--header); display: flex; flex-direction: column; justify-content: center; padding: 0 20px; font-weight: 700; font-size: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand small { font-weight: 400; font-size: 11px; color: #94A3B8; }
.sidebar nav ul { list-style: none; margin: 0; padding: 8px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-in);
  color: #CBD5E1; font-size: 14px; min-height: 40px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-ico { width: 20px; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 16px 20px; font-size: 12px; color: #CBD5E1; display: grid; gap: 4px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot .muted { color: #94A3B8; }
.sidebar-backdrop { display: none; }

.main-wrap { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--header); display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; margin-left: 8px; }
.demo-badge { margin-left: auto; font-size: 12px; color: var(--warn); background: var(--warn-weak); border: 1px solid #F3D9B1; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.icon-btn.menu-btn { display: none; }
main { padding: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; outline: none; }

/* ---------- 基本部品 ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: var(--radius-in);
  font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: #F1F5F9; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: #1D4ED8; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-outline { color: var(--danger); border-color: #F0C4C4; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.link { border-color: transparent; background: transparent; color: var(--primary); padding: 0 6px; }
.btn.link:hover { background: var(--primary-weak); }
.btn.link.danger { color: var(--danger); background: transparent; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid transparent;
  background: transparent; border-radius: var(--radius-in); font-size: 16px; cursor: pointer; color: var(--sub);
}
.icon-btn:hover { background: var(--neutral-weak); color: var(--text); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.small { width: 24px; height: 24px; font-size: 13px; }

input[type=text], input[type=search], input[type=date], input[type=time], input[type=month], input[type=email], input[type=tel], input[type=url], input[type=number], select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-in);
  height: 36px; padding: 0 10px; width: 100%; min-width: 0;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
select.compact { height: 30px; font-size: 13px; padding: 0 6px; width: auto; }
input.num { width: 72px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }
[aria-invalid=true] { border-color: var(--danger) !important; }
.check, .radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; min-height: 32px; }
.check input, .radio input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); flex: 0 0 auto; }
.check.small { font-size: 13px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-size: 12px; font-weight: 600;
  white-space: nowrap; border: 1px solid transparent; vertical-align: middle;
}
.badge.neutral { background: var(--neutral-weak); color: #475569; }
.badge.muted { background: #F1F5F9; color: var(--sub); border-color: var(--line); }
.badge.info { background: var(--primary-weak); color: var(--primary); }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.danger { background: var(--danger-weak); color: var(--danger); }
.badge.night { background: var(--night-weak); color: var(--night); }
.badge + .badge { margin-left: 4px; }

.progress { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.progress-num { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2.6em; }
.progress-bar { width: 96px; height: 6px; background: var(--neutral-weak); border-radius: 3px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; background: var(--warn); }
.progress-bar span.done { background: var(--ok); }
.progress.compact .progress-bar { width: 56px; }
.progress-unset { font-size: 12px; color: var(--sub); border: 1px dashed var(--line); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex: 0 0 auto; }
.dot.lg { width: 16px; height: 16px; }
.empty { text-align: center; color: var(--sub); padding: 16px 8px; display: grid; gap: 8px; justify-items: center; }
.empty p { margin: 0; }
.notice { background: var(--warn-weak); color: var(--warn); border-radius: var(--radius-in); padding: 8px 12px; font-size: 13px; margin: 0; }
.hint { color: var(--sub); font-size: 12px; margin: 4px 0 0; }
.hint.notice { color: var(--warn); }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: inherit; font-size: 12px; cursor: pointer; margin: 2px; }

/* ---------- 一覧・表 ---------- */
.filters { padding: 12px 16px; }
.filter-grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.fl { display: grid; gap: 4px; font-size: 12px; color: var(--sub); min-width: 140px; }
.fl.wide { flex: 1 1 280px; }
.fl.checks { display: flex; gap: 12px; align-items: center; min-height: 36px; color: var(--text); font-size: 13px; }
.fl.inline { display: flex; align-items: center; gap: 8px; }
.fl.inline select { width: auto; }
.filter-foot { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--sub); font-size: 12px; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--sub); font-size: 12px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; }
.table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table.compact td { padding: 4px 8px; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #F8FAFC; }
.table tr.is-done td { color: var(--sub); }
.table tr.is-today td { background: var(--primary-weak); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .chk { width: 36px; }
.table .chk input { width: 18px; height: 18px; accent-color: var(--primary); }
.ellipsis { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs { font-size: 12px; color: var(--sub); }
.summary-row { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; padding: 8px 0; }
.summary-row b { font-size: 16px; }
.sub-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin: 12px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.sub-head.warn { color: var(--warn); }
.member-block + .member-block { margin-top: 4px; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: grid; gap: 2px; border-left-width: 4px; }
.stat span { font-size: 12px; color: var(--sub); }
.stat b { font-size: 24px; font-variant-numeric: tabular-nums; }
.stat.muted-b { border-left-color: #94A3B8; }
.stat.warn-b { border-left-color: var(--warn); }
.stat.ok-b { border-left-color: var(--ok); }
.stat.neutral-b { border-left-color: #475569; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 10px 16px; font: inherit; font-weight: 600; color: var(--sub); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-in); overflow: hidden; }
.seg-btn { border: 0; background: #fff; padding: 0 14px; height: 34px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text); }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { background: var(--primary); color: #fff; }

.dl { display: grid; grid-template-columns: 8em 1fr; gap: 8px 12px; margin: 0; font-size: 13px; }
.dl dt { color: var(--sub); }
.dl dd { margin: 0; min-width: 0; word-break: break-word; }
.inline-dl { grid-template-columns: auto 1fr auto 1fr; }

/* ---------- カレンダー ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav.small input { width: auto; height: 30px; }
.month-title { font-size: 20px; min-width: 7.5em; text-align: center; }
.cal-scroll { overflow-x: auto; }
.cal-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); min-width: 640px; --head-h: 32px; --bar-h: 22px; --more-h: 18px; }
.cal-dows, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { text-align: center; font-size: 12px; font-weight: 600; color: var(--sub); padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #FAFBFC; }
.cal-week { min-height: 112px; row-gap: 2px; }
.cal-cell { grid-row: 1 / -1; padding: 2px 4px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.cal-cell:hover { background: #F8FAFC; }
.cal-cell.out { background: #FAFBFC; }
.cal-cell.out .cal-date { color: #A0AEC0; }
.cal-cell.selected { background: var(--primary-weak); box-shadow: inset 0 0 0 2px var(--primary); }
.cal-cell-head { display: flex; align-items: center; gap: 4px; height: calc(var(--head-h) - 4px); }
.cal-date { border: 0; background: transparent; font: inherit; font-weight: 700; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; color: var(--text); padding: 0; }
.cal-date.sun { color: var(--danger); }
.cal-date.sat { color: var(--primary); }
.cal-cell.today .cal-date { background: var(--primary); color: #fff; }
.today-tag { font-size: 11px; color: var(--primary); font-weight: 700; }
.cal-weather { margin-left: auto; font-size: 15px; }
/* 予定の帯：日をまたぐ予定は開始日〜終了日まで1本でつなぐ */
.cal-bar {
  position: relative; z-index: 1; display: flex; gap: 4px; align-items: center; min-width: 0; height: var(--bar-h);
  margin: 0 3px; padding: 0 6px; border: 0; border-radius: 4px; background: var(--c); color: #fff;
  font: inherit; font-size: 12px; font-weight: 600; text-align: left; cursor: pointer; overflow: hidden; white-space: nowrap;
}
.cal-bar:hover { filter: brightness(1.08); }
.cal-bar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal-bar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-bar.cancelled { text-decoration: line-through; opacity: .5; }
.cal-bar.completed { opacity: .6; }
.cal-bar .arr { font-size: 8px; opacity: .8; }
.cal-bar .t { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 500; }
.cal-bar .n { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal-bar .x { flex: 0 0 auto; font-size: 10px; }
.cal-more { position: relative; z-index: 1; align-self: start; border: 0; background: transparent; font: inherit; font-size: 12px; color: var(--primary); text-align: left; padding: 0 6px; cursor: pointer; }
.legend { margin: 8px 0 0; font-size: 12px; color: var(--sub); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lg { display: inline-block; padding: 0 6px; border-radius: 4px; font-weight: 700; background: var(--c); color: #fff; }


.day-cols { min-width: 0; }
.cat-scroll { display: flex; flex-direction: column; gap: 12px; }
.cat-col { flex: 0 0 auto; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--cat); border-radius: var(--radius); min-width: 0; }
.cat-col-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cat-name { font-weight: 700; }
.count { font-size: 12px; color: var(--sub); }
.cat-col-body { padding: 8px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.cat-col-body > :not(.card) { grid-column: 1 / -1; }
.card { position: relative; border: 1px solid var(--line); border-radius: var(--radius-in); padding: 8px 10px; background: #fff; display: grid; gap: 3px; font-size: 13px; }
.card:hover { border-color: #B8C4D2; background: #FCFDFE; }
.card-hit { position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer; border-radius: inherit; }
.card a, .card button:not(.card-hit), .card input, .card label { position: relative; z-index: 1; }
.card-top { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.card-top .time { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 4px; }
.card-title { font-weight: 600; word-break: break-word; }
.card-sub { color: var(--sub); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ev-item { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 8px 10px; border: 1px solid var(--line); border-left: 4px solid var(--cat, var(--line)); border-radius: var(--radius-in); background: #fff; font-size: 13px; line-height: 1.4; grid-column: 1 / -1; }
.ev-item:hover { background: #F8FAFC; }
.ev-item > :not(.card-hit) { position: relative; pointer-events: none; }
.ev-item .el-cust { color: var(--sub); }
.ev-item .el-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-item .el-title { font-weight: 600; word-break: break-word; }
.ev-item .el-crew b { font-weight: 700; }
.ev-item .el-car { color: var(--sub); }
.ev-item.cancelled { opacity: .6; }
.ev-item.cancelled .el-title { text-decoration: line-through; }
.cal-bar .k, .cal-wx { display: none; }
.segs.cal-view > button { height: 30px; padding: 0 14px; font-size: 13px; }
.task-row .bigcheck { width: 20px; height: 20px; border-radius: 5px; }
.task-row .bigcheck:checked::after { font-size: 12px; }
.rem-list { margin: 2px 0 0; padding-left: 18px; font-size: 12px; }
.col-group { border: 1px solid var(--line); border-radius: var(--radius-in); }
.col-group-head { display: flex; width: 100%; justify-content: space-between; border: 0; background: #FAFBFC; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border-radius: var(--radius-in); }
.col-group-body { padding: 8px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); align-items: start; }
.col-group-body > :not(.card) { grid-column: 1 / -1; }
.task-row { display: grid; gap: 2px; padding: 4px 2px; border-bottom: 1px dashed var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row.is-done .check-label { text-decoration: line-through; color: var(--sub); }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12px; padding-left: 22px; align-items: center; }
.att-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 6px 2px; border-bottom: 1px dashed var(--line); align-items: center; }
.att-row:last-child { border-bottom: 0; }
.att-name { font-weight: 600; }
.att-vals { grid-column: 1 / 2; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; }
.att-row .btn { grid-row: 1 / 3; grid-column: 2; }

/* ---------- 案件詳細 ---------- */
.detail-head { display: grid; gap: 8px; }
.detail-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-title h2 { font-size: 20px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; align-items: center; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.is-done .check-label { color: var(--sub); text-decoration: line-through; }
.check.big { min-height: 36px; font-size: 14px; }
.check.big input { width: 20px; height: 20px; }
.proc-meta { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 12px; flex-wrap: wrap; }
.checklist-head { display: grid; gap: 6px; padding-bottom: 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.checklist-head .sub { color: var(--sub); font-size: 12px; }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-list li { border-bottom: 1px solid var(--line); }
.ev-list li:last-child { border-bottom: 0; }
.ev-list li.cancelled .ev-title { text-decoration: line-through; color: var(--sub); }
.ev-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; border: 0; background: transparent; font: inherit; font-size: 13px; text-align: left; padding: 8px 4px; cursor: pointer; }
.ev-line:hover { background: #F8FAFC; }
.ev-date { font-weight: 700; }
.ev-time { color: var(--sub); font-variant-numeric: tabular-nums; }
.ev-title { flex: 1 1 160px; min-width: 0; }

/* ---------- マニュアル・設定 ---------- */
.link-list, .cat-list { list-style: none; margin: 0; padding: 0; }
.link-list li, .cat-list li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.link-list li:last-child, .cat-list li:last-child { border-bottom: 0; }
.link-main { flex: 1 1 240px; min-width: 0; }
.link-title { font-weight: 600; }
.url { word-break: break-all; }
.link-ops { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.cat-info { display: grid; }
.danger-zone { border-color: #F0C4C4; }
.danger-zone p { margin: 0 0 12px; }
.notfound { text-align: center; display: grid; gap: 12px; justify-items: center; padding: 40px 16px; }
.notfound p { margin: 0; color: var(--sub); }

/* ---------- モーダル・フォーム ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal { background: var(--panel); border-radius: var(--radius); width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
.modal.wide { width: min(760px, 100%); }
.modal.small { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; flex: 1; word-break: break-word; }
.modal-x .t { display: none; }
.modal-body { padding: 16px 24px; overflow-y: auto; display: grid; gap: 4px; align-content: start; }
.modal-body form { display: grid; gap: 12px; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 12px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-msg { margin: 0; }
.confirm-list { margin: 8px 0 0; padding-left: 20px; color: var(--sub); }
.field { display: grid; gap: 4px; min-width: 0; }
.field > label, .field > legend { font-size: 13px; font-weight: 600; }
.field[hidden] { display: none; }
.req { margin-left: 6px; font-size: 11px; color: var(--danger); font-weight: 600; }
.field-error { color: var(--danger); font-size: 12px; min-height: 0; }
.field-error:empty { display: none; }
.form-error { background: var(--danger-weak); color: var(--danger); border-radius: var(--radius-in); padding: 8px 12px; font-size: 13px; }
.form-sub { margin: 0; color: var(--sub); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset.section { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px 16px; margin: 0; display: grid; gap: 8px; min-width: 0; }
fieldset.section legend { font-weight: 700; padding: 0 6px; }
.inline-add { display: flex; gap: 8px; align-items: center; }
.dup-list { font-size: 12px; color: var(--warn); }
.picker { display: grid; gap: 8px; }
.picker-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.picker-list { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.picker-groupbox { display: flex; flex-wrap: wrap; gap: 2px 16px; align-items: center; border: 1px dashed var(--line); border-radius: var(--radius-in); padding: 2px 10px 2px 8px; }
.picker-group { font-size: 12px; color: var(--sub); font-weight: 600; }
.picker-free { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 6px; }
.picker-free .sub { font-size: 12px; color: var(--sub); font-weight: 600; }
.check.new { gap: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { display: grid; justify-items: center; gap: 2px; cursor: pointer; font-size: 11px; color: var(--sub); }
.swatch input { position: absolute; opacity: 0; }
.swatch span { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--text); }
.swatch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 3px; }

#toast-root { position: fixed; right: 24px; bottom: 24px; display: grid; gap: 8px; z-index: 80; }
.toast { background: #0F172A; color: #fff; padding: 10px 16px; border-radius: var(--radius-in); font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .3s; max-width: 360px; }
.toast.ok::before { content: "✓ "; color: #86EFAC; }
.toast.error { background: var(--danger); }
.toast.hide { opacity: 0; }

/* ---------- 1024px前後 ---------- */
@media (max-width: 1180px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .demo-badge { display: none; }
}

/* ---------- スマートフォン ---------- */
@media (max-width: 768px) {
  :root { font-size: 15px; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { box-shadow: 4px 0 24px rgba(0,0,0,.2); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 25; }
  .app { background: none; }
  .icon-btn.menu-btn { display: inline-flex; width: 44px; height: 44px; margin-left: -8px; }
  .sidebar nav a { min-height: 44px; }
  .topbar { padding: 0 12px; gap: 8px; height: 56px; }
  .topbar h1 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-width: 0; }
  .topbar-actions { margin-left: 0; }
  .topbar-actions .btn { padding: 0 10px; }
  main { padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); gap: 12px; }
  .cat-col-body, .col-group-body { grid-template-columns: 1fr; }
  .panel { padding: 12px; }
  .btn { height: 44px; }
  .btn.small { height: 36px; }
  .icon-btn { width: 44px; height: 44px; }
  .check, .radio { min-height: 44px; }
  input[type=text], input[type=search], input[type=date], input[type=time], input[type=month], input[type=email], input[type=tel], input[type=url], input[type=number], select { height: 44px; font-size: 16px; }
  select.compact { height: 36px; font-size: 14px; }
  textarea { font-size: 16px; }
  .fl { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
  .fl.wide { flex-basis: 100%; }
  .grid2 { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .dl, .inline-dl { grid-template-columns: 7em 1fr; }

  .toolbar .month-nav { flex-wrap: wrap; width: 100%; }
  .month-title { font-size: 17px; min-width: 0; flex: 1; }
  .cal-grid { min-width: 0; }
  .cal-grid { --head-h: 28px; --bar-h: 16px; --more-h: 14px; }
  .cal-week { min-height: 72px; row-gap: 1px; }
  .cal-cell { padding: 1px 2px; }
  .cal-bar { margin: 0 1px; padding: 0 3px; font-size: 10px; border-radius: 3px; }
  .cal-bar .t, .cal-bar .arr { display: none; }
  .cal-more { font-size: 10px; padding: 0 2px; }
  .cal-weather { font-size: 12px; }
  .cal-date { width: 26px; height: 26px; font-size: 13px; }
  .today-tag { display: none; }
  .cal-cell-head .today-tag { display: none; }


  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal, .modal.wide, .modal.small { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .modal-body { padding: 16px; flex: 1; }
  .modal-foot { padding: 12px 16px; position: sticky; bottom: 0; background: var(--panel); }
  .modal-head { padding: 8px 8px 8px 16px; }
  #toast-root { left: 16px; right: 16px; bottom: 16px; }
  .ellipsis { max-width: 180px; }
  .proc-meta { margin-left: 28px; }
}


/* =====================================================================
   スマホUI（デザイン「Signtop スマホUI設計」準拠）の共通部品
   PCでも使える部品はここ、スマホだけの見た目は下の @media に置く
   ===================================================================== */
:root { --sp-line: #E2E8F0; --sp-track: #EEF2F6; --sp-dark: #1F2937; --sp-r: 14px; }
.tabbar, .back-link { display: none; }

/* 一覧グループ（白い角丸の箱に区切り線つきの行） */
.list-group { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--sp-line); border-radius: var(--sp-r); overflow: hidden; }
.list-group > li + li { border-top: 1px solid var(--sp-line); }
.list-group.flat { border: 0; border-radius: 0; }
.lg-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px; border: 0; background: transparent; font: inherit; color: var(--text); text-align: left; cursor: pointer; text-decoration: none; }
.lg-row:hover { background: #F8FAFC; text-decoration: none; }
.lg-label { font-weight: 600; flex: 1 1 auto; min-width: 0; }
.lg-meta { font-size: 12px; color: var(--sub); }
.lg-meta.warn { color: var(--warn); }
.lg-chev { color: #94A3B8; font-size: 18px; }
.sq { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; background: var(--c, #94A3B8); }

/* セグメント（灰色の溝に白いつまみ） */
.segs { display: flex; background: var(--sp-track); border-radius: 10px; padding: 3px; gap: 2px; }
.segs > button { flex: 1 1 0; min-width: 0; height: 38px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-size: 14px; color: var(--sub); cursor: pointer; white-space: nowrap; }
.segs > button.active, .segs > button[aria-pressed=true] { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.segs > button.active.ok { color: var(--ok); }
.segs > button.active.warn { color: var(--warn); }
.segs > button.active.info { color: var(--primary); }
.segs > button.active.solid-ok { background: var(--ok); color: #fff; }

/* 丸チップ（絞り込み・選択） */
.chips-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; }
.chips-row::-webkit-scrollbar { display: none; }
.pchip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--sp-line); background: #fff; font: inherit; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; white-space: nowrap; }
.pchip.active, .pchip[aria-pressed=true] { background: var(--sp-dark); border-color: var(--sp-dark); color: #fff; }
.pchip.sel { background: var(--primary-weak); border-color: var(--primary); color: var(--primary); }

/* セクション見出し（色の四角＋見出し＋右に追加リンク） */
.sec-head { display: flex; align-items: center; gap: 8px; margin: 4px 2px 8px; }
.sec-head h3 { font-size: 15px; }
.sec-head .count { font-weight: 400; }
.sec-head .add-link { margin-left: auto; border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 0; text-decoration: none; }

/* 大きなチェック（タスク・工程） */
.bigcheck { appearance: none; -webkit-appearance: none; width: 26px; height: 26px; border: 2px solid #CBD5E1; border-radius: 7px; background: #fff; flex: 0 0 auto; cursor: pointer; display: inline-grid; place-content: center; margin: 0; }
.bigcheck:checked { background: var(--ok); border-color: var(--ok); }
.bigcheck:checked::after { content: "✓"; color: #fff; font-size: 15px; font-weight: 700; line-height: 1; }

/* ＋メニュー（下から出るシート） */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(480px, 100%); background: var(--panel); border-radius: 20px 20px 0 0; padding: 8px 0 calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(15,23,42,.2); }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: #CBD5E1; margin: 4px auto 8px; }
.sheet-head { display: flex; align-items: center; padding: 4px 16px 12px 20px; }
.sheet-head h2 { flex: 1; font-size: 17px; }
.sheet-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px 8px; }
.sheet-tile { display: grid; gap: 22px; justify-items: start; padding: 16px 14px; border: 0; border-radius: var(--sp-r); background: color-mix(in srgb, var(--c) 9%, #fff); color: color-mix(in srgb, var(--c) 75%, #000); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; text-align: left; }
.sheet-tile .sq { background: var(--c); }
.sheet .lg-row .sq { width: 10px; height: 10px; }

@media (max-width: 768px) {
  :root { --bg: #F5F7FA; }
  body { background: var(--bg); }
  /* 上部バー：大きな見出し。ハンバーガーは使わず下部タブで移動する */
  .icon-btn.menu-btn { display: none; }
  .topbar { height: auto; min-height: 60px; padding: 10px 16px 8px; flex-wrap: wrap; gap: 4px 8px; background: var(--panel); border-bottom: 1px solid var(--sp-line); }
  .topbar h1 { font-size: 24px; font-weight: 700; flex: 1 1 auto; }
  .back-link { display: block; flex: 0 0 100%; font-size: 15px; font-weight: 600; color: var(--primary); }
  .back-link[hidden] { display: none; }
  .topbar-actions .btn { height: 40px; border-radius: 999px; padding: 0 16px; font-weight: 700; }
  .topbar-actions .btn:not(.primary) { border-color: transparent; background: transparent; color: var(--primary); padding: 0 4px; }
  main { padding: 16px 16px calc(104px + env(safe-area-inset-bottom)); }
  .panel { border-color: var(--sp-line); border-radius: var(--sp-r); box-shadow: none; }

  /* 下部タブ */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); align-items: start; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--panel); border-top: 1px solid var(--sp-line); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 5px; padding-top: 4px; font-size: 11px; font-weight: 500; color: #94A3B8; text-decoration: none; }
  .tabbar a.active { color: var(--primary); font-weight: 700; }
  .tb-ico { display: block; border: 2px solid currentColor; }
  .tabbar a.active .tb-ico { background: #DBEAFE; }
  .i-home { width: 18px; height: 18px; border-radius: 6px; }
  .i-projects { width: 20px; height: 15px; border-radius: 3px; }
  .i-billing { width: 18px; height: 18px; border-radius: 9px; }
  .i-more { width: 18px; height: 6px; border-radius: 3px; margin: 6px 0; }
  .tb-add { justify-self: center; width: 56px; height: 56px; margin-top: -18px; border-radius: 28px; border: 4px solid #fff; background: var(--primary); color: #fff;
    font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 6px 16px rgba(37,99,235,.35); }
  #toast-root { bottom: calc(96px + env(safe-area-inset-bottom)); }
  /* 入力画面：全画面。左上「閉じる」、中央に見出し、下に大きな保存ボタン */
  .modal-head { padding: 10px 16px; gap: 8px; }
  .modal-head h2 { text-align: center; font-size: 17px; }
  .modal-x { order: -1; width: auto; min-width: 56px; height: 40px; justify-content: flex-start; color: var(--sub); font-size: 15px; }
  .modal-x .x { display: none; }
  .modal-x .t { display: inline; }
  .modal-head::after { content: ""; min-width: 56px; }
  .modal-body { background: var(--bg); }
  .modal-foot { border-top: 1px solid var(--sp-line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn.primary { flex: 1 1 auto; height: 52px; border-radius: 12px; font-size: 16px; font-weight: 700; }
  .modal.small .modal-foot .btn.primary, .modal.small .modal-foot .btn.danger { flex: 0 0 auto; height: 44px; font-size: 15px; }
  /* 確認ダイアログは全画面にせず中央に出す */
  .modal-backdrop:has(.modal.small) { align-items: center; padding: 16px; }
  .modal.small { height: auto; border-radius: 16px; }
  .modal.small .modal-head::after, .modal.small .modal-x { display: none; }
  .modal.small .modal-head h2 { text-align: left; }
  .modal.small .modal-body { background: var(--panel); }
}

/* PC専用・スマホ専用の出し分け */
@media (min-width: 769px) { .sp-only { display: none !important; } }
@media (max-width: 768px) { .pc-only { display: none !important; } }

/* ---------- スマホ：ホーム（カレンダー＋日別一覧） デザイン01〜03 ---------- */
@media (max-width: 768px) {
  .cal-panel { padding: 12px 8px 8px; }
  .cal-panel .toolbar { padding: 0 6px; gap: 6px; flex-wrap: nowrap; }
  .cal-panel .month-nav { width: auto; flex-wrap: nowrap; gap: 0; }
  .cal-panel .month-title { font-size: 16px; text-align: left; flex: 0 0 auto; padding: 0 2px; }
  .nav-arrow { width: 32px; padding: 0; border-color: transparent; background: transparent; font-size: 18px; color: var(--sub); }
  .cal-panel .toolbar > .btn { height: 34px; border-radius: 999px; padding: 0 14px; font-size: 13px; }
  .segs.cal-view { padding: 2px; }
  .segs.cal-view > button { height: 30px; padding: 0 12px; }
  .cal-grid { border: 0; --head-h: 44px; --bar-h: 18px; --more-h: 14px; }
  .cal-dow { border: 0; background: transparent; font-size: 12px; padding: 2px 0 6px; }
  .cal-week { min-height: 58px; border-top: 1px solid #EEF2F6; }
  .cal-cell { border: 0; padding: 2px 0; }
  .cal-cell.out { background: transparent; }
  .cal-cell.selected { background: transparent; box-shadow: none; }
  .cal-cell-head { flex-direction: column; justify-content: flex-start; gap: 0; height: auto; }
  .cal-date { width: 30px; height: 30px; font-size: 16px; font-weight: 500; }
  .cal-cell.selected .cal-date { box-shadow: inset 0 0 0 2px var(--primary); }
  .cal-cell.today .cal-date { background: var(--primary); color: #fff; font-weight: 700; }
  .cal-weather { display: none; }
  .cal-wx { display: block; font-size: 10px; line-height: 1; color: var(--sub); }
  .cal-wx.wx-晴れ { color: var(--warn); }
  .cal-wx.wx-雨 { color: var(--primary); }
  /* 帯：淡い地＋左に濃い線、先頭にカテゴリの頭文字 */
  .cal-bar { background: color-mix(in srgb, var(--c) 12%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); border-left: 2px solid var(--c);
    font-size: 10px; font-weight: 600; padding: 0 3px; border-radius: 3px; gap: 2px; }
  .cal-bar.cont-l { border-left: 0; }
  .cal-bar .k { display: inline; font-weight: 700; }
  .legend { display: none; }

  /* 日別一覧：カテゴリごとに「■ 見出し 件数 ＋追加」と白いカード */
  .cat-scroll { gap: 20px; }
  .cat-col { background: transparent; border: 0; border-radius: 0; }
  .cat-col-head { padding: 0 2px 8px; border: 0; gap: 8px; }
  .cat-col-head::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--cat); flex: 0 0 auto; }
  .cat-col-head .cat-name { font-size: 15px; }
  .cat-col-head .btn { height: 32px; border: 0; background: transparent; color: var(--primary); font-weight: 600; padding: 0 2px; }
  .cat-col-body { background: var(--panel); border: 1px solid var(--sp-line); border-radius: var(--sp-r); padding: 0; gap: 0; overflow: hidden; }
  .cat-col-body > * + * { border-top: 1px solid var(--sp-line); }
  .cat-col-body > .empty { padding: 14px; }
  .ev-item { border: 0; border-radius: 0; padding: 12px 14px; gap: 2px 10px; font-size: 14px; }
  .ev-item .el-cust { flex: 0 0 100%; font-size: 12px; }
  .ev-item .el-time { font-size: 16px; }
  .ev-item .el-title { font-size: 15px; }
  .ev-item .el-crew, .ev-item .el-car { font-size: 13px; }
  .cat-col-body .card { border: 0; border-radius: 0; padding: 12px 14px; }
  .cat-col-body .col-group { margin: 8px; }
  .task-row { grid-template-columns: 1fr; padding: 10px 14px; border-bottom: 0; }
  .task-row .check { gap: 12px; }
  .task-row .bigcheck { width: 26px; height: 26px; border-radius: 7px; }
  .task-row .bigcheck:checked::after { font-size: 15px; }
  .task-meta { padding-left: 38px; }
  .member-block .sub-head { margin: 0; padding: 8px 14px; background: #F8FAFC; border-bottom: 0; color: var(--sub); font-size: 12px; }
  .sub-head.warn { margin: 0; padding: 8px 14px; border-bottom: 0; }
  .member-block .pad { padding: 10px 14px; }
  .att-row { padding: 10px 14px; border-bottom: 0; }
}

