/*
  Deliberately hand-written and dependency-free. This is an internal console for a handful of
  operators; a CSS framework here would be a build step and a supply-chain surface bought for
  about four hundred lines of styling.

  Colours track the product's brand token `primary` (#0FA3B1) so the admin and the app read as
  one system, but nothing is loaded from the tenant theme — an admin console whose own chrome
  changes with whichever tenant is selected would be actively confusing.
*/

:root {
    --ink: #12232a;
    --muted: #64777f;
    --line: #dde5e8;
    --surface: #ffffff;
    --canvas: #f4f7f8;
    --primary: #0fa3b1;
    --primary-deep: #0b7c87;
    --danger: #c0392b;
    --danger-soft: #fdecea;
    --warn: #b7791f;
    --success: #1e8e5a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font: 15px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ── Shell ─────────────────────────────────────────────────────────────────── */

.page {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex: 0 0 240px;
    background: var(--ink);
    color: #e6eef1;
    padding: 20px 0;

    /* Pinned to the viewport with its own scroller: a tall page scrolls the window past it
       instead of stretching it, and a menu taller than the screen scrolls on its own. */
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.brand {
    padding: 0 20px 20px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.brand-mark {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-sub {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--primary);
}

main {
    flex: 1;
    min-width: 0; /* lets wide tables scroll instead of stretching the shell */
}

.content {
    padding: 28px 32px 64px;
    max-width: 1200px;
}

h1 {
    font-size: 24px;
    font-weight: 650;
    letter-spacing: -0.01em;
    margin: 0 0 20px;
}

/* ── Navigation ────────────────────────────────────────────────────────────── */

.nav-menu {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.nav-section {
    padding: 18px 20px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #7d949c;
}

.nav-item {
    padding: 8px 20px;
    color: #cddade;
    text-decoration: none;
    border-left: 3px solid transparent;
}

a.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

a.nav-item.active {
    background: rgba(15, 163, 177, 0.15);
    border-left-color: var(--primary);
    color: #fff;
}

/* Not-yet-built sections. Visibly inert rather than a link to an empty page. */
.nav-item-pending {
    color: #5d7178;
    cursor: default;
}

.nav-item-pending::after {
    content: " · soon";
    font-size: 11px;
    color: #4a5c63;
}

.env-badge {
    margin: 16px 20px 0;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-align: center;
    background: #34474e;
    color: #cddade;
}

.env-badge-development {
    background: #234a3a;
    color: #7fe0b0;
}

/* Anything that is not Development gets the loud treatment: this console can rotate live
   credentials, so "which environment am I in" must never be a guess. */
.env-badge-production,
.env-badge-staging {
    background: #5c1f1a;
    color: #ffb4a8;
}

/* ── Tables ────────────────────────────────────────────────────────────────── */

.table-scroll {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

table.grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table.grid th,
table.grid td {
    text-align: left;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.grid th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    background: #fafcfc;
}

table.grid tbody tr:last-child td {
    border-bottom: none;
}

table.grid tbody tr:hover {
    background: #f7fbfb;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Bits ──────────────────────────────────────────────────────────────────── */

code {
    font-family: "Cascadia Mono", ui-monospace, "Consolas", monospace;
    font-size: 0.92em;
    background: #eef3f4;
    padding: 1px 5px;
    border-radius: 3px;
}

.muted {
    color: var(--muted);
}

.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #eef3f4;
    color: var(--muted);
}

.pill-active {
    background: #e3f5ec;
    color: var(--success);
}

.pill-suspended {
    background: var(--danger-soft);
    color: var(--danger);
}

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 150px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.alert p {
    margin: 6px 0 0;
}

.alert-error {
    border-color: #f0c3bd;
    background: var(--danger-soft);
    color: #7d2620;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field > span {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.field input {
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    color: var(--ink);
    background: var(--surface);
}

.field input:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}

.btn {
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-deep);
}

/* ── Login / password ──────────────────────────────────────────────────────── */

.login-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 380px;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(18, 35, 42, 0.06), 0 8px 24px rgba(18, 35, 42, 0.06);
}

.login-brand {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
}

.login-card .brand-mark {
    color: var(--ink);
    font-size: 22px;
}

.login-title {
    margin: 0;
    font-size: 18px;
    text-align: center;
}

.login-note {
    margin: 0;
    font-size: 13px;
}

.login-error {
    padding: 10px 12px;
    font-size: 14px;
}

/* ── Sidebar account block ─────────────────────────────────────────────────── */

.nav-account {
    margin: 0 20px;
    padding-top: 14px;
    border-top: 1px solid #2a3b42;
}

.nav-account-name {
    font-size: 13px;
    font-weight: 650;
    color: #e6eef1;
    overflow-wrap: anywhere;
}

.nav-account-role {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary);
}

.nav-account-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

.nav-account-link {
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 12px;
    color: #9db2ba;
    text-decoration: underline;
    cursor: pointer;
}

.nav-account-link:hover {
    color: #fff;
}

/* ── Ops screens ───────────────────────────────────────────────────────────── */

.section-title {
    margin: 28px 0 4px;
    font-size: 16px;
    font-weight: 650;
}

.section-note {
    margin: 0 0 12px;
    max-width: 70ch;
    font-size: 13px;
}

/* Error text is the one column allowed to wrap — a NetSuite fault body on one line pushes every
   other column off the screen, and that body is usually the reason you opened the page. */
table.grid td.wrap {
    white-space: normal;
    min-width: 220px;
    max-width: 460px;
}

.num-bad {
    color: var(--danger);
    font-weight: 650;
}

.pill-good {
    background: #e3f5ec;
    color: var(--success);
}

.pill-bad {
    background: var(--danger-soft);
    color: var(--danger);
}

.pill-warn {
    background: #fdf3e0;
    color: var(--warn);
}

.pill-info {
    background: #e6f4f6;
    color: var(--primary-deep);
}

.pill-neutral {
    background: #eef3f4;
    color: var(--muted);
}

/* ── Settings ──────────────────────────────────────────────────────────────── */

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.setting-row {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.setting-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.setting-label {
    font-weight: 650;
}

.setting-key {
    font-size: 12px;
}

.setting-help {
    margin: 6px 0 0;
    max-width: 78ch;
    font-size: 12.5px;
    color: var(--muted);
}

.setting-shadowed {
    color: var(--warn);
}

.setting-input {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.setting-input input,
.setting-input select {
    flex: 1;
    max-width: 460px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    background: var(--surface);
    color: var(--ink);
}

.setting-input input:disabled,
.setting-input select:disabled {
    background: #f3f6f7;
    color: var(--muted);
}

.btn-small {
    padding: 7px 14px;
    background: #eef3f4;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-small:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-small:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.alert-ok {
    border-color: #b7e2cc;
    background: #eefaf4;
    color: #16694a;
}

/* ── Tenant configuration ──────────────────────────────────────────────────── */

.crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.crumbs a {
    color: var(--primary-deep);
    text-decoration: none;
}

.crumbs a:hover {
    text-decoration: underline;
}

.crumb-sep {
    color: var(--muted);
}

.subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin: 0 0 20px;
    border-bottom: 1px solid var(--line);
}

.subnav a,
.subnav button {
    padding: 8px 14px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    font: inherit;
    font-size: 14px;
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
}

.subnav a:hover,
.subnav button:hover {
    color: var(--ink);
}

.subnav a.active,
.subnav button.active {
    border-bottom-color: var(--primary);
    color: var(--ink);
    font-weight: 600;
}

.subnav-inner {
    margin-top: 16px;
}

.tenant-picker {
    margin: 0 20px 6px;
    font-size: 13px;
}

.tenant-picker summary {
    padding: 6px 10px;
    border: 1px solid #2f434a;
    border-radius: 6px;
    color: #e6eef1;
    cursor: pointer;
    list-style-position: inside;
}

.tenant-picker ul {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
}

.tenant-picker a {
    display: block;
    padding: 5px 10px;
    border-radius: 4px;
    color: #cddade;
    text-decoration: none;
}

.tenant-picker a:hover,
.tenant-picker a.active {
    background: rgba(15, 163, 177, 0.15);
    color: #fff;
}

.tenant-picker code {
    background: none;
    color: #7d949c;
    font-size: 11px;
}

a.stat-link {
    color: inherit;
    text-decoration: none;
}

a.stat-link:hover {
    border-color: var(--primary);
}

.check-ok {
    color: var(--success);
}

.check-missing {
    color: var(--danger);
    font-weight: 600;
}

.check-soft {
    color: var(--muted);
}

.alert-warn {
    border-color: #f1d9a8;
    background: #fdf6e7;
    color: #7a5310;
    margin: 12px 0;
}

.alert-info {
    border-color: #bfe3e8;
    background: #eef8f9;
    color: #0b5f67;
    margin: 12px 0;
}

.alert-ok,
.alert-error {
    margin: 12px 0;
}

.issue-list {
    margin: 6px 0 0;
    padding-left: 20px;
}

.issue-list li {
    margin: 2px 0;
}

.issue-error {
    color: #7d2620;
}

.issue-warn {
    color: #7a5310;
}

.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 18px;
    margin: 0 0 18px;
    font-size: 14px;
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
}

.plain-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plain-list li {
    padding: 4px 0;
}

.plain-list.columns {
    columns: 3 220px;
}

.small {
    font-size: 12.5px;
}

.center {
    text-align: center;
}

.nowrap {
    white-space: nowrap;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */

fieldset {
    margin: 0;
    padding: 0;
    border: none;
    min-width: 0;
}

.form-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 16px 0;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.danger-card {
    border-color: #f0c3bd;
}

.form-heading {
    margin: 6px 0 0;
    font-size: 14px;
    font-weight: 650;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px 18px;
}

.bilingual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}

.field.narrow {
    max-width: 420px;
}

.field input,
.field select,
.field textarea,
.grid-form input,
.grid-form select,
.axis textarea,
.search-row input {
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    width: 100%;
}

.field select:focus,
.field textarea:focus,
.grid-form input:focus,
.grid-form select:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: var(--primary);
}

