/* Canvas · Graphite. Responsive equal-sized translation panes. */
:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #ecefef;
  --ink: #273138;
  --muted: #56636d;
  --line: #d4dadd;
  --border: #7b8892;
  --accent: #303b45;
  --on-accent: #ffffff;
  --accent-soft: #e6ebee;
  --sidebar: #e9eded;
  --success: #206141;
  --success-bg: #e9f4ec;
  --warning: #875112;
  --warning-bg: #fff3d9;
  --danger: #a13737;
  --danger-bg: #ffeded;
  --radius: 12px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { margin-top: 0; line-height: 1.25; letter-spacing: -.03em; }
h1 { font-size: clamp(2rem, 3.8vw, 2.7rem); font-weight: 650; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.05rem; }
p { margin-top: 0; }
small { font-size: .8rem; }
pre, code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .83rem; overflow-wrap: anywhere; }
pre { white-space: pre-wrap; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.muted, .small-text { color: var(--muted); }
.row, .wrap, .bulk-actions, .section-heading, .header-actions { display: flex; gap: 12px; align-items: center; }
.wrap, .bulk-actions { flex-wrap: wrap; }
.grow { flex: 1; }
.right { text-align: right; }

/* Rings are inset on text panes; ordinary controls retain space for an outset ring. */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button, .button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}
button:hover:enabled, .button:hover { background: var(--surface-2); border-color: var(--ink); }
button:active:enabled { transform: translateY(1px); }
.primary, .button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.primary:hover:enabled, .button.primary:hover { background: var(--ink); color: var(--on-accent); }
.secondary { color: var(--ink); background: var(--surface); }
.text-button, .text-link { padding: 5px; min-height: 30px; background: transparent; color: var(--accent); border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover:enabled, .text-link:hover:enabled { border-color: var(--border); background: var(--surface-2); }
.danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.button.small, button.small { padding: 6px 10px; min-height: 32px; font-size: .8rem; }
button[aria-pressed=true], .button[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
/* Explicit selectors outrank primary/secondary fills, so disabled controls remain legible. */
button:disabled, .button:disabled, input:disabled, select:disabled {
  opacity: 1;
  cursor: not-allowed;
  color: var(--muted);
  background: var(--surface-2);
  border-color: var(--border);
}
button.text-button:disabled { background: transparent; border-color: transparent; text-decoration: none; }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input[type=checkbox], input[type=radio] { width: 19px; height: 19px; flex: none; accent-color: var(--accent); cursor: pointer; }
summary { cursor: pointer; font-weight: 600; }

/* Public workspace: expand without losing a comfortable browser-edge gutter. */
.header, .site-header,
body.workspace main:not(.admin-main), .public-main {
  width: calc(100% - clamp(32px, 7vw, 112px));
  max-width: 1480px;
  margin-inline: auto;
}
.header, .site-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 0 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.6rem; font-weight: 750; letter-spacing: -.06em; text-decoration: none; }
.brand-mark { color: var(--accent); }
.brand-symbol { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; color: var(--on-accent); background: var(--accent); font-size: 1.1rem; }
.brand small { color: var(--muted); font-size: .72rem; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.header nav, .header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.header nav a, .header-actions a { color: var(--muted); font-size: .85rem; }
.header nav a[aria-current=page] { color: var(--ink); font-weight: 700; }
body.workspace main:not(.admin-main), .public-main { padding: 28px 0 16px; }
.intro, .public-heading { margin: 0 0 26px; }
.intro h1, .public-heading h1 { margin: 0 0 10px; }
.intro > p:last-child, .public-heading > p { color: var(--muted); max-width: 720px; font-size: 1rem; margin-bottom: 0; }
.eyebrow { color: var(--muted); font-size: .73rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; margin: 0 0 12px; }
.translation-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 32px #27313806; overflow: hidden; }
.toolbar, .translation-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; padding: 18px 22px; gap: 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.language-field, .language-picker { display: flex; align-items: center; min-width: 0; gap: 12px; }
.language-field label, .language-picker > span { color: var(--muted); font-size: .8rem; font-weight: 600; }
.language-field select, .language-picker select { flex: 1; width: 100%; min-width: 0; max-width: 350px; font-weight: 650; font-size: .95rem; }
.language-field select { appearance: none; padding-right: 2.1rem; background-image: url('/chevron.svg'); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; }
.swap { flex: none; }
.panes, .translation-panes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pane, .text-pane { min-width: 0; display: grid; grid-template-rows: 52px auto 56px; }
.output-pane, .text-pane + .text-pane { border-left: 1px solid var(--line); background: var(--surface-2); }
.pane-heading, .pane-topline { padding: 0 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.pane textarea, .text-input {
  display: block;
  width: 100%;
  height: 380px;
  min-height: 160px;
  padding: 14px 22px 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.13rem;
  line-height: 1.75;
  resize: none;
  overflow: auto;
  overflow-wrap: anywhere;
  outline-offset: -4px;
}
.pane textarea:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.pane-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 22px 14px; color: var(--muted); font-size: .75rem; min-height: 48px; }
.actions, .translation-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-top: 1px solid var(--line); }
.actions > p { color: var(--muted); font-size: .85rem; margin: 0; flex: 1; }
.actions .primary { padding: 12px 26px; min-width: 150px; }
.notes, .public-bottom { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 18px 3px; color: var(--muted); font-size: .8rem; }
.notes p, .public-bottom p { margin: 0; }
.notes a { white-space: nowrap; }
.result-note { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 12px 16px; margin: 16px 0 0; font-size: .85rem; }
.result-note p:last-child { margin-bottom: 0; }
.metadata { padding: 16px 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.metadata h2 { font-size: 1rem; color: var(--ink); margin: 0 0 6px; }
.metadata > p { margin-bottom: 10px; }
.metadata .bulk-actions { margin: 12px 0; }
.metadata summary { color: var(--accent); }
.metadata dl, .meta-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 20px; margin: 14px 0 0; }
.metadata dt, .meta-grid dt { font-weight: 600; }
.metadata dd, .meta-grid dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.metadata li { padding-block: 5px; }
.metadata li p { margin-bottom: 5px; }

/* Shared feedback and management form controls. */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; margin: 0 0 18px; font-size: .85rem; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; font-weight: 400; }
.field textarea { min-height: 100px; resize: vertical; }
.field small, .field .hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
.field-grid, .settings-grid, .admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.field.full { grid-column: 1 / -1; }
.check-field { display: flex; align-items: flex-start; gap: 10px; font-size: .85rem; margin: 12px 0; }
.notice, .note, .empty-state { color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; font-size: .875rem; margin-block: 18px; }
.notice h2, .notice h3, .empty-state h2, .empty-state h3 { color: var(--ink); margin-bottom: 8px; }
.notice p:last-child, .note p:last-child, .empty-state p:last-child { margin-bottom: 0; }
.notice.warning, .notice-warning, .note.warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
.notice.error, .notice-error, .error { color: var(--danger); }
.notice.error, .notice-error { background: var(--danger-bg); border-color: var(--danger); }
.notice.success, .notice-success, .note.success { color: var(--success); background: var(--success-bg); border-color: var(--success); }
.empty-state { padding: 28px; }
.feedback-backdrop, .scrim, .modal-backdrop { position: fixed; inset: 0; z-index: 20; background: #1d252cb3; padding: 30px; display: grid; place-items: center; overflow: auto; }
.feedback-dialog, .modal { display: block; position: relative; width: min(100%, 620px); max-height: calc(100svh - 60px); margin: auto; padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 20px 80px #0003; overflow: auto; }
dialog.feedback-dialog::backdrop { background: #1d252cb3; }
.feedback-dialog > h2, .modal > h2 { font-size: 1.5rem; margin: 0 0 10px; }
.feedback-dialog > p, .modal > p { color: var(--muted); font-size: .875rem; }
.feedback-dialog textarea { min-height: 110px; }
.feedback-actions, .modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.sample-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.sample-pair > * { min-width: 0; border: 1px solid var(--line); padding: 12px; border-radius: 7px; background: var(--surface-2); }
.sample-pair p, .sample-pair pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 180px; overflow: auto; font-size: .85rem; margin: 7px 0 0; }

/* Administration layout. Management data is rendered only after a verified session. */
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 75svh; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: clip; }
.admin-sidebar, .sidebar { display: flex; flex-direction: column; gap: 24px; min-width: 0; background: var(--sidebar); border-right: 1px solid var(--line); padding: 22px 16px; }
.admin-sidebar .brand, .sidebar .brand { padding: 0 9px; }
.admin-nav, .sidebar-nav { display: flex; flex-direction: column; gap: 6px; }
.admin-nav-item, .nav-item, .admin-nav button, .sidebar-nav button { display: flex; width: 100%; justify-content: flex-start; gap: 10px; padding: 11px 12px; background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 7px; text-decoration: none; font-size: .87rem; font-weight: 550; }
.admin-nav-item:hover, .nav-item:hover, .admin-nav button:hover:enabled, .sidebar-nav button:hover:enabled { background: var(--surface); }
.admin-nav-item[aria-current=page], .nav-item[aria-current=page], .admin-nav [aria-current=page], .admin-nav .active, .sidebar-nav .active { color: var(--ink); background: var(--surface); border-color: var(--border); font-weight: 650; }
.sidebar-footer, .admin-account { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: .8rem; }
.account { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.account strong { color: var(--ink); display: block; }
.account span { font-size: .75rem; }
.admin-main { min-width: 0; width: 100%; margin: 0; }
.admin-header { padding: 24px 28px 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.admin-header h1 { font-size: 1.65rem; margin: 4px 0 0; }
.breadcrumbs { color: var(--muted); font-size: .8rem; }
.admin-content { padding: 28px; min-width: 0; }
.card, .admin-card, .management { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; margin-bottom: 22px; }
.card h2, .admin-card h2, .management h2 { margin: 0 0 12px; }
.card > p, .admin-card > p, .management > p { color: var(--muted); font-size: .875rem; line-height: 1.65; }
.card > p:last-child, .admin-card > p:last-child { margin-bottom: 0; }
.card-header, .section-title, .section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.card-header h2, .section-title h2, .section-title h3 { margin: 0 0 6px; }
.section-title p { color: var(--muted); margin: 0; font-size: .875rem; }
.card-header p { color: var(--muted); margin: 0; font-size: .8rem; }
.admin-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-toolbar input[type=search] { flex: 1; min-width: 180px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 650; line-height: 1.45; }
.badge.success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.badge.warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.login-card { max-width: 540px; margin: 40px auto 70px; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.login-card h1, .login-card h2 { font-size: 1.8rem; }
.login-card > p { color: var(--muted); font-size: .95rem; }
.login-card .primary { width: 100%; margin: 10px 0; }
.login-card .notice { margin-bottom: 0; }

/* Real inventory, transfers, routes and process diagnostics retain their Elm APIs. */
.bulk-actions { margin: 16px 0; }
.policy-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; }
.policy-fields label { font-size: .85rem; font-weight: 600; }
.policy-fields input { display: block; width: 100%; margin-top: 7px; }
.pack-search { display: block; font-size: .875rem; font-weight: 600; }
.pack-search input { display: block; width: 100%; max-width: 620px; margin-top: 8px; }
.table-scroll, .table-wrap { overflow-x: auto; max-width: 100%; }
table, .admin-table { border-collapse: collapse; width: 100%; font-size: .83rem; }
caption { text-align: left; font-weight: 650; padding-bottom: 14px; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); background: var(--surface-2); font-size: .75rem; font-weight: 600; }
td small { display: block; color: var(--muted); margin-top: 4px; font-size: .75rem; }
td code { overflow-wrap: anywhere; }
td:has(progress) { min-width: 240px; }
.batch-status { padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--accent-soft); display: grid; gap: 7px; }
.batch-status label { font-weight: 650; }
.batch-status span { color: var(--muted); font-size: .85rem; }
progress { width: 100%; min-width: 100px; height: 13px; display: block; margin-block: 8px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; accent-color: var(--accent); background: var(--surface-2); }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.confirm-panel { margin: 18px 0; border: 1px solid var(--danger); border-radius: 8px; background: var(--danger-bg); padding: 18px; }
.confirm-panel button + button { margin-left: 10px; }
.route-card { padding: 18px; margin-block: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.route-card h3 { margin-bottom: 8px; }
.route-card p { color: var(--muted); font-size: .85rem; }
.route-card ul { font-size: .85rem; padding-left: 20px; }
.route-ready { color: var(--success) !important; }
.route-unavailable { color: var(--danger) !important; }
.metric-grid, .stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 16px 0 24px; }
.metric-grid > div, .stat { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); min-width: 0; }
.metric-grid dt, .stat dt { color: var(--muted); font-size: .8rem; }
.metric-grid dd, .stat dd { margin: 7px 0 0; font-size: 1.3rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.server-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.server-charts figure { padding: 14px; margin: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.server-charts figcaption { color: var(--muted); font-size: .8rem; }
.server-charts svg { display: block; width: 100%; height: 90px; margin-top: 10px; }
#profile-rows td:first-child, #profile-rows td:last-child { font-family: ui-monospace, monospace; font-size: .8rem; overflow-wrap: anywhere; }
#profile-seconds { max-width: 90px; }
.management details > summary { color: var(--accent); }

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .admin-sidebar, .sidebar { padding: 22px 12px; }
  .admin-content { padding: 22px; }
  .admin-grid, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .header, .site-header { padding: 20px 0 12px; gap: 14px; flex-wrap: wrap; }
  .brand { font-size: 1.4rem; }
  .brand small { display: none; }
  .header nav, .header-actions { gap: 12px; }
  .connection, .service-state { font-size: .73rem; }
  body.workspace main:not(.admin-main), .public-main { padding-top: 20px; }
  .intro, .public-heading { margin-bottom: 20px; }
  .intro > p:last-child, .public-heading > p { font-size: .9rem; }
  .toolbar, .translation-toolbar { padding: 14px; gap: 10px; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .language-field, .language-picker { flex-direction: column; align-items: stretch; gap: 6px; }
  .language-field label { font-size: .73rem; }
  .language-field select { padding: 9px 23px 9px 8px; font-size: .85rem; background-position: right 8px center; }
  .swap { margin-top: 22px; padding-inline: 8px; font-size: .75rem; max-width: 80px; }
  .panes, .translation-panes, .field-grid, .sample-pair { grid-template-columns: 1fr; }
  .pane, .text-pane { grid-template-rows: 48px auto 56px; }
  .output-pane, .text-pane + .text-pane { border-left: 0; border-top: 1px solid var(--line); }
  .pane-heading, .pane-topline { padding-inline: 18px; }
  .pane textarea, .text-input { padding: 12px 18px 18px; font-size: 1rem; line-height: 1.65; }
  .pane-footer { padding-inline: 18px; font-size: .72rem; }
  .actions, .translation-actions { padding: 16px; flex-wrap: wrap; gap: 12px; }
  .actions > p { flex-basis: 100%; }
  .actions .primary { flex: 1; }
  .notes, .public-bottom { flex-wrap: wrap; font-size: .75rem; gap: 12px; }
  .metadata { padding: 16px 18px; }
  .metadata dl, .meta-grid { grid-template-columns: 1fr; gap: 4px; }
  .metadata dd, .meta-grid dd { margin-bottom: 10px; }
  .feedback-backdrop, .scrim, .modal-backdrop { padding: 14px; }
  .feedback-dialog, .modal { max-height: calc(100svh - 28px); padding: 22px; }
  .feedback-actions, .modal-actions { flex-wrap: wrap; }
  .feedback-actions .primary { flex: 1; }
  .admin-shell { display: flex; flex-direction: column; }
  .admin-sidebar, .sidebar { padding: 16px; gap: 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .admin-nav, .sidebar-nav { flex-direction: row; overflow-x: auto; gap: 5px; padding: 4px; }
  .admin-nav-item, .nav-item, .admin-nav button, .sidebar-nav button { flex: none; width: auto; white-space: nowrap; font-size: .8rem; padding: 10px; }
  .sidebar-footer, .admin-account { padding-top: 12px; }
  .admin-header { padding: 20px; }
  .admin-content { padding: 18px 16px; }
  .admin-header h1 { font-size: 1.5rem; }
  .card, .admin-card, .management { padding: 18px; margin-bottom: 18px; }
  .admin-grid, .settings-grid, .server-charts { grid-template-columns: 1fr; }
  .login-card { margin-block: 24px 40px; padding: 24px; }
  .metric-grid, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-grid > div, .stat { padding: 12px; }
  .metric-grid dd { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Feedback is an Elm dialog; native fieldset disabled state covers all form controls. */
.dialog-backdrop { position: fixed; inset: 0; z-index: 20; background: #1d252cb3; padding: 30px; display: grid; place-items: center; overflow: auto; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.dialog-heading h2 { margin: 3px 0 0; font-size: 1.5rem; }
.dialog-close { flex: none; }
.feedback-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 18px; font-size: .85rem; }
.form-field > label { font-weight: 600; }
.form-field select, .form-field textarea, .form-field input { width: 100%; }
.form-field textarea { min-height: 130px; resize: vertical; }
.form-field small { color: var(--muted); font-size: .78rem; }
.feedback-consent { display: flex; align-items: flex-start; gap: 10px; font-size: .85rem; margin: 20px 0 12px; }
.feedback-consent input { margin: 2px 0 0; }
.feedback-form > fieldset > .muted { font-size: .8rem; line-height: 1.6; }
.feedback-pair { font-weight: 600; color: var(--ink) !important; }
.feedback-review { border: 1px solid var(--border); border-radius: 7px; padding: 14px; font-size: .85rem; margin: 18px 0; }
.feedback-review h3 { margin: 18px 0 8px; font-size: .8rem; color: var(--muted); }
.feedback-review pre { background: var(--surface-2); color: var(--ink); margin: 0; border-radius: 5px; padding: 12px; max-height: 200px; overflow: auto; white-space: pre-wrap; font: inherit; }
.feedback-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); border-radius: 7px; padding: 14px; font-size: .85rem; margin: 18px 0; }
.feedback-receipt { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); border-radius: 7px; padding: 14px; }
#feedback-status:empty { display: none; }
@media (max-width: 760px) { .dialog-backdrop { padding: 14px; } }

/* Canvas page composition and keyboard entry. */
.skip-link { position: fixed; z-index: 30; inset: 12px auto auto 12px; transform: translateY(-160%); padding: 10px 16px; background: var(--accent); color: var(--on-accent); border: 2px solid var(--surface); border-radius: 7px; font-weight: 600; }
.skip-link:focus { transform: translateY(0); outline: 3px solid var(--accent); }
.public-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.public-heading .intro { margin: 0; }
.public-heading .intro > p:last-child { max-width: 650px; }
.actions .bulk-actions { margin: 0; }
.result-tools { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 18px; overflow: hidden; }
.result-summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 22px; }
.result-summary .result-note { padding: 0; border: 0; background: transparent; margin: 0; }
.result-summary button { flex: none; }
@media (max-width: 760px) {
  .public-heading { align-items: flex-start; gap: 18px; flex-direction: column; }
  .result-summary { padding: 15px 18px; flex-wrap: wrap; gap: 12px; }
}

/* Administration forms and review states from Admin.View. */
.admin-content .section-title h1 { font-size: clamp(1.7rem, 2.4vw, 2.15rem); margin: 0 0 9px; }
.admin-content .section-title .eyebrow { margin-bottom: 9px; }
.admin-header > span { color: var(--muted); font-size: .85rem; align-self: center; }
.admin-sidebar .eyebrow { margin: 0 9px -8px; }
.sidebar-footer strong { display: block; color: var(--ink); font-weight: 650; }
.sidebar-footer p { margin: 3px 0 12px; overflow-wrap: anywhere; }
.sidebar-footer .badge { display: table; margin: 0 0 8px; }
.sidebar-footer button { margin-left: -5px; }
.admin-toolbar > .field { margin-bottom: 0; min-width: 160px; }
.admin-toolbar > .field:first-child { flex: 1; max-width: 580px; }
.admin-table td p { margin: 6px 0; max-width: 470px; min-width: 130px; overflow-wrap: anywhere; }
.badge-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; max-width: 300px; }
.check-label { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: .85rem; margin: 14px 0 18px; }
.check-label input { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; padding-top: 18px; margin-top: 22px; border-top: 1px solid var(--line); }
.admin-card > .admin-grid { margin: 18px 0 22px; }
.admin-card > .admin-grid > div > pre { padding: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); max-height: 340px; overflow: auto; line-height: 1.65; }
.admin-card > .admin-grid h3 { color: var(--muted); font-size: .85rem; }
.admin-card > .admin-grid > div { min-width: 0; }
.secret-panel { border-color: var(--warning); background: var(--warning-bg); }
.secret-panel textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; resize: none; line-height: 1.6; }
.token-editor { border-color: var(--border); }
.token-editor fieldset { border: 1px solid var(--border); border-radius: 7px; padding: 8px 18px 0; margin: 6px 0 18px; }
.token-editor legend { padding: 0 6px; font-weight: 600; font-size: .85rem; }
.token-editor h3 { margin: 5px 0 8px; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { border-top: 1px solid var(--line); padding: 18px 0; }
.activity-list li:first-child { border-top: 0; padding-top: 4px; }
.activity-list li:last-child { padding-bottom: 0; }
.activity-list strong { font-weight: 600; font-size: .9rem; }
.activity-list p { margin: 6px 0; color: var(--muted); font-size: .85rem; }
.activity-list small { color: var(--muted); }
.small { font-size: .8rem; }
@media (max-width: 760px) {
  .admin-sidebar .eyebrow { margin-bottom: -8px; }
  .sidebar-footer { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .sidebar-footer p { margin: 0; }
  .sidebar-footer .badge { margin: 0; }
  .sidebar-footer button { margin-left: auto; }
  .admin-toolbar { align-items: stretch; }
  .admin-toolbar > .field { min-width: 140px; flex: 1; }
  .card-actions button { flex: 1; }
}

/* Detection results: plain candidates, with no actions or expandable metadata. */
.language-candidates { margin-top: 20px; padding: 18px 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.language-candidates h2 { margin: 0 0 12px; font-size: .95rem; }
.language-candidates p { color: var(--muted); margin: 0 0 10px; font-size: .85rem; }
.language-candidates ol { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; max-width: 440px; }
.language-candidates li { display: flex; justify-content: space-between; gap: 24px; color: var(--ink); font-size: .9rem; }
.candidate-score { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Keep the detection shortcut beside the source selector at every viewport size. */
.source-controls { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; width: 100%; }
.detect-reset { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; }
.detect-reset svg { display: block; }
