:root {
  --ink: #2b3a4a;
  --ink-2: #435466;
  --ink-3: #687787;
  --copper: #b45f2f;
  --copper-dark: #91451f;
  --cream: #faf6f0;
  --paper: #fffdf9;
  --white: #fff;
  --line: #ded8cf;
  --line-strong: #c7bfb5;
  --green: #2f7d4f;
  --red: #a4413b;
  --amber: #9b6a14;
  --blue: #31658c;
  --sidebar: 244px;
  --topbar: 62px;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(43 58 74 / 8%), 0 10px 32px rgb(43 58 74 / 5%);
  --focus: 0 0 0 3px rgb(180 95 47 / 22%);
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--cream); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif; line-height: 1.55; }
body { margin: 0; min-width: 320px; background: var(--cream); }
body.drawer-open { overflow: hidden; }
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 34ch; margin-bottom: .45rem; overflow-wrap: anywhere; font-size: clamp(1.65rem, 2.5vw, 2.2rem); line-height: 1.2; letter-spacing: -.025em; }
h2 { margin-bottom: .35rem; font-size: 1.08rem; line-height: 1.35; }
h3 { font-size: .95rem; }
hr { margin: 1.25rem 0; border: 0; border-top: 1px solid var(--line); }
code, .mono-link { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
code { padding: .12rem .3rem; border-radius: 4px; background: #f1eee8; overflow-wrap: anywhere; }
fieldset { margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: 6px; }
legend { padding: 0 .35rem; font-size: .78rem; font-weight: 700; }
[hidden], .hidden-field { display: none !important; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.break-all { word-break: break-all; }

.app-shell { min-height: 100vh; }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: var(--sidebar); flex-direction: column; padding: 20px 14px 14px; color: #eef1f3; background: var(--ink); }
.brand { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 8px; color: white; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; flex: 0 0 auto; border-radius: 7px; color: white; background: var(--copper); font-family: Georgia, serif; font-size: 1.25rem; font-weight: 700; }
.brand-mark-large { width: 46px; height: 46px; font-size: 1.6rem; }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .11em; }
.brand small { margin-top: 1px; color: #aeb9c3; font-size: .61rem; }
.workspace-switcher { margin: 26px 4px 16px; }
.workspace-switcher label { display: flex; justify-content: space-between; margin: 0 4px 5px; color: #aeb9c3; font-size: .66rem; font-weight: 700; letter-spacing: .06em; }
.workspace-switcher select { width: 100%; padding: 8px 28px 8px 9px; border: 1px solid #536270; border-radius: 6px; color: white; background: #354656; font-size: .82rem; }
.primary-nav { display: grid; gap: 3px; }
.primary-nav a { display: grid; grid-template-columns: 18px minmax(0, 1fr); align-items: center; gap: 9px; padding: 9px 10px; border-left: 3px solid transparent; border-radius: 4px; color: #e3e8eb; font-size: .83rem; }
.primary-nav .lucide { color: #aeb9c3; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { border-left-color: var(--copper); color: white; background: rgb(255 255 255 / 8%); text-decoration: none; }
.sidebar-utilities { margin-top: auto; border-top: 1px solid #445565; }
.sidebar-utilities summary { display: flex; align-items: center; gap: 9px; padding: 12px 10px 8px; color: #bdc7cf; cursor: pointer; font-size: .72rem; font-weight: 700; list-style: none; }
.sidebar-utilities summary::-webkit-details-marker { display: none; }
.secondary-nav { display: grid; gap: 2px; padding: 0 4px 12px; }
.secondary-nav a { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 4px; color: #bdc7cf; font-size: .72rem; }
.secondary-nav a:hover { color: white; background: rgb(255 255 255 / 7%); text-decoration: none; }
.sidebar-footer { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; padding: 13px 5px 0; border-top: 1px solid #445565; }
.user-avatar { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--ink); background: #d9e0e4; font-size: .75rem; font-weight: 800; }
.user-copy { min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { font-size: .7rem; }
.user-copy small { color: #9fadb8; font-size: .62rem; }
.sidebar-footer .text-button { color: #bdc7cf; font-size: .63rem; }
.app-main { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; height: var(--topbar); align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgb(250 246 240 / 94%); backdrop-filter: blur(12px); }
.topbar-context { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--ink-3); font-size: .77rem; }
.topbar-context span:not(:last-child)::after, .topbar-context a::after { margin-left: 8px; color: var(--line-strong); content: "/"; }
.topbar-context strong { overflow: hidden; color: var(--ink); text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions, .header-actions { display: flex; align-items: center; gap: 8px; }
.menu-button { display: none; }
.content { width: min(1480px, 100%); margin: 0 auto; padding: 32px clamp(18px, 3vw, 42px) 64px; }
.app-footer { padding: 0 24px 22px; color: var(--ink-3); font-size: .67rem; text-align: center; }
.app-footer a { color: var(--ink-2); font-weight: 800; }
.message-stack { position: fixed; top: 74px; right: 22px; z-index: 45; display: grid; width: min(390px, calc(100vw - 30px)); gap: 7px; }
.message { padding: 11px 14px; border: 1px solid #c9d5cc; border-radius: 6px; color: #245d3b; background: #edf6f0; box-shadow: var(--shadow); font-size: .82rem; }
.message-error { border-color: #dfbab7; color: #852f2a; background: #fff1f0; }
.message-warning { border-color: #e0c88e; color: #74500f; background: #fff8e7; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.page-header > div:first-child { min-width: 0; }
.eyebrow { display: none; }
.heading-meta { margin-bottom: .38rem; color: var(--ink-3); font-size: .78rem; }
.heading-detail, .page-subtitle, .supporting-copy { margin-bottom: 0; color: var(--ink-3); font-size: .84rem; }
.page-header .page-subtitle { display: none; }
.page-header .eyebrow:has(.key-chip) { display: block; margin-bottom: .38rem; color: var(--ink-3); font-size: .78rem; }
.page-header .eyebrow:has(.key-chip) ~ .page-subtitle { display: block; }
.panel { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-header h2, .panel-header p { margin-bottom: 0; }
.panel-header > a { font-size: .76rem; font-weight: 700; }
.panel-large { grid-column: span 2; }
.narrow-page { width: min(760px, 100%); margin: 0 auto; }
.stack { display: grid; align-content: start; gap: 18px; }
.stack > .panel { margin: 0; }
.two-column-layout, .dashboard-grid, .ticket-layout, .builder-layout { display: grid; gap: 18px; align-items: start; }
.two-column-layout { grid-template-columns: minmax(0, 1.6fr) minmax(300px, .85fr); }
.dashboard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.ticket-layout { grid-template-columns: minmax(0, 1.8fr) minmax(280px, .65fr); }
.builder-layout { grid-template-columns: minmax(0, 1.5fr) minmax(310px, .75fr); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.admin-grid > .panel { margin: 0; }

.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border: 1px solid transparent; border-radius: 6px; font-size: .78rem; font-weight: 750; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.button:hover { text-decoration: none; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { color: white; border-color: var(--copper); background: var(--copper); }
.button-primary:hover { border-color: var(--copper-dark); background: var(--copper-dark); }
.button-quiet { border-color: var(--line-strong); color: var(--ink); background: var(--paper); }
.button-quiet:hover { background: #f2eee7; }
.button-small { min-height: 31px; padding: 6px 10px; font-size: .7rem; }
.button-block { width: 100%; }
.lucide { width: 17px; height: 17px; flex: 0 0 auto; stroke-width: 1.8; }
.button-small .lucide { width: 15px; height: 15px; }
.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--ink); background: var(--paper); }
.icon-button-dark { width: 30px; height: 30px; border-color: transparent; color: #bdc7cf; background: transparent; }
.icon-button:hover { color: var(--copper); background: #f2eee7; }
.text-button { padding: 0; border: 0; background: none; font-weight: 700; }
.text-link { font-size: .75rem; font-weight: 700; }
.danger-text { color: var(--red) !important; }
.warning-text { color: var(--amber); }
.save-status { margin-left: 8px; color: var(--ink-3); font-size: .72rem; }

.metric-strip { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 1px; margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); box-shadow: var(--shadow); }
.metric-strip article { display: grid; min-height: 104px; align-content: center; padding: 15px 18px; background: var(--paper); }
.metric-strip span { color: var(--ink-3); font-size: .7rem; font-weight: 700; }
.metric-strip strong { margin: 2px 0 0; font-size: 1.65rem; font-variant-numeric: tabular-nums; }
.metric-strip small { color: #8c969e; font-size: .61rem; }
.compact-metrics { grid-template-columns: repeat(4, 1fr); }
.compact-metrics article { min-height: 86px; }
.metric-key { font-size: 1rem !important; }

.table-wrap { max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; scrollbar-gutter: stable; }
.table-panel { padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .76rem; }
th { color: var(--ink-3); background: #f6f2ec; font-size: .65rem; letter-spacing: .03em; text-align: left; text-transform: uppercase; }
th, td { padding: 10px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffbf5; }
.table-note { display: block; max-width: 310px; margin-top: 2px; overflow-wrap: anywhere; color: var(--ink-3); }
.title-link { display: inline-block; max-width: 42ch; overflow-wrap: anywhere; color: var(--ink); font-weight: 700; }
.mono-link { color: var(--blue); font-weight: 750; white-space: nowrap; }
.select-cell { width: 34px; text-align: center; }
.is-muted { opacity: .58; }
.filter-bar, .bulk-bar, .inline-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-bottom: 14px; }
.compact-select { position: relative; align-items: center; margin: 0; }
.compact-select > .lucide { position: absolute; left: 10px; z-index: 1; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.compact-select select { width: min(360px, 46vw); padding-left: 35px; }
.saved-view-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: -8px 0 14px; color: var(--ink-3); font-size: .7rem; }
.saved-view-bar form { display: flex; align-items: center; gap: 7px; }
.saved-view-bar select { width: auto; min-height: 32px; }
.inline-save-form { margin-top: 6px; }
.inline-save-form input:not([type="checkbox"]) { min-height: 32px; }
.filter-bar { padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: rgb(255 253 249 / 72%); }
.filter-bar .field { min-width: 140px; }
.filter-bar .field label { display: none; }
.filter-bar input, .filter-bar select { min-height: 34px; max-width: 210px; }
.filter-bar .search-field { flex: 1 1 250px; }
.filter-bar .search-field input { width: 100%; max-width: none; }
.search-field { position: relative; }
.search-field > .lucide { position: absolute; top: 50%; left: 11px; z-index: 1; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-field > .lucide + input { padding-left: 36px; }
.filter-bar-progressive { align-items: center; }
.filter-disclosure { flex: 0 0 auto; }
.filter-disclosure > summary, .saved-view-bar summary { display: inline-flex; min-height: 34px; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 5px; color: var(--blue); cursor: pointer; font-size: .72rem; font-weight: 800; list-style: none; }
.filter-disclosure > summary::-webkit-details-marker, .saved-view-bar summary::-webkit-details-marker { display: none; }
.filter-disclosure[open] { flex: 1 0 100%; }
.filter-options { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); align-items: end; gap: 9px; margin-top: 10px; padding-top: 11px; border-top: 1px solid var(--line); }
.filter-options .field { min-width: 0; }
.filter-options .field label { display: block; }
.filter-options input, .filter-options select { width: 100%; max-width: none; }
.saved-view-bar label { display: inline-flex; align-items: center; }
.saved-view-bar > details > summary { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--line-strong); color: var(--ink); }
.saved-view-bar > details[open] { flex: 1 0 100%; }
.bulk-bar { position: sticky; top: 72px; z-index: 9; padding: 9px 12px; color: white; background: var(--ink); }
.bulk-bar input, .bulk-bar select { min-height: 30px; }
.pagination { display: flex; justify-content: center; gap: 18px; padding: 18px; font-size: .78rem; }
.pagination span { color: var(--ink-3); }

.record-list { display: grid; gap: 8px; }
.record-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 22px; padding: 14px 17px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); box-shadow: 0 1px 2px rgb(43 58 74 / 5%); }
.record-main { display: flex; min-width: 0; align-items: center; gap: 13px; color: var(--ink); }
.record-main:hover { text-decoration: none; }
.record-main > span:last-child { min-width: 0; }
.record-main strong, .record-main small { display: block; }
.record-main small { display: -webkit-box; overflow: hidden; color: var(--ink-3); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.record-row dl { display: flex; gap: 24px; margin: 0; }
.record-row dl div { min-width: 58px; }
.record-row dt { color: var(--ink-3); font-size: .62rem; }
.record-row dd { margin: 2px 0 0; font-size: .78rem; font-weight: 700; }
.key-chip { display: inline-flex; align-items: center; padding: 3px 7px; border: 1px solid #c9d3da; border-radius: 4px; color: var(--ink); background: #f1f5f7; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .69rem; font-weight: 800; white-space: nowrap; }
.type-swatch { display: inline-block; width: 8px; height: 30px; flex: 0 0 auto; border-radius: 3px; background: var(--type-color, var(--ink)); }
.status-badge, .severity, .priority { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border-radius: 999px; color: var(--ink-2); background: #e8ecef; font-size: .64rem; font-weight: 800; text-transform: none; white-space: nowrap; }
.status-published, .status-done, .status-approved, .status-resolved { color: #24633e; background: #e1f0e7; }
.status-draft, .status-new, .status-open { color: #6d5117; background: #f7edcf; }
.status-in_progress, .status-triaged, .status-reopened { color: #245f85; background: #e1eef7; }
.status-retired, .status-not_planned { color: #6d7378; background: #e7e8e9; }
.severity-high, .severity-blocking, .priority-critical { color: #8b302c; background: #fae2e0; }
.severity-medium, .priority-high { color: #795416; background: #f7eac7; }
.severity-low, .priority-low { color: #356474; background: #e0eff2; }

.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.stack-form { display: grid; gap: 14px; }
.compact-grid { gap: 11px; }
.span-3 { grid-column: span 3; }.span-4 { grid-column: span 4; }.span-6 { grid-column: span 6; }.span-8 { grid-column: span 8; }.span-9 { grid-column: span 9; }.span-12 { grid-column: span 12; }
.field { min-width: 0; }
.field > label, .stack-form > label { display: block; margin-bottom: 5px; color: var(--ink-2); font-size: .7rem; font-weight: 800; }
.field b { color: var(--red); }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; font-size: .82rem; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--copper); outline: none; box-shadow: var(--focus); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.field-help, .field-error { display: block; margin: 4px 0 0; color: var(--ink-3); font-size: .65rem; }
.field-error { color: var(--red); font-weight: 700; }
.checkbox-field { display: flex !important; align-items: flex-start; gap: 8px; margin: 0; font-size: .76rem !important; }
.checkbox-field input, .checkbox-compact input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--copper); }
.checkbox-field span, .checkbox-field strong, .checkbox-field small { display: block; }
.checkbox-field small { color: var(--ink-3); font-weight: 400; }
.checkbox-compact { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.privacy-note { display: flex; gap: 12px; padding: 10px 12px; border-left: 3px solid var(--copper); color: var(--ink-3); background: #f8f2e9; font-size: .7rem; }
.privacy-note strong { flex: 0 0 auto; color: var(--ink); }
.prose { color: var(--ink-2); font-size: .86rem; }
.prose > :last-child { margin-bottom: 0; }
.code-input, .context-data { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.context-data { max-height: 260px; overflow: auto; padding: 10px; border-radius: 5px; background: #f2eee8; font-size: .66rem; white-space: pre-wrap; }

.tab-nav { display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tab-nav a, .tab-nav button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border: 0; border-bottom: 2px solid transparent; color: var(--ink-3); background: none; font-size: .76rem; font-weight: 750; }
.tab-nav [aria-current="page"], .tab-nav [aria-selected="true"] { border-bottom-color: var(--copper); color: var(--ink); }
.category-list article, .link-list article, .builder-field { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.category-list article:last-child, .link-list article:last-child, .builder-field:last-child { border-bottom: 0; }
.category-list article > div, .link-list article > a, .builder-field > div { min-width: 0; flex: 1; }
.category-list strong, .category-list p, .link-list strong, .link-list p, .builder-field strong, .builder-field small { display: block; margin: 0; }
.category-list p, .link-list p, .builder-field small { color: var(--ink-3); font-size: .7rem; }
.plain-list, .coverage-list, .token-list, .attachment-list, .chip-list, .error-list { margin: 0; padding: 0; list-style: none; }
.plain-list li { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list a, .plain-list li > span:not(.type-swatch) { display: grid; min-width: 0; flex: 1; color: var(--ink); }
.plain-list strong, .plain-list small { display: block; }
.plain-list small { color: var(--ink-3); }
.coverage-meter { display: grid; min-height: 154px; place-content: center; margin: 5px auto 18px; text-align: center; }
.coverage-meter::before { grid-area: 1/1; width: 118px; height: 118px; border-radius: 50%; background: conic-gradient(var(--green) var(--coverage), #e3e3df 0); content: ""; }
.coverage-meter::after { grid-area: 1/1; place-self: center; width: 91px; height: 91px; border-radius: 50%; background: var(--paper); content: ""; }
.coverage-meter strong, .coverage-meter span { z-index: 1; grid-area: 1/1; place-self: center; }
.coverage-meter strong { transform: translateY(-8px); font-size: 1.45rem; }
.coverage-meter span { max-width: 88px; transform: translateY(20px); color: var(--ink-3); font-size: .56rem; }
.coverage-list li, .token-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .72rem; }
.activity-list, .comment-list { margin: 0; padding: 0; list-style: none; }
.dashboard-activity > summary { display: flex; align-items: center; gap: 7px; padding: 0; color: var(--ink); font-size: .9rem; list-style: none; }
.dashboard-activity > summary::-webkit-details-marker { display: none; }
.dashboard-activity[open] > summary { margin-bottom: 12px; }
.dashboard-activity > .text-link { display: inline-block; margin-top: 12px; }
.activity-list li { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border-bottom: 0; }
.activity-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--copper); }
.activity-list p { margin: 1px 0 0; color: var(--ink-3); font-size: .68rem; }
.activity-list time, .comment-list time { color: var(--ink-3); font-size: .64rem; white-space: nowrap; }
.compact-activity li { padding: 7px 0; font-size: .72rem; }
.detail-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; margin: 0; }
.detail-grid div { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.detail-grid dt, .metadata-list dt { color: var(--ink-3); font-size: .65rem; }
.detail-grid dd, .metadata-list dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: .79rem; }
.detail-layout-grid > div { grid-column: var(--field-column) / span var(--field-width); grid-row: var(--field-row) / span var(--field-height); }
.dynamic-form-layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: minmax(72px, auto); gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.dynamic-layout-field { grid-column: var(--field-column) / span var(--field-width); grid-row: var(--field-row) / span var(--field-height); align-content: start; }
.metadata-list { margin: 0; }
.metadata-list div { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.metadata-list div:last-child { border-bottom: 0; }
.secondary-actions { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.secondary-actions > summary { display: flex; align-items: center; gap: 7px; padding: 7px 0; color: var(--blue); cursor: pointer; font-size: .72rem; font-weight: 800; list-style: none; }
.secondary-actions > summary::-webkit-details-marker { display: none; }
.secondary-actions > .stack-form { margin-top: 10px; }
.danger-action { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.danger-action .text-button { display: inline-flex; align-items: center; gap: 6px; }
.link-direction { width: 110px; flex: 0 0 auto; color: var(--copper); font-size: .67rem; font-weight: 800; }
.link-list form { margin-left: auto; }
.section-divider { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.attachment-list { margin-top: 10px; }
.attachment-list li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; font-size: .7rem; }
.comment-list li { padding: 12px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 8px; background: white; }
.comment-list li > div { display: flex; align-items: center; gap: 8px; }
.comment-list time { margin-left: auto; }
.comment-list p { margin: 7px 0 0; color: var(--ink-2); font-size: .8rem; }
.comment-list .internal-note { border-color: #e2c984; background: #fff9e9; }
.count-badge { padding: 1px 5px; border-radius: 9px; background: #e7e4df; font-size: .6rem; }
.search-results { max-height: 210px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: white; }
.search-results button { display: flex; width: 100%; gap: 8px; padding: 8px; border: 0; border-bottom: 1px solid var(--line); text-align: left; background: white; }

.field-builder-list { margin-bottom: 14px; }
.builder-field label { display: flex; align-items: center; gap: 5px; font-size: .65rem; }
.builder-field select { width: 62px; min-height: 31px; padding: 4px; }
.drag-handle { color: var(--ink-3); cursor: grab; }
.layout-panel { overflow: hidden; }
.layout-toolbar { align-items: center; }
.layout-toolbar-actions { justify-content: flex-end; }
.layout-toolbar > div:first-child { display: flex; min-width: 0; align-items: baseline; gap: 10px; }
.layout-ruler { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; margin: 4px 10px 6px; }
.layout-ruler span { height: 3px; border-radius: 999px; background: var(--line-strong); }
.field-layout-canvas { --canvas-rows: 3; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-template-rows: repeat(var(--canvas-rows), 128px); gap: 8px; min-height: 360px; padding: 10px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; background-color: #f8f5ef; background-image: linear-gradient(to right, rgb(43 58 74 / 5%) 1px, transparent 1px), linear-gradient(to bottom, rgb(43 58 74 / 5%) 1px, transparent 1px); background-size: calc(100% / 12) 100%, 100% 128px; }
.layout-field { display: grid; position: relative; min-width: 0; align-content: start; gap: 9px; padding: 11px; overflow: visible; border: 1px solid #c8c0b6; border-top: 3px solid var(--copper); border-radius: 7px; background: var(--paper); box-shadow: 0 3px 12px rgb(43 58 74 / 8%); }
.layout-field:focus-visible, .layout-field.is-dragging { border-color: var(--copper); outline: none; box-shadow: var(--focus); }
.layout-field.is-dragging { opacity: .5; }
.layout-field-head { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto auto; align-items: start; gap: 7px; }
.layout-field-head strong, .layout-field-head small { display: block; overflow-wrap: anywhere; }
.layout-field-head small { color: var(--ink-3); font-size: .66rem; }
.layout-field-head .drag-handle { display: grid; place-items: center; min-height: 30px; }
.layout-field-controls { display: flex; min-width: 0; align-items: center; gap: 7px; }
.layout-field-controls > label { display: flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: .62rem; }
.layout-field-controls select { width: 70px; min-height: 30px; padding: 3px 19px 3px 6px; font-size: .66rem; }
.icon-button-compact { width: 30px; height: 30px; }
.icon-button-compact .lucide { width: 14px; height: 14px; }
.nudge-controls { display: flex; gap: 2px; margin-right: auto; }
.layout-field-tools { position: relative; }
.layout-field-tools > summary { list-style: none; }
.layout-field-tools > summary::-webkit-details-marker { display: none; }
.layout-field-tools[open] > summary { color: var(--copper); background: #f2eee7; }
.layout-field-popover { position: absolute; top: 36px; right: -36px; z-index: 20; width: min(330px, calc(100vw - 84px)); padding: 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--paper); box-shadow: 0 12px 32px rgb(43 58 74 / 20%); }
.layout-field-popover .compact-edit-form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.builder-add { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.builder-add > summary { width: fit-content; list-style: none; cursor: pointer; }
.builder-add > summary::-webkit-details-marker { display: none; }
.builder-add-form { margin-top: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: #f8f5ef; }
.compact-empty { min-height: 240px; gap: 10px; }
.compact-empty .lucide { width: 26px; height: 26px; color: var(--ink-3); }
.schema-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 10px; }
.schema-grid article { grid-column: span var(--field-span, 12); min-height: 94px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.schema-grid article > * { display: block; margin-bottom: 4px; }
.schema-grid small, .schema-grid p { color: var(--ink-3); font-size: .68rem; }
.required-mark { margin-left: 6px; color: var(--red); font-size: .58rem; }

.coverage-rule-list, .insight-list { display: grid; gap: 12px; }
.coverage-rule-list .panel { margin: 0; }
.coverage-number { color: var(--green); font-size: 1.5rem; }
.progress-track { height: 7px; overflow: hidden; border-radius: 9px; background: #e2e2dd; }
.progress-track span { display: block; height: 100%; background: var(--green); }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip-list a { display: block; padding: 3px 7px; border: 1px solid #c9d3da; border-radius: 4px; background: #f1f5f7; font-family: ui-monospace, monospace; font-size: .66rem; }
details summary { padding: 8px 0; cursor: pointer; color: var(--blue); font-size: .75rem; font-weight: 700; }
.matrix-table { min-width: 650px; }
.matrix-table th:not(:first-child) { min-width: 110px; text-align: center; }
.matrix-cell { text-align: center; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.matrix-cell.has-value { color: var(--ink); background: #f7eadf; font-weight: 800; }
.graph-canvas { position: relative; min-height: 560px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background-color: #fbfaf7; background-image: radial-gradient(#cfd2d3 1px, transparent 1px); background-size: 18px 18px; touch-action: none; }
.graph-canvas svg { width: 100%; height: 560px; }
.graph-edge { stroke: #9aa5ad; stroke-width: 1.4; marker-end: url(#arrow); }
.graph-edge-label { fill: var(--ink-3); font-size: 10px; }
.graph-node circle { stroke: white; stroke-width: 3; filter: drop-shadow(0 2px 4px rgb(43 58 74 / 20%)); }
.graph-node text { fill: var(--ink); font-size: 10px; font-weight: 800; }
.graph-empty { display: grid; position: absolute; inset: 0; place-items: center; color: var(--ink-3); font-size: .8rem; }
.graph-legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--ink-3); font-size: .64rem; }
.graph-legend span { display: inline-flex; align-items: center; gap: 4px; }
.graph-legend .lucide { width: 13px; height: 13px; }
.insight { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; margin: 0 !important; }
.insight-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: white; background: var(--blue); font-weight: 900; }
.insight-high .insight-icon { background: var(--red); }
.insight-low .insight-icon { background: var(--green); }
.evidence { margin-top: 12px; font-size: .7rem; }

.result-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
.result-metrics div { padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.result-metrics dt { color: var(--ink-3); font-size: .65rem; }.result-metrics dd { margin: 0; font-size: 1.3rem; font-weight: 800; }
.error-list { max-height: 240px; overflow: auto; color: var(--red); font-size: .7rem; }
.admin-create { margin-top: 14px; border-top: 1px solid var(--line); }
.admin-create form { margin-top: 8px; padding-top: 5px; }
.token-reveal { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }.token-reveal code { min-width: 0; flex: 1; user-select: all; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; border-left: 3px solid var(--amber); }
.danger-zone h2, .danger-zone p { margin-bottom: 0; }.danger-zone p { color: var(--ink-3); font-size: .75rem; }

.empty-state { display: grid; min-height: 190px; place-items: center; padding: 35px; border: 1px dashed var(--line-strong); border-radius: 7px; text-align: center; }
.empty-state p { max-width: 480px; color: var(--ink-3); font-size: .78rem; }
.muted-block { margin: 0; padding: 24px 12px; color: var(--ink-3); text-align: center; font-size: .78rem; }

.drawer-scrim { position: fixed; inset: 0; z-index: 79; background: rgb(25 34 42 / 42%); }
.feedback-drawer { position: fixed; inset: 0 0 0 auto; z-index: 80; display: flex; width: min(520px, 100vw); flex-direction: column; transform: translateX(103%); border-left: 1px solid var(--line); background: var(--paper); box-shadow: -12px 0 40px rgb(25 34 42 / 18%); transition: transform 180ms ease; }
.feedback-drawer[aria-hidden="false"] { transform: translateX(0); }
.feedback-drawer form { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.drawer-header, .drawer-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-header h2 { margin: 0; }.drawer-footer { justify-content: flex-end; border-top: 1px solid var(--line); border-bottom: 0; }
.drawer-body { min-height: 0; flex: 1; overflow: auto; padding: 18px 20px; }
.close-button { padding: 6px; border: 0; background: none; font-size: .72rem; font-weight: 700; }
.feedback-preview { margin: 14px 0; }
.feedback-image-stage, .feedback-detail-image { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: #e9e9e6; }
.feedback-image-stage { cursor: crosshair; }
.feedback-image-stage img { width: 100%; }
.feedback-marker { position: absolute; width: 22px; height: 22px; transform: translate(-50%, -50%); border: 3px solid white; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--red), 0 2px 8px rgb(0 0 0 / 35%); pointer-events: none; }
.feedback-marker::after { position: absolute; inset: 6px; border-radius: 50%; background: white; content: ""; }
.feedback-marker.is-static { display: block; }
.inline-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; }
.capture-placeholder { display: grid; min-height: 110px; place-content: center; margin: 14px 0; border: 1px dashed var(--line-strong); border-radius: 6px; color: var(--ink-3); text-align: center; font-size: .7rem; }
.capture-placeholder strong, .capture-placeholder span { display: block; }
.privacy-note + .form-error { margin-top: 10px; }
.form-error { padding: 9px; border-radius: 5px; color: var(--red); background: #fae8e6; font-size: .72rem; }
.feedback-detail-image { max-height: 650px; }.feedback-detail-image img { width: 100%; object-fit: contain; }

.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 28px; background: var(--ink); }
.login-panel { display: grid; width: min(900px, 100%); grid-template-columns: 1.05fr .95fr; overflow: hidden; border-radius: 10px; background: var(--paper); box-shadow: 0 22px 70px rgb(0 0 0 / 22%); }
.login-brand, .login-form-panel { display: grid; align-content: center; min-height: 510px; padding: clamp(36px, 6vw, 70px); }
.login-brand { color: white; background: linear-gradient(145deg, #243442, var(--ink)); }
.login-brand h1 { margin: 15px 0 8px; letter-spacing: .12em; }
.login-brand p:last-child { max-width: 300px; color: #c7d0d6; }
.login-form-panel h2 { font-size: 1.6rem; }.login-footnote { margin: 18px 0 0; color: var(--ink-3); font-size: .64rem; }

@media (max-width: 1080px) {
  :root { --sidebar: 218px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 300px; }.panel-large { grid-column: auto; }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }.metric-strip article:nth-child(n+4) { min-height: 82px; }
  .record-row dl { gap: 12px; }
}
@media (max-width: 820px) {
  .app-sidebar { width: min(286px, calc(100vw - 44px)); transform: translateX(-103%); transition: transform 180ms ease; box-shadow: 15px 0 35px rgb(0 0 0 / 25%); }
  .app-sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 29; display: block; width: 100%; height: 100%; border: 0; background: rgb(25 34 42 / 44%); }
  .sidebar-scrim[hidden] { display: none; }
  .app-main { margin-left: 0; }
  .menu-button { display: inline-grid; }
  .topbar { gap: 8px; padding: 0 12px; }.topbar-context { display: none; }.topbar-actions { min-width: 0; margin-left: auto; gap: 6px; }
  .content { padding: 24px 16px 50px; }
  .two-column-layout, .dashboard-grid, .ticket-layout, .builder-layout, .admin-grid { grid-template-columns: 1fr; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .record-row { grid-template-columns: 1fr; }.record-row dl { padding-left: 0; }
  .table-wrap { margin-inline: -1px; }
  .table-wrap table { min-width: 720px; }
  .login-panel { grid-template-columns: 1fr; }.login-brand { min-height: 240px; }.login-form-panel { min-height: 390px; }
}
@media (max-width: 560px) {
  :root { --topbar: 56px; }
  .topbar-create span, .topbar-feedback span { display: none; }
  .topbar-create, .topbar-feedback { width: 36px; min-height: 36px; padding: 0; }
  .page-header { display: grid; gap: 12px; margin-bottom: 18px; }.header-actions { flex-wrap: wrap; }
  .page-header > .button, .page-header > form, .page-header > .header-actions { justify-self: start; }
  h1 { max-width: 100%; font-size: clamp(1.55rem, 8vw, 2rem); }
  .metric-strip, .compact-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-strip article:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .metric-strip article { min-height: 78px; padding: 11px 12px; }
  .metric-strip strong { font-size: 1.35rem; }
  .span-3, .span-4, .span-6, .span-8, .span-9 { grid-column: span 12; }
  .record-row { gap: 12px; padding: 13px; }.record-row dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 12px; }
  form[data-bulk-form] .table-wrap { overflow: visible; }
  form[data-bulk-form] table { width: 100%; min-width: 0; table-layout: fixed; }
  form[data-bulk-form] :is(th, td):is(:nth-child(4), :nth-child(5), :nth-child(7), :nth-child(8), :nth-child(9)) { display: none; }
  form[data-bulk-form] :is(th, td):nth-child(1) { width: 34px; }
  form[data-bulk-form] :is(th, td):nth-child(2) { width: 58px; }
  form[data-bulk-form] :is(th, td):nth-child(6) { width: 78px; }
  .dashboard-grid .panel-large .table-wrap { overflow: visible; }
  .dashboard-grid .panel-large table { width: 100%; min-width: 0; table-layout: fixed; }
  .dashboard-grid .panel-large :is(th, td):nth-child(n + 3) { display: none; }
  .dashboard-grid .panel-large :is(th, td):first-child { width: 60px; }
  .filter-bar { display: grid; grid-template-columns: 1fr; }.filter-bar > * { width: 100%; max-width: none !important; }.filter-bar .search-field { grid-column: 1 / -1; }
  .filter-disclosure { min-width: 0; }.filter-disclosure > summary { width: fit-content; }.filter-options { grid-template-columns: 1fr; }
  .saved-view-bar { align-items: stretch; }.saved-view-bar > form:first-child { min-width: 0; flex: 1; }.saved-view-bar > form:first-child select { width: 100%; }
  .tab-nav { overflow-x: auto; }.tab-nav > * { flex: 0 0 auto; }
  .panel { padding: 15px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid > div { grid-column: 1 / -1; }
  .detail-layout-grid > div { grid-row: auto; }
  .dynamic-form-layout { display: grid; grid-template-columns: 1fr; grid-auto-rows: auto; }
  .dynamic-layout-field { grid-column: 1 / -1; grid-row: auto; }
  .schema-grid article { grid-column: span 12; }
  .layout-ruler { display: none; }
  .field-layout-canvas { display: flex; min-height: 0; flex-direction: column; background-image: none; }
  .layout-field { min-height: 128px; flex: none; overflow: visible; }
  .layout-field-popover { right: -36px; }
  .layout-field-controls { flex-wrap: wrap; }
  .danger-zone { display: grid; }
  .login-brand, .login-form-panel { padding: 32px 24px; }
  .feedback-drawer { width: 100vw; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }
@media print { .app-sidebar, .topbar, .feedback-drawer, .drawer-scrim, .button, .filter-bar { display: none !important; }.app-main { margin: 0; }.content { max-width: none; padding: 0; }.panel { box-shadow: none; } }