fieldset:disabled input,
fieldset:disabled select,
fieldset:disabled textarea,
input:disabled,
select:disabled,
textarea:disabled {
    background: #f3f6f7;
    color: var(--muted);
}

/* A prerendered editor whose circuit has not started yet: shown, but not usable. */
.editor-host[inert] button {
    opacity: .6;
}

.field small {
    font-size: 12px;
}

.field-error {
    display: block;
    font-size: 12.5px;
    font-style: normal;
    color: var(--danger);
}

.code-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-family: "Cascadia Mono", ui-monospace, "Consolas", monospace;
    font-size: 12.5px;
    line-height: 1.5;
    tab-size: 2;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
}

.choice input {
    margin-top: 4px;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 6px 18px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
}

.btn {
    display: inline-block;
    text-decoration: none;
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary-deep);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #9c2e22;
}

.btn-danger-soft {
    color: var(--danger);
}

.btn:disabled,
.btn-icon:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary:disabled:hover {
    background: var(--primary);
}

.btn-icon {
    padding: 2px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: none;
    font-size: 11px;
    color: var(--muted);
    cursor: pointer;
}

.btn-icon:hover:not(:disabled) {
    border-color: var(--line);
    color: var(--ink);
}

.order-cell {
    width: 1%;
}

table.grid-form td {
    white-space: normal;
    vertical-align: top;
    padding: 6px 8px;
}

