/* BrandGuard Customer Admin — Warm Grey */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
    /* ── Core palette ── */
    --bg:           #f5f4f1;        /* warm grey page bg */
    --bg2:          #eceae6;        /* slightly deeper */
    --bg3:          #e4e1db;        /* input backgrounds */

    --card:         #ffffff;
    --card-border:  #e2dfd9;

    --sidebar-bg:   #f2f0ec;
    --sidebar-border: #dedad4;

    /* ── Brand blue (logo accent only) ── */
    --blue:         #00a0e9;
    --blue-d:       #0082c0;        /* hover */
    --blue-l:       #eaf5fd;        /* tint backgrounds */
    --blue-b:       #b8d8f0;        /* tint borders */
    --ice:          #005f8a;        /* dark-blue text on light */

    /* ── Text ── */
    --text:         #0f172a;        /* primary — high-contrast charcoal */
    --muted:        #4f5f6f;        /* secondary, kept readable */
    --dim:          #71808d;        /* placeholders and low-priority labels */

    /* ── Status ── */
    --green:        #00a878;
    --green-l:      #e8f5f0;
    --green-b:      #9adece;

    --amber:        #d97706;
    --amber-l:      #fef3e2;
    --amber-b:      #f9c97a;

    --red:          #dc3545;
    --red-l:        #fdecea;
    --red-b:        #f5b8be;

    /* ── Misc ── */
    --radius:       10px;
    --shadow:       0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
    --shadow-md:    0 4px 20px rgba(0,0,0,0.10);

    /* Legacy aliases — keeps inline JS styles working */
    --primary:       #00a0e9;
    --primary-light: #eaf5fd;
    --danger:        #dc3545;
    --warning:       #d97706;
    --success:       #00a878;
    --border:        #e2dfd9;
    --text-secondary:#6b7c8a;
}


* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
}

/* ═══════════════════════════════
   LOGIN
═══════════════════════════════ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 70% 50% at 50% -10%, rgba(0,0,0,0.04) 0%, transparent 65%),
        var(--bg);
}
.login-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 44px 40px;
    width: min(420px, calc(100vw - 32px));
    text-align: center;
    box-shadow: var(--shadow-md);
}
.login-card h1 { font-size: 22px; margin-bottom: 6px; color: var(--text); }
.customer-login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.customer-login-brand h1 { margin-bottom: 0; line-height: 1; min-width: 0; }
.customer-login-brand img { display: block; max-width: 100%; height: auto !important; max-height: 24px; }
.customer-beta-badge {
    display: inline-flex; align-items: center; vertical-align: middle;
    padding: 1px 6px; border: 1px solid #cbd6ea; border-radius: 5px;
    background: #eef2fa; color: #425783; font-size: 11px; font-weight: 600;
    line-height: 1.5; white-space: nowrap;
}
.login-card h2 { font-size: 17px; margin: 0 0 10px; color: var(--text); text-align: left; }
.login-card p  { font-size: 13px; color: var(--muted); margin-bottom: 32px; }
.login-label {
    display: block;
    margin: 0 0 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}
.login-card input {
    width: 100%; padding: 11px 14px;
    background: var(--bg3);
    border: 1px solid var(--card-border);
    border-radius: 8px; font-size: 14px; color: var(--text);
    margin-bottom: 16px; outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.login-card input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.08);
}
.login-card input::placeholder { color: var(--dim); }
.login-error { color: var(--red); font-size: 13px; margin-bottom: 12px; display: none; }
.login-secondary-action {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.mfa-enrollment {
    margin: 12px 0 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg2);
    text-align: left;
}

.mfa-secret {
    margin: 6px 0 10px;
    padding: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-family: Consolas, monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    user-select: all;
}

/* ═══════════════════════════════
   LAYOUT
═══════════════════════════════ */
.app { display: none; }
.app.active { display: flex; min-height: 100vh; }

/* ═══════════════════════════════
   SIDEBAR
═══════════════════════════════ */
.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 20px 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar-brand {
    padding: 0 18px 18px;
    border-bottom: 1px solid var(--sidebar-border);
    margin-bottom: 10px;
}
.sidebar-brand h2 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.sidebar-brand h2 img { filter: none; }
.sidebar-brand span { font-size: 10px; color: var(--muted); line-height: 1.6; }
.sidebar-nav { flex: 1; padding: 4px 0; }

.nav-section {
    padding: 14px 20px 6px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nav-section-secondary {
    border-top: 1px solid rgba(148, 163, 184, .18);
    margin-top: 8px;
    padding-top: 14px;
}

.nav-item-secondary { color: var(--muted); }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px;
    color: var(--muted);
    cursor: pointer; font-size: 13.5px; font-weight: 400;
    transition: all 0.15s;
    border-left: 2px solid transparent;
    margin-bottom: 1px;
}
.nav-item:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.nav-item.active {
    background: var(--blue-l);
    color: var(--blue-d);
    border-left-color: var(--blue);
    font-weight: 600;
}
.nav-item .icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--sidebar-border);
    font-size: 12px;
    color: var(--dim);
}
.lang-btn {
    color: var(--muted) !important;
    text-decoration: none !important;
    font-size: 12px; transition: color 0.15s;
}
.lang-btn:hover { color: var(--blue) !important; }

.tenant-context {
    display: none;
    margin-top: 12px;
    padding: 9px 10px;
    border: 1px solid #a9dced;
    border-left: 3px solid var(--blue);
    border-radius: 4px;
    background: var(--blue-l);
}

.tenant-context-label,
.tenant-context-code {
    display: block;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

#tenant-name {
    display: block;
    margin: 2px 0;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
    word-break: break-word;
}
.login-hint {
    margin: -2px 0 14px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
}

.session-card {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    background: #fff;
}

.session-role {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.session-email,
.session-permissions {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    word-break: break-word;
}

.session-permissions {
    margin-top: 4px;
}

#logout-link { color: var(--dim) !important; text-decoration: none !important; font-size: 12px; }
#logout-link:hover { color: var(--muted) !important; }

/* ═══════════════════════════════
   MAIN AREA
═══════════════════════════════ */
.main { flex: 1; overflow-y: auto; max-height: 100vh; background: var(--bg); }

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--card-border);
    padding: 13px 28px;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 10;
    box-shadow: 0 1px 0 var(--card-border);
}
.topbar h1 {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px; font-weight: 700;
    letter-spacing: 0; color: var(--text);
}
.topbar-right {
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--muted);
}
.topbar-context{font-size:12px;color:var(--text);font-weight:650;min-width:0;overflow-wrap:anywhere;margin-inline:16px;flex:1}.topbar-context span{display:inline-block;margin-right:10px}.topbar-context .environment-unavailable{color:var(--muted)}
.company-time-zone{display:flex;flex-direction:column;gap:2px;min-width:180px;font-size:11px;font-weight:600;color:var(--muted)}.company-time-zone select{max-width:250px;min-height:30px;border:1px solid var(--card-border);border-radius:6px;background:var(--card);color:var(--text);font-size:12px}.company-time-zone small{font-size:10px;font-weight:400;max-width:250px}.company-time-zone small:empty{display:none}
@media(max-width:768px){.topbar{flex-wrap:wrap;gap:8px}.topbar-context{order:3;flex-basis:100%;margin:0;font-size:12px}.topbar-right{order:2;flex-basis:100%;margin-left:0;justify-content:space-between;flex-wrap:wrap}.company-time-zone{min-width:min(18rem,100%);flex:1 1 18rem}.company-time-zone select{width:100%;max-width:100%}}
.dashboard-version {
    display: inline-flex; align-items: baseline; gap: 5px;
    padding: 4px 8px;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}
.dashboard-version strong { color: var(--text); font-size: 12px; }
.content { padding: 24px 28px; }

/* ═══════════════════════════════
   CARDS
═══════════════════════════════ */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.card-title {
    font-size: 11px; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0; margin-bottom: 16px;
}

/* ═══════════════════════════════
   STAT CARDS
═══════════════════════════════ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--blue), rgba(0,160,233,0.25));
}
.stat-value {
    font-family: 'Orbitron', monospace;
    font-size: 26px; font-weight: 700; color: var(--text);
}
.stat-label {
    font-size: 11px; color: var(--muted); margin-top: 5px;
    text-transform: uppercase; letter-spacing: 0;
}

/* ═══════════════════════════════
   TABLES
═══════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    text-align: left; padding: 9px 12px;
    border-bottom: 2px solid var(--bg3);
    color: var(--muted); font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0; white-space: nowrap;
    background: var(--bg);
}
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--bg);
    vertical-align: middle; color: var(--text);
}
td:first-child {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
tr:hover td { background: var(--blue-l); }
tr:last-child td { border-bottom: none; }

/* Recent scans — don't mono first col */
#recent-scans-tbody td:first-child {
    font-family: 'DM Sans', monospace;
    font-size: 12px; color: var(--text);
}

/* ═══════════════════════════════
   BUTTONS
═══════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 7px;
    font-size: 13px; font-weight: 500;
    cursor: pointer; border: none;
    transition: all 0.15s; font-family: inherit;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-d); box-shadow: 0 2px 8px rgba(0,160,233,0.25); }

.btn-danger { background: var(--red-l); color: var(--red); border: 1px solid var(--red-b); }
.btn-danger:hover { background: #fbd0d4; }

.btn-outline {
    background: #f0f3f6; color: var(--text);
    border: 1px solid #cad3dd;
}
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-l); }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Export CSV */
.btn-export {
    background: #f0f3f6; color: var(--text);
    border: 1px solid #cad3dd;
    padding: 7px 14px; font-size: 12px; border-radius: 7px;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 6px;
    box-shadow: var(--shadow);
}
.btn-export:hover { border-color: var(--green); color: var(--green); background: var(--green-l); }

