/* ============================================================================
   Onix — Design System
   A modern, enterprise-grade ERP UI. Class names are kept stable so every
   existing page inherits the new look with no markup changes. Ships with a
   first-class dark theme (auto + manual override via [data-theme]).
   ============================================================================ */

/* ─── Design tokens ──────────────────────────────────────────────────────── */

:root {
    /* Surfaces */
    --bg:            #eef1f6;
    --bg-soft:       #f6f8fb;
    --panel:         #ffffff;
    --panel-2:       #f8fafc;
    --panel-hover:   #f4f7fb;

    /* Text */
    --ink:           #16202e;
    --ink-soft:      #3a465a;
    --muted:         #6a7689;
    --muted-2:       #93a0b5;

    /* Lines */
    --line:          #e4e9f2;
    --line-strong:   #d3dbe8;

    /* Brand — a confident, modern indigo/blue */
    --brand:         #3557f0;
    --brand-strong:  #2742d6;
    --brand-ink:     #ffffff;
    --brand-soft:    #e9eeff;
    --brand-soft-2:  #dbe3ff;
    --ring:          rgba(53, 87, 240, 0.35);

    /* Semantic */
    --good:          #12855a;
    --good-soft:     #d9f3e6;
    --danger:        #d23f38;
    --danger-soft:   #fde3e1;
    --danger-strong: #b02f28;
    --warn:          #b5731a;
    --warn-soft:     #fceccf;
    --info:          #1f6fb2;
    --info-soft:     #dcecfb;

    /* Top bar (dark chrome) */
    --topbar-bg:     #131a2b;
    --topbar-bg-2:   #1b2540;
    --topbar-ink:    #eef2fb;
    --topbar-ink-dim:#9aa8c7;
    --topbar-hover:  rgba(255, 255, 255, 0.08);
    --topbar-active: rgba(255, 255, 255, 0.14);
    --topbar-border: rgba(255, 255, 255, 0.09);
    --topbar-h:      56px;

    /* Elevation */
    --shadow-xs: 0 1px 1px rgba(16, 24, 40, 0.05);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.07), 0 1px 3px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 14px rgba(16, 24, 40, 0.09), 0 2px 4px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 18px 44px rgba(16, 24, 40, 0.18);

    /* Radii */
    --radius-xs: 5px;
    --radius-sm: 7px;
    --radius-md: 11px;
    --radius-lg: 16px;

    /* Motion */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dur:  0.16s;

    /* Search glyph (light theme) — stroke matches --muted. */
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%236a7689' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");

    color-scheme: light;
}

/* Auto dark mode */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { color-scheme: dark; }
}

/* Manual dark toggle (data-theme="dark" set on <html>) */
:root[data-theme="dark"] {
    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238b97ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    --bg:            #0d1117;
    --bg-soft:       #10151d;
    --panel:         #161c26;
    --panel-2:       #1b222e;
    --panel-hover:   #1e2632;

    --ink:           #e8edf5;
    --ink-soft:      #c1cad8;
    --muted:         #8b97ab;
    --muted-2:       #6b7688;

    --line:          #262f3d;
    --line-strong:   #33404f;

    --brand:         #6f8bff;
    --brand-strong:  #5573f5;
    --brand-ink:     #0d1117;
    --brand-soft:    #1c2740;
    --brand-soft-2:  #24325a;
    --ring:          rgba(111, 139, 255, 0.4);

    --good:          #4cc78a;
    --good-soft:     #143728;
    --danger:        #f27a72;
    --danger-soft:   #3a1e1c;
    --danger-strong: #f27a72;
    --warn:          #e0a44a;
    --warn-soft:     #362a12;
    --info:          #64b0e8;
    --info-soft:     #14293a;

    --topbar-bg:     #0a0e15;
    --topbar-bg-2:   #131b2e;

    --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.6);

    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238b97ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
        --bg:            #0d1117;
        --bg-soft:       #10151d;
        --panel:         #161c26;
        --panel-2:       #1b222e;
        --panel-hover:   #1e2632;
        --ink:           #e8edf5;
        --ink-soft:      #c1cad8;
        --muted:         #8b97ab;
        --muted-2:       #6b7688;
        --line:          #262f3d;
        --line-strong:   #33404f;
        --brand:         #6f8bff;
        --brand-strong:  #5573f5;
        --brand-ink:     #0d1117;
        --brand-soft:    #1c2740;
        --brand-soft-2:  #24325a;
        --ring:          rgba(111, 139, 255, 0.4);
        --good:          #4cc78a;  --good-soft:   #143728;
        --danger:        #f27a72;  --danger-soft: #3a1e1c;  --danger-strong: #f27a72;
        --warn:          #e0a44a;  --warn-soft:   #362a12;
        --info:          #64b0e8;  --info-soft:   #14293a;
        --topbar-bg:     #0a0e15;  --topbar-bg-2: #131b2e;
        --shadow-xs: 0 1px 1px rgba(0,0,0,.3);
        --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
        --shadow-md: 0 4px 16px rgba(0,0,0,.45);
        --shadow-lg: 0 20px 48px rgba(0,0,0,.6);
        color-scheme: dark;
    }
}

/* ─── Reset & base ───────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    text-rendering: optimizeLegibility;
}

::selection { background: var(--brand-soft-2); color: var(--ink); }

a { color: var(--brand); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--brand-strong); text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Custom scrollbars. The window keeps room for its scrollbar whether or not the page is long enough to need one,
   so the fixed chrome (its right edge is the viewport's) and the content do not shift by a scrollbar's width between
   a short page and a long one — a classic scrollbar only; an overlay one (macOS) takes no room either way. */
html { scrollbar-gutter: stable; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-2); background-clip: content-box; }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ─── Page chrome ────────────────────────────────────────────────────────── */

.page { display: flex; flex-direction: column; min-height: 100vh; }
/* No entrance animation: a page arrives rendered and stays put — nothing slides or fades on a navigation
   (css/onix-shell.css, "The rail away"; js/onix-settle.js holds the page while its island loads). */
main  { flex: 1; padding: 26px 30px 56px; }
.content { max-width: 1440px; margin: 0 auto; }

/* ─── Top bar ────────────────────────────────────────────────────────────── */

.topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: stretch;
    background: linear-gradient(180deg, var(--topbar-bg-2), var(--topbar-bg));
    color: var(--topbar-ink);
    min-height: var(--topbar-h);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid var(--topbar-border);
    padding: 0 16px;
    box-shadow: 0 1px 0 rgba(0,0,0,0.2), var(--shadow-sm);
}

.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right { gap: 6px; }

.topbar a, .topbar a:visited { color: var(--topbar-ink); }
.topbar a:hover { text-decoration: none; color: #fff; }

.topbar-brand {
    font-size: 1.05rem;
    letter-spacing: 0.2px;
    padding: 0 4px;
    color: var(--topbar-ink) !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.topbar-brand::before {
    content: "";
    width: 22px; height: 22px;
    border-radius: 7px;
    background: linear-gradient(135deg, #6f8bff, #3557f0 60%, #7b3ff0);
    box-shadow: 0 2px 8px -1px rgba(53,87,240,0.7);
    flex: 0 0 auto;
}
.topbar-brand strong { color: #fff; font-weight: 800; }

.topbar-sep { color: var(--topbar-ink-dim); font-weight: 300; user-select: none; margin: 0 1px; opacity: 0.7; }
.topbar-appname {
    font-weight: 650;
    font-size: 0.95rem;
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    transition: background var(--dur) var(--ease);
}
.topbar-appname:hover { background: var(--topbar-hover); }

.topbar .user {
    color: var(--topbar-ink-dim);
    font-size: 0.9rem;
    padding: 0 8px 0 4px;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.topbar .user::before {
    content: attr(data-initial);
    width: 28px; height: 28px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), #7b3ff0);
    color: #fff; font-weight: 700; font-size: 0.8rem;
    flex: 0 0 auto;
}

.topbar-iconlink {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--topbar-ink-dim);
    padding: 0;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.topbar-iconlink svg { width: 18px; height: 18px; display: block; }
.topbar-iconlink:hover { background: var(--topbar-hover); color: #fff; }
.logout-form { margin: 0; display: inline-flex; }

/* Theme toggle: show the moon (switch-to-dark) in light mode, sun in dark mode. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

/* ─── App switcher (waffle dropdown) ─────────────────────────────────────── */

.app-switcher { position: relative; }
.app-switcher > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    color: var(--topbar-ink);
    transition: background var(--dur) var(--ease);
}
.app-switcher > summary::-webkit-details-marker,
.app-switcher > summary::marker { display: none; content: ""; }
.app-switcher > summary:hover { background: var(--topbar-hover); }
.app-switcher[open] > summary { background: var(--topbar-active); }
.waffle-svg { width: 22px; height: 22px; display: block; color: var(--topbar-ink); }

.app-switcher-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 18px;
    min-width: 580px;
    z-index: 60;
    animation: pop-in 0.16s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }

.app-switcher-header {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}
.app-switcher-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    display: flex; flex-wrap: wrap; gap: 4px 12px;
    font-size: 0.8rem;
}
.app-switcher-footer-label { color: var(--muted); }
.app-switcher-footer a { color: var(--muted) !important; }
.app-switcher-footer a:hover { color: var(--brand) !important; text-decoration: underline; }

/* ─── Company switcher (multi-company mode) ─────────────────────────────── */

.company-switcher { position: relative; }
.company-switcher > summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--topbar-ink);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--dur) var(--ease);
}
.company-switcher > summary::-webkit-details-marker,
.company-switcher > summary::marker { display: none; content: ""; }
.company-switcher > summary:hover { background: var(--topbar-hover); }
.company-switcher[open] > summary { background: var(--topbar-active); }
.company-switcher > summary svg { width: 16px; height: 16px; flex: none; }
.company-switcher > summary .company-caret { width: 12px; height: 12px; opacity: 0.7; }
.company-current-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