table.grid td.wrap {
    white-space: normal;
}

tr.row-off td {
    color: var(--muted);
}

tr.confirm-row td {
    background: var(--danger-soft);
    white-space: normal;
}

.style-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.style-picker .preview-btn {
    cursor: pointer;
    opacity: 0.55;
}

.style-picker .preview-btn.chosen {
    opacity: 1;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary);
}

.pill-style-primary {
    background: #e6f4f6;
    color: var(--primary-deep);
}

.pill-style-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.pill-style-secondary {
    background: #eef3f4;
    color: var(--muted);
}

.axis {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}

.axis-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.axis-head strong {
    min-width: 100px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.chip {
    padding: 2px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.chip:hover {
    border-color: var(--primary);
}

table.matrix td.cell-warn {
    background: #fdf6e7;
}

.lookup {
    margin: 0;
    padding: 0;
    list-style: none;
}

.lookup li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line);
}

.search-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.search-row input {
    max-width: 360px;
}

.pager {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.editor-crash button {
    margin-top: 6px;
}

/* ── View designer ─────────────────────────────────────────────────────────── */

.designer-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 20px;
    align-items: end;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.designer-titles {
    grid-column: 1 / -1;
}

.designer-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 13px;
    color: var(--muted);
}

.designer-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.designer-issues {
    margin: 12px 0 0;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 13px;
}

.designer-issues summary {
    cursor: pointer;
    font-weight: 600;
}