/* ═══════════════════════════════
   FORMS
═══════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; font-size: 12px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: 0; margin-bottom: 7px;
}
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 10px 12px;
    background: var(--bg3); border: 1px solid var(--card-border);
    border-radius: 7px; font-size: 14px; color: var(--text);
    outline: none; transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--dim); }
.form-group input:focus, .form-group textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,160,233,0.10);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { cursor: pointer; }
.form-hint { font-size: 11px; color: var(--dim); margin-top: 5px; }
.product-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 1rem;
}
.product-page-header h1 {
    color: var(--text);
    font-size: 1.35rem;
    line-height: 1.25;
    margin: 0;
}
.product-page-header p {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.5;
    margin: 0.35rem 0 0;
    max-width: 46rem;
}
.product-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
    gap: 0.9rem;
    min-width: 0;
}
.product-summary-card {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: 0.9rem;
    align-items: start;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    min-width: 0;
    padding: 1rem;
}
.product-summary-hero {
    align-items: center;
    aspect-ratio: 1;
    background: var(--bg3);
    border: 1px solid var(--card-border);
    border-radius: 0.65rem;
    color: var(--dim);
    display: flex;
    font-size: 1.5rem;
    justify-content: center;
    overflow: hidden;
}
.product-summary-hero img {
    height: 100%;
    object-fit: cover;
    width: 100%;
}
.product-summary-body {
    min-width: 0;
}
.product-summary-body h2 {
    color: var(--text);
    font-size: 1rem;
    line-height: 1.3;
    margin: 0;
    overflow-wrap: anywhere;
}
.product-summary-body > p {
    color: var(--muted);
    display: -webkit-box;
    font-size: 0.875rem;
    line-height: 1.45;
    margin: 0.35rem 0 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.product-summary-facts,
.product-summary-skus,
.product-summary-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.65rem;
}
.product-summary-facts {
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 0.7rem;
}
.product-summary-skus {
    margin-top: 0.55rem;
}
.product-summary-skus span {
    background: var(--bg3);
    border: 1px solid var(--card-border);
    border-radius: 999px;
    color: var(--text);
    font-size: 0.875rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 0.2rem 0.5rem;
}
.product-summary-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
}
.product-empty-state {
    color: var(--muted);
    padding: 2rem;
    text-align: center;
}
.modal-overlay.product-authoring-overlay {
    padding: 1rem;
}
.modal.product-authoring-dialog {
    max-height: calc(100vh - 2rem);
    max-width: 61rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1.25rem;
    width: min(61rem, calc(100vw - 2rem));
    font-size: 1rem;
    line-height: 1.5;
}
.product-authoring-dialog form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.product-authoring-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0.25rem;
    scroll-padding-bottom: 1rem;
}
.product-image-status {
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.4;
    margin-top: 0.5rem;
    padding: 0.55rem 0.65rem;
}
.product-image-status strong,
.product-image-status span,
.product-image-status small { display: block; }
.product-image-status.pending,
.product-image-status.uploading { background: var(--blue-l); color: var(--blue); }
.product-image-status.failed,
.product-image-status.review { background: var(--amber-l); color: var(--amber); }
.product-image-status.available,
.product-image-status.succeeded { background: var(--green-l); color: var(--green); }
.product-authoring-section-heading {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}
.product-authoring-heading {
    align-items: flex-start;
    background: var(--card);
    display: flex;
    flex: 0 0 auto;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.product-authoring-heading h2,
.product-authoring-section-heading h3 {
    color: var(--text);
    margin: 0;
}
.product-authoring-heading h2 {
    font-size: 1.25rem;
}
.product-authoring-section-heading h3 {
    font-size: 1.125rem;
}
.product-dialog-close {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.45rem;
    color: var(--muted);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 1.35rem;
    height: 2.25rem;
    justify-content: center;
    width: 2.25rem;
}
.product-dialog-close:hover,
.product-dialog-close:focus-visible {
    background: var(--bg3);
    border-color: var(--card-border);
    color: var(--text);
    outline: 0.15rem solid rgba(0,160,233,0.16);
}
.product-authoring-basics,
.product-attribute-editor-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.product-authoring-basics .form-group:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}
.product-authoring-basics .form-group:nth-child(3) {
    grid-column: 2;
    grid-row: 1 / span 2;
}
.product-authoring-dialog .form-group {
    min-width: 0;
    margin-bottom: 0.75rem;
}
.product-authoring-dialog .form-group > span {
    display: block;
    margin-bottom: 0.4rem;
}
.product-authoring-dialog input:not([type="checkbox"]):not([type="radio"]),
.product-authoring-dialog select,
.product-authoring-dialog textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font: inherit;
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg3);
    color: var(--text);
}
.product-authoring-dialog input[type="checkbox"],
.product-authoring-dialog input[type="radio"] {
    flex: 0 0 auto;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.2rem;
}
.product-authoring-dialog .form-hint,
.product-authoring-dialog .form-warning,
.product-authoring-dialog small {
    display: block;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.product-authoring-dialog .btn,
.product-summary-actions .btn {
    font-size: 0.875rem;
    min-height: 2.5rem;
    white-space: normal;
}
.product-current-image {
    border: 1px solid var(--card-border);
    border-radius: 0.65rem;
    height: 4.5rem;
    object-fit: cover;
    width: 4.5rem;
}
.product-authoring-section {
    border-top: 1px solid var(--card-border);
    margin-top: 0.25rem;
    padding: 1rem 0;
}
.product-attribute-list,
.product-sku-summary-list,
.product-sku-combination-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 0.75rem;
}
.product-scope-guide {
    background: var(--bg3);
    border-radius: 0.55rem;
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 0.75rem;
    padding: 0.75rem;
}
.product-scope-guide summary {
    cursor: pointer;
    color: var(--text);
}
.product-scope-guide p {
    color: var(--muted);
    margin: 0.5rem 0 0;
}
.form-warning {
    color: var(--amber);
    display: block;
    font-size: 0.7rem;
    line-height: 1.4;
    margin-top: 0.3rem;
}
.product-attribute-summary,
.product-sku-summary {
    align-items: center;
    background: var(--bg3);
    border: 1px solid var(--card-border);
    border-radius: 0.6rem;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    min-width: 0;
    padding: 0.75rem;
}
.product-attribute-summary.retired {
    opacity: 0.72;
}
.product-attribute-summary-heading {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
}
.product-attribute-summary-heading span {
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.875rem;
    padding: 0.15rem 0.4rem;
}
.product-attribute-summary-heading .public {
    background: var(--green-l);
    color: var(--green);
}
.product-attribute-summary-heading .internal {
    background: var(--amber-l);
    color: var(--amber);
}
.product-attribute-summary p,
.product-sku-summary p {
    color: var(--muted);
    font-size: 0.875rem;
    margin: 0.35rem 0 0;
    overflow-wrap: anywhere;
}
.product-attribute-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.product-attribute-editor,
.product-choice-options,
.product-sku-combination {
    border: 1px solid var(--card-border);
    border-radius: 0.6rem;
    min-width: 0;
    padding: 0.75rem;
}
.product-attribute-editor legend,
.product-choice-options legend {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    padding: 0 0.3rem;
}
.product-attribute-advanced,
.product-authoring-advanced {
    color: var(--muted);
    font-size: 0.875rem;
    margin: 0.5rem 0;
}
.product-option-row {
    align-items: flex-start;
    display: flex;
    gap: 0.55rem;
    margin-top: 0.55rem;
}
.product-option-row small {
    display: block;
    margin-top: 0.15rem;
}
.product-sku-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.75rem 0;
}
.product-sku-mode label {
    align-items: center;
    border: 1px solid var(--card-border);
    border-radius: 0.55rem;
    display: flex;
    gap: 0.45rem;
    padding: 0.55rem 0.7rem;
}
.product-choice-options {
    margin-top: 0.65rem;
}
.product-choice-options label {
    display: inline-flex;
    gap: 0.35rem;
    margin: 0.35rem 0.8rem 0 0;
}
.product-sku-combination {
    display: grid;
    gap: 0.25rem;
}
.product-sku-combination span {
    color: var(--text);
    font-size: 1rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}
.product-sku-combination input {
    max-width: 100%;
    min-width: 0;
}
.product-authoring-issue {
    background: var(--amber-l);
    border: 1px solid var(--amber-b);
    border-radius: 0.5rem;
    color: var(--amber);
    font-size: 0.875rem;
    margin-top: 0.65rem;
    padding: 0.65rem;
}
.product-empty-note {
    color: var(--dim);
    font-size: 0.875rem;
    margin: 0.75rem 0;
}
.product-authoring-dialog .product-authoring-actions {
    background: var(--card);
    border-top: 1px solid var(--card-border);
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0;
    padding: 0.85rem 0 0;
    position: static;
}
.product-sku-set-review { margin-top: 1rem; }
.product-authoring-issue ul { padding-left: 1.5rem; }
.product-authoring-issue p { margin: 0; }
.product-sku-result { color: var(--text); }
@media (max-width: 1280px) {
    .product-card-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
    }
    .modal.product-authoring-dialog {
        max-width: 56rem;
    }
}
@media (max-width: 760px) {
    .product-page-header,
    .product-authoring-section-heading,
    .product-attribute-summary,
    .product-sku-summary {
        align-items: stretch;
        flex-direction: column;
    }
    .product-page-header .btn,
    .product-authoring-section-heading .btn {
        width: 100%;
    }
    .product-card-grid,
    .product-authoring-basics,
    .product-attribute-editor-grid,
    .product-scope-guide {
        grid-template-columns: minmax(0, 1fr);
    }
    .product-authoring-basics .form-group:nth-child(2),
    .product-authoring-basics .form-group:nth-child(3) {
        grid-column: auto;
        grid-row: auto;
    }
    .modal-overlay.product-authoring-overlay {
        align-items: stretch;
        padding: 0;
    }
    .modal.product-authoring-dialog {
        border-radius: 0;
        max-height: 100vh;
        max-width: none;
        min-height: 100vh;
        padding: 1rem;
        width: 100%;
    }
    .product-authoring-dialog .product-authoring-actions {
        padding: 0.75rem 0 0;
    }
}

.product-code-value {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
    font-weight: 700;
}
.product-allocation-status {
    margin-top: 4px;
    font-size: 10px;
    line-height: 1.35;
}
.product-allocation-status.ready { color: var(--green); }
.product-allocation-status.blocked { color: var(--amber); }
.product-passport-source {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}
.product-passport-preview {
    color: var(--muted);
    font-size: 11px;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.product-passport-panel {
    border: 1px solid var(--blue-b);
    border-radius: 8px;
    background: #f5fbff;
    padding: 12px;
    margin-top: 14px;
}
.product-passport-panel h3 {
    color: var(--text);
    font-size: 13px;
    margin: 0 0 10px;
}

.catalog-definition-step {
    border-top: 1px solid var(--card-border);
    padding: 14px 0 4px;
}
.catalog-definition-step h4 {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    margin: 0;
}
.catalog-definition-step .form-hint {
    margin: 4px 0 10px;
    line-height: 1.45;
}
.catalog-definition-example {
    border-left: 3px solid var(--blue);
    background: #fff;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
    margin: 4px 0 8px;
    padding: 7px 9px;
}
.catalog-definition-preview {
    border: 1px solid var(--blue-b);
    border-radius: 7px;
    background: #fff;
    margin: 8px 0 10px;
    padding: 10px;
}
.catalog-definition-preview-row {
    display: grid;
    grid-template-columns: minmax(110px, 0.8fr) minmax(130px, 1fr) minmax(120px, 1fr);
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 12px;
}
.catalog-definition-preview-row code {
    overflow-wrap: anywhere;
}
.catalog-definition-preview-row span {
    color: var(--muted);
}
.catalog-definition-preview-flags {
    color: var(--dim);
    font-size: 10px;
    margin-top: 7px;
}
.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}
@media (max-width: 760px) {
    .catalog-definition-preview-row {
        grid-template-columns: 1fr;
    }
}


.catalog-variant-saved-list {
    display: grid;
    gap: 8px;
    margin: 10px 0;
}
.catalog-variant-saved-summary {
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    background: #f0fdf4;
    padding: 10px 12px;
}
.catalog-variant-saved-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px 12px;
    color: var(--text);
    font-size: 12px;
}
.catalog-variant-saved-heading code {
    overflow-wrap: anywhere;
}
.catalog-variant-saved-name,
.catalog-variant-saved-attributes {
    color: var(--muted);
    font-size: 11px;
    margin-top: 6px;
}
.catalog-variant-add-another {
    margin: 8px 0 2px;
}
.catalog-variant-builder {
    margin-top: 10px;
}
.catalog-variant-builder-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.catalog-variant-choice-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0;
}
.catalog-variant-choice-group {
    border: 1px solid var(--card-border);
    border-radius: 7px;
    padding: 9px 10px;
}
.catalog-variant-choice-group legend {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    padding: 0 4px;
}
.catalog-variant-choice-group > div {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 12px;
    margin-top: 7px;
}
.catalog-variant-choice-group label {
    color: var(--muted);
    font-size: 11px;
}
.catalog-variant-combination-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0 6px;
    color: var(--text);
    font-size: 12px;
}
.catalog-variant-combination-preview {
    display: grid;
    gap: 7px;
    margin-top: 8px;
}
.catalog-variant-combination-row {
    display: grid;
    grid-template-columns: minmax(130px, 0.8fr) minmax(140px, 1fr) minmax(170px, 1fr);
    gap: 8px;
    align-items: center;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: #fff;
    padding: 8px 9px;
    color: var(--muted);
    font-size: 11px;
}
.catalog-variant-combination-row code {
    overflow-wrap: anywhere;
}
.catalog-variant-combination-row label span {
    display: block;
    margin-bottom: 3px;
}
.catalog-variant-combination-row.collision {
    border-color: #fca5a5;
    background: #fef2f2;
}
.catalog-variant-combination-row.collision strong {
    grid-column: 1 / -1;
    color: var(--red);
    font-size: 10px;
}
@media (max-width: 760px) {
    .catalog-variant-choice-groups,
    .catalog-variant-combination-row {
        grid-template-columns: 1fr;
    }
}

.product-passport-preview-box {
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: #fff;
    padding: 9px 10px;
    color: var(--ice);
    font-size: 12px;
    overflow-wrap: anywhere;
}
.product-passport-future-note {
    color: var(--amber);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    margin: 8px 0 0;
}

/* Filter selects on tags page */
#tag-filter-status, #tag-filter-product {
    padding: 7px 10px; background: var(--card);
    border: 1px solid var(--card-border); border-radius: 7px;
    font-size: 13px; color: var(--text); outline: none;
    cursor: pointer; font-family: inherit;
    box-shadow: var(--shadow);
}