.company-switcher-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 272px;
    max-width: 340px;
    z-index: 60;
    animation: pop-in 0.16s var(--ease);
}
.company-switcher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 10px 8px;
}
.company-switcher-count {
    min-width: 20px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--line);
    color: var(--muted);
    font-size: 0.68rem;
    text-align: center;
}
/* The list scrolls; header and footer stay put — long company lists stay usable. */
.company-switcher-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: min(56vh, 384px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
    padding-right: 2px;
}
.company-switcher-list::-webkit-scrollbar { width: 8px; }
.company-switcher-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
.company-switcher-list::-webkit-scrollbar-track { background: transparent; }
.company-switch-form { margin: 0; flex: none; }
.company-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
    transition: background var(--dur) var(--ease);
}
.company-option:hover:not(:disabled),
.company-option:focus-visible { background: var(--topbar-hover, rgba(125, 125, 125, 0.12)); }
.company-option.active {
    font-weight: 600;
    cursor: default;
    background: color-mix(in srgb, var(--brand) 10%, transparent);
}
.company-avatar {
    width: 30px;
    height: 30px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: color-mix(in srgb, var(--brand) 16%, transparent);
    color: var(--brand);
    font-size: 0.82rem;
    font-weight: 700;
}
.company-option.active .company-avatar {
    background: var(--brand);
    color: #fff;
}
.company-option-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    line-height: 1.25;
}
.company-option-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-option-code {
    font-size: 0.7rem;
    color: var(--muted);
    letter-spacing: 0.04em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-option-check { width: 15px; height: 15px; color: var(--brand); flex: none; }
.company-switcher-footer {
    margin-top: 6px;
    padding: 8px 10px 4px;
    border-top: 1px solid var(--line);
    font-size: 0.8rem;
}
.company-switcher-footer a { color: var(--muted) !important; text-decoration: none; }
.company-switcher-footer a:hover { color: var(--brand) !important; text-decoration: underline; }

@media (max-width: 860px) { .company-current-name { max-width: 90px; } }

/* ─── Top submenu (horizontal) ───────────────────────────────────────────── */

.topbar-submenu {
    display: flex;
    align-items: stretch;
    gap: 2px;
    min-height: var(--topbar-h);
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 0 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.topbar-submenu::-webkit-scrollbar { height: 0; }

.topbar-submenu .topbar-link {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    color: var(--topbar-ink-dim);
    font-size: 0.9rem;
    font-weight: 550;
    border-bottom: 2px solid transparent;
    position: relative;
    transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.topbar-submenu .topbar-link:hover { color: #fff; background: var(--topbar-hover); }
.topbar-submenu .topbar-link.active {
    color: #fff;
    border-bottom-color: var(--brand);
    background: linear-gradient(180deg, transparent 60%, rgba(53,87,240,0.16) 100%);
}

/* ─── Apps grid (home + switcher panel) ──────────────────────────────────── */

.apps-grid-title { margin: 0 0 4px; font-size: 1.7rem; font-weight: 750; letter-spacing: -0.02em; }

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.app-tile {
    --app-color: var(--brand);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 24px 14px 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--ink);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
    overflow: hidden;
    isolation: isolate;
}
.app-tile::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 90px;
    background: radial-gradient(120px 60px at 50% -10px, color-mix(in srgb, var(--app-color) 22%, transparent), transparent 70%);
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
    z-index: -1;
}
.app-tile:hover {
    text-decoration: none;
    border-color: color-mix(in srgb, var(--app-color) 45%, var(--line));
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.app-tile:hover::after { opacity: 1; }

.app-tile-icon {
    width: 58px; height: 58px;
    border-radius: 16px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    background: linear-gradient(140deg, color-mix(in srgb, var(--app-color) 82%, #fff 18%), var(--app-color));
    box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--app-color) 70%, transparent), inset 0 1px 0 rgba(255,255,255,0.25);
    transition: transform var(--dur) var(--ease);
}
.app-tile:hover .app-tile-icon { transform: scale(1.05); }
.app-tile-icon .app-svg { width: 28px; height: 28px; display: block; }

.app-tile-title { font-weight: 650; font-size: 0.94rem; line-height: 1.25; color: var(--ink); }

.app-tile-badge {
    font-size: 0.66rem; font-weight: 700; color: var(--warn);
    background: var(--warn-soft); border-radius: 999px; padding: 2px 8px;
    letter-spacing: 0.03em; text-transform: uppercase;
}

/* Compact tiles inside the switcher panel */
.app-switcher-panel .apps-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); margin-top: 0; gap: 10px; }
.app-switcher-panel .app-tile { padding: 14px 10px; border-radius: var(--radius-md); }
.app-switcher-panel .app-tile-icon { width: 44px; height: 44px; border-radius: 12px; }
.app-switcher-panel .app-tile-icon .app-svg { width: 22px; height: 22px; }
.app-switcher-panel .app-tile-title { font-size: 0.86rem; }

/* ─── Typography ─────────────────────────────────────────────────────────── */

h1 { font-size: 1.55rem; font-weight: 720; margin: 0 0 10px; letter-spacing: -0.02em; }
h2 { font-size: 1.2rem;  font-weight: 680; margin: 0 0 10px; letter-spacing: -0.01em; }
h3 { font-size: 1rem;    font-weight: 660; margin: 20px 0 8px; }
.lead { color: var(--muted); font-size: 0.98rem; }
.muted { color: var(--muted); }

.page-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.page-header h1, .page-header h2 { margin: 0; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid var(--line-strong);
    background: var(--panel);
    color: var(--ink);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font: inherit;
    font-weight: 550;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.button:hover { border-color: var(--muted-2); background: var(--panel-hover); text-decoration: none; }
.button:active { transform: translateY(1px); box-shadow: none; }
.button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.button.primary {
    background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 92%, #fff 8%), var(--brand));
    color: var(--brand-ink);
    border-color: var(--brand-strong);
    box-shadow: 0 1px 2px rgba(16,24,40,0.14), inset 0 1px 0 rgba(255,255,255,0.2);
}
.button.primary:hover { background: linear-gradient(180deg, var(--brand), var(--brand-strong)); border-color: var(--brand-strong); }

.button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.button.small { padding: 3px 9px; font-size: 0.8rem; border-radius: var(--radius-xs); }

.button.danger { background: var(--danger); color: #fff; border-color: var(--danger-strong); box-shadow: 0 1px 2px rgba(16,24,40,0.14); }
.button.danger:hover { background: var(--danger-strong); }
.button.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: var(--panel); }
.button.danger-outline:hover { border-color: var(--danger); background: var(--danger-soft); }
.button.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.button.ghost:hover { background: var(--panel-hover); border-color: var(--line); }

.link-button { background: none; border: 0; color: var(--brand); cursor: pointer; padding: 0; font: inherit; font-weight: 550; }
.link-button:hover { color: var(--brand-strong); text-decoration: underline; }
.link-button.danger { color: var(--danger); }

/* ─── Toolbar / filters ──────────────────────────────────────────────────── */

.toolbar {
    display: flex; gap: 6px; align-items: center; margin: 0 0 12px; flex-wrap: wrap;
    padding: 6px 10px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
}
/* Search: a compact pill that grows a little on focus, not a full-width slab. */
.toolbar input[type=search] {
    flex: 0 1 230px;
    min-width: 160px;
    height: 28px;
    padding: 0 12px 0 32px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font: inherit;
    font-size: 0.9rem;
    background: var(--panel-2) var(--search-icon) no-repeat 12px center;
    background-size: 15px;
    color: var(--ink);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
                background-color var(--dur) var(--ease), flex-basis 0.2s var(--ease);
}
.toolbar input[type=search]:hover { border-color: var(--muted-2); }
.toolbar input[type=search]:focus {
    outline: none;
    border-color: var(--brand);
    background-color: var(--panel);
    box-shadow: 0 0 0 3px var(--ring);
    flex-basis: 320px;
}
.toolbar input[type=search]::placeholder { color: var(--muted-2); }
.toolbar input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Plain text inputs in toolbars (inline panels etc.) — no search affordance. */
.toolbar input[type=text] {
    flex: 0 1 220px;
    padding: 4px 9px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    background: var(--panel-2);
    color: var(--ink);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.toolbar input[type=text]:focus {
    outline: none; border-color: var(--brand); background-color: var(--panel);
    box-shadow: 0 0 0 3px var(--ring);
}
.toolbar select {
    padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--panel-2); color: var(--ink); font: inherit; cursor: pointer;
}
.toolbar select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.toolbar label.inline { display: flex; align-items: center; gap: 6px; color: var(--muted); }

/* ─── Data table ─────────────────────────────────────────────────────────── */

/* NOTE: no `overflow: hidden` here — any overflow value other than visible
   turns the table into the containing scrollport for the sticky header, which
   then permanently offsets the header 56px into the table and covers the first
   data row. Corner clipping is done per-cell below instead. */
table.grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
}
table.grid thead th:first-child { border-top-left-radius: var(--radius-md); }
table.grid thead th:last-child { border-top-right-radius: var(--radius-md); }
table.grid tbody:last-child tr:last-child td:first-child { border-bottom-left-radius: var(--radius-md); }
table.grid tbody:last-child tr:last-child td:last-child { border-bottom-right-radius: var(--radius-md); }
table.grid tfoot tr:last-child > *:first-child { border-bottom-left-radius: var(--radius-md); }
table.grid tfoot tr:last-child > *:last-child { border-bottom-right-radius: var(--radius-md); }
table.grid th, table.grid td { padding: 6px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid thead th {
    background: var(--panel-2);
    font-weight: 640;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    position: sticky; top: var(--topbar-h); z-index: 1;
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}
table.grid tbody tr { transition: background var(--dur) var(--ease); }
table.grid tbody tr:hover { background: var(--panel-hover); }
table.grid tbody tr:last-child td { border-bottom: 0; }
/* Keep .actions a real table cell — display:flex on a <td> breaks table layout
   (the cell escapes its row: buttons render outside the table and a phantom
   row appears above the header). Space the buttons with margins instead. */
table.grid td.actions { text-align: right; white-space: nowrap; }
table.grid td.actions > * { display: inline-flex; vertical-align: middle; }
table.grid td.actions > * + * { margin-left: 6px; }
table.grid th.num, table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tfoot th, table.grid tfoot td { background: var(--panel-2); font-weight: 640; border-top: 1px solid var(--line-strong); border-bottom: 0; }
table.grid td .muted, table.grid tbody tr td.muted { color: var(--muted); }

.pager {
    display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 0.88rem;
}

/* Empty-state row helper */
table.grid tbody tr td[colspan] { color: var(--muted); text-align: center; padding: 24px 14px; font-style: normal; }

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

.form {
    max-width: 720px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
.form fieldset { border: 0; padding: 0; margin: 0 0 12px; }
.form legend { font-weight: 650; padding-bottom: 4px; }
.form label { display: block; margin-bottom: 8px; }
.form label span { display: block; font-size: 0.76rem; font-weight: 550; color: var(--ink-soft); margin-bottom: 2px; }
.form label em { color: var(--danger); font-style: normal; }

/* A field is a value with a line under it — Odoo's form, a printed sheet — not a rounded box: the caption, the
   value and the figures of a form line up and read at one look. The line darkens under the pointer, the field
   fills while it has the focus; a textarea keeps a faint frame, its extent being its meaning. */
.form input, .form select, .form textarea,
.form-card input, .form-card select, .form-card textarea {
    width: 100%;
    min-height: 26px;
    padding: 2px 6px;
    border: 1px solid transparent;
    border-bottom-color: var(--line-strong);
    border-radius: 4px 4px 0 0;
    font: inherit;
    font-size: 0.9rem;
    line-height: 1.3;
    background: transparent;
    color: var(--ink);
    transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.form select, .form-card select { padding-right: 2px; }
.form textarea, .form-card textarea { border-color: var(--line); border-radius: 6px; padding: 4px 7px; }
.form input:hover, .form select:hover, .form textarea:hover,
.form-card input:hover, .form-card select:hover, .form-card textarea:hover { border-bottom-color: var(--muted-2); background: var(--panel-hover); }
.form input:focus, .form select:focus, .form textarea:focus,
.form-card input:focus, .form-card select:focus, .form-card textarea:focus {
    outline: none; border-color: var(--brand); background: var(--panel);
    box-shadow: none;
}
.form input::placeholder, .form-card input::placeholder, .form textarea::placeholder { color: var(--muted-2); }
.form input:disabled, .form-card input:disabled, .form select:disabled { opacity: 0.6; cursor: not-allowed; border-bottom-color: var(--line); }

.form label.inline { display: flex; align-items: center; gap: 8px; }
.form label.inline input { width: auto; min-height: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 10px; }

input[type=checkbox], input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; }

/* Inline create/edit form card shown above the list tables */
.form-card {
    max-width: 1000px;
    background: var(--panel);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin: 0 0 12px;
    box-shadow: var(--shadow-md);
    animation: pop-in 0.18s var(--ease);
    position: relative;
}
.form-card::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--brand); border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.form-card h3 { margin: 0 0 8px; font-size: 0.95rem; }
.form-card label { display: block; }
.form-card label span { display: block; font-size: 0.76rem; font-weight: 550; color: var(--ink-soft); margin-bottom: 2px; }
.form-card label.inline { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.form-card label.inline input { width: auto; min-height: 0; }
.form-card label.inline span { margin: 0; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 12px; margin-bottom: 10px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
/* REV-018: what a new partner cannot do without (the partner editor's create form, the partner quick-create). */
label.required > span:first-child::after { content: " *"; color: var(--danger); font-weight: 650; }
/* IDE-014: an advised field (no "*") says why it is worth filling in, under its input — never a refusal. */
.field-hint { display: block; margin-top: 3px; font-size: 0.72rem; font-weight: 400; line-height: 1.3; color: var(--muted); }
p.field-hint { margin: -4px 0 8px; }
/* IDE-015: the no-number placeholder (9999999999) in a partner's number field is greyed; the number field of a
   company in the EU whose placeholder was taken out asks for the number in the colour of the "*". */
input.no-number { color: var(--muted); font-style: italic; }
.field-hint.number-asked { color: var(--danger); }
.form-grid .align-end { align-self: end; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-card .form-section-title { margin: 10px 0 8px; font-size: 0.9rem; }
/* The country of an address alone on its row keeps one column's width (auto-fit would stretch it over the row). */
.form-grid.country-row { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }

/* Preset picker opening a form card (reconciliation models): bank, what to recognise, "Use preset" */
.preset-picker { margin: 0 0 16px; padding: 12px 14px 4px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-soft); }
.preset-picker p { margin: 0 0 10px; font-size: 0.85rem; overflow-wrap: anywhere; }
.preset-picker-action { display: flex; align-items: flex-end; }
/* REV-022: statement texts pasted beside the label condition — the regex suggested from them, each tried on it. */
.label-samples { margin: 0 0 16px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-soft); }
.label-samples__row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.label-samples__row label { flex: 1 1 320px; display: grid; gap: 4px; }
.label-samples__row textarea { width: 100%; min-height: 3.6em; font-family: var(--font-code); font-size: 0.85rem; }
.label-samples__list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 0.85rem; }
.label-samples__list li { display: flex; gap: 8px; align-items: baseline; overflow-wrap: anywhere; }
.label-samples .alert { margin: 10px 0 0; }

/* Dynamic line editors inside the form card */
table.lines { width: 100%; border-collapse: collapse; margin: 8px 0 12px; }
table.lines th, table.lines td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
table.lines th { color: var(--muted); font-weight: 640; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.lines td.num input { text-align: right; }

/* Ledger reports (Accounting → Ledgers): TB / оборотна ведомост column blocks, totals, tax panel */
.ledger-catalog { flex-wrap: wrap; gap: 10px; }
/* A group of the catalogue stays inside a narrow window: its buttons shrink, then scroll within the group. */
.ledger-catalog .onix-segmented { max-width: 100%; overflow-x: auto; }
.ledger-scroll { overflow-x: auto; }
table.lines.ledger-blocks th.num, table.lines.ledger-blocks td.num,
table.lines.ledger-totals td.num { text-align: right; white-space: nowrap; }
table.lines.ledger-blocks thead th[colspan] { text-align: center; border-bottom-color: var(--line-strong); }
table.lines tr.ledger-group td { font-weight: 640; color: var(--ink); }
table.lines tr.ledger-subtotal td { color: var(--muted); font-style: italic; }
table.lines tr.ledger-total td { font-weight: 700; border-top: 1px solid var(--line-strong); }
table.lines td.level-1 { padding-left: 22px; }
table.lines td.level-2 { padding-left: 36px; }
table.lines td.level-3 { padding-left: 50px; }
table.lines td.level-4 { padding-left: 64px; }
/* REV-036: the chevron of an account row of the оборотна ведомост по контрагенти / по продукти folds its rows */
table.lines .ledger-fold {
    display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 4px; padding: 0;
    border: 0; background: none; color: var(--muted); cursor: pointer; vertical-align: middle;
}
table.lines .ledger-fold svg { width: 16px; height: 16px; transition: transform var(--dur) var(--ease); }
table.lines .ledger-fold[aria-expanded="true"] svg { transform: rotate(90deg); }
/* REV-033: the "Journal items" button of an account row of the trial balances (Odoo's line button): the name at
   the left, the button at the right end of the cell; a folding account row keeps its chevron in front of both. */
table.lines .ledger-account { display: inline-flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; vertical-align: middle; }
table.lines td:has(> .ledger-fold) .ledger-account { width: calc(100% - 22px); }
table.lines .ledger-account > span { min-width: 0; }
table.lines .ledger-account .ledger-items {
    display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 1px 7px; font-size: 0.75rem; white-space: nowrap;
    color: var(--muted); text-decoration: none;
}
table.lines .ledger-account .ledger-items svg { width: 13px; height: 13px; flex: none; }
table.lines .ledger-account .ledger-items:hover, table.lines .ledger-account .ledger-items:focus-visible { color: var(--brand-strong); border-color: var(--brand); }
@media print { table.lines .ledger-account .ledger-items { display: none; } }
/* ATP-021: a ledger's journal item opens the document behind it (row click); its ⋯ holds the journal entry. A bank
   statement's transaction reached from a ledger is marked. */
table.lines tr.ledger-item { cursor: pointer; }
table.lines tr.ledger-item:hover td { background: var(--panel-2); }
table.lines td.ledger-item-menu { width: 1%; white-space: nowrap; text-align: right; }
table.lines tr.is-selected td { background: var(--brand-soft); }
table.lines tr.is-selected td:first-child { box-shadow: inset 4px 0 0 var(--brand); }
.ledger-tax-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
table.lines input, table.lines select {
    width: 100%; padding: 5px 8px; border: 1px solid var(--line-strong);
    border-radius: var(--radius-xs); font: inherit; background: var(--panel-2); color: var(--ink);
}
table.lines input:focus, table.lines select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 2px var(--ring); }

/* Analytic distribution widget (a line editor cell): chips + inline plan → account → % editor. */
.analytic-field { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 160px; }
.analytic-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.analytic-chip-remove { font-size: 11px; line-height: 1; }
.analytic-editor { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
table.lines .analytic-editor select { width: auto; max-width: 160px; }
table.lines .analytic-editor input.analytic-percent, .analytic-percent { width: 72px; text-align: right; }
.analytic-add { font-size: 0.85rem; }
.analytic-problem { flex-basis: 100%; color: var(--warn); font-size: 0.8rem; }
.plan-color { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: 6px; vertical-align: middle; }
/* Odoo's 12 plan colour indices, on the design-system ramps. */
.plan-color-0 { background: var(--dnt-grey-400); }
.plan-color-1 { background: var(--dnt-coral-500); }
.plan-color-2 { background: var(--dnt-teal-500); }
.plan-color-3 { background: var(--dnt-navy-500); }
.plan-color-4 { background: var(--dnt-teal-300); }
.plan-color-5 { background: var(--dnt-coral-300); }
.plan-color-6 { background: var(--dnt-navy-300); }
.plan-color-7 { background: var(--dnt-teal-700); }
.plan-color-8 { background: var(--dnt-coral-700); }
.plan-color-9 { background: var(--dnt-navy-700); }
.plan-color-10 { background: var(--dnt-grey-600); }
.plan-color-11 { background: var(--dnt-teal-200); }
.plan-depth-1 { padding-left: 16px; }
.plan-depth-2 { padding-left: 32px; }
.plan-depth-3 { padding-left: 48px; }
/* Search-as-you-type picker (product on an invoice line) */
.picker { position: relative; }
.picker-list {
    position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px);
    max-height: 260px; overflow-y: auto; margin: 0; padding: 4px 0; list-style: none;
    background: var(--panel); border: 1px solid var(--line-strong);
    border-radius: var(--radius-xs); box-shadow: var(--shadow-md);
}
.picker-list li button {
    display: flex; width: 100%; gap: 8px; justify-content: space-between; align-items: baseline;
    padding: 6px 10px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.picker-list li button:hover, .picker-list li button:focus { background: var(--panel-hover); outline: none; }
.picker-list .muted, .picker-empty { color: var(--muted); font-size: 0.8rem; }
.picker-empty { padding: 6px 10px; }
.tax-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }

.imbalance { font-weight: 650; }
.imbalance.off { color: var(--danger); }
.imbalance.ok { color: var(--good); }

/* Journal entry lines editor: section / note rows, generated tax and balancing lines. */
table.journal-lines tr.line-section td { font-weight: 650; }
table.journal-lines tr.line-note td { font-style: italic; color: var(--muted); }
table.journal-lines tr.line-tax td,
table.journal-lines tr.line-auto-balance td { color: var(--muted); }
table.journal-lines tr.line-auto-balance td { font-style: italic; }
table.journal-lines .analytic-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
table.journal-lines .line-currency { display: flex; gap: 4px; }
/* The amount in the line currency is a number to read, not a 20 px sliver (QA #28). */
table.journal-lines .line-currency input[type="number"] { min-width: 7.5em; }
table.journal-lines .tax-grids { font-size: 0.85em; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.card dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; margin: 0; }
.card dt { color: var(--muted); font-size: 0.9rem; }
.card dd { margin: 0; }
.card h3 { margin-top: 0; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */

.alert {
    padding: 7px 12px 7px 36px;
    border-radius: var(--radius-sm);
    margin: 6px 0;
    position: relative;
    border: 1px solid transparent;
    font-size: 0.88rem;
}
.alert::before {
    content: ""; position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; background-repeat: no-repeat; background-position: center; background-size: contain;
}
.alert.error {
    background: var(--danger-soft); color: var(--danger-strong);
    border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}
.alert.error::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23d23f38' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E"); }
.alert.success {
    background: var(--good-soft); color: var(--good);
    border-color: color-mix(in srgb, var(--good) 35%, transparent);
}
.alert.success::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2312855a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/%3E%3Cpolyline points='22 4 12 14.01 9 11.01'/%3E%3C/svg%3E"); }
.alert.info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.alert.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }

/* ─── Status badges ──────────────────────────────────────────────────────── */

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 640;
    background: var(--panel-2);
    color: var(--muted);
    white-space: nowrap;
    border: 1px solid var(--line);
    line-height: 1.3;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.badge.is-good, .badge-ok { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 28%, transparent); }
.badge.is-active { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 28%, transparent); }
.badge.is-bad { background: var(--danger-soft); color: var(--danger-strong); border-color: color-mix(in srgb, var(--danger) 28%, transparent); }
.badge-off { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 28%, transparent); }
.badge.is-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 28%, transparent); }