.designer-grid {
    display: grid;
    grid-template-columns: minmax(280px, 1.3fr) minmax(260px, 1fr) minmax(220px, 0.9fr);
    gap: 16px;
    align-items: start;
}

.designer-tree,
.designer-props,
.designer-palette {
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
}

.designer-props {
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.designer-props fieldset {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.designer-props .bilingual {
    grid-template-columns: 1fr;
}

.tree-tab {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.tree-section {
    margin: 4px 0 6px 14px;
    padding-left: 10px;
    border-left: 2px solid #e8eef0;
}

.tree-field {
    margin-left: 12px;
}

.tree-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border-radius: 5px;
}

.tree-row.selected {
    background: #e6f4f6;
}

.tree-label {
    flex: 1;
    min-width: 0;
    padding: 4px 6px;
    border: none;
    background: none;
    font: inherit;
    font-size: 13.5px;
    text-align: left;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.tree-row-tab .tree-label {
    font-weight: 650;
}

.tree-row-section .tree-label {
    font-weight: 600;
    color: #33474e;
}

.tree-tools {
    display: flex;
    flex: 0 0 auto;
}

.tree-add {
    margin: 2px 0 0 6px;
    padding: 2px 6px;
    border: none;
    background: none;
    font: inherit;
    font-size: 12.5px;
    color: var(--primary-deep);
    cursor: pointer;
}

.tree-add:hover {
    text-decoration: underline;
}

.palette-group {
    margin: 12px 0 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.palette {
    margin: 0;
    padding: 0;
    list-style: none;
}

.palette button {
    display: block;
    width: 100%;
    padding: 4px 6px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: none;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.palette button:hover:not(:disabled) {
    border-color: var(--line);
    background: #f7fbfb;
}

.palette li.placed button {
    opacity: 0.45;
    cursor: default;
}

.palette small {
    display: block;
}

/* ── Preview ───────────────────────────────────────────────────────────────── */

.preview-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 14px;
    margin-bottom: 14px;
}

.preview-controls .field {
    min-width: 320px;
}

.toggle {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 6px;
    overflow: hidden;
}

.toggle button {
    padding: 8px 14px;
    border: none;
    background: var(--surface);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.toggle button.active {
    background: var(--primary);
    color: #fff;
}

.preview {
    max-width: 440px;
    padding: 16px;
    background: #f7f9fa;
    border: 1px solid var(--line);
    border-radius: 18px;
    font-size: 14px;
}

.preview-title {
    margin-bottom: 12px;
    font-size: 17px;
    font-weight: 650;
}

.preview-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.preview-tabs button {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font: inherit;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}

.preview-tabs button.active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.preview-section {
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--surface);
    border-radius: 12px;
}

.preview-section h4 {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--muted);
}

.preview-field {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f3f4;
}

.preview-field:last-child {
    border-bottom: none;
}

.preview-field-wide {
    flex-direction: column;
    gap: 6px;
}

.preview-label {
    color: var(--muted);
}

.preview-value {
    text-align: end;
    font-weight: 550;
    overflow-wrap: anywhere;
}

.preview-empty {
    color: var(--muted);
    font-size: 13px;
}

.preview-help {
    margin: 4px 0;
    color: var(--muted);
    font-size: 13px;
}

.preview-divider {
    border: none;
    border-top: 1px solid var(--line);
}

.preview-table-scroll {
    overflow-x: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.preview-table th,
.preview-table td {
    padding: 4px 6px;
    border-bottom: 1px solid #f0f3f4;
    text-align: start;
    white-space: nowrap;
}

.preview-table th {
    color: var(--muted);
    font-weight: 600;
}

.preview-files {
    margin: 0;
    padding: 0;
    list-style: none;
}

.preview-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 6px;
}

.preview-btn {
    display: inline-block;
    padding: 9px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
}

.preview-btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.preview-btn-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.preview-btn-secondary {
    color: var(--ink);
}

/* ── Circuit health ────────────────────────────────────────────────────────── */

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 10px 20px;
    background: #7d2620;
    color: #fff;
    font-size: 14px;
}

#blazor-error-ui a {
    color: #fff;
    font-weight: 600;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 14px;
    top: 8px;
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
}

.reconnect-modal {
    display: none;
}

.reconnect-modal.components-reconnect-show,
.reconnect-modal.components-reconnect-failed,
.reconnect-modal.components-reconnect-rejected {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 999;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    background: rgba(18, 35, 42, 0.35);
}

.reconnect-card {
    max-width: 420px;
    padding: 18px 22px;
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(18, 35, 42, 0.2);
    font-size: 14px;
}

.reconnect-card p {
    display: none;
    margin: 0;
}

.components-reconnect-show .reconnect-show-text,
.components-reconnect-failed .reconnect-failed-text,
.components-reconnect-rejected .reconnect-rejected-text {
    display: block;
}

/* ── Display mode: the record ID and the cards' positions ── */

.display-panel {
    display: grid;
    gap: 18px;
}

.display-block {
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.display-id {
    max-width: 360px;
}

.display-layout {
    display: grid;
    grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.display-slot-editor {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.display-slot-editor .bilingual {
    grid-template-columns: 1fr;
}

/* The app's cards, near enough to judge a layout by. */

.dcard {
    padding: 14px 15px 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-inline-start: 4px solid var(--primary);
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(18, 35, 42, 0.06);
    color: var(--ink);
    font-size: 12px;
}

.dcard-row,
.dcard-split,
.dcard-footer {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
}

.dcard-col {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.dcard-end {
    align-items: flex-end;
    text-align: end;
}

.dcard-big {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.dcard-caption,
.dcard-muted {
    color: var(--muted);
    font-size: 11.5px;
}

.dcard-bold {
    font-weight: 800;
}

.dcard-eyebrow {
    margin-bottom: 3px;
    color: var(--primary-deep);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 1.1px;
}

.dcard-title {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    font-size: 14px;
    font-weight: 800;
}

.dcard-sep {
    color: var(--muted);
}

.dcard-pill {
    margin-inline-start: auto;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(226, 92, 58, 0.12);
    color: #e25c3a;
    font-size: 10px;
}

.dcard-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
}

.dcard-icon {
    margin-inline-end: 4px;
}

.dcard-footer {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid var(--line);
    align-items: center;
}

.dcard-module {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.6px;
}

.dcard-ref {
    color: var(--primary-deep);
    font-size: 11.5px;
    font-weight: 800;
}

.dcard-grow {
    flex: 1;
    min-width: 0;
    text-align: end;
}

.dcard-line {
    display: block;
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: 700;
}

.dcard-fixed,
.dcard-fixed-inline {
    color: #9aa9af;
    font-size: 10.5px;
    font-style: italic;
}

.dcard-fixed {
    margin-top: 8px;
    padding: 4px 8px;
    border: 1px dashed var(--line);
    border-radius: 8px;
}

.dcard-slot {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 100%;
    padding: 3px 7px;
    border: 1px dashed var(--primary);
    border-radius: 6px;
    background: rgba(15, 163, 177, 0.06);
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.dcard-end .dcard-slot {
    align-items: flex-end;
    text-align: end;
}

.dcard-slot small {
    color: var(--primary-deep);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.dcard-slot.empty {
    border-color: var(--line);
    background: transparent;
    color: #9aa9af;
    font-style: italic;
}

.dcard-slot.selected {
    border-style: solid;
    box-shadow: 0 0 0 2px rgba(15, 163, 177, 0.25);
}

.preview-id {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
}

.preview .dcard {
    margin-bottom: 12px;
}

.preview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 400px));
    gap: 16px;
    margin-top: 18px;
}

@media (max-width: 1100px) {
    .display-layout {
        grid-template-columns: 1fr;
    }

    .designer-grid {
        grid-template-columns: 1fr;
    }

    .designer-props {
        position: static;
    }
}

@media (max-width: 720px) {
    .bilingual {
        grid-template-columns: 1fr;
    }

    .designer-toolbar {
        grid-template-columns: 1fr;
    }
}

/* An action that reads as part of a sentence, e.g. "Refresh from NetSuite" under a picker. */
.btn-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: var(--primary-deep);
    text-decoration: underline;
    cursor: pointer;
}

.btn-link:disabled {
    color: var(--muted);
    cursor: default;
}

.record-type-status {
    display: block;
    margin-top: 4px;
}

.record-type-status .btn-link {
    margin-left: .3em;
}

/* The activation QR: white quiet zone in either theme, crisp modules when scaled. */
.qr-code { display: block; background: #fff; padding: 12px; border-radius: 8px; image-rendering: pixelated; margin: 12px 0; }