/* ═══════════════════════════════
   STATUS BADGES
═══════════════════════════════ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }

.badge-active   { background: var(--green-l); color: var(--green);  border: 1px solid var(--green-b); }
.badge-active::before { background: var(--green); }

.badge-suspended { background: var(--amber-l); color: var(--amber);  border: 1px solid var(--amber-b); }
.badge-suspended::before { background: var(--amber); }
.badge-scan-warning { background: var(--amber-l); color: var(--amber); border: 1px solid var(--amber-b); }
.badge-scan-warning::before { background: var(--amber); }


.badge-revoked  { background: var(--red-l);   color: var(--red);    border: 1px solid var(--red-b); }
.badge-revoked::before { background: var(--red); }

/* ═══════════════════════════════
   COLOR PICKER
═══════════════════════════════ */
.color-picker-group { display: flex; align-items: center; gap: 10px; }
.color-picker-group input[type="color"] {
    width: 44px; height: 36px; border: 1px solid var(--card-border);
    border-radius: 7px; padding: 2px; cursor: pointer; background: var(--bg3);
}
.color-picker-group input[type="text"] { width: 120px; }

/* ═══════════════════════════════
   IMAGE UPLOAD
═══════════════════════════════ */
.upload-area {
    border: 2px dashed var(--card-border); border-radius: var(--radius);
    padding: 24px; text-align: center; cursor: pointer; transition: all 0.2s;
}
.upload-area:hover { border-color: var(--blue); background: var(--blue-l); }
.upload-area .icon { font-size: 28px; margin-bottom: 8px; }
.upload-area p { font-size: 13px; color: var(--muted); }
.upload-area input { display: none; }
.preview-image {
    max-width: 120px; max-height: 120px;
    border-radius: 8px; object-fit: cover; border: 1px solid var(--card-border);
}

/* ═══════════════════════════════
   MODAL
═══════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(10,30,60,0.35);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(3px);
}
.modal {
    background: var(--card); border: 1px solid var(--card-border);
    border-radius: 14px; padding: 28px; width: 460px;
    max-width: 90vw; max-height: 82vh; overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal h2 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.confirm-modal { max-width: 480px; }
.confirm-message { color: var(--muted); font-size: 13px; line-height: 1.5; margin: -6px 0 0; }
.confirm-note { border: 1px solid #fde68a; background: #fffbeb; color: #92400e; border-radius: 8px; padding: 9px 10px; font-size: 12px; line-height: 1.45; margin-top: 12px; }

.scope-list {
    display: grid;
    gap: 8px;
}
.form-group .scope-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.scope-option input[type="checkbox"] {
    width: 16px;
    min-width: 16px;
    height: 16px;
    margin: 2px 0 0;
    padding: 0;
    cursor: pointer;
}
.scope-option span {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.scope-option strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}
.scope-option small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.35;
}
.secret-modal-message {
    margin: -6px 0 14px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}
.secret-token-box {
    padding: 12px;
    border: 1px solid var(--blue-b);
    border-radius: 8px;
    background: var(--blue-l);
}
.secret-token-label {
    margin-bottom: 6px;
    color: var(--ice);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}
.secret-token-value {
    color: var(--text);
    font-family: Consolas, 'SFMono-Regular', monospace;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-all;
}
/* JS-created modals (tagAttr, csvImport, addAttrSub, attributes) */
[id="tagAttrModal"] > div, [id="csvImportModal"] > div,
[id="addAttrSubModal"] > div, [id="attributesModal"] > div {
    background: var(--card) !important;
    border: 1px solid var(--card-border) !important;
    border-radius: 14px !important;
    color: var(--text) !important;
}
[id="tagAttrModal"] h3, [id="csvImportModal"] h3,
[id="addAttrSubModal"] h3, [id="attributesModal"] h3 { color: var(--text) !important; }
[id="tagAttrModal"] label, [id="csvImportModal"] label,
[id="addAttrSubModal"] label, [id="attributesModal"] label { color: var(--muted) !important; }
[id="tagAttrModal"] p, [id="csvImportModal"] p { color: var(--muted) !important; }
[id="tagAttrModal"] input, [id="tagAttrModal"] select, [id="tagAttrModal"] textarea,
[id="csvImportModal"] input, [id="addAttrSubModal"] input, [id="addAttrSubModal"] select,
[id="attributesModal"] input, [id="attributesModal"] select {
    background: var(--bg3) !important;
    border-color: var(--card-border) !important;
    color: var(--text) !important;
    border-radius: 7px !important;
}
.attr-item {
    background: var(--bg) !important;
    border-color: var(--card-border) !important;
    color: var(--text) !important;
}