/* ─── Reports / stat cards ───────────────────────────────────────────────── */

.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-top: 20px; }
.report-grid .card dd.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A record's fields as label / value pairs (the manufacturing order's header and cost, QA #52). */
.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 8px 0 16px; }
.kv-grid dt { color: var(--onix-muted, #6b7280); }
.kv-grid dd { margin: 0; }
.kv-grid dd.num { font-variant-numeric: tabular-nums; }

/* Report catalogue (statement reports run by a custom handler, e.g. the cash flow statement) */
.report-catalogue { list-style: none; padding: 0; margin: 4px 0 16px; display: grid; gap: 8px; }
.report-catalogue li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.report-catalogue li .muted { font-size: 0.86rem; }
table.cash-flow tr.is-warn td { color: var(--warn); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 4px 0 22px; }
.stat-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md);
    padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card .stat-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 720; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .stat-delta { font-size: 0.82rem; font-weight: 600; margin-top: 4px; }
.stat-card .stat-delta.up { color: var(--good); }
.stat-card .stat-delta.down { color: var(--danger); }
.stat-card::after {
    content: ""; position: absolute; right: -20px; top: -20px; width: 90px; height: 90px; border-radius: 50%;
    background: radial-gradient(circle, var(--brand-soft), transparent 70%); opacity: 0.6;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */

.empty-state {
    text-align: center; padding: 48px 24px; color: var(--muted);
    background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius-md);
}
.empty-state svg { width: 40px; height: 40px; opacity: 0.5; margin-bottom: 12px; }
.empty-state h3 { margin: 0 0 4px; color: var(--ink); }

/* ─── Loading ────────────────────────────────────────────────────────────── */

.spinner {
    display: inline-block; width: 18px; height: 18px; vertical-align: -3px;
    border: 2px solid var(--line-strong); border-top-color: var(--brand);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
    background: linear-gradient(90deg, var(--panel-2) 25%, var(--panel-hover) 50%, var(--panel-2) 75%);
    background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius-xs);
}
@keyframes shimmer { to { background-position: -200% 0; } }

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

