:root {
  --bg: #f6f8fb; --surface: #ffffff; --surface-2: #f0f3f8; --ink: #18253b; --ink-2: #526178; --muted: #77859a;
  --line: #e4e9f1; --accent: #3267e3; --accent-ink: #ffffff; --good: #1a7f4b; --warn: #b26a00; --bad: #c0392b;
  --nav: #ffffff; --nav-ink: #526178; --nav-muted: #8894a6; --radius: 12px; --canvas: #edf1f6;
  --chip-good-bg: #e3f3ea; --chip-good: #1a7f4b; --chip-warn-bg: #fbefd9; --chip-warn: #8a5200;
  --chip-info-bg: #e1ecfa; --chip-info: #1c5cab; --chip-trained-bg: #ede7fb; --chip-trained: #4a3aa7;
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--ink); -webkit-font-smoothing: antialiased;
}
/* Dark: follows the system unless the viewer chose Light; always when they chose Dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161615; --surface: #1f1f1d; --surface-2: #2a2a27; --ink: #f2f2ef; --ink-2: #c3c2b7; --muted: #8f8e88;
    --line: #3a3a36; --accent: #3987e5; --nav: #0f1113; --canvas: #2b2b28;
    --chip-good-bg: #173a27; --chip-good: #6fd39b; --chip-warn-bg: #3d2c0d; --chip-warn: #f0b552;
    --chip-info-bg: #16304f; --chip-info: #8dbcf5; --chip-trained-bg: #2c2550; --chip-trained: #b4aaf2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161615; --surface: #1f1f1d; --surface-2: #2a2a27; --ink: #f2f2ef; --ink-2: #c3c2b7; --muted: #8f8e88;
    --line: #3a3a36; --accent: #3987e5; --nav: #0f1113; --canvas: #2b2b28;
    --chip-good-bg: #173a27; --chip-good: #6fd39b; --chip-warn-bg: #3d2c0d; --chip-warn: #f0b552;
    --chip-info-bg: #16304f; --chip-info: #8dbcf5; --chip-trained-bg: #2c2550; --chip-trained: #b4aaf2;
    color-scheme: dark;
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; height: 100vh; height: 100dvh; background: var(--bg); overflow: hidden; }
a { color: var(--accent); }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.nav { width: 218px; flex: none; background: var(--surface); color: var(--ink); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 0 12px 16px; }
.brand { display: flex; align-items: center; gap: 11px; flex: none; height: 89px; padding: 0 12px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 11px; box-shadow: 0 4px 10px #3267e320; }
.brand-mark svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: -.5px; }
.brand-text > span { display: block; font-size: 9px; font-weight: 600; letter-spacing: 2.6px; color: var(--muted); margin-top: 3px; }
.nav-pages { overflow-y: auto; flex: 1; }
.nav-group { padding: 8px 0; }
.nav-title { font-size: 10px; font-weight: 650; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 7px 12px 9px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 11px 12px; margin: 2px 0; color: var(--ink-2); text-decoration: none; border-radius: 8px; font-size: 13px; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { color: var(--accent); background: var(--chip-info-bg); font-weight: 650; }
.nav-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.nav-settings { position: relative; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.nav-settings > summary { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 10px; border-radius: 8px; font-size: 12px; color: var(--ink-2); list-style: none; }
.nav-settings > summary:hover { background: var(--surface-2); }
.nav-settings-panel { position: absolute; left: 0; bottom: 48px; width: 252px; z-index: 35; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 12px 40px #17294320; }
.nav-caption { font-size: 8px; letter-spacing: .13em; color: var(--muted); padding: 10px 12px 0; }
.nav-foot { padding: 12px 8px 0; font-size: 11px; color: var(--muted); line-height: 1.6; border-top: 1px solid var(--line); margin-top: 14px; }
main { flex: 1; overflow: auto; min-width: 0; }
.page { padding: 36px 40px; max-width: 1560px; margin: 0 auto; }
h1 { font-size: 25px; letter-spacing: -.7px; font-weight: 650; margin: 0 0 8px; }
.sub { color: var(--ink-2); margin: 0 0 26px; line-height: 1.7; font-size: 13px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
input[type=text], input[type=search], input[type=number], select { font: inherit; padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
button { font: inherit; font-size: 13px; font-weight: 500; padding: 8px 13px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; white-space: nowrap; transition: border-color .15s, box-shadow .15s; }
button:hover { border-color: var(--muted); background: var(--surface-2); }
button:focus-visible, summary:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.primary:hover { filter: brightness(.95); background: var(--accent); }
button.active { background: var(--chip-info-bg); color: var(--accent); border-color: transparent; }
button:disabled { opacity: .5; cursor: default; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; box-shadow: 0 2px 4px #18253b03; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--accent); box-shadow: 0 8px 24px #18253b0c; }
a.card { text-decoration: none; color: inherit; }
.card img { width: 100%; height: 190px; object-fit: contain; background: #fff; border-bottom: 1px solid var(--line); }
.card .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 7px; }
.card .title { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.card .meta { color: var(--ink-2); font-size: 12px; overflow-wrap: anywhere; line-height: 1.5; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.chip.good { background: var(--chip-good-bg); color: var(--chip-good); }
.chip.warn { background: var(--chip-warn-bg); color: var(--chip-warn); }
.chip.info { background: var(--chip-info-bg); color: var(--chip-info); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; }
.muted { color: var(--muted); }
.log { background: #111; color: #d9d9d4; font: 12px/1.5 ui-monospace, Menlo, monospace; padding: 10px; border-radius: 6px; max-height: 300px; overflow: auto; white-space: pre-wrap; }
#toast { position: fixed; bottom: 18px; right: 18px; max-width: 420px; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--surface); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50; }
#toast.show { opacity: .95; }
#toast.error { background: var(--bad); color: #fff; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 260px;
  border: 2px dashed var(--line); border-radius: 12px; padding: 36px 24px; text-align: center; background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s; }
.drop:hover, .drop:focus-within { border-color: var(--accent); }
.drop.over { border-color: var(--accent); background: var(--surface-2); }
.drop .icon { width: 52px; height: 52px; color: var(--accent); }
.drop .big { font-size: 16px; font-weight: 600; color: var(--ink); }
.drop .formats { font-size: 12px; color: var(--muted); }
.steps { display: flex; gap: 8px; margin: 0 0 18px; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; }
.step b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-size: 12px; }
.step.on { color: var(--ink); border-color: var(--accent); }
.step.on b { background: var(--accent); color: var(--accent-ink); }
.add-wrap { max-width: 900px; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.pages figure { margin: 0; border: 2px solid var(--line); border-radius: 6px; cursor: pointer; background: #fff; }
.pages figure.selected { border-color: var(--accent); }
.pages img { width: 100%; height: 150px; object-fit: contain; display: block; }
.pages figcaption { font-size: 12px; text-align: center; padding: 3px; color: #333; }

/* editor */
.editor { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.editor-header { display: flex; gap: 14px; align-items: center; padding: 18px 24px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.back-button { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 18px; }
.back-button:hover { background: var(--surface-2); }
.editor-heading { min-width: 100px; flex: 1; }
.eyebrow { font-size: 9px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.editor-heading .title { font-size: 17px; letter-spacing: -.35px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.editor-status { display: flex; align-items: center; gap: 10px; flex: none; }
.save-state { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.editor-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.editor-actions #save { min-width: 66px; }
.verify-button { font-size: 12px; }
.action-menu { position: relative; }
.action-menu > summary { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 500; list-style: none; white-space: nowrap; }
summary::-webkit-details-marker { display: none; }
.action-menu > summary:hover, .action-menu[open] > summary { background: var(--surface-2); }
.action-popover { position: absolute; right: 0; top: calc(100% + 10px); width: 286px; padding: 16px; z-index: 25; display: flex; flex-direction: column; align-items: stretch; gap: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 12px 40px #17294326; max-height: min(600px, 75vh); overflow-y: auto; }
.action-popover label { font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.action-popover select { width: 100%; min-width: 0; }
.action-popover p { font-size: 12px; line-height: 1.5; margin: 0; }
.action-popover button { text-align: left; }
.menu-heading { font-size: 13px; font-weight: 650; }
.floor-actions { width: 230px; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 22px; border-bottom: 1px solid var(--line); background: var(--surface); flex: none; }
.drawing-tools { display: flex; align-items: center; min-width: 0; overflow-x: auto; scrollbar-width: thin; gap: 12px; padding: 1px; }
.tool-group { display: flex; align-items: center; gap: 3px; flex: none; }
.history-tools { border-left: 1px solid var(--line); padding-left: 12px; }
.tool-group button { border-color: transparent; padding: 7px 10px; font-size: 12px; }
.tool-group button.active { background: var(--chip-info-bg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent); }
kbd { font-family: inherit; font-size: 9px; color: var(--muted); padding-left: 6px; opacity: .8; }
.assist-tools { display: flex; gap: 7px; align-items: center; flex: none; }
.assist-button { color: var(--accent); background: var(--chip-info-bg); border-color: transparent; font-size: 12px; }
.assist-button > span { padding-right: 4px; font-size: 16px; }
.editor-body { flex: 1; display: flex; min-height: 0; overflow: hidden; }
.annotation-workflow { display: flex; align-items: center; flex-wrap: wrap; column-gap: 20px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 11px; line-height: 1.6; flex: none; }
.workflow-steps { display: flex; gap: 26px; align-items: center; list-style: none; margin: 0; padding: 0; }
.workflow-steps li { display: flex; align-items: center; gap: 7px; color: var(--muted); position: relative; white-space: nowrap; }
.workflow-steps li:not(:last-child)::after { content: '›'; position: absolute; right: -17px; color: var(--muted); }
.workflow-steps li > span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 10px; font-weight: 600; }
.workflow-steps .current { color: var(--accent); font-weight: 600; }
.workflow-steps .current > span { color: #fff; background: var(--accent); }
.workflow-note { margin-left: auto; color: var(--muted); font-size: 10px; }
#annotation-status:not(:empty), .annotation-progress { flex-basis: 100%; }
#annotation-status { max-height: 68px; overflow: auto; color: var(--ink-2); }
.annotation-progress { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 8px; background: var(--surface-2); }
.annotation-progress[hidden] { display: none; }
.annotation-spinner { width: 24px; height: 24px; flex: none; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: annotation-spin .8s linear infinite; }
.annotation-elapsed { margin-left: auto; flex: none; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@keyframes annotation-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .annotation-spinner { animation: none; } }
.canvas { flex: 1; position: relative; background: var(--canvas); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 16px 16px; min-width: 0; min-height: 0; overflow: hidden; }
.canvas > svg { position: absolute; inset: 0; outline: none; }
.canvas > svg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.canvas svg { width: 100%; height: 100%; display: block; user-select: none; }
.canvas .hint { position: absolute; left: 16px; bottom: 16px; max-width: min(500px, calc(100% - 220px)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; line-height: 1.5; color: var(--ink-2); background: var(--surface); padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; pointer-events: none; box-shadow: 0 2px 8px #17294306; }
.canvas-caption { position: absolute; top: 16px; left: 16px; display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 10px; pointer-events: none; }
.canvas-page { background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 5px 9px; color: var(--ink-2); font-weight: 500; }
.canvas-zoom { position: absolute; bottom: 16px; right: 16px; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 4px 12px #1729430c; }
.canvas-zoom button { border: 0; padding: 5px 10px; font-size: 14px; }
.canvas-zoom #fit { border-left: 1px solid var(--line); border-radius: 0 5px 5px 0; font-size: 11px; margin-left: 3px; }
#zoom-level { min-width: 42px; font-size: 10px; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.edge-magnifier { position: absolute; width: 180px; height: 180px; border: 2px solid var(--accent); border-radius: 50%; overflow: hidden; background: #fff; box-shadow: 0 3px 16px #0006; pointer-events: none; z-index: 4; }
.edge-magnifier[hidden] { display: none; }
.magnifier-crosshair { position: absolute; inset: 50% auto auto 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); }
.magnifier-crosshair::before, .magnifier-crosshair::after { content: ""; position: absolute; background: #111; box-shadow: 0 0 0 1px #fff; }
.magnifier-crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; }
.magnifier-crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }
.magnifier-zoom { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 1px 6px; border-radius: 4px; color: #111; background: #fffd; font-size: 12px; font-weight: 600; }
.side { width: 304px; flex: none; border-left: 1px solid var(--line); background: var(--surface); overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; scrollbar-width: thin; }
.side > div { padding: 17px 18px; border-bottom: 1px solid var(--line); flex: none; }
.side > div:empty { display: none; }
.side h3 { font-size: 10px; text-transform: uppercase; letter-spacing: .09em; font-weight: 650; color: var(--ink-2); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; }
.side p { font-size: 11px; line-height: 1.6; margin: 10px 0; }
.side .toolbar { gap: 6px; margin-bottom: 0; }
.side .toolbar button { font-size: 11px; padding: 7px 9px; }
.inspector-heading { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 24px; }
.selection-count { color: var(--muted); font-size: 10px; font-weight: 400; }
.section-count { font-size: 10px; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
.side #review-label { font-size: 13px; padding: 10px; border-radius: 7px; }
.label-list { max-height: 30vh; overflow-y: auto; scrollbar-width: thin; margin: 0 -6px; }
.side .review-label-row { padding: 7px 7px; margin: 1px 0; border-radius: 6px; font-size: 12px; }
.side .swatch { width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.side .count { font-size: 11px; }
.side summary { font-size: 11px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.selection-help { margin-top: 14px; }
.selection-help summary { color: var(--muted); font-weight: 400; font-size: 10px; }
.side .activity-entry { border-left: 2px solid var(--line); margin-top: 14px; padding-left: 10px; font-size: 11px; line-height: 1.7; }
.view-controls label { font-size: 11px; color: var(--ink-2); }
.view-controls input[type=range] { width: 160px; margin-left: 10px; accent-color: var(--accent); vertical-align: middle; }
.view-controls input[type=checkbox] { accent-color: var(--accent); margin-top: 12px; }
.keyboard-help p { font-size: 10px; }
.label-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.label-row:hover { background: var(--surface-2); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.label-row .count { margin-left: auto; color: var(--muted); font-size: 12px; }
.label-row.hidden { opacity: .4; }
.review-label-row { width: 100%; border: 1px solid transparent; background: transparent; text-align: left; white-space: normal; }
.review-label-row.active { color: var(--accent); border-color: var(--accent); background: var(--surface-2); }
.review-label-row.active .count { color: var(--accent); }
.review-label-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.review-empty { padding: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink-2); }
.attr-row { display: flex; gap: 6px; margin-bottom: 5px; }
.attr-row input { flex: 1; min-width: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.status-dot.dirty { background: var(--warn); }
.status-dot.saved { background: var(--good); }
.shape { cursor: pointer; }
.handle { fill: #fff; stroke: #111; cursor: move; }
.handle.active { fill: var(--accent); stroke: #fff; }
.corner-actions { margin-bottom: 10px; }
.corner-actions p { margin: 5px 0 0; font-size: 12px; }
.gat-table td:last-child { white-space: nowrap; }
.nav a:focus:not(:focus-visible) { outline: none; }
.notice { margin: 10px 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--accent); background: var(--surface-2); line-height: 1.6; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; }
.tabs a { padding: 8px 14px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.bthumb { width: 150px; max-height: 150px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 4px; display: block; }
table.bulk td { vertical-align: middle; }
tr.muted-row td { opacity: .6; }
.mid { cursor: copy; }
.chip.trained { background: var(--chip-trained-bg); color: var(--chip-trained); }
.nav-foot a { color: var(--accent); padding: 0; display: inline; font-size: inherit; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 60; }
.modal-card { background: var(--surface); color: var(--ink); border-radius: 12px; padding: 22px; width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line); }
.xml-copy-card { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.xml-copy-card textarea { width: 100%; height: min(55vh, 500px); margin-bottom: 12px; resize: vertical; font: 12px/1.5 ui-monospace, Menlo, monospace; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.login-screen { background: var(--bg); z-index: 90; padding: 20px; }
.login-card { width: min(420px, 100%); padding: 36px; box-shadow: 0 12px 50px #1729430d; }
.login-brand { font-size: 22px; font-weight: 700; letter-spacing: -.7px; margin-bottom: 38px; }
.login-brand span { color: var(--accent); font-size: 10px; letter-spacing: 2px; margin-left: 8px; }
.login-card h2 { font-size: 23px; letter-spacing: -.7px; margin: 12px 0; }
.login-card label { display: block; margin: 18px 0 7px; font-size: 12px; font-weight: 500; }
.login-card input { width: 100%; padding: 12px; font: inherit; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); }
.login-card button { width: 100%; padding: 12px; }
.login-error { color: var(--bad); font-size: 12px; line-height: 1.6; min-height: 18px; margin: 14px 0; }
.login-footnote { font-size: 10px; color: var(--muted); line-height: 1.7; margin: 20px 0 0; }
[aria-disabled=true] { opacity: .45; pointer-events: none; }
.modal-card h2 { margin: 0 0 6px; font-size: 18px; }
.stale { position: fixed; top: 0; left: 218px; right: 0; z-index: 70; background: #b26a00; color: #fff; padding: 8px 16px; font-size: 13px; }
.stale code { background: rgba(0,0,0,.2); padding: 1px 5px; border-radius: 4px; }
.tag-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -4px 0 16px; }
.tag { border-radius: 16px; padding: 4px 11px; font-size: 12px; }
.tag span { color: var(--muted); margin-left: 3px; }
.tag.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tag.on span { color: var(--accent-ink); opacity: .85; }
.tag.clear { border-style: dashed; }
.chip.verified { background: var(--chip-good-bg); color: var(--chip-good); font-weight: 600; }
.theme { display: flex; gap: 2px; margin: 0 0 10px; padding: 3px; border-radius: 7px; background: var(--surface-2); }
.theme button { flex: 1; padding: 6px 0; font-size: 11px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); }
.theme button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px #17294312; }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
button.danger:hover { border-color: var(--bad); }
button.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
.plan-form { display: grid; grid-template-columns: 1fr 1.3fr 260px; gap: 18px; align-items: start; }
.plan-form textarea { width: 100%; font: 13px/1.5 ui-monospace, Menlo, monospace; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.shape-svg { width: 100%; height: 200px; display: block; }
.stage-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.stage-n { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.plan-img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.cands { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
.cands img { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
table.rules tr.fail td { color: var(--bad); }
@media (max-width: 1100px) { .plan-form, .two-col { grid-template-columns: 1fr; } }
.graph-svg { width: 100%; max-height: 620px; display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.totals { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink-2); }
tr.subtotal td { color: var(--ink-2); background: var(--surface-2); }
.theme-inline { display: inline-flex; gap: 4px; }
.solver-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.solver-steps figure { margin: 0; }
.solver-steps img { width: 100%; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.solver-steps figcaption { font-size: 12px; margin-top: 4px; line-height: 1.4; }
@media (max-width: 1100px) { .solver-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 1400px) {
  .editor-header { padding: 16px 18px; gap: 10px; }
  .editor-heading .title { font-size: 15px; }
  .workflow-note { display: none; }
  .tool-group button { padding: 7px 8px; }
  .tool-group kbd { display: none; }
  .side { width: 282px; }
  .editor-bar { padding: 9px 16px; }
}
@media (max-width: 1180px) {
  .nav { width: 72px; padding: 0 10px 12px; }
  .brand { height: 80px; padding: 0 8px; }
  .brand-text, .nav-label, .nav-pages .nav-title, .nav-caption { display: none; }
  .nav a { justify-content: center; padding: 13px; }
  .nav-group { padding: 6px 0; }
  .nav-settings > summary { justify-content: center; }
  .nav-settings-panel { left: 58px; bottom: 0; }
  .stale { left: 72px; }
  .editor-status > .trained { display: none; }
}
@media (max-width: 950px) {
  .save-state { display: none; }
  .editor-status { gap: 4px; }
  .editor-header { gap: 8px; }
  .editor-actions { gap: 5px; }
  .verify-button { font-size: 10px; padding: 8px; }
  .side { width: 258px; }
  .side > div { padding: 15px; }
  .assist-tools > .action-menu > summary { font-size: 0; padding: 8px; }
  .assist-tools > .action-menu > summary::before { content: '⚙'; font-size: 15px; }
  .assist-tools > .action-menu > summary span { display: none; }
  .page { padding: 26px 22px; }
}
@media (max-width: 700px) {
  .nav { width: 58px; padding: 0 5px 10px; }
  .brand { padding: 0 7px; height: 70px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .nav a { padding: 12px; }
  .nav-settings-panel { left: 49px; }
  .stale { left: 58px; }
  .editor-header { flex-wrap: wrap; padding: 12px; gap: 8px; }
  .editor-heading .title { font-size: 14px; }
  .editor-status .chip { font-size: 9px; }
  .editor-status > .good { display: none; }
  .editor-actions { width: 100%; justify-content: flex-end; }
  .editor-actions .action-menu:first-child > summary { font-size: 0; padding: 7px; }
  .editor-actions .action-menu:first-child > summary::after { content: '•••'; font-size: 13px; }
  .editor-actions .action-menu:first-child > summary span { display: none; }
  .editor-actions .export-menu > summary { padding: 8px; gap: 6px; font-size: 11px; }
  .editor-actions #save { min-width: 48px; padding: 8px 10px; font-size: 11px; }
  .verify-button { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .action-popover { position: fixed; top: 124px; right: 12px; width: min(286px, calc(100vw - 82px)); }
  .assist-tools .action-popover { top: 170px; }
  .editor-bar { padding: 8px 10px; gap: 6px; }
  .assist-button { font-size: 11px; padding: 8px; }
  .assist-button > span { display: none; }
  .assist-tools { gap: 4px; }
  .annotation-workflow { padding: 8px 12px; }
  .workflow-steps { gap: 16px; width: 100%; justify-content: space-between; }
  .workflow-steps li { gap: 4px; font-size: 9px; }
  .workflow-steps li:not(:last-child)::after { display: none; }
  .workflow-steps li:not(.current) { font-size: 0; gap: 0; }
  .editor-body { flex-direction: column; }
  .side { width: 100%; max-height: 38%; border-left: 0; border-top: 1px solid var(--line); }
  .canvas { min-height: 160px; }
  .canvas-caption { left: 10px; top: 10px; }
  .canvas .hint { display: none; }
  .canvas-zoom { right: 10px; bottom: 10px; }
  .inspector-heading { margin-bottom: 16px; }
  .page { padding: 22px 16px; }
  .panel { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
}

.nav-foot b { overflow-wrap: anywhere; }
.access-table { overflow-x: auto; margin-bottom: 16px; }

.ai-reference-button { display: inline-flex; align-items: center; gap: 7px; color: var(--accent); }
.ai-reference-button .nav-icon { width: 16px; height: 16px; }
.ai-reference-card { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; }
.ai-reference-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.ai-reference-badge { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 12px; font-weight: 600; }
.ai-reference-heading button { font-size: 22px; padding: 1px 9px; }
.ai-reference-card .sub { margin: 10px 0 18px; }
.ai-reference-steps { padding-left: 21px; font-size: 13px; line-height: 1.65; color: var(--ink-2); }
.ai-reference-steps li { padding-left: 4px; margin-bottom: 12px; }
.ai-reference-steps b { color: var(--ink); }
.ai-reference-card .notice { font-size: 12px; margin: 18px 0; }
.ai-reference-card label { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 600; }
.ai-reference-card textarea { width: 100%; height: 185px; resize: vertical; font: 11px/1.6 ui-monospace, Menlo, monospace; padding: 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--surface-2); }
.ai-reference-card #ai-reference-status { min-height: 32px; font-size: 12px; line-height: 1.6; }
.ai-reference-actions { justify-content: flex-end; margin-bottom: 0; }
@media (max-width: 560px) { .ai-reference-card { padding: 18px; } .ai-reference-actions button { flex: 1; } }

.ownership-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 24px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 11px; color: var(--ink-2); }
.ownership-bar b { overflow-wrap: anywhere; }
.ownership-bar button { font-size: 11px; padding: 5px 9px; }
#active-issue { flex: 1; overflow-wrap: anywhere; }
.correction-form { background: var(--surface); padding: 14px 24px; border-bottom: 1px solid var(--line); }
.correction-form label { display: block; margin-bottom: 8px; font-size: 12px; }
.correction-form textarea { width: min(700px, 100%); height: 64px; display: block; padding: 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit; }
.correction-form .toolbar { margin: 10px 0 0; }
#correction-error { color: var(--bad); font-size: 12px; }
.team-floor-filters { align-items: flex-end; gap: 12px; margin-bottom: 24px; }
.team-floor-filters label { display: grid; gap: 6px; font-size: 11px; color: var(--ink-2); }
.team-floor-filters input, .team-floor-filters select { padding: 9px; max-width: min(300px, calc(100vw - 110px)); }
.team-floor-card { cursor: default; }
.team-floor-preview { display: block; }
.team-floor-card .meta b { overflow-wrap: anywhere; }
.team-floor-card .toolbar { margin: 12px 0 0; }
.issue-reason { padding: 5px 0; color: var(--ink-2); overflow-wrap: anywhere; }

.label-filter { position: relative; }
.label-filter > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; color: var(--ink); background: var(--surface); list-style: none; }
.label-filter-menu { padding: 10px; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.label-filter-menu > p { margin: 0 0 8px; }
.label-filter-options { max-height: 235px; overflow-y: auto; scrollbar-width: thin; }
.label-filter-options label { display: flex; align-items: center; gap: 7px; padding: 6px 2px; font-size: 12px; cursor: pointer; }
.label-filter-options input { accent-color: var(--accent); flex: none; }
.label-filter-options .count { margin-left: auto; color: var(--muted); font-size: 11px; }
.label-filter-actions { margin: 10px 0 0; }
.removal-scope { margin: 6px 0 0; font-size: 10px; }

.storage-page { max-width: 1500px; }
.storage-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.storage-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 24px 0; }
.storage-stats > div { border: 1px solid var(--line); border-radius: 10px; padding: 18px; background: var(--surface); }
.storage-stats span { display: block; color: var(--muted); font-size: 12px; }
.storage-stats strong { display: block; font-size: 28px; margin-top: 8px; }
.storage-help { margin-bottom: 20px; line-height: 1.6; }
.storage-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.storage-table { border-collapse: collapse; width: 100%; text-align: left; font-size: 12px; }
.storage-table th { background: var(--surface-2); color: var(--muted); font-weight: 600; padding: 13px 16px; white-space: nowrap; }
.storage-table td { border-top: 1px solid var(--line); padding: 16px; vertical-align: top; max-width: 370px; overflow-wrap: anywhere; }
.storage-table small { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.storage-table .chip { margin: 0 4px 4px 0; }
.storage-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 195px; }
.storage-row-actions button { font-size: 11px; padding: 6px 9px; }
.storage-objects { margin-top: 28px; }
.storage-objects > summary { cursor: pointer; font-size: 14px; font-weight: 600; padding: 12px 0; }
.storage-objects code { font-size: 11px; }
#objects-more { margin-top: 12px; }
.storage-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; padding: 26px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 16px 64px #0004; }
.storage-dialog::backdrop { background: #10182888; }
.storage-dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.storage-dialog h2 { font-size: 19px; margin: 0; }
.storage-dialog label { display: block; font-size: 12px; margin-top: 20px; line-height: 1.6; }
.storage-dialog textarea, .storage-dialog input { display: block; width: 100%; margin-top: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--surface-2); font: inherit; }
.storage-dialog textarea { height: 82px; resize: vertical; }
.storage-dialog .notice { line-height: 1.6; }
#storage-delete-status, #storage-files-status { line-height: 1.7; font-size: 13px; }
.storage-file { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 12px; }
.storage-file span { overflow-wrap: anywhere; }
.storage-file small { flex: none; color: var(--muted); }
@media (max-width: 700px) { .storage-stats { grid-template-columns: 1fr 1fr; } .storage-heading { align-items: flex-start; flex-direction: column; } .storage-page .team-floor-filters label { width: 100%; } .storage-page .team-floor-filters input, .storage-page .team-floor-filters select { width: 100%; max-width: 100%; } }
.storage-dialog .toolbar { margin-top: 18px; justify-content: flex-end; }

.dataset-floor-link { display: block; color: inherit; text-decoration: none; flex: 1; }
.dataset-owner-action { padding: 0 16px 14px; }
.dataset-owner-action button { font-size: 12px; }
.storage-dialog select { width: 100%; display: block; margin-top: 7px; }
#team-mine.on { color: var(--accent); border-color: var(--accent); }