/* ═══════════════════════════════
   CHART (CSS bars)
═══════════════════════════════ */
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 0; }
.chart-bar  { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.chart-bar-fill {
    width: 100%; background: var(--blue);
    border-radius: 4px 4px 0 0; min-height: 2px;
    transition: height 0.4s ease; opacity: 0.85;
}
.chart-bar-label { font-size: 10px; color: var(--dim); }
.chart-bar-value { font-size: 11px; font-weight: 600; color: var(--muted); }

/* ═══════════════════════════════
   GEO ROWS
═══════════════════════════════ */
#geo-container > div {
    color: var(--text) !important;
    border-bottom-color: var(--bg3) !important;
}

/* ═══════════════════════════════
   TAG PRODUCT DROPDOWN (inline td)
═══════════════════════════════ */
td select {
    background: var(--bg3) !important;
    border-color: var(--card-border) !important;
    color: var(--text) !important;
    border-radius: 6px; padding: 3px 8px;
    font-size: 12px; cursor: pointer;
}

/* ═══════════════════════════════
   PAGE SECTIONS
═══════════════════════════════ */
.page { display: none; }
.page.active { display: block; }
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 13px; }

/* ═══════════════════════════════
   TOAST
═══════════════════════════════ */
.toast {
    position: fixed; top: 20px; right: 20px;
    background: var(--text); color: #fff;
    padding: 11px 20px; border-radius: 8px; font-size: 13px;
    z-index: 2000; animation: slideIn 0.25s ease-out;
    box-shadow: 0 4px 16px rgba(0,30,60,0.2);
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* showToast (inline JS bottom-toast) */
body > div[style*="bottom:24px"] {
    background: var(--text) !important;
    color: #fff !important;
    font-family: 'DM Sans', sans-serif !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0,30,60,0.2) !important;
}

/* ═══════════════════════════════
   RESPONSIVE
═══════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .content { padding: 16px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .topbar { padding: 12px 16px; }
}

/* ═══════════════════════════════
   CUSTOMER ITEMS
═══════════════════════════════ */
.items-toolbar {
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.items-toolbar input[type="search"] {
    flex: 1 1 280px;
    min-width: 220px;
    padding: 7px 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    font-family: inherit;
    box-shadow: var(--shadow);
}
.items-toolbar input[type="search"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,160,233,0.10);
}
.items-toolbar select {
    min-width: 140px;
    padding: 7px 10px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    box-shadow: var(--shadow);
}
.item-allocation-modal { width: 680px; max-height: calc(100vh - 24px); overflow-y: auto; }
.item-allocation-modal > .modal-actions {
    position: sticky;
    bottom: -1px;
    margin-bottom: -1px;
    padding: 12px 0 1px;
    background: var(--surface, #fff);
    border-top: 1px solid var(--card-border);
}
.item-allocation-hint {
    margin: -8px 0 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}
.item-allocation-product-picker {
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: #fff;
    overflow: hidden;
}
.item-allocation-product-picker > input[type="search"] {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--card-border);
    border-radius: 0;
    box-shadow: none;
}
.item-allocation-product-picker > input[type="search"]:focus {
    border-color: var(--blue);
    box-shadow: inset 0 -2px 0 var(--blue);
}
.item-allocation-product-options {
    display: grid;
    max-height: 190px;
    overflow-y: auto;
    padding: 5px;
}
.item-allocation-product-option {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    text-align: left;
    font-family: inherit;
    cursor: pointer;
}
.item-allocation-product-option:hover,
.item-allocation-product-option:focus-visible {
    border-color: var(--blue-b);
    background: var(--blue-l);
    outline: none;
}
.item-allocation-product-option.selected {
    border-color: var(--blue);
    background: var(--blue-l);
}
.item-allocation-product-option.unavailable {
    cursor: not-allowed;
    opacity: 0.68;
}
.item-allocation-product-option.unavailable:hover {
    border-color: transparent;
    background: transparent;
}
.item-allocation-product-option strong {
    font-size: 13px;
    line-height: 1.35;
}
.item-allocation-product-option span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
}
.item-allocation-product-option .item-allocation-product-issue {
    color: var(--amber);
    font-weight: 700;
}
.item-allocation-product-empty {
    padding: 12px 10px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}
.item-allocation-product-selected {
    min-height: 20px;
    margin-top: 7px;
    color: var(--ice);
    font-size: 12px;
    font-weight: 700;
}
.item-allocation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 12px;
}
.item-allocation-checkbox {
    align-content: start;
}
.item-allocation-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 2px 0 4px;
}
.item-allocation-grid[hidden],
.item-allocation-route-panel[hidden],
.item-allocation-product-summary[hidden],
.item-allocation-variant-summary[hidden] {
    display: none;
}
.item-allocation-product-summary,
.item-allocation-variant-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid var(--blue-b);
    border-radius: 8px;
    background: var(--blue-l);
}
.item-allocation-product-summary > div {
    display: grid;
    gap: 3px;
}
.item-allocation-product-summary strong {
    color: var(--ice);
    font-size: 14px;
}
.item-allocation-product-summary span,
.item-allocation-variant-summary {
    color: var(--muted);
    font-size: 12px;
}
.item-allocation-route-note,
.item-allocation-route-warning,
.item-allocation-effective-route {
    margin: 0 0 14px;
    padding: 11px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fbfdff;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}
.item-allocation-route-warning {
    border-color: var(--amber-b);
    background: var(--amber-l);
    color: var(--amber);
}
.item-allocation-effective-route {
    border-color: var(--green-b);
    background: var(--green-l);
    color: var(--green);
}
.item-allocation-effective-route > strong {
    display: block;
    margin-bottom: 7px;
}
.item-allocation-effective-route dl {
    display: grid;
    gap: 6px;
    margin: 0;
}
.item-allocation-effective-route dl > div {
    display: grid;
    grid-template-columns: minmax(90px, 0.35fr) minmax(0, 1fr);
    gap: 10px;
}
.item-allocation-effective-route dt {
    color: var(--muted);
    font-weight: 700;
}
.item-allocation-effective-route dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-family: Consolas, 'SFMono-Regular', monospace;
}
.item-allocation-advanced {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fbfdff;
}
.item-allocation-advanced summary {
    color: var(--ice);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}
.item-allocation-advanced[open] summary {
    margin-bottom: 10px;
}
.item-allocation-safety-boundary {
    padding: 10px 12px;
    border: 1px solid var(--green-b);
    border-radius: 8px;
    background: var(--green-l);
    color: var(--green) !important;
    font-weight: 700;
}
.item-allocation-preview {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--blue-b);
    border-radius: 7px;
    background: var(--blue-l);
    color: var(--ice);
    font-family: Consolas, 'SFMono-Regular', monospace;
    font-size: 13px;
    font-weight: 700;
}
.item-allocation-preview.error {
    border-color: var(--red-b);
    background: var(--red-l);
    color: var(--red);
    font-family: inherit;
    font-weight: 600;
}
.item-allocation-section {
    margin: 2px 0 12px;
    padding-top: 14px;
    border-top: 1px solid var(--card-border);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.item-allocation-factory-preview {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--amber-b);
    border-radius: 8px;
    background: var(--amber-l);
    color: var(--amber);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}
.item-allocation-factory-preview.ready {
    border-color: var(--green-b);
    background: var(--green-l);
    color: var(--green);
}
.item-allocation-packaging {
    margin: 0 0 14px;
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fbfdff;
}
.item-allocation-packaging summary {
    color: var(--ice);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}
.item-allocation-packaging[open] summary { margin-bottom: 10px; }
.item-allocation-sequence-preview {
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--blue-l);
    color: var(--ice);
    font-family: Consolas, 'SFMono-Regular', monospace;
    font-size: 12px;
}
.item-allocation-success { width: 620px; }
.item-allocation-success-items { margin: 0 0 18px; padding-left: 20px; }
.item-allocation-success-items li { margin: 6px 0; overflow-wrap: anywhere; }
.item-allocation-success-items span { display: block; color: var(--muted); font-size: 12px; }
.item-allocation-success > p {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}
.hosted-passport-presentation {
    margin: 0 0 14px;
    padding: 12px;
    border: 1px solid var(--blue-b);
    border-radius: 8px;
    background: #f5fbff;
}
.hosted-passport-presentation span { color: var(--muted); font-size: 11px; font-weight: 700; }
.hosted-passport-presentation .item-code { margin-top: 4px; white-space: normal; overflow-wrap: anywhere; }
.hosted-passport-presentation p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#items-tbody td:first-child {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
}
.item-code {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--ice);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.item-main {
    font-weight: 600;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-muted {
    color: #667482;
    font-size: 11.5px;
    line-height: 1.38;
    font-weight: 500;
}
.permission-disabled {
    opacity: 0.58;
    cursor: not-allowed !important;
}
.access-detail {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
    margin-top: 4px;
}
.access-mono {
    font-family: Consolas, 'SFMono-Regular', monospace;
    color: #475569;
}
.access-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 170px;
}
.access-locked {
    padding: 26px 16px;
    text-align: center;
    color: var(--muted);
    background: #f8fafc;
    font-size: 12px;
    font-weight: 600;
}
.access-device-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg);
}
.access-device-summary span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.access-device-summary strong {
    color: var(--text);
    font-size: 12px;
    line-height: 1.3;
    word-break: break-word;
}
.item-subline {
    display: flex;
    gap: 6px;
    font-size: 11px;
    line-height: 1.45;
    white-space: nowrap;
}
.item-subline span {
    color: var(--dim);
    min-width: 44px;
}
.item-url {
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    color: var(--ice);
}