.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(900px 500px at 15% -5%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 60%),
        radial-gradient(800px 500px at 90% 110%, color-mix(in srgb, #7b3ff0 14%, transparent), transparent 60%),
        var(--bg);
    padding: 24px;
}
.login-card {
    width: 100%; max-width: 400px;
}
.login-card h1 { text-align: center; }
.login-brand {
    display: inline-flex; align-items: center; gap: 10px; justify-content: center;
    width: 100%;
    font-size: 1.4rem; color: var(--ink) !important; margin-bottom: 8px;
}
.login-brand::before {
    content: ""; width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(135deg, #6f8bff, #3557f0 60%, #7b3ff0);
    box-shadow: 0 4px 14px -2px rgba(53,87,240,0.6);
}
.login-brand strong { font-weight: 800; }
.login-brand:hover { text-decoration: none; }
.form.login {
    max-width: 380px; margin: 18px auto 0; box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg); padding: 26px;
}
.form.login .button { width: 100%; margin-top: 6px; padding: 10px 12px; font-size: 0.95rem; }

/* Show/hide password (ported from the legacy onixbi-web login). The button
   carries data-onix-toggle-password; onix-boot.js flips the input type and
   the is-visible class, swapping the two pre-rendered eye icons. */
.form .input-wrapper { position: relative; display: flex; align-items: center; margin: 0; font-size: inherit; }
.form .input-wrapper input { padding-right: 42px; }
.toggle-pw {
    position: absolute; right: 6px; display: flex; align-items: center;
    background: none; border: 0; padding: 6px; cursor: pointer; color: var(--muted);
}
.toggle-pw:hover { color: var(--ink); }
.toggle-pw .eye-off { display: none; }
.toggle-pw.is-visible .eye { display: none; }
.toggle-pw.is-visible .eye-off { display: block; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
    .topbar { grid-template-columns: auto 1fr auto; padding: 0 12px; column-gap: 8px; }
    .topbar .user { display: none; }
    .topbar-submenu { grid-column: 1 / -1; min-height: 46px; padding: 0 6px; border-top: 1px solid var(--topbar-border); }
    .app-switcher-panel { min-width: 90vw; left: -8px; }
    .app-switcher-panel .apps-grid { grid-template-columns: repeat(2, 1fr); }
    main { padding: 18px 14px 40px; }
    table.grid thead th { top: 0; }
    .card dl { grid-template-columns: 1fr; }
}

/* ─── Kanban board ───────────────────────────────────────────────────────── */

.kanban {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding: 2px 2px 18px;
    min-height: 420px;
}
.kanban-col {
    flex: 0 0 292px;
    max-width: 292px;
    background: color-mix(in srgb, var(--panel) 55%, var(--bg));
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 220px);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.kanban-col.drag-over {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--ring);
    background: var(--brand-soft);
}
.kanban-col-head {
    --col-color: var(--brand);
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 14px 10px;
    border-bottom: 2px solid var(--col-color);
    position: relative;
}
.kanban-col-title { font-weight: 680; font-size: 0.92rem; }
.kanban-col-count {
    font-size: 0.72rem; font-weight: 700;
    background: color-mix(in srgb, var(--col-color) 14%, var(--panel));
    color: var(--col-color);
    border-radius: 999px; padding: 1px 8px;
}
.kanban-col-total { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.kanban-cards {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    min-height: 80px;
}
.kanban-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 13px;
    box-shadow: var(--shadow-xs);
    cursor: grab;
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--line-strong); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.45; transform: rotate(1.5deg) scale(0.98); }

