:root {
  color-scheme: light;
  --ink: #10223f;
  --muted: #5b6d83;
  --canvas: #f7f9fc;
  --surface: #ffffff;
  --line: #dbe4ef;
  --brand: #1f5faa;
  --brand-dark: #17477d;
  --focus: #e8a317;
  --danger: #a42a37;
  --shadow: 0 12px 32px rgba(16, 34, 63, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 20; padding: .6rem .8rem; color: white; background: var(--brand-dark); border-radius: .4rem; }
.skip-link:focus { top: 1rem; }
.loading-shell { padding: 3rem; color: var(--muted); text-align: center; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 15.5rem 1fr; }
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.4rem 1rem; color: #41566e; background: #eaf0f6; border-right: 1px solid #d6e0ea; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 0 .45rem; color: #183d63; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: .6rem; background: #d6e8fa; color: #17477d; font-size: 1.25rem; font-weight: 900; }
.brand small { display: block; color: #607994; font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav-list { display: grid; gap: .35rem; }
.nav-button { width: 100%; display: flex; align-items: center; gap: .7rem; padding: .72rem .8rem; color: #41566e; background: transparent; border: 0; border-radius: .55rem; text-align: left; }
.nav-button:hover, .nav-button[aria-current="page"] { color: #173c61; background: #d6e7f7; }
.sidebar-foot { margin-top: auto; padding: 1rem .45rem 0; border-top: 1px solid #d1dce8; color: #607994; font-size: .82rem; }
.button-link { padding: 0; color: inherit; background: transparent; border: 0; text-decoration: underline; }
.workspace { min-width: 0; padding: clamp(1rem, 3vw, 2.25rem); }
.topbar { display: flex; align-items: start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.eyebrow { margin: 0 0 .25rem; color: var(--brand); font-size: .73rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .3rem; font-size: clamp(1.55rem, 3vw, 2.15rem); letter-spacing: -.04em; }
.muted { color: var(--muted); }
.content-grid { display: grid; gap: 1.25rem; }
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; }
.stat { padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; box-shadow: var(--shadow); }
.stat .number { display: block; margin-top: .35rem; color: var(--ink); font-size: 1.45rem; font-weight: 800; letter-spacing: -.04em; }
.stat .label { color: var(--muted); font-size: .78rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; box-shadow: var(--shadow); }
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; padding: 1rem; border-bottom: 1px solid var(--line); }
.field { display: grid; gap: .32rem; min-width: 8.5rem; color: var(--muted); font-size: .8rem; font-weight: 650; }
.field.grow { flex: 1 1 15rem; }
input, select, textarea { width: 100%; padding: .62rem .7rem; color: var(--ink); background: white; border: 1px solid #b9c8d9; border-radius: .45rem; }
textarea { min-height: 5.5rem; resize: vertical; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .55rem .8rem; color: white; background: var(--brand); border: 1px solid var(--brand); border-radius: .48rem; font-weight: 750; transition: transform 150ms cubic-bezier(.23,1,.32,1), background 150ms ease; }
.button:hover { background: var(--brand-dark); }
.button:active { transform: scale(.97); }
.button.secondary { color: var(--ink); background: white; border-color: #a9bad0; }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.small { min-height: 2.1rem; padding: .35rem .6rem; font-size: .82rem; }
.button-row { display: flex; flex-wrap: wrap; gap: .55rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .82rem 1rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .71rem; letter-spacing: .07em; text-transform: uppercase; }
td { font-size: .9rem; }
tr[data-contact-id] { cursor: pointer; }
tr[data-contact-id]:hover { background: #f0f6fe; }
.empty { padding: 2rem; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; }
.notice { padding: .8rem 1rem; border-radius: .55rem; background: #fff4d8; color: #654300; border: 1px solid #edcf81; }
.notice.error { color: #7f1e2a; background: #fdebed; border-color: #f2b8be; }
.modal-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 1rem; background: rgba(11, 26, 48, .5); }
.modal { width: min(52rem, 100%); max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border-radius: .85rem; box-shadow: 0 22px 60px rgba(0,0,0,.24); }
.modal-header { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.25rem 0; }
.modal-body { padding: 1.25rem; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.detail-grid .full { grid-column: 1 / -1; }
.classification-grid { min-width: 0; margin: 0 0 1rem; padding: .9rem; border: 1px solid var(--line); border-radius: .65rem; }
.classification-grid:last-child { margin-bottom: 0; }
.classification-grid legend { padding: 0 .35rem; color: var(--ink); font-size: .92rem; font-weight: 800; }
.classification-grid .muted { margin-bottom: .7rem; font-size: .8rem; }
.choice-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.choice { display: flex; align-items: center; gap: .5rem; min-width: 0; min-height: 2.5rem; padding: .48rem .58rem; color: var(--ink); background: #f7faff; border: 1px solid #c9d7e8; border-radius: .45rem; font-size: .83rem; font-weight: 650; cursor: pointer; }
.choice:hover { background: #edf5ff; border-color: #92b2d7; }
.choice input { width: 1rem; height: 1rem; flex: 0 0 auto; padding: 0; accent-color: var(--brand); }
.choice span { overflow-wrap: anywhere; }
.section { padding-top: 1rem; margin-top: 1rem; border-top: 1px solid var(--line); }
.activity-item { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-item p { margin: .35rem 0 0; white-space: pre-wrap; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.tag { padding: .22rem .5rem; color: #17477d; background: #eaf3fe; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.modal-footer { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.25rem 1.25rem; }
@media (max-width: 980px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) { .app-shell { grid-template-columns: 1fr; } .sidebar { gap: .9rem; padding: .8rem 1rem; } .nav-list { display: flex; flex-wrap: wrap; overflow: visible; } .nav-button { flex: 1 1 auto; width: auto; justify-content: center; } .sidebar-foot { display: none; } .workspace { padding: 1rem; } .detail-grid { grid-template-columns: 1fr; } .detail-grid .full { grid-column: auto; } .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .topbar { align-items: stretch; flex-direction: column; } .topbar .button { width: 100%; } .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .toolbar { align-items: stretch; } .toolbar .button { width: 100%; } .choice-grid { grid-template-columns: 1fr; } th:nth-child(4), td:nth-child(4), th:nth-child(5), td:nth-child(5) { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; } }