.item-link {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    color: #003f5c;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0;
    cursor: pointer;
    text-align: left;
}
.item-link:hover { text-decoration: underline; }
.item-detail-chip {
    appearance: none;
    margin: 3px 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
}
.item-detail-chip:hover {
    color: var(--ice);
    text-decoration: underline;
}
.import-error-list {
    margin-top: 8px;
    color: #b91c1c;
}
.import-error-list ul {
    margin: 4px 0 0 18px;
    padding: 0;
    max-height: 120px;
    overflow: auto;
}
.item-detail-modal {
    background: #fff;
    border-radius: 8px;
    width: min(980px, 94vw);
    max-height: 84vh;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.22);
}
.item-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 0;
    padding: 22px 24px 14px;
    border-bottom: 1px solid var(--card-border);
    flex: 0 0 auto;
}
.item-detail-body {
    overflow: auto;
    padding: 16px 24px 22px;
}
.item-detail-head h3 {
    margin: 0 0 4px;
    font-size: 17px;
    color: var(--text);
}
.item-detail-head button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--dim);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.item-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.item-detail-summary-line {
    border: 1px solid var(--card-border);
    border-radius: 7px;
    padding: 10px 12px;
    background: #fafafa;
    min-width: 0;
}
.item-detail-summary-line span {
    display: block;
    color: var(--dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 4px;
}
.item-detail-summary-line strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.item-passport-preview {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--blue-b);
    border-radius: 7px;
    background: #f5fbff;
    padding: 12px 14px;
    margin: 0 0 16px;
}
.item-passport-preview span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.item-passport-preview strong {
    display: block;
    max-width: 620px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ice);
    font-size: 13px;
    letter-spacing: 0;
}
.item-passport-preview strong.empty {
    color: var(--dim);
    font-weight: 500;
}
.item-passport-preview p {
    margin: 5px 0 0;
    color: var(--dim);
    font-size: 11px;
}
.item-passport-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    min-width: 190px;
}
.item-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.item-detail-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}
.item-detail-field-wide { grid-column: 1 / -1; }
.item-detail-field span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}
.item-detail-field input,
.item-detail-field textarea {
    border: 1px solid var(--card-border);
    border-radius: 7px;
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    padding: 9px 10px;
    resize: vertical;
}
.item-detail-field input::placeholder,
.item-detail-field textarea::placeholder {
    color: #b6c1ce;
}
.item-detail-field input:focus,
.item-detail-field textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,160,233,0.10);
}
.item-detail-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 16px 0 18px;
}
.item-draft-removal-blocked {
    display: grid;
    gap: 4px;
    margin: -6px 0 16px;
    padding: 9px 11px;
    border: 1px solid var(--red-b);
    border-radius: 7px;
    background: var(--red-l);
    color: var(--red);
    font-size: 11px;
    line-height: 1.4;
}
.draft-removal-modal { width: min(560px, 94vw); }
.draft-removal-hint {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}
.draft-removal-effect {
    margin-bottom: 14px;
    padding: 9px 10px;
    border: 1px solid var(--amber-b);
    border-radius: 7px;
    background: var(--amber-l);
    color: var(--amber);
    font-size: 12px;
    line-height: 1.45;
}
.draft-removal-modal .form-group { margin-bottom: 12px; }
.draft-removal-modal .form-group > span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}
.draft-removal-modal input,
.draft-removal-modal textarea { width: 100%; }
.item-detail-section-title {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 12px;
    letter-spacing: 0;
    text-transform: uppercase;
}
.item-scans-table table th,
.item-scans-table table td {
    font-size: 12px;
}
@media (max-width: 760px) {
    .item-allocation-grid { grid-template-columns: 1fr; }
    .item-detail-summary,
    .item-edit-grid { grid-template-columns: 1fr; }
    .item-passport-preview { flex-direction: column; }
    .item-passport-actions { justify-content: flex-start; min-width: 0; }
}