.kanban-card-title { font-weight: 640; font-size: 0.92rem; line-height: 1.3; margin-bottom: 6px; }
.kanban-card-sub { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.kanban-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.kanban-card-foot .spacer { flex: 1; }
.kanban-card-amount { font-weight: 680; font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.kanban-card-actions { display: flex; gap: 4px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
/* A board to look at (KanbanBoard Draggable="false"): its cards are not picked up. */
.kanban-card.is-static, .kanban-card.is-static:active { cursor: default; }
/* A card's first line: its title, its figure at the end (the invoice kanban: the number, the total); chips under it. */
.kanban-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.kanban-card-head > :first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card-head > .kanban-card-amount { flex: none; }
.kanban-card-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
/* The invoice card's "№ 0114558970": the sign stays with its number. */
.invoice-card .kanban-card-sub > span { white-space: nowrap; }
/* A record's row actions on its card: it opens from its title, so the row's Edit / View is not drawn twice
   (as specific as the row-actions buttons of onix-datagrid.css, which loads later, and one class more). */
.kanban-card .row-actions .button.small.row-open { display: none; }
.kanban-card-actions .row-actions { margin-left: auto; }

/* REV-002 — the invoice list's actions over the selected documents, in its control row (InvoiceListActions), in the
   filters' place while rows are ticked: the count as a brand chip that clears the selection, then the buttons and
   menus; what an action left undone under the row. */
.invoice-selection { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.invoice-selection__count {
    height: 30px;
    padding: 0 10px;
    border: 1px solid transparent;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}
.invoice-selection__count:hover { border-color: var(--brand); }
.invoice-selection__count:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.invoice-selection__clear { margin-left: 2px; font-size: 1rem; line-height: 1; }
.invoice-selection-report { margin: 0 0 8px; }
.invoice-selection-report__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.invoice-selection-report ul { margin: 8px 0 0; padding-left: 18px; }
.invoice-selection-report li { margin: 4px 0; }
.invoice-selection-report li > * + * { margin-left: 8px; }
.invoice-selection-report__document { font-weight: 600; white-space: nowrap; }

/* Settings › Mailboxes (MailboxesAdmin): the control row while mailboxes are ticked — the count chip, then the actions —,
   what an action left undone under it, and the new passwords shown once. */
.mailbox-selection { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.mailbox-selection__count {
    height: 30px;
    padding: 0 10px;
    border: 1px solid transparent;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}
.mailbox-selection__count:hover { border-color: var(--brand); }
.mailbox-selection__count:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.mailbox-selection__clear { margin-left: 2px; font-size: 1rem; line-height: 1; }
.mailbox-report { margin: 0 0 8px; }
.mailbox-report__head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mailbox-report ul { margin: 8px 0 0; padding-left: 18px; }
.mailbox-report li { margin: 4px 0; }
.mailbox-report__mailbox { font-weight: 600; white-space: nowrap; }
.mailbox-passwords li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mailbox-passwords code { font-size: 0.95rem; letter-spacing: 0.02em; user-select: all; }
.mailbox-make { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mailbox-make select { min-width: 260px; }
.invoice-payment-links { margin: 0 0 8px; }
.invoice-payment-links__list { margin: 0 0 8px; padding: 0; list-style: none; }
.invoice-payment-links__list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.invoice-payment-links__list input { flex: 1 1 260px; min-width: 0; }
.invoice-payment-links__document { font-weight: 600; white-space: nowrap; }

.kanban-empty {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 22px 10px;
    text-align: center;
    color: var(--muted-2);
    font-size: 0.83rem;
}

/* ─── View switcher ──────────────────────────────────────────────────────── */

.view-switcher {
    display: inline-flex;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-left: auto;
    background: var(--panel-2);
}
.view-switcher-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    border: 0; background: transparent; cursor: pointer; color: var(--muted);
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.view-switcher-btn + .view-switcher-btn { border-left: 1px solid var(--line); }
.view-switcher-btn svg { width: 16px; height: 16px; }
.view-switcher-btn:hover { color: var(--ink); background: var(--panel-hover); }
.view-switcher-btn.active { background: var(--brand); color: #fff; }

/* ─── Workflow status bar ────────────────────────────────────────────────── */

.statusbar { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--panel); }
.statusbar-step {
    border: 0; background: transparent; font: inherit; font-size: 0.78rem; font-weight: 600;
    padding: 4px 12px; cursor: pointer; color: var(--muted); position: relative;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.statusbar-step + .statusbar-step { border-left: 1px solid var(--line); }
.statusbar-step:hover:not(:disabled) { background: var(--panel-hover); color: var(--ink); }
.statusbar-step.done { color: var(--brand); background: var(--brand-soft); }
.statusbar-step.current { color: #fff; background: var(--brand); cursor: default; }
.statusbar-step:disabled { cursor: default; }

/* ─── Priority stars ─────────────────────────────────────────────────────── */

.stars { display: inline-flex; gap: 1px; }
.star {
    border: 0; background: transparent; cursor: pointer; padding: 0 1px;
    font-size: 1rem; line-height: 1; color: var(--line-strong);
    transition: color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.star.on { color: #f0b429; }
.stars:not(.readonly) .star:hover { transform: scale(1.25); }
.stars.readonly .star { cursor: default; }

/* ─── Avatars ────────────────────────────────────────────────────────────── */

.avatar {
    --avatar-color: var(--brand);
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 50%;
    background: color-mix(in srgb, var(--avatar-color) 18%, var(--panel));
    color: var(--avatar-color);
    font-size: 0.68rem; font-weight: 750; letter-spacing: 0.02em;
    border: 1px solid color-mix(in srgb, var(--avatar-color) 32%, transparent);
    flex: 0 0 auto;
}

/* ─── Toasts ─────────────────────────────────────────────────────────────── */

.toast-host {
    position: fixed; right: 18px; bottom: 18px; z-index: 200;
    display: flex; flex-direction: column; gap: 10px;
    max-width: min(380px, calc(100vw - 36px));
}
.toast {
    display: flex; align-items: center; gap: 10px;
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    cursor: pointer;
    animation: toast-in 0.22s var(--ease);
    border-left-width: 3px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
.toast.leaving { opacity: 0; transform: translateX(16px); transition: opacity 0.25s var(--ease), transform 0.25s var(--ease); }
.toast-icon { display: inline-flex; flex: 0 0 auto; }
.toast-icon svg { width: 18px; height: 18px; }
.toast-success { border-left-color: var(--good); }
.toast-success .toast-icon { color: var(--good); }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }

/* ─── Command palette ────────────────────────────────────────────────────── */

.topbar-search {
    display: inline-flex; align-items: center; gap: 9px;
    min-width: 230px;
    height: 36px; padding: 0 8px 0 12px;
    margin-right: 6px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    color: var(--topbar-ink-dim);
    font: inherit; font-size: 0.86rem;
    cursor: pointer;
    text-align: left;
    transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
                border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.topbar-search:hover {
    background: rgba(255,255,255,0.09);
    color: #fff;
    border-color: rgba(255,255,255,0.22);
}
.topbar-search:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.topbar-search svg { width: 15px; height: 15px; flex: 0 0 auto; opacity: 0.85; }
.topbar-search-hint { flex: 1; font-weight: 450; letter-spacing: 0.01em; }
.topbar-search kbd {
    font-family: inherit; font-size: 0.68rem; font-weight: 650;
    background: rgba(255,255,255,0.09);
    border: 1px solid rgba(255,255,255,0.14);
    border-bottom-width: 2px;
    border-radius: 5px; padding: 2px 6px;
    color: var(--topbar-ink-dim);
    line-height: 1.2;
}
.topbar-search:hover kbd { color: #fff; }

.palette-backdrop {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(10, 14, 25, 0.45);
    backdrop-filter: blur(3px);
    display: none;
    align-items: flex-start; justify-content: center;
    padding: 12vh 16px 16px;
}
.palette-backdrop.open { display: flex; animation: fade-in 0.14s var(--ease); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.palette {
    width: 100%; max-width: 560px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: pop-in 0.16s var(--ease);
}
.palette-inputwrap {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
}
.palette-inputwrap svg { width: 18px; height: 18px; flex: 0 0 auto; }
.palette-inputwrap kbd {
    font-family: inherit; font-size: 0.7rem; font-weight: 600;
    background: var(--panel-2); border: 1px solid var(--line-strong);
    border-radius: 4px; padding: 2px 6px; color: var(--muted);
}
.palette-input {
    flex: 1; border: 0; outline: none; background: transparent;
    font: inherit; font-size: 1rem; color: var(--ink);
}
.palette-input::placeholder { color: var(--muted-2); }
.palette-list { max-height: 330px; overflow-y: auto; padding: 8px; }
.palette-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink) !important;
    text-decoration: none !important;
}
.palette-item.selected { background: var(--brand-soft); }
.palette-chip { --chip: var(--brand); width: 10px; height: 10px; border-radius: 3px; background: var(--chip); flex: 0 0 auto; }
.palette-label { font-weight: 600; font-size: 0.92rem; }
.palette-app { margin-left: auto; font-size: 0.78rem; color: var(--muted); }
.palette-empty { padding: 26px; text-align: center; color: var(--muted); }

@media (max-width: 860px) {
    .topbar-search-hint, .topbar-search kbd { display: none; }
    .topbar-search { min-width: 0; width: 36px; padding: 0; justify-content: center; border-radius: var(--radius-sm); }
    .kanban-col { flex-basis: 260px; }
    .toolbar input[type=search] { flex: 1 1 100%; }
}

/* ─── Admin: Apps (install/uninstall) ────────────────────────────────────── */

.apps-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; margin-top: 18px; }
.apps-admin-card {
    display: flex; align-items: center; gap: 14px; padding: 16px;
    border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--panel);
    box-shadow: var(--shadow-sm); transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.apps-admin-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.apps-admin-card.is-uninstalled { opacity: 0.7; background: var(--panel-2); }
.apps-admin-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 auto; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2); }
.apps-admin-icon svg { width: 24px; height: 24px; }
.apps-admin-body { flex: 1 1 auto; min-width: 0; }
.apps-admin-title { font-weight: 650; display: flex; align-items: baseline; gap: 8px; }
.apps-admin-ver { font-size: 0.75rem; color: var(--muted); font-weight: 400; }
.apps-admin-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.apps-admin-count { font-size: 0.78rem; color: var(--muted); }
.apps-admin-actions { flex: 0 0 auto; }

/* ─── Admin: Settings hub ────────────────────────────────────────────────── */

.settings-shell { display: grid; grid-template-columns: 230px 1fr; gap: 28px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 78px; }
.settings-nav h3 { margin: 0 0 8px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.settings-nav-item {
    text-align: left; padding: 9px 13px; border: 0; background: transparent; border-radius: var(--radius-sm);
    cursor: pointer; font: inherit; font-weight: 550; color: var(--ink-soft); transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.settings-nav-item:hover { background: var(--panel-hover); color: var(--ink); }
.settings-nav-item.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.settings-pane { min-width: 0; }
.settings-group { margin: 0 0 14px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 650; }
.settings-field { display: grid; grid-template-columns: 1fr 280px; gap: 20px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.settings-field:first-of-type { border-top: 0; }
.settings-label { display: flex; flex-direction: column; gap: 2px; font-weight: 600; }
.settings-help { font-size: 0.8rem; color: var(--muted); font-weight: 400; }
.settings-input input[type=text], .settings-input input[type=number], .settings-input input[type=password], .settings-input select {
    width: 100%; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    font: inherit; background: var(--panel-2); color: var(--ink);
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.settings-input input:focus, .settings-input select:focus { outline: none; border-color: var(--brand); background: var(--panel); box-shadow: 0 0 0 3px var(--ring); }
.settings-input input[type=checkbox] { width: 18px; height: 18px; }

@media (max-width: 860px) {
    .settings-shell { grid-template-columns: 1fr; }
    .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
    .settings-field { grid-template-columns: 1fr; gap: 8px; }
}

/* ---- Product pictures: the list's thumbnail and the product form's "Pictures" card (ProductPicturesPanel) ---- */
.product-thumb {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    object-fit: contain;
    background: var(--panel-2);
}
.product-pictures { margin-top: 12px; }
.pp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.pp-tile {
    position: relative;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--panel);
}
.pp-tile.is-main { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.pp-image { display: block; background: var(--panel-2); }
.pp-image img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.pp-main { position: absolute; top: 6px; left: 6px; }
.pp-bar { display: flex; flex-direction: column; gap: 2px; padding: 4px 6px 6px; }
.pp-bar input[type=text] { width: 100%; min-width: 0; }
.pp-actions { display: flex; align-items: center; gap: 2px; }
.pp-actions .pp-delete, .pp-actions .button.danger { margin-left: auto; }
/* Inside the product's .form-card: its label / span rules (block, small caps of a field) must not reach the "+" tile. */
.product-pictures .pp-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 168px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.85rem;
    cursor: pointer;
}
.product-pictures .pp-add:hover, .product-pictures .pp-add:focus-within { border-color: var(--brand); color: var(--brand); background: var(--panel-hover); }
.product-pictures .pp-add.is-busy { opacity: 0.6; cursor: progress; }
.product-pictures .pp-add input[type=file] { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.product-pictures .pp-add span { display: inline; margin: 0; font-size: inherit; font-weight: inherit; color: inherit; }
.product-pictures .pp-add .pp-add-plus { font-size: 1.6rem; line-height: 1; font-weight: 300; }
@media (max-width: 560px) {
    /* A phone: two pictures a row, the tile's buttons wrapping under its description. */
    .pp-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .pp-actions { flex-wrap: wrap; gap: 0; }
    .pp-actions .button.small { padding: 3px 5px; }
    .product-pictures .pp-add { min-height: 120px; }
}

/* ---- File drop zone (drag documents onto a grid, Odoo journal-upload style) ---- */
.dropzone-host { position: relative; }
.dropzone-host .dropzone-input { display: none; }
.dropzone-overlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 5;
    border: 2px dashed var(--brand);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--brand) 10%, transparent);
    align-items: center;
    justify-content: center;
    pointer-events: none;
}
.dropzone-host.dragging .dropzone-overlay { display: flex; }
.dropzone-overlay-inner {
    background: var(--panel);
    color: var(--ink);
    border: 1px solid var(--brand);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 12px 20px;
    font-weight: 600;
}
.dropzone-hint {
    border: 1px dashed var(--line, var(--muted));
    border-radius: var(--radius-md);
    color: var(--muted);
    padding: 6px 12px;
    margin: 8px 0;
    font-size: 0.86em;
}
/* ATP-009: the upload line (Shared/DocumentUploadStatus) under a list's control row on pages without onix-documents.css —
   the invoice lists' Upload; the same look as on Documents. */
.dxg-notices .docs-upload-progress { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--muted); }
.dxg-notices .docs-upload-progress progress { flex: 0 1 240px; height: 8px; accent-color: var(--brand); }
.dxg-notices .docs-upload-notice ul { margin: 0; padding-left: 18px; }
.dxg-notices .docs-upload-notice .link-button { float: right; }

/* ─── Documents: the folder tree beside the list (Pages/Documents) is drawn by css/onix-documents.css (the page's own
   sheet) as Odoo Documents' search panel; the layout of the page is there too. */

.docs-path { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 0; font-family: var(--font-display); }
.docs-path a { color: var(--muted); text-decoration: none; }
.docs-path a:hover { color: var(--brand-strong); text-decoration: underline; }
.docs-path-sep { color: var(--muted); }
/* ATP-007: the file and folder names in the grid's own text — a hover underline says they open. */
.docs-name, .docs-folder-link { color: inherit; font: inherit; cursor: pointer; text-decoration: none; }
.docs-name:hover, .docs-folder-link:hover { color: inherit; text-decoration: underline; }
.docs-move { max-width: 240px; }

/* ─── ACC-097: accounting ↔ documents ─────────────────────────────────────────
   The "Documents (n)" chip of the invoice / entry forms (Components/Shared/RecordDocumentsChip),
   the Accounting folders card (Pages/Documents/AccountingFoldersView) and the e-invoice's
   embedded-PDF switch of the viewer. */
.record-documents { position: relative; display: inline-flex; align-items: center; }
.record-documents__chip { cursor: pointer; border: 0; font: inherit; }
.record-documents__list {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 60;
    min-width: 320px; max-width: min(480px, 92vw); padding: 12px;
    box-shadow: var(--shadow-md); border-radius: var(--radius-md);
    display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; font-weight: normal;
}
.record-documents__list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.record-documents__list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.record-documents__list li .button { margin-left: auto; }
.record-documents__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.accounting-folders { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.accounting-folders__head { display: flex; align-items: center; gap: 10px; }
.docs-create-accounting .form-grid { align-items: end; }
.report-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-viewer-note { margin: 0 0 8px; }

/* ACC-108: the documents requested for a record (Components/Shared/DocumentRequestsPanel) — a bank transaction's
   in Bank Matching and Bank Transactions. */
.document-requests { display: flex; flex-direction: column; gap: 10px; margin: 8px 0; }
.document-requests__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.document-requests .form-card { margin: 0; }

/* ─── Document viewer (Components/Shared/DocumentViewer) ──────────────────────
   A wide drawer over the page (Components/Shared/Drawer, css/onix-drawer.css:
   the scrim, the box, the head) or, IDE-018, its own page (.doc-viewer--page,
   below); here the content only. */

.doc-viewer-body { flex: 1 1 auto; min-height: 0; display: flex; background: var(--bg-soft); }
/* White whatever the theme: the browser draws a text file as black on nothing. */
.doc-viewer-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: 0; background: white; }
.doc-viewer-scroll {
    flex: 1 1 auto; min-width: 0; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    overflow: auto;
    padding: 16px;
}
.doc-viewer-image {
    max-width: 100%; max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-xs);
    box-shadow: var(--shadow-md);
    cursor: zoom-in;
}
/* At full size the image scrolls from its top-left corner: a centred flex item
   larger than its box cannot be scrolled to its start. */
.doc-viewer-scroll.is-full-size { align-items: flex-start; justify-content: flex-start; }
.doc-viewer-scroll.is-full-size .doc-viewer-image { max-width: none; max-height: none; cursor: zoom-out; }
/* A PDF's pages, one under the other at the viewer's width (images Documents renders). */
/* REV-016: "Page i of n" under every page of the viewer. */
.doc-viewer-page { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.doc-viewer-page figcaption { font-size: 0.78rem; color: var(--muted); }

/* REV-016: the cut dialog — the pages as thumbnails with a cut mark between every two. */
.doc-split { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; margin: 0 0 12px;
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.doc-split__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.doc-split__presets { display: flex; gap: 6px; margin-left: auto; }
.doc-split__pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.doc-split__page { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.doc-split__page img { width: 110px; height: auto; border: 1px solid var(--line); border-radius: var(--radius-xs); background: #fff; }
.doc-split__page figcaption { font-size: 0.75rem; color: var(--muted); }
.doc-split__cut { align-self: stretch; min-width: 26px; border: 1px dashed var(--line-strong); border-radius: var(--radius-xs);
    background: transparent; color: var(--muted); cursor: pointer; }
.doc-split__cut.is-cut { border: 2px solid var(--danger); color: var(--danger-strong); background: var(--danger-soft); }
.doc-split__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.doc-split__foot .muted { margin-right: auto; }
.docs-multipage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.docs-multipage__item { display: inline-flex; align-items: center; gap: 6px; }
.docs-split-mark { cursor: pointer; border: 0; font: inherit; }

.doc-viewer-pages {
    flex: 1 1 auto; min-width: 0; min-height: 0;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    overflow: auto;
    padding: 16px;
}
.doc-viewer-pages img {
    display: block;
    width: 100%; max-width: 900px; height: auto;
    background: white;
    border-radius: var(--radius-xs);
    box-shadow: var(--shadow-md);
}
.doc-viewer-loading { margin: auto; }
.doc-viewer-empty { margin: auto; padding: 32px; max-width: 460px; text-align: center; }
.doc-viewer-empty .muted { overflow-wrap: anywhere; }
/* IDE-018: the viewer as its own page (/view/document/{id}) — the shell's bar and the breadcrumb over it,
   the rest of the window for the document; its head keeps "Back to Documents" where the dialog's ✕ is. */
.doc-viewer--page {
    display: flex; flex-direction: column;
    width: 100%;
    height: calc(100dvh - var(--topbar-h, 64px) - var(--trail-h, 36px) - 28px);
    min-height: 320px;
    background: var(--panel); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.doc-viewer--page .doc-viewer-pages { padding: 16px 16px 32px; }

/* The viewer's head holds more buttons than a phone's width: the name on a line of its own. */
@media (max-width: 720px) {
    .doc-viewer--page { border: 0; border-radius: 0; }
    .doc-viewer .drawer__head { flex-wrap: wrap; }
    .doc-viewer .drawer__title { flex-basis: 100%; }
}

/* Batch payments: the error / warning list (Odoo batch error wizard). */
.batch-issues { margin: 12px 0; }
.batch-issue-list { list-style: none; margin: 8px 0; padding: 0; }
.batch-issue-list > li {
    display: grid;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line, var(--muted));
}
.batch-issue-list > li:last-child { border-bottom: none; }
.batch-issue-payments { color: var(--muted); font-size: 0.9em; }
/* ---- Journal dashboard (Accounting → Journals, Dashboard tab) ------------- */
.journals-tabs { margin: 4px 0 16px; }
.jdash { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.jdash-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; }
.jdash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.jdash-head .onix-card-title { margin: 2px 0 0; }
.jdash-body { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: end; }
.jdash-figures { display: grid; gap: 6px; margin: 0; }
.jdash-figure { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9em; }
.jdash-figure dt { color: var(--muted); }
.jdash-figure dd { margin: 0; font-family: var(--font-display); color: var(--ink); white-space: nowrap; }
.jdash-figure dd a { color: inherit; }
.jdash-figure.is-attention dd { color: var(--warn); font-weight: 600; }
.jdash-graph { width: 100%; height: auto; overflow: visible; }
.jdash-base { stroke: var(--line-strong); stroke-width: 1; }
.jdash-line { fill: none; stroke: var(--brand); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.jdash-dot { fill: var(--brand); stroke: var(--panel); stroke-width: 2; }
.jdash-hit { fill: transparent; }
.jdash-hit:hover { fill: var(--hairline); }
.jdash-bar rect { fill: var(--brand); }
.jdash-bar.is-past rect { fill: var(--warn); }
.jdash-bar:hover rect { opacity: 0.8; }
.jdash-bar text { fill: var(--muted); font-size: 7px; font-family: var(--font-text); }
.jdash-alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 0.85em; color: var(--warn); }
.jdash-alert-mark { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%;
    border: 1.5px solid currentColor; font-size: 10px; font-weight: 700; margin-right: 4px; }
.jdash-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
@media (max-width: 520px) { .jdash-body { grid-template-columns: 1fr; } }

/* ─── Add-subject wizard (Identity) ─────────────────────────────────────── */

.wizard { max-width: 880px; }
.wizard-back { margin: 0 0 6px -10px; }
.wizard-card { max-width: none; }
/* The add-subject wizard: a company already in Onix, and the request for access sent to its owners. */
.access-notice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin: 12px 0; }
.access-notice .button { margin-top: 4px; }
.access-ask textarea { width: 100%; resize: vertical; }
.access-ask-hint { margin: -4px 0 12px; }
.wizard-hint { margin: 0 0 12px; font-size: 0.82rem; }
/* The proposal screen of a subject's work mailbox (Components/Shared/MailboxProposal): the address as one line — the name,
   a field as wide as what is typed with its line always drawn (it is the one thing to change here), right before the
   fleet's domain —, Mail's word on it, and the other free names as one-click buttons. */
.mailbox-proposal-address { display: flex; align-items: baseline; min-width: 0; font-family: var(--font-mono, ui-monospace, monospace); font-size: 1.2rem; line-height: 1.6; }
.drawer.mailbox-proposal .mailbox-proposal-address .mailbox-proposal-name {
    flex: 0 1 auto; min-width: 2ch; max-width: 100%; min-height: 0; box-sizing: content-box; padding: 0 1px;
    border: 0; border-bottom: 1px solid var(--o-input-border, var(--muted-2)); border-radius: 0; box-shadow: none;
    background: transparent; color: var(--ink); font: inherit;
}
.drawer.mailbox-proposal .mailbox-proposal-address .mailbox-proposal-name:hover:not(:disabled, :focus) { border-bottom-color: var(--ink-soft); }
.drawer.mailbox-proposal .mailbox-proposal-address .mailbox-proposal-name:focus { outline: none; border-bottom-color: var(--o-primary, var(--brand)); box-shadow: 0 1px 0 var(--o-primary, var(--brand)); }
.drawer.mailbox-proposal .mailbox-proposal-address .mailbox-proposal-name[aria-invalid=true] { border-bottom-color: var(--danger); }
.mailbox-proposal-domain { flex: 0 0 auto; color: var(--muted); }
.mailbox-proposal-state { min-height: 1.4em; margin: 8px 0 0; font-size: 0.86rem; overflow-wrap: anywhere; }
.mailbox-proposal-state.is-free { color: var(--good); }
.mailbox-proposal-state.is-taken,
.mailbox-proposal-state.is-invalid,
.mailbox-proposal-state.is-unanswered { color: var(--danger); }
.mailbox-proposal-others { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 18px 0 0; font-size: 0.86rem; }
.mailbox-proposal-others > span { flex: 0 0 100%; }
.mailbox-proposal-others .button { font-family: var(--font-mono, ui-monospace, monospace); }
.subject-mailbox-line { display: block; overflow-wrap: anywhere; }
.setup-balloon-mailbox { margin: 0 0 8px; overflow-wrap: anywhere; }
/* ATP-029: where the onboarding guide stands ("Step 1 done — next: …") and the company's industry. */
.setup-balloon p.setup-balloon-progress { margin: 6px 0 4px; font-weight: 600; color: var(--ink); }
.setup-balloon p.setup-balloon-industry { margin: 0 0 12px; }
.kind-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin: 14px 0 6px; }
.kind-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
    padding: 20px; font: inherit; color: var(--ink); cursor: pointer;
    background: var(--panel); border: 2px solid var(--brand); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
    transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.kind-card:hover:not(:disabled) { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--brand-strong); }
.kind-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.kind-card:disabled { opacity: 0.55; cursor: not-allowed; border-color: var(--line-strong); box-shadow: none; }
.kind-card strong { font-family: var(--font-display); font-size: 1.05rem; }
.kind-card .onix-icontile { color: var(--brand); }
.wizard-lookup { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 6px; }
.wizard-lookup label { flex: 1 1 220px; max-width: 24rem; }
.wizard-wait {
    display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; margin: 0 0 14px;
    background: var(--info-soft); border: 1px solid var(--brand); border-radius: var(--radius-md);
}
.wizard-wait p { margin: 4px 0 0; }
/* OP-027: the demo company's sample data going in, step by step. */
.demo-seed-steps { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 4px; }
.demo-seed-step {
    display: grid; grid-template-columns: 1.2rem 1fr auto; gap: 0 10px; align-items: baseline;
    padding: 6px 4px; border-bottom: 1px solid var(--line);
}
.demo-seed-step::before { content: "○"; color: var(--muted); }
.demo-seed-step.is-running::before { content: "◔"; color: var(--brand); }
.demo-seed-step.is-done::before { content: "✓"; color: var(--good); }
.demo-seed-step.is-failed::before { content: "✕"; color: var(--danger); }
.demo-seed-label { font-weight: 550; }
.demo-seed-note { grid-column: 2 / -1; overflow-wrap: anywhere; }
.terms-body {
    max-height: 24rem; overflow: auto; padding: 12px 16px; margin: 12px 0;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--panel-2);
}
.terms-body p { margin: 0 0 10px; }
.consent-accept { margin-top: 6px; }
.created-notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.created-notice form { display: inline; margin: 0; }

/* The new company's next steps (CompanySetupBalloon): a floating card in the
   toasts' corner, just beneath them, that stays until it is closed. */
.setup-balloon {
    position: fixed; right: 18px; bottom: 18px; z-index: 190;
    width: min(380px, calc(100vw - 36px));
    padding: 16px 18px;
    background: var(--panel); color: var(--ink);
    border: 1px solid var(--line-strong); border-left: 3px solid var(--brand);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.22s var(--ease);
}
.setup-balloon-title { display: block; padding-right: 28px; }
.setup-balloon p { margin: 6px 0 12px; font-size: 0.9rem; }
.setup-balloon-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.setup-balloon-close {
    position: absolute; top: 10px; right: 10px;
    display: inline-flex; padding: 4px;
    background: none; border: 0; border-radius: var(--radius-xs);
    color: var(--muted); cursor: pointer;
}
.setup-balloon-close:hover { background: var(--panel-hover); color: var(--ink); }

/* ACC-094: structured Bulgarian address editor (Partners) */
.bg-address-results { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow: auto; }
.bg-address-results .button { width: 100%; text-align: left; justify-content: flex-start; }
.bg-address-preview { margin: 4px 0 0; display: flex; flex-direction: column; gap: 2px; }
.bg-address-preview strong { font-family: var(--font-text); font-weight: 600; color: var(--ink); }
.identifier-badge { margin-left: 8px; }

/* ACC-095 — partner Registry panel (Trade Register facts) and the invoice's partner VAT banner. */
.partner-registry .registry-facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: .5rem 0; }
.partner-registry .registry-facts dt { color: var(--muted); }
.partner-registry .registry-facts dd { margin: 0; }
.partner-registry .vat-status { align-items: center; flex-wrap: wrap; }
.partner-vat-warnings ul { margin: .25rem 0 .5rem 1.25rem; padding: 0; }

/* IDE-016 — the register fill buttons as split buttons (Fill | ▾ Fill and validate) and the verdict chip. */
.register-fill { display: inline-flex; align-items: stretch; flex: none; }
/* Inside a form's <label> (the invoice header's ЕИК row) the caption rule (.form label span, .form-card label span) would
   make the split button and its ▾ blocks, stacked one under the other: they stay one row, in the field's own type. */
.form label .register-fill, .form-card label .register-fill,
.form label .register-fill > .row-menu, .form-card label .register-fill > .row-menu {
    display: inline-flex; margin: 0; font-size: inherit; font-weight: inherit; color: inherit;
}
.register-fill > .button { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.register-fill > .row-menu > .row-menu-button { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: -1px; padding-inline: 4px; min-width: 0; }
.register-fill > .row-menu > .row-menu-button > svg { width: 12px; height: 12px; transform: rotate(90deg); }
.register-fill .row-menu-panel [role="menuitemradio"].is-active { color: var(--brand-strong); font-weight: 600; }
.register-fill .row-menu-panel [role="menuitemradio"].is-active::before { content: "✓ "; }
.partner-validation { white-space: normal; max-width: 100%; }
.partner-validation-row { display: flex; justify-content: flex-start; }
.partner-registry > .partner-validation { margin: .25rem 0 .5rem; }

/* REV-031: what settled a posted document, under its totals. */
.invoice-settlements { margin: 8px 0 12px auto; max-width: 560px; display: grid; gap: 4px; font-size: 0.9rem; }
.invoice-settlements__row, .invoice-settlements__due { display: flex; gap: 10px; align-items: baseline; justify-content: flex-end; flex-wrap: wrap; }
.invoice-settlements__what { flex: 1 1 auto; text-align: right; font-style: italic; }
.invoice-settlements__undo { color: var(--danger, #b42318); }
.invoice-settlements__due { border-top: 1px solid var(--line); padding-top: 4px; }

/* A subject's mark (Components/Shared/SubjectMark.razor): its logo on a white tile — logos are drawn for paper — else
   its first letter. My Subjects' list and edit form; the switcher's .company-avatar takes the same tile (onix-shell.css). */
.subject-mark {
    width: 26px;
    height: 26px;
    flex: none;
    display: inline-grid;
    place-items: center;
    margin-right: 8px;
    vertical-align: middle;
    overflow: hidden;
    border-radius: 7px;
    background: color-mix(in srgb, var(--brand) 16%, transparent);
    color: var(--brand);
    font-size: 0.74rem;
    font-weight: 700;
}
.subject-mark[data-initial]::before,
.company-avatar[data-initial]::before { content: attr(data-initial); }
.subject-mark.has-logo,
.company-avatar.has-logo { background: #fff; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1); padding: 2px; overflow: hidden; }
.subject-mark.has-logo > img,
.company-avatar.has-logo > img { width: 100%; height: 100%; display: block; object-fit: contain; }
.subject-mark--lg { width: 76px; height: 76px; margin: 0; border-radius: 14px; font-size: 1.7rem; }
.subject-mark--lg.has-logo { padding: 6px; }
.subject-logo-field {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin: 16px 0 14px;
    padding-top: 16px;
    border-top: 1px solid var(--hairline, rgba(15, 23, 42, 0.1));
}
.subject-logo-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 62ch; }
.subject-logo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.subject-logo-actions label.button { cursor: pointer; }
.subject-logo-actions .is-disabled { opacity: 0.5; pointer-events: none; }
