:root {
  color-scheme: light;
  --page: #fff;
  --surface: #fff;
  --ink: #18212f;
  --muted: #49566a;
  --line: #ccd6e5;
  --soft: #f4f4f5;
  --blue: #173771;
  --focus: #125e9a;
  --gutter: clamp(16px, 3vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.6 "Segoe UI", "Malgun Gothic", system-ui, sans-serif; word-break: keep-all; overflow-wrap: anywhere; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1, h2, h3, strong, summary { font-weight: 650; }
h1 { font-size: clamp(24px, 3vw, 32px); line-height: 1.25; }
h2 { font-size: 19px; line-height: 1.4; }
h3 { font-size: 16px; }
a { color: var(--blue); text-underline-offset: .2em; }
button, input, textarea { color: inherit; font: inherit; }
select { color: inherit; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 8px 12px; }
button, input, textarea, .button { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
button, .button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 6px 12px; cursor: pointer; text-decoration: none; }
button:hover, .button:hover { background: var(--soft); }
button:disabled { opacity: .65; cursor: default; }
.primary, .primary:hover { background: var(--blue); color: white; border-color: var(--blue); }
input, textarea { width: 100%; min-width: 0; padding: 8px 12px; }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.skip { position: fixed; top: 8px; left: 8px; z-index: 2; padding: 8px 12px; background: white; transform: translateY(-150%); }
.skip:focus { transform: none; }
.shell { min-height: 100vh; display: grid; grid-template-columns: clamp(188px, 18vw, 240px) minmax(0, 1fr); }
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 0 16px 20px; }
.rail nav { position: sticky; top: 12px; }
.brand { min-height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 8px; font-size: 17px; color: var(--ink); text-decoration: none; font-weight: 650; }
.mark { background: #293641; color: white; border-radius: 6px; padding: 2px 8px; font-size: 13px; }
.nav-list { list-style: none; display: grid; gap: 4px; margin: 0; padding: 0; }
.nav-list a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.nav-list a:hover { background: var(--soft); }
.nav-list a[aria-current] { color: var(--blue); background: #e8eff5; font-weight: 650; }
.bar { min-height: 64px; padding: 8px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#session { display: flex; gap: 8px; align-items: center; min-width: 0; }
#content { max-width: 1400px; margin: 0 auto; padding: 28px var(--gutter) 40px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.sub, .meta { color: var(--muted); font-size: 13px; }
.scope { color: var(--blue); font-size: 13px; font-weight: 650; margin-bottom: 4px; }
.stack { display: grid; gap: 16px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.search { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.search label { flex: 1 1 240px; }
label > span { display: block; margin-bottom: 4px; font-weight: 650; }
.status-list { display: flex; gap: 8px; flex-wrap: wrap; }
.status-list a[aria-current] { background: #e8eff5; color: var(--blue); border-color: #a6bbcd; font-weight: 650; }
.number { font-variant-numeric: tabular-nums; margin-inline-start: 8px; }
.cards { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.card { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; background: var(--surface); }
.card h3 a { color: inherit; }
.card h3 a:hover { color: var(--blue); }
.view-list { display: grid; gap: 8px; list-style: none; padding: 0; margin: 0; }
.view { padding-top: 8px; border-top: 1px solid var(--line); }
.view-head { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip { display: inline-block; background: #eceef0; color: #414951; border-radius: 5px; padding: 1px 8px; font-size: 13px; font-weight: 650; }
.chip.todo { background: #e7eff7; color: #234f76; }
.chip.wait { background: #f5ebd9; color: #684810; }
.chip.done { background: #e3efe7; color: #294f38; }
.chip.review { background: #f3e6e3; color: #793e32; }
.chip.date { background: #eceef0; color: #414951; }
.condition > .view-head { margin-bottom: 8px; }
.condition > * + *, .coverage > :not(summary) { margin-top: 8px; }
.condition-list > .condition + .condition { margin-top: 0; }
.work-item { display: flex; gap: 8px; flex-wrap: wrap; align-items: start; }
.published-record { display: inline-flex; align-items: center; min-height: 24px; font-size: 13px; }
.child-views > summary { color: var(--blue); cursor: pointer; }
.child-views > ul { margin-top: 8px; }
.request-card > section { border-top: 1px solid var(--line); padding-top: 16px; }
.count-context { margin-inline-start: 8px; font-weight: 400; }
.date-filter { justify-self: start; }
.copy { white-space: pre-wrap; }
.facts { display: grid; gap: 8px 16px; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); }
.facts dt { color: var(--muted); font-size: 13px; }
.evidence { margin: 4px 0 0; padding-left: 20px; }
.message { padding: 12px 16px; border-radius: 8px; background: var(--soft); }
.message.question { background: #e8eff5; }
.alert { background: #f8efec; color: #71352d; }
.narrow { max-width: 54rem; }
.login { max-width: 400px; }
.chat-layout { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(196px, 240px); align-items: start; }
.chat-log { min-height: 120px; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history a[aria-current] { font-weight: 650; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.shell { grid-template-columns: clamp(174px, 14vw, 198px) minmax(0, 1fr); }
.bar, .brand { min-height: 60px; }
.mark { background: none; color: var(--ink); font-size: 28px; padding: 0; }
.rail nav { padding-top: 20px; }
.nav-list a { border-radius: 0; }
.nav-list a[aria-current] { box-shadow: inset 3px 0 var(--blue); }
.board-screen, .detail-screen { gap: 16px; }
.board-screen .page-heading, .detail-drag-header .page-heading { align-items: center; }
.board-screen .page-heading h1, .detail-drag-header h1 { font-size: clamp(28px, 3vw, 40px); }
.board-screen .page-heading .sub, .detail-drag-header .sub { margin-top: 5px; }
#board-tools { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; }
#board-tools:empty { display: none; }
.bar:has(#board-tools:not(:empty)) .bar-label { display: none; }
#board-tools .search { flex: 1; min-width: 0; align-items: center; flex-wrap: nowrap; }
#board-tools .search label { flex: 1; min-width: 0; }
#board-tools .search label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#board-tools .search input { border-color: transparent; background: var(--soft); }
#board-tools :is(button, .button) { white-space: nowrap; }
.board-header-actions .date-filter { display: flex; align-items: center; gap: 8px; }
.board-header-actions .date-filter > span { margin: 0; font-size: 13px; font-weight: 500; }
.board-screen .status-list { border-bottom: 1px solid var(--line); gap: 14px; }
.board-screen .status-list .button { background: transparent; border: 0; border-bottom: 3px solid transparent; border-radius: 0; }
.board-screen .status-list .button[aria-current] { border-bottom-color: var(--blue); }
.board-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.board-list { min-width: 0; gap: 0; }
.board-list #list-title { margin-bottom: 3px; font-size: 13px; color: var(--muted); }
.board-list .cards { gap: 0; }
.board-row { display: grid; grid-template-columns: minmax(0, 3fr) minmax(54px, .65fr) minmax(100px, .95fr) minmax(61px, .68fr); align-items: start; gap: 8px; }
.row-labels { padding: 8px 12px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.board-list .card { background: white; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px; gap: 4px; }
.board-list .card.is-previewed { background: #edf2f9; box-shadow: inset 3px 0 var(--blue); }
.board-list .card h3 { font-size: 16px; line-height: 1.35; }
.board-list .card h3 a { text-decoration: none; }
.board-list .card h3 a:hover { text-decoration: underline; }
.board-list .card h3 .row-select { min-height: 0; border: 0; border-radius: 0; padding: 0; background: transparent; text-align: start; font-weight: inherit; }
.board-list .card h3 .row-select:hover { color: var(--blue); text-decoration: underline; }
.board-list .card h3 .row-open { display: none; }
.row-date { display: grid; gap: 3px; font-variant-numeric: tabular-nums; }
.row-date-value { display: block; color: var(--ink); }
.row-identity { margin-top: 3px; }
.row-note { font-size: 13px; line-height: 1.4; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-links { font-size: 13px; }
.board-list > div:last-child { padding-top: 12px; }
.row-state { display: flex; flex-wrap: wrap; gap: 4px; }
.row-state .chip, .detail-drag-header .chip { white-space: nowrap; }
.board-preview { padding-left: 22px; border-left: 1px solid var(--line); gap: 9px; min-width: 0; }
.board-preview h2 { font-size: 24px; }
.board-preview > .chip { justify-self: start; }
.preview-section { border-top: 1px solid var(--line); padding-top: 10px; }
.preview-description > summary { color: var(--blue); cursor: pointer; }
.preview-description > p { margin-top: 8px; }
.preview-date-group { gap: 4px; }
.preview-dates .facts { grid-template-columns: repeat(auto-fit, minmax(min(116px, 100%), 1fr)); }
.preview-evidence { display: grid; gap: 5px; }
.evidence-event-date:not(:empty) { display: block; }
.preview-actions, .preview-confirmed { padding-top: 11px; border-top: 1px solid var(--line); gap: 7px; }
.preview-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.preview-row { display: grid; gap: 2px; font-size: 14px; }
.preview-row p { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.preview-row strong { color: var(--blue); }
.preview-link { justify-self: start; min-height: 44px; display: inline-flex; align-items: center; }
.mobile-preview, .mobile-department { display: none; }
.detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.detail-toolbar .button { min-height: 44px; }
.detail-toolbar .form-actions button:disabled { color: var(--muted); }
.detail-screen .request-card { padding: 0; border: 0; background: transparent; }
.detail-drag-header { border-bottom: 1px solid var(--ink); padding: 0 0 20px; }
.detail-columns { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.detail-evidence { border-left: 1px solid var(--line); padding-left: 22px; }
.detail-main > section + section, .detail-evidence > section + section { border-top: 1px solid var(--line); padding-top: 16px; }

@media (min-width: 761px) {
  .rail { position: sticky; top: 0; height: 100dvh; align-self: start; overflow-y: auto; }
  .bar { position: sticky; top: 0; z-index: 1; }
  .board-layout { overflow-anchor: none; }
  .board-preview { position: sticky; top: 72px; max-height: calc(100dvh - 84px); overflow-y: auto;
    scrollbar-gutter: stable; overscroll-behavior-y: contain; padding-right: 4px; }
}

@media (max-width: 760px) {
  html { overscroll-behavior-x: none; }
  .shell { display: block; }
  .rail { padding: 0 16px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { min-height: 52px; padding: 0; }
  .rail nav { position: static; }
  .nav-list { display: flex; flex-wrap: wrap; }
  .nav-list a { padding: 8px 10px; }
  .bar { min-height: 52px; }
  #content { padding-top: 20px; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .panel, .card { padding: 16px; }
  .facts { grid-template-columns: repeat(auto-fit, minmax(min(136px, 100%), 1fr)); }
  body:has(.board-screen) .rail, body:has(.detail-screen) .rail { padding-bottom: 0; }
  body:has(.board-screen) .rail nav, body:has(.detail-screen) .rail nav { display: none; }
  .board-screen, .detail-screen { gap: 16px; }
  .bar:has(#board-tools:not(:empty)) { display: grid; padding-block: 6px; }
  .bar:has(#board-tools:not(:empty)) #session { grid-row: 1; justify-self: end; }
  #board-tools { grid-row: 2; }
  #board-tools .search { flex-wrap: wrap; gap: 4px; }
  #board-tools .search input, #board-tools button { min-height: 38px; }
  .board-screen .page-heading { align-items: flex-start; }
  .board-header-actions { align-self: end; }
  .mobile-department { display: block; min-height: 44px; max-width: 10rem; }
  .board-layout, .detail-columns { grid-template-columns: minmax(0, 1fr); }
  .board-screen .status-list { flex-wrap: nowrap; overflow-x: auto; gap: 0; scrollbar-width: none; }
  .board-screen .status-list .button { min-height: 44px; flex: none; }
  .board-screen .status-list .button:first-child { padding-inline-start: 6px; }
  .board-preview, .row-labels { display: none; }
  .board-list { min-height: 156px; }
  .board-list, .detail-columns { touch-action: pan-y pinch-zoom; }
  .detail-drag-header { touch-action: pan-down pinch-zoom; }
  .board-row { grid-template-columns: minmax(0, 1fr) auto; }
  .row-date { grid-column: 2; grid-row: 2; }
  .row-department { grid-column: 1; grid-row: 2; }
  .row-state { grid-column: 2; grid-row: 1; }
  .board-list .card { padding: 14px 0; }
  .board-list .card h3 .row-select { display: none; }
  .board-list .card h3 .row-open { display: inline; }
  .board-list .card.is-previewed { background: transparent; box-shadow: none; }
  .board-list .card:first-child { border-bottom-color: var(--ink); }
  .mobile-preview { display: grid; }
  .mobile-preview > :is(.scope, h2, .sub, .chip, section:not(.preview-actions)) { display: none; }
  .mobile-preview > .preview-confirmed { display: grid; }
  .detail-evidence { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
}