/* ═══════════════════════════════
   Batch Dashboard
═══════════════════════════════ */
.batch-toolbar,
.items-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.batch-toolbar input,
.items-toolbar input {
    min-width: 260px;
    flex: 1 1 260px;
}
.batch-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.batch-progress {
    min-width: 120px;
}
.batch-progress-bar {
    height: 7px;
    border-radius: 999px;
    background: var(--bg3);
    border: 1px solid var(--card-border);
    overflow: hidden;
}
.batch-progress-bar span {
    display: block;
    height: 100%;
    background: var(--green);
}
.batch-progress-text {
    margin-top: 4px;
    font-size: 11px;
    color: var(--muted);
}
.batch-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}
.batch-detail-head h3 {
    font-size: 18px;
    color: var(--text);
    margin: 0;
}
.batch-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.batch-metric-grid div {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 10px 12px;
    background: var(--bg);
}
.batch-metric-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 4px;
    font-weight: 700;
}
.batch-metric-grid strong {
    font-family: 'Orbitron', monospace;
    font-size: 16px;
    color: var(--text);
}
.batch-detail-table {
    margin-top: 12px;
}
#batches-tbody td,
#batch-detail-card td {
    color: var(--text);
}
#batches-tbody td:first-child,
#batch-detail-card td:first-child {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    color: var(--text);
}
#batches-tbody .item-link,
#batch-detail-card .item-link {
    color: #003f5c;
}
#batches-tbody strong,
#batch-detail-card strong {
    color: #0b1220;
}
.batch-status-line {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
}
.batch-operational-states {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}
.batch-state-pair {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 3px 4px 3px 8px;
    border: 1px solid #dbe3ec;
    border-radius: 7px;
    background: #fff;
}
.batch-state-label {
    color: #334155;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}
.batch-state-pair .badge,
.batch-state-pair .batch-write-state,
.batch-state-pair .batch-lot-state {
    flex: 0 0 auto;
}
.badge-draft { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.badge-draft::before { background: #64748b; }
.badge-ready { background: var(--blue-l); color: var(--ice); border: 1px solid var(--blue-b); }
.badge-ready::before { background: var(--blue); }
.badge-production { background: var(--amber-l); color: var(--amber); border: 1px solid var(--amber-b); }
.badge-production::before { background: var(--amber); }
.badge-delivered { background: var(--green-l); color: var(--green); border: 1px solid var(--green-b); }
.badge-delivered::before { background: var(--green); }
.badge-hold { background: var(--red-l); color: var(--red); border: 1px solid var(--red-b); }
.badge-hold::before { background: var(--red); }
.batch-write-state {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
}
.batch-write-state.write-partiallywritten {
    border-color: var(--amber-b);
    background: var(--amber-l);
    color: var(--amber);
}
.batch-write-state.write-written {
    border-color: var(--green-b);
    background: var(--green-l);
    color: var(--green);
}
.batch-lot-state {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
}
.batch-lot-state.lot-ready { border-color: var(--blue-b); background: var(--blue-l); color: var(--ice); }
.batch-lot-state.lot-inprogress { border-color: var(--blue-b); background: var(--blue-l); color: var(--ice); }
.batch-lot-state.lot-paused { border-color: var(--amber-b); background: var(--amber-l); color: var(--amber); }
.batch-lot-state.lot-completed { border-color: var(--green-b); background: var(--green-l); color: var(--green); }
.batch-lot-handoff {
    margin: 14px 0 2px;
    padding: 14px;
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--blue);
    border-radius: 8px;
    background: #fbfdfe;
}
.batch-lot-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}
.batch-lot-head p,
.batch-lot-writer-note,
.batch-lot-metadata-note {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}
.batch-lot-current {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: #fff;
    font-size: 12px;
}
.batch-lot-current span { color: var(--muted); }
.batch-lot-preview { margin-top: 12px; }
.batch-lot-preview-title {
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}
.batch-lot-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.batch-lot-metrics div {
    padding: 9px 10px;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: #fff;
}
.batch-lot-metrics span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}
.batch-lot-metrics strong { display: block; margin-top: 3px; font-size: 15px; }
.batch-lot-current-metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.batch-lot-current-help {
    margin: -2px 0 9px;
    color: #334155;
    font-size: 12px;
    line-height: 1.45;
}
.batch-lot-current-items {
    display: grid;
    gap: 6px;
    margin-top: 9px;
}
.batch-lot-current-item {
    display: grid;
    grid-template-columns: 48px minmax(150px, 1fr) 90px 100px minmax(120px, auto);
    gap: 8px;
    align-items: center;
    padding: 7px 9px;
    border: 1px solid var(--card-border);
    border-radius: 7px;
    background: #fff;
    color: #0b1220;
    font-size: 11px;
}
.batch-lot-item-sequence,
.batch-lot-item-attempts,
.batch-lot-item-uid {
    color: #475569;
}
.batch-lot-item-uid {
    overflow-wrap: anywhere;
}
.batch-lot-item-status {
    display: inline-flex;
    justify-content: center;
    padding: 3px 7px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
}
.batch-lot-item-status.item-locked {
    border-color: var(--amber-b);
    background: var(--amber-l);
    color: var(--amber);
}
.batch-lot-item-status.item-written {
    border-color: var(--green-b);
    background: var(--green-l);
    color: var(--green);
}
.batch-lot-item-status.item-failed,
.batch-lot-item-status.item-scrapped {
    border-color: var(--red-b);
    background: var(--red-l);
    color: var(--red);
}
.batch-lot-exclusions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 5px;
    max-height: 190px;
    overflow: auto;
    margin-top: 9px;
}
.batch-lot-exclusions span {
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--red-l);
    color: var(--red);
    font-size: 11px;
}
.batch-lot-create-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-top: 10px;
}
.batch-lot-create-row .form-group { flex: 1; margin: 0; }
.batch-lot-create-row select { width: 100%; }
.batch-lot-error { color: var(--red); font-size: 12px; }
.batch-warning-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid var(--amber-b);
    background: var(--amber-l);
    color: var(--amber);
    font-size: 11px;
    font-weight: 600;
}
.batch-readiness {
    display: grid;
    gap: 10px;
    margin: 14px 0 2px;
    padding: 12px 14px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    border-left-width: 4px;
    background: #fff;
}
.batch-readiness.neutral {
    border-color: #cbd5e1;
    border-left-color: #64748b;
    background: #f8fafc;
}
.batch-readiness.action {
    border-color: var(--blue-b);
    border-left-color: var(--blue);
    background: var(--blue-l);
}
.batch-readiness.attention {
    border-color: var(--amber-b);
    border-left-color: var(--amber);
    background: var(--amber-l);
}
.batch-readiness.success {
    border-color: var(--green-b);
    border-left-color: var(--green);
    background: var(--green-l);
}
.batch-readiness.ready {
    border-color: var(--green-b);
    border-left-color: var(--green);
    background: var(--green-l);
}
.batch-readiness.warn {
    border-color: var(--amber-b);
    border-left-color: var(--amber);
    background: var(--amber-l);
}
.batch-readiness.blocked {
    border-color: var(--red-b);
    border-left-color: var(--red);
    background: var(--red-l);
}
.batch-readiness-head span,
.batch-readiness-section > span {
    display: block;
    color: #334155;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.batch-readiness-head strong {
    display: block;
    color: #0b1220;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}
.batch-readiness-head p {
    margin: 3px 0 0;
    color: #334155;
    font-size: 12px;
    line-height: 1.35;
}
.batch-readiness-section {
    display: grid;
    gap: 6px;
}
.batch-readiness-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    padding: 7px 9px;
    border-radius: 6px;
    border-left: 3px solid transparent;
    background: rgba(255, 255, 255, 0.72);
    font-size: 12px;
    line-height: 1.35;
}
.batch-readiness-row b {
    color: #334155;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}
.batch-readiness-row strong {
    color: #0b1220;
    font-weight: 600;
    word-break: break-word;
}
.batch-readiness-row.fact-neutral { border-left-color: #94a3b8; }
.batch-readiness-row.fact-action { border-left-color: var(--blue); }
.batch-readiness-row.fact-attention { border-left-color: var(--amber); }
.batch-readiness-row.fact-success { border-left-color: var(--green); }
.batch-readiness-row.fact-neutral strong { color: #475569; }
.batch-readiness-row.fact-action strong { color: var(--ice); }
.batch-readiness-row.fact-attention strong { color: var(--amber); }
.batch-readiness-row.fact-success strong { color: var(--green); }
.batch-workflow-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1.1fr) minmax(280px, 0.9fr);
    gap: 16px;
    margin: 16px 0;
    padding-top: 16px;
    border-top: 1px solid var(--bg3);
}
.batch-workflow-form,
.batch-workflow-side {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 14px;
}
.batch-workflow-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 10px;
}
.batch-workflow-form .form-group {
    margin-bottom: 12px;
}
.batch-workflow-form textarea {
    min-height: 70px;
}
.batch-warning-title {
    margin-top: 18px;
}
.batch-checklist-grid {
    display: grid;
    gap: 7px;
}
.batch-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
    color: var(--muted);
    font-size: 12px;
}
.batch-check-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--dim);
    flex-shrink: 0;
}
.batch-check-item.done {
    color: var(--text);
    font-weight: 600;
}
.batch-check-item.done .batch-check-dot {
    background: var(--green);
}
.batch-warning-list {
    display: grid;
    gap: 8px;
}
.batch-warning {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.35;
}
.batch-warning span {
    min-width: 38px;
    font-size: 10px;
    letter-spacing: 0;
    font-weight: 700;
}
.batch-warning strong {
    font-weight: 600;
}
.batch-warning.warn {
    border: 1px solid var(--amber-b);
    background: var(--amber-l);
    color: var(--amber);
}
.batch-warning.error {
    border: 1px solid var(--red-b);
    background: var(--red-l);
    color: var(--red);
}
.batch-empty-note {
    border: 1px solid var(--green-b);
    background: var(--green-l);
    color: var(--green);
    border-radius: 8px;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 600;
}

.batch-history-title {
    margin-top: 18px;
}
.batch-history-list {
    display: grid;
    gap: 10px;
}
.batch-history-item {
    display: grid;
    grid-template-columns: 11px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    color: var(--text);
}
.batch-history-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--blue);
    margin-top: 4px;
    box-shadow: 0 0 0 3px var(--blue-l);
}
.batch-history-item strong {
    display: block;
    color: #0b1220;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}
.batch-history-item p {
    margin: 3px 0;
    color: #334155;
    font-size: 11.5px;
    line-height: 1.35;
    word-break: break-word;
}
.batch-history-item em {
    display: block;
    color: #667482;
    font-size: 11px;
    font-style: normal;
    line-height: 1.3;
}
.batch-history-empty {
    border: 1px dashed var(--card-border);
    border-radius: 8px;
    padding: 9px 10px;
    color: #667482;
    font-size: 12px;
    font-weight: 600;
    background: #fafafa;
}
@media (max-width: 760px) {
    .batch-detail-head {
        display: block;
    }
    .batch-detail-head .batch-actions {
        margin-top: 12px;
    }
    .batch-toolbar input,
    .items-toolbar input {
        min-width: 100%;
    }
    .batch-workflow-grid,
    .batch-workflow-controls,
    .batch-lot-metrics,
    .batch-lot-current-metrics {
        grid-template-columns: 1fr;
    }
    .batch-lot-current-item {
        grid-template-columns: 48px minmax(0, 1fr);
    }
    .batch-lot-item-status,
    .batch-lot-item-attempts,
    .batch-lot-item-uid { grid-column: 2; }
    .batch-lot-head,
    .batch-lot-current,
    .batch-lot-create-row { display: block; }
    .batch-lot-head .batch-lot-state,
    .batch-lot-create-row .btn { margin-top: 9px; }
}

.data-intake-card { grid-column: 1 / -1; }
.brand-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.passport-mapping-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}
.passport-mapping-head .card-title { margin-bottom: 5px; }
.passport-mapping-head p {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    margin: 0;
    max-width: 900px;
}
.passport-mapping-counts {
    display: grid;
    grid-template-columns: repeat(3, minmax(54px, 1fr));
    gap: 5px;
    min-width: 260px;
}
.passport-mapping-counts span {
    border: 1px solid var(--card-border);
    border-radius: 6px;
    background: #fbfdfe;
    color: var(--muted);
    font-size: 10px;
    padding: 5px 6px;
    text-align: center;
}
.passport-mapping-counts strong {
    display: block;
    color: var(--text);
    font-size: 12px;
}
.intake-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.intake-metric {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fbfdfe;
    padding: 12px;
    min-width: 0;
}
.intake-metric span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.intake-metric strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.intake-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.intake-activity {
    border-top: 1px solid var(--bg3);
    padding-top: 12px;
    margin-bottom: 12px;
}
.intake-activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 9px;
}
.intake-activity-head span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .45px;
    text-transform: uppercase;
}
.intake-activity-list {
    display: grid;
    gap: 8px;
}
.intake-activity-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
}
.intake-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--blue);
    margin-top: 5px;
    box-shadow: 0 0 0 3px var(--blue-l);
}
.intake-activity-item strong {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
}
.intake-activity-item strong span {
    color: var(--muted);
    font-weight: 700;
}
.intake-activity-item p {
    margin: 3px 0;
    color: #334155;
    font-size: 11.5px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.intake-activity-item em,
.intake-activity-empty {
    color: #667482;
    font-size: 11px;
    font-style: normal;
    line-height: 1.3;
}
.intake-activity-empty {
    border: 1px dashed var(--card-border);
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
    font-weight: 700;
}
.data-health-card {
    margin-bottom: 16px;
}
.data-health-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 14px;
}
.data-health-head .card-title {
    margin-bottom: 5px;
}
.data-health-head p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}
.data-health-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}
.data-health-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--green);
    border-radius: 8px;
    background: #fbfdfe;
    padding: 10px 12px;
    margin-bottom: 12px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
}
.data-health-summary.is-issue {
    border-left-color: var(--amber);
    background: #fffaf2;
}
.data-health-pill {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid var(--green-b);
    background: var(--green-l);
    color: var(--green);
}
.data-health-pill.issue {
    border-color: var(--amber-b);
    background: var(--amber-l);
    color: var(--amber);
}
.data-health-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}
.data-health-metric {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg);
    padding: 11px 12px;
    min-width: 0;
}
.data-health-metric span {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 5px;
}
.data-health-metric strong {
    display: block;
    color: var(--text);
    font-size: 13px;
    overflow-wrap: anywhere;
}
.data-health-samples {
    border-top: 1px solid var(--bg3);
    padding-top: 12px;
}
.data-health-samples h4 {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.data-health-sample-list {
    display: grid;
    gap: 8px;
}
.data-health-sample-row {
    display: grid;
    grid-template-columns: 190px repeat(3, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: #fff;
    padding: 9px 10px;
    font-size: 12px;
}
.data-health-sample-row strong {
    color: var(--text);
    font-size: 12px;
}
.data-health-sample-row span {
    color: var(--muted);
    overflow-wrap: anywhere;
}
.data-health-empty {
    border: 1px dashed var(--card-border);
    border-radius: 8px;
    color: var(--muted);
    background: #fff;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
}
.import-intake-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}
.import-intake-strip div {
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg);
    padding: 9px 10px;
    min-width: 0;
}
.import-intake-strip span {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}
.import-intake-strip strong {
    display: block;
    color: var(--text);
    font-size: 12px;
    overflow-wrap: anywhere;
}
@media (max-width: 900px) {
    .brand-settings-grid { grid-template-columns: 1fr; }
    .intake-grid,
    .import-intake-strip,
    .data-health-grid,
    .data-health-sample-row { grid-template-columns: 1fr; }
    .data-health-head { display: block; }
    .data-health-actions { justify-content: flex-start; margin-top: 10px; }
    .passport-mapping-head { display: block; }
    .passport-mapping-head button { margin-top: 10px; }
    .passport-mapping-counts { min-width: 220px; }
}

/* Canonical Item CSV intake (V4.4.5 Slice 7A) */
.item-import-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(8, 27, 45, .64);
}
.item-import-dialog {
    width: min(1040px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 24px 70px rgba(0, 20, 40, .28);
}
.item-import-head,
.item-import-actions,
.item-import-file-row,
.item-import-selected {
    display: flex;
    align-items: center;
    gap: 10px;
}
.item-import-head {
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--card-border);
}
.item-import-head h2 { margin: 0 0 5px; font-size: 18px; }
.item-import-head p { margin: 0; color: var(--muted); font-size: 13px; }
.item-import-close {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
}
.item-import-step { padding: 18px 22px; border-bottom: 1px solid var(--card-border); }
.item-import-step h3 { margin: 0 0 9px; font-size: 14px; }
.item-import-file-row { flex-wrap: wrap; }
.item-import-file-row input[type="file"] { flex: 1 1 320px; min-width: 220px; }
.item-import-selected {
    justify-content: space-between;
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: 7px;
    background: var(--bg);
    font-size: 12px;
}
.item-import-empty { padding: 24px; text-align: center; color: var(--muted); }
.item-import-counts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}
.item-import-count {
    padding: 10px 12px;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    background: var(--bg);
}
.item-import-count span { display: block; color: var(--muted); font-size: 11px; }
.item-import-count strong { display: block; margin-top: 3px; font-size: 20px; }
.item-import-count.reject strong { color: var(--red); }
.item-import-atomic,
.item-import-errors {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid rgba(190, 95, 25, .35);
    border-radius: 8px;
    background: rgba(240, 145, 45, .10);
    color: var(--text);
}
.item-import-errors { padding-left: 30px; font-size: 12px; }
.item-import-table-wrap {
    margin-top: 12px;
    overflow: auto;
    border: 1px solid var(--card-border);
    border-radius: 8px;
}
.item-import-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    font-size: 12px;
}
.item-import-table th,
.item-import-table td {
    padding: 9px;
    border-bottom: 1px solid var(--card-border);
    text-align: left;
    vertical-align: top;
}
.item-import-table th { position: sticky; top: 0; background: var(--bg); z-index: 1; }
.item-import-action { font-weight: 700; }
.item-import-action.reject { color: var(--red); }
.item-import-actions {
    justify-content: flex-end;
    padding: 16px 22px 20px;
}
@media (max-width: 900px) {
    .item-import-overlay { align-items: stretch; padding: 10px; }
    .item-import-dialog { max-height: calc(100vh - 20px); }
    .item-import-head,
    .item-import-step,
    .item-import-actions { padding-left: 14px; padding-right: 14px; }
    .item-import-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .item-import-actions { flex-wrap: wrap; }
    .item-import-actions .btn { flex: 1 1 150px; }
}

/* V4.4.6 manual acceptance: readable controls without browser zoom. */
.mobile-nav-toggle { display: none; }
.operation-group th { background: #edf6fb; text-transform: none; }
.operation-timeline { margin-top: 8px; overflow-wrap: anywhere; }
.operation-timeline summary { cursor: pointer; }
.operation-timeline ol { padding-left: 20px; margin-top: 8px; }
body { font-size: 16px; line-height: 1.5; }
.main { min-width: 0; }
.sidebar { width: 248px; }
.nav-item { font-size: 16px; padding-top: 12px; padding-bottom: 12px; }
.sidebar :is(.tenant-context-label, .tenant-context-code, .session-email, .session-permissions, .session-role, .nav-section, .sidebar-footer, .lang-btn),
.sidebar-brand span, #tenant-name, #logout-link { font-size: 14px !important; line-height: 1.5; }
.topbar h1 { font-size: 20px; }
.main :is(p, small, label, th, td, summary), .modal-overlay :is(p, small, label, summary),
.item-muted, .card-title, .badge, .item-status, .batch-check-item, .batch-warning, .batch-warning strong,
.batch-readiness-row, .batch-readiness-row b, .batch-readiness-row strong, .batch-history-item,
.item-allocation-hint, .item-allocation-section-title, .item-allocation-product-option span,
.item-allocation-product-summary span, .item-allocation-safety-boundary, .stat-label,
.login-label, .login-hint { font-size: 14px; line-height: 1.5; }
.main :is(th, td) { padding: 12px; }
.btn, .btn-sm { min-height: 40px; font-size: 14px; padding: 9px 14px; line-height: 1.35; white-space: normal; }
input:not([type='checkbox']):not([type='radio']):not([type='color']):not([type='hidden']), select, textarea {
    font: inherit; font-size: 16px; min-width: 0; min-height: 42px;
    max-width: 100%; padding: 10px 12px; border: 1px solid var(--card-border); border-radius: 8px;
}
textarea { min-height: 100px; }
input[type='checkbox'], input[type='radio'] { width: 18px; height: 18px; flex: 0 0 auto; }
.modal { width: min(760px, calc(100vw - 32px)); max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); }
.modal h2 { font-size: 22px; line-height: 1.35; }
.modal-actions { flex-wrap: wrap; gap: 10px; }
.form-group { min-width: 0; }
.modal :is(input, select, textarea), .item-detail-modal :is(input, select, textarea) { font-size: 16px; }
.modal.item-allocation-modal { display: flex; flex-direction: column; overflow: hidden; }
.item-allocation-modal > h2, .item-allocation-modal > .item-allocation-hint { flex: 0 0 auto; }
.item-allocation-body { min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 8px; }
.item-allocation-modal > .modal-actions { position: static; flex: 0 0 auto; margin: 14px 0 0; padding: 14px 0 0; }
.modal-overlay .form-hint,
.item-allocation-modal :is(small, .item-allocation-section, .item-allocation-route-note, .item-allocation-route-warning, .item-allocation-effective-route, .item-allocation-preview, .item-allocation-sequence-preview, .item-allocation-factory-preview),
.item-allocation-product-option strong, .hosted-passport-presentation span, .hosted-passport-presentation .item-code { font-size: 14px; line-height: 1.5; }
.form-group label { display: block; margin-bottom: 7px; }
.form-group :is(input:not([type='checkbox']):not([type='radio']), select, textarea) { width: 100%; }
.table-wrapper { max-width: 100%; overflow-x: auto; }
.batch-workflow-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.batch-workflow-form, .batch-workflow-side { min-width: 0; }
.batch-actions { flex-wrap: wrap; }
.item-link, .loading, .batch-state-label, .batch-write-state, .batch-lot-state,
.batch-warning-pill, .batch-progress-text, .batch-metric-grid > div > span,
.batch-lot-error, .batch-readiness-head > span, .batch-warning > span,
.batch-history-item strong, .batch-history-item em, .batch-lot-preview-title,
.batch-lot-metrics span, .batch-lot-exclusions span { font-size: 14px; line-height: 1.5; }
#batches-pagination span { font-size: 14px !important; }
#page-batches .loading { font-size: 14px; }
#batch-detail-card td:first-child { font-size: 14px; }
.workflow-authority-note, .workflow-delivery-gate { margin: 14px 0; padding: 14px 16px; border: 1px solid var(--card-border); border-radius: 8px; background: #f4f8fc; overflow-wrap: anywhere; }
.workflow-delivery-gate summary { cursor: pointer; font-weight: 600; }
.workflow-delivery-gate p { margin-top: 10px; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #007bb5; outline-offset: 3px; }
@media (max-width: 1100px) {
    .batch-workflow-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 600px) {
    .modal { padding: 18px; }
    .item-allocation-grid, .batch-workflow-controls { grid-template-columns: 1fr; }
    .topbar { flex-wrap: wrap; gap: 10px; }
    .item-allocation-product-summary { flex-wrap: wrap; }
}
@media (max-width: 768px) {
    .mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .sidebar.mobile-open { display: flex; position: fixed; top: 72px; left: 0; bottom: 0; width: min(280px, 90vw); overflow-y: auto; z-index: 40; box-shadow: var(--shadow-md); }
}

/* V5.2 action and evidence states: appearance never grants permission. */
.btn:focus-visible, .btn-export:focus-visible { outline:3px solid #0078ac; outline-offset:3px; }
.btn:disabled, .btn-export:disabled { opacity:.55; cursor:not-allowed; box-shadow:none; }
.bg-complete-summary, .bg-locked-summary { padding:16px; border:1px solid #99cdb7; border-radius:10px; background:#eaf7ef; color:#175b40; line-height:1.6; overflow-wrap:anywhere; }
.bg-complete-summary strong, .bg-locked-summary strong { color:#124c35; }
.bg-stage-summary { padding:14px; border:1px solid var(--card-border); border-radius:10px; background:#f4f6f8; color:var(--text); line-height:1.6; }
#access-audit-controls { font-size:13px; }
#access-audit-scope-note { margin:8px 0; line-height:1.6; color:var(--muted); }
.login-hint, .notice, .field-error { overflow-wrap:anywhere; white-space:normal; }

.btn-primary { background:#0078a9; color:#fff; }
.btn-primary:hover:not(:disabled) { background:#00638e; }

.operation-current-error { color:#b42318; }

/* V6.0.1: one application scroll owner; preserve table/modal overflow. */
body:has(#app.active) { overflow: hidden; }
.app.active { height: 100dvh; min-height: 0; overflow: hidden; }
.app.active > .sidebar { max-height: 100dvh; overflow-y: auto; }
.app.active > .main { min-width: 0; min-height: 0; height: 100dvh; max-height: none; overflow-y: auto; overscroll-behavior-y: contain; }
[hidden] { display: none !important; }

#team-list-controls { margin-bottom: 12px; }
#team-list-controls input { max-width: 100%; }
.team-members-table { width: 100%; }
.team-members-table th,
.team-members-table td { text-align: start; vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.team-members-table td > small,
.team-protected { display: block; margin-top: 5px; }
.team-members-table td > .badge { margin-top: 4px; }
.team-protected { color: #8a4a04; }
.team-row-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; }
.team-row-actions summary { cursor: pointer; color: var(--primary, #0369a1); }
.team-member-details[open],
.team-more[open] { flex-basis: 100%; }
.team-member-details dl,
.team-more > div { display: grid; gap: 6px; margin: 6px 0 0; justify-items: start; }
.team-member-details dt { font-weight: 600; }
.team-member-details dd { margin: 0 0 4px; }
.team-more p { margin: 0; font-size: 12px; }
.team-mobile-label { display: none; }
@media (max-width: 680px) {
    .team-members-table,
    .team-members-table tbody,
    .team-members-table tr,
    .team-members-table td { display: block; }
    .team-members-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .team-members-table tr { border-bottom: 1px solid var(--border, #dce2e7); padding-block: 8px; }
    .team-members-table td { border: 0; padding: 5px 4px; }
    .team-mobile-label { display: block; color: var(--text-secondary, #64748b); font-size: 12px; font-weight: 600; }
}

.dashboard-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin-block: 10px 16px; }
.dashboard-metrics > div { display:grid; gap:6px; align-content:start; min-width:0; padding:14px; background:var(--bg-card,#fff); border:1px solid var(--border,#dce2e7); border-radius:10px; }
.dashboard-metrics strong { font-size:26px; line-height:1.2; }
.dashboard-metrics small { color:var(--text-secondary,#64748b); }
.dashboard-sections { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:12px; }
.dashboard-section { min-width:0; overflow-wrap:anywhere; }
.dashboard-section th,.dashboard-section td { white-space: normal; }
.dashboard-section h3,.dashboard-risk h3 { margin-bottom:8px; }
.dashboard-period { display:flex; flex-wrap:wrap; gap:8px; align-items:end; }
.dashboard-counts { display:flex; flex-wrap:wrap; gap:8px 16px; margin:10px 0; }
.dashboard-counts > div { display:flex; gap:6px; }
.dashboard-counts dd { font-weight:600; margin:0; }
.dashboard-trend { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px 12px; }
.dashboard-trend > div { display:grid; grid-template-columns:3em minmax(0,1fr) 2em; align-items:center; gap:5px; font-size:12px; }
.dashboard-trend progress { width:100%; height:10px; }
#insights-account-security[hidden], #insights-legacy-details[hidden] { display:none; }
#insights-account-security { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
#insights-account-security button { white-space:normal; }
html[data-dashboard-only] #tenant-code,
html[data-dashboard-only] #tenant-context-label,
html[data-dashboard-only] .sidebar-brand h2,
html[data-dashboard-only] #sidebar-version,
html[data-dashboard-only] #session-card,
html[data-dashboard-only] .dashboard-version,
html[data-dashboard-only] .company-time-zone,
html[data-dashboard-only] .nav-section,
html[data-dashboard-only] .nav-item:not([data-page="stats"]):not([data-page="tags"]) { display:none!important; }
html[data-dashboard-only]:not([data-dashboard-records]) .nav-item[data-page="tags"] { display:none!important; }
html[data-dashboard-only] #tenant-name { overflow-wrap:anywhere; }
@media (max-width: 1040px) { .dashboard-sections { grid-template-columns: minmax(0, 1fr); } }

.dashboard-password-dialog{margin:auto;width:min(480px,calc(100vw - 32px));padding:18px;border:1px solid var(--border,#dce2e7);border-radius:12px;max-height:85vh;overflow:auto}
.dashboard-password-dialog::backdrop{background:#15243c66}
.dashboard-password-dialog form,.dashboard-password-dialog label{display:grid;gap:10px}
.dashboard-password-dialog input{width:100%;padding:8px}

.table-detail-row[hidden] { display: none !important; }
.table-detail-row > td { background: var(--surface, #f7f9fb); }
.table-detail-row dl { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(0, 2fr); gap: .35rem 1rem; }
.table-detail-row dd { margin: 0; overflow-wrap: anywhere; }
.table-detail-button { margin-inline-end: .25rem; }
.cq-tag-identity { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; }
.cq-tag-identity code { min-width: 0; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.team-members-table .badge { white-space: nowrap; overflow-wrap: normal; }
#page-team .stat-grid .stat-card { padding-block: 12px; }
#access-user-role:disabled, #access-user-status:disabled { opacity: .68; cursor: not-allowed; }
#access-user-email, #access-user-name, #access-user-notes { background: var(--surface, #fff); }
#access-role-description { display: block; margin-block: .35rem; }
@media (max-width: 600px) {
    .table-detail-row dl { grid-template-columns: minmax(0, 1fr); }
}

.dashboard-section-wide { grid-column: 1 / -1; }
.dashboard-trend.dashboard-trend-bars { height: 154px; display: grid; grid-template-columns: repeat(var(--days), minmax(0, 1fr)); gap: 3px; padding: 0 10px 31px; }
.dashboard-trend.dashboard-trend-bars > div { display: flex; align-items: end; justify-content: center; position: relative; }
.dashboard-trend-bar { display: block; background: var(--accent, #0573a4); border-radius: 3px 3px 0 0; height: max(2px, var(--height)); width: min(75%, 24px); }
.dashboard-trend-tick { position: absolute; inset-block-start: 100%; display: grid; justify-items: center; gap: 1px; padding-block-start: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; line-height: 1.15; }


.dashboard-table-scroll { max-block-size: 13.5rem; overflow: auto; scroll-padding-block-start: 4.5rem; }
.dashboard-table-scroll th { position: sticky; inset-block-start: 0; z-index: 1; }
.dashboard-table-scroll td { vertical-align: top; }
.dashboard-table-scroll + .dashboard-scroll-hint { margin: 4px 0 0; text-align: end; font-size: .8rem; }
.dashboard-table-scroll td button { font: inherit; overflow-wrap: anywhere; }
@media (min-width: 1041px) { .dashboard-table-scroll th { white-space: nowrap; } }

.dashboard-recent-table td:first-child { white-space: nowrap; }
@media (max-width: 480px) {
    .dashboard-table-scroll :is(th,td) { padding-inline: 8px; }
    .dashboard-region-table th, html[lang="zh-CN"] .dashboard-table-scroll th { white-space: nowrap; }
}
.region-setup-link { font-size: .8rem; text-align: start; }
#data-health-refresh-btn[hidden] { display: none; }

.dashboard-recent-label { display: none; }

@media (max-width: 760px) {
    .dashboard-recent-table,
    .dashboard-recent-table tbody { display: block; min-width: 0; }
    .dashboard-recent-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .dashboard-recent-table tbody > tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .65rem .875rem;
        border-bottom: 1px solid var(--border, #dce2e7);
        padding: .7rem .35rem;
    }
    .dashboard-section-wide .dashboard-recent-table td {
        display: block;
        min-width: 0;
        border: 0;
        padding: 0;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }
    .dashboard-recent-table td[colspan] { grid-column: 1 / -1; }
    .dashboard-recent-label { display: block; margin-bottom: .2rem; color: var(--muted, #435d72); font-size: .75rem; }
}
