/* =============================================================================
   F2 Memories — Asset Manager
   Standalone admin stylesheet. Independent of style.css.
   Visual direction: museum catalog software (parchment + navy + gold),
   not a SaaS dashboard.
   ============================================================================= */

:root {
    /* USMC palette (mirrored from style.css; admin.html does not load style.css) */
    --usmc-scarlet: #CE1126;
    --usmc-gold: #FFC72C;
    --usmc-navy: #003F87;

    /* Admin-specific */
    --parchment: #F5F0E8;
    --parchment-dark: #ECE5D7;
    --parchment-line: #D9D0BC;

    /* Status colors — muted, authoritative */
    --status-green: #2D7D46;
    --status-amber: #C8920A;
    --status-red: #B83232;

    /* Neutrals */
    --gray-50:  #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md:  0 4px 10px rgba(15, 23, 42, 0.08);
    --shadow-lg:  0 12px 28px rgba(15, 23, 42, 0.15);
    --shadow-panel: -10px 0 30px rgba(15, 23, 42, 0.12);

    /* Typography */
    --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Montserrat', var(--font-body);

    /* Layout */
    --sidebar-w: 240px;
    --panel-w: 420px;
    --t-fast: 150ms;
    --t-med: 250ms;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    /* min-height (not height:100%) so body grows to full content height. With height:100% body
       is capped at one viewport, which becomes the containing block for the shared sticky nav
       (.f2-header, a body child) — so it releases and scrolls away after ~1 viewport of scroll.
       Nothing here needs an exact-viewport body (shell/sidebar/overlays use 100vh/calc/fixed). */
    min-height: 100%;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--parchment);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================================================
   PASSWORD GATE
   ============================================================================= */

.password-overlay {
    position: fixed;
    inset: 0;
    background: var(--usmc-navy);
    background-image:
        linear-gradient(135deg, rgba(0, 63, 135, 0.95), rgba(0, 31, 67, 0.95)),
        radial-gradient(circle at 30% 20%, rgba(255, 199, 44, 0.1), transparent 40%);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.password-overlay.hidden { display: none; }

.password-modal {
    background: #fff;
    border: 3px solid var(--usmc-gold);
    border-radius: 12px;
    padding: 40px 36px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.password-logo {
    width: 130px;
    height: auto;
    margin-bottom: 16px;
}

.password-modal h2 {
    margin: 0 0 6px 0;
    font-family: var(--font-display);
    font-size: 1.4em;
    color: var(--usmc-navy);
    letter-spacing: 0.5px;
}

.password-modal p {
    margin: 0 0 24px 0;
    color: var(--gray-600);
    font-size: 0.95em;
}

#passwordForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#passwordInput {
    padding: 12px 14px;
    border: 2px solid var(--gray-300);
    border-radius: 6px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color var(--t-fast);
}

#passwordInput:focus {
    outline: none;
    border-color: var(--usmc-navy);
    box-shadow: 0 0 0 3px rgba(0, 63, 135, 0.15);
}

#passwordSubmit {
    padding: 12px 14px;
    background: var(--usmc-gold);
    color: var(--usmc-navy);
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: 1px;
    cursor: pointer;
    transition: background var(--t-fast);
}

#passwordSubmit:hover {
    background: #ffb700;
}

.password-error {
    margin: 0;
    color: var(--status-red);
    font-size: 0.9em;
    min-height: 1.2em;
}

/* =============================================================================
   ADMIN SHELL: sidebar + content + detail panel
   ============================================================================= */

.admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */

.sidebar {
    background: var(--usmc-navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    /* Sits below the shared site nav (.f2-header, 74px sticky top:0) so it doesn't tuck under it. */
    position: sticky;
    top: 74px;
    height: calc(100vh - 74px);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 14px 18px;
    border-bottom: 1px solid rgba(255, 199, 44, 0.18);
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 4px;
}

.sidebar-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.sidebar-subtitle {
    font-size: 0.72em;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    margin-top: 2px;
}

.sidebar-stats {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 199, 44, 0.18);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 0.85em;
}

.stat-label { color: rgba(255, 255, 255, 0.7); }

.stat-value {
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.stat-row-approved .stat-value { color: #7ce097; }
.stat-row-pending .stat-value  { color: var(--usmc-gold); }
.stat-row-rejected .stat-value { color: #ff9a8c; }

.sidebar-nav {
    flex: 1;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    appearance: none;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.78);
    text-align: left;
    padding: 9px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: var(--font-display);
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: background var(--t-fast), color var(--t-fast);
    width: 100%;
}

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

.nav-item.is-active {
    background: rgba(255, 199, 44, 0.12);
    color: var(--usmc-gold);
    border-left: 3px solid var(--usmc-gold);
    padding-left: 9px;
}

.nav-count {
    font-size: 0.78em;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.07);
    padding: 1px 7px;
    border-radius: 10px;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-body);
    font-weight: 500;
    letter-spacing: 0;
}

.nav-item.is-active .nav-count {
    color: var(--usmc-gold);
    background: rgba(255, 199, 44, 0.15);
}

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid rgba(255, 199, 44, 0.18);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 199, 44, 0.25);
    color: #fff;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast);
}

.sidebar-btn:hover {
    background: rgba(255, 199, 44, 0.15);
}

.sidebar-btn-icon { width: 14px; height: 14px; }

.sidebar-btn-as-label {
    user-select: none;
}

/* Connection status indicator */
.conn-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(255, 199, 44, 0.18);
    border-radius: 6px;
}
.conn-dot {
    flex: 0 0 9px;
    height: 9px;
    width: 9px;
    border-radius: 50%;
    background: var(--gray-400);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
}
.conn-status.conn-synced .conn-dot {
    background: #7ce097;
}
.conn-status.conn-offline .conn-dot {
    background: #ffbd5a;
}
.conn-status.conn-syncing .conn-dot {
    background: #a3d4ff;
    animation: conn-pulse 1s infinite ease-in-out;
}
@keyframes conn-pulse {
    0%   { transform: scale(0.9); opacity: 0.7; }
    50%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}
.conn-text {
    flex: 1;
    min-width: 0;
    line-height: 1.2;
}
.conn-label {
    font-size: 0.82em;
    font-weight: 600;
    color: #fff;
}
.conn-status.conn-synced  .conn-label { color: #7ce097; }
.conn-status.conn-offline .conn-label { color: #ffbd5a; }
.conn-status.conn-syncing .conn-label { color: #a3d4ff; }
.conn-sub {
    font-size: 0.72em;
    color: rgba(255, 255, 255, 0.55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conn-refresh {
    flex: 0 0 auto;
    background: none;
    border: 1px solid rgba(255, 199, 44, 0.25);
    color: #fff;
    border-radius: 5px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background var(--t-fast);
}
.conn-refresh:hover {
    background: rgba(255, 199, 44, 0.18);
}
.conn-refresh svg {
    width: 14px;
    height: 14px;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 360px;
}
.toast {
    background: var(--gray-800);
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    font-size: 0.85em;
    line-height: 1.4;
    animation: toast-in 200ms ease-out;
    pointer-events: auto;
    border-left: 3px solid var(--status-green);
}
.toast.toast-error {
    border-left-color: var(--status-red);
}
.toast.is-leaving {
    animation: toast-out 250ms ease-in forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(8px); }
}

/* =============================================================================
   CONTENT AREA
   ============================================================================= */

.content {
    background: var(--parchment);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    position: sticky;
    top: 74px;   /* below the shared site nav (74px) */
    background: var(--parchment);
    padding: 22px 28px 16px;
    border-bottom: 1px solid var(--parchment-line);
    z-index: 50;
    backdrop-filter: blur(4px);
}

.content-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

#categoryTitle {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.5em;
    font-weight: 700;
    color: var(--gray-900);
    letter-spacing: 0.3px;
}

.category-counts {
    font-size: 0.85em;
    color: var(--gray-600);
    font-variant-numeric: tabular-nums;
}

.category-counts .count-pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 10px;
    margin-left: 6px;
    font-weight: 600;
    font-size: 0.9em;
}

.count-pill.cp-approved { background: rgba(45, 125, 70, 0.13); color: var(--status-green); }
.count-pill.cp-pending  { background: rgba(200, 146, 10, 0.15); color: var(--status-amber); }
.count-pill.cp-rejected { background: rgba(184, 50, 50, 0.13); color: var(--status-red); }

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 460px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--gray-400);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 9px 12px 9px 36px;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9em;
    color: var(--gray-800);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

#searchInput:focus {
    outline: none;
    border-color: var(--usmc-navy);
    box-shadow: 0 0 0 3px rgba(0, 63, 135, 0.12);
}

.status-tabs {
    display: flex;
    gap: 2px;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    padding: 3px;
}

.status-tab {
    appearance: none;
    background: none;
    border: none;
    padding: 5px 11px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.82em;
    font-weight: 600;
    color: var(--gray-600);
    cursor: pointer;
    transition: background var(--t-fast), color var(--t-fast);
}

.status-tab:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.status-tab.is-active {
    background: var(--usmc-navy);
    color: #fff;
}

.status-tab-count {
    display: inline-block;
    min-width: 1.1em;
    padding: 0 5px;
    margin-left: 3px;
    border-radius: 999px;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
}
.status-tab.is-active .status-tab-count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.status-tab-count:empty { display: none; }

.bulk-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.bulk-btn {
    appearance: none;
    background: #fff;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.bulk-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.bulk-approve:hover {
    background: rgba(45, 125, 70, 0.08);
    color: var(--status-green);
    border-color: var(--status-green);
}

.bulk-icon { width: 14px; height: 14px; }

.keyboard-hint {
    margin-top: 10px;
    font-size: 0.76em;
    color: var(--gray-500);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.keyboard-hint kbd {
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 3px;
    padding: 1px 6px;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.88em;
    color: var(--gray-700);
    box-shadow: 0 1px 0 var(--gray-300);
}

/* =============================================================================
   GRID
   ============================================================================= */

.grid-area {
    padding: 22px 28px 60px;
    flex: 1;
}

.subcategory-section {
    margin-bottom: 28px;
}

.subcategory-section:last-child {
    margin-bottom: 0;
}

.subcategory-header {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--gray-700);
    margin: 4px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--parchment-line);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.subcategory-header.subcat-orphans {
    color: var(--gray-500);
    font-style: italic;
    border-bottom-style: dashed;
}

.subcategory-header-count {
    font-size: 0.82em;
    color: var(--gray-500);
    font-weight: 500;
}

.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.asset-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-left: 3px solid var(--gray-200);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform var(--t-fast), box-shadow var(--t-fast), border-color var(--t-fast);
    cursor: pointer;
    outline: none;
}

.asset-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.asset-card:focus-visible {
    box-shadow: var(--shadow-md), 0 0 0 3px rgba(0, 63, 135, 0.35);
}

.asset-card.status-approved {
    border-left-color: var(--status-green);
}

.asset-card.status-rejected {
    border-left-color: var(--status-red);
}

.asset-card.status-rejected .asset-image-wrap {
    opacity: 0.5;
}

.asset-card.status-rejected:hover .asset-image-wrap {
    opacity: 0.75;
}

.asset-image-wrap {
    position: relative;
    height: 140px;
    background-color: #fdfdfd;
    background-image:
        linear-gradient(45deg, var(--gray-100) 25%, transparent 25%),
        linear-gradient(-45deg, var(--gray-100) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--gray-100) 75%),
        linear-gradient(-45deg, transparent 75%, var(--gray-100) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity var(--t-fast);
    border-bottom: 1px solid var(--gray-100);
}

.asset-image {
    max-width: 88%;
    max-height: 88%;
    object-fit: contain;
}

.format-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(15, 23, 42, 0.7);
    color: #fff;
    font-size: 0.66em;
    font-weight: 700;
    letter-spacing: 0.6px;
    padding: 2px 6px;
    border-radius: 3px;
}

.status-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.status-badge.status-approved { background: var(--status-green); }
.status-badge.status-pending  { background: var(--status-amber); }
.status-badge.status-rejected { background: var(--status-red); }

.edited-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--usmc-navy);
    color: var(--usmc-gold);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.edited-badge .action-icon { width: 12px; height: 12px; }

.asset-info {
    padding: 10px 12px 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.asset-name {
    font-weight: 600;
    font-size: 0.86em;
    color: var(--gray-900);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.asset-meta {
    font-size: 0.75em;
    color: var(--gray-600);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asset-actions {
    display: flex;
    gap: 4px;
    padding: 8px 8px 10px 8px;
    border-top: 1px solid var(--gray-100);
    background: var(--gray-50);
}

.action-btn {
    appearance: none;
    flex: 1;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    padding: 6px 4px;
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.action-btn:hover { transform: translateY(-1px); }

.action-btn.action-approve:hover {
    background: rgba(45, 125, 70, 0.1);
    border-color: var(--status-green);
    color: var(--status-green);
}

.action-btn.action-reject:hover {
    background: rgba(184, 50, 50, 0.1);
    border-color: var(--status-red);
    color: var(--status-red);
}

.action-btn.action-reset:hover {
    background: rgba(200, 146, 10, 0.12);
    border-color: var(--status-amber);
    color: var(--status-amber);
}

.action-btn.is-active.action-approve {
    background: var(--status-green);
    color: #fff;
    border-color: var(--status-green);
}

.action-btn.is-active.action-reject {
    background: var(--status-red);
    color: #fff;
    border-color: var(--status-red);
}

.action-icon { width: 14px; height: 14px; }

/* Card grid: icon-only action buttons (labels live in the detail panel) —
   keeps all 3–4 actions fitting in a ~180px card. */
.asset-actions .action-btn { padding: 7px 4px; }
.asset-actions .action-icon { width: 16px; height: 16px; }

.note-input-row {
    padding: 0 8px 10px;
    background: var(--gray-50);
}

.note-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.78em;
    color: var(--gray-800);
    background: #fff;
}

.note-input:focus {
    outline: none;
    border-color: var(--status-red);
    box-shadow: 0 0 0 2px rgba(184, 50, 50, 0.1);
}

/* Empty state */
.grid-empty {
    text-align: center;
    color: var(--gray-500);
    padding: 80px 20px;
}

.empty-icon { width: 48px; height: 48px; color: var(--gray-400); margin: 0 auto 12px; }

/* =============================================================================
   DETAIL PANEL
   ============================================================================= */

.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--panel-w);
    max-width: 100vw;
    background: #fff;
    border-left: 1px solid var(--gray-200);
    box-shadow: var(--shadow-panel);
    transform: translateX(100%);
    transition: transform var(--t-med) ease;
    z-index: 200;
    display: flex;
    flex-direction: column;
}

.detail-panel.is-open {
    transform: translateX(0);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.detail-close {
    appearance: none;
    background: none;
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--t-fast);
}

.detail-close:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.detail-close svg { width: 16px; height: 16px; }

#detailTitle {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1em;
    font-weight: 600;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-image-wrap {
    background-color: #fdfdfd;
    background-image:
        linear-gradient(45deg, var(--gray-100) 25%, transparent 25%),
        linear-gradient(-45deg, var(--gray-100) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--gray-100) 75%),
        linear-gradient(-45deg, transparent 75%, var(--gray-100) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    min-height: 240px;
    max-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.detail-image-wrap img {
    max-width: 100%;
    max-height: 336px;
    object-fit: contain;
}

.detail-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px 14px;
}

.detail-section-label {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.72em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.metadata-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metadata-row {
    display: flex;
    gap: 8px;
    font-size: 0.85em;
    align-items: baseline;
    border-bottom: 1px dotted var(--gray-200);
    padding-bottom: 5px;
}

.metadata-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.metadata-key {
    flex: 0 0 110px;
    color: var(--gray-500);
    font-weight: 500;
    font-size: 0.92em;
    text-transform: capitalize;
}

.metadata-val {
    flex: 1;
    color: var(--gray-800);
    word-break: break-word;
}

.detail-status-row {
    display: flex;
    gap: 6px;
}

.detail-status-row .action-btn {
    flex: 1;
}

.detail-note {
    margin-top: 8px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 8px;
}

.detail-note-input {
    width: 100%;
    min-height: 60px;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.82em;
    color: var(--gray-800);
    resize: vertical;
}

.detail-note-input:focus {
    outline: none;
    border-color: var(--status-red);
    box-shadow: 0 0 0 2px rgba(184, 50, 50, 0.1);
}

.detail-path {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.78em;
    color: var(--gray-700);
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    padding: 6px 8px;
    word-break: break-all;
}

/* ----- Detail-panel edit section (rename / reassign / variant group) ----- */
.detail-edit {
    border-color: var(--usmc-navy);
    background: #fff;
    box-shadow: inset 3px 0 0 var(--usmc-navy);
}

.detail-edit .detail-section-label {
    color: var(--usmc-navy);
    display: flex;
    align-items: center;
    gap: 8px;
}

.edit-badge {
    font-family: var(--font-body);
    font-size: 0.92em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--status-amber);
    background: rgba(200, 146, 10, 0.12);
    border: 1px solid rgba(200, 146, 10, 0.35);
    border-radius: 999px;
    padding: 1px 8px;
    font-weight: 600;
}

.edit-field {
    display: block;
    margin-bottom: 12px;
}
.edit-field:last-child { margin-bottom: 0; }

.edit-field-label {
    display: block;
    font-size: 0.74em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.edit-input-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
}

.edit-input {
    flex: 1;
    width: 100%;
    padding: 7px 9px;
    border: 1px solid var(--gray-300);
    border-radius: 5px;
    font-family: inherit;
    font-size: 0.88em;
    color: var(--gray-800);
    background: #fff;
}

.edit-input:focus {
    outline: none;
    border-color: var(--usmc-navy);
    box-shadow: 0 0 0 2px rgba(0, 63, 135, 0.12);
}

.edit-revert-btn,
.edit-suggest-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0 10px;
    border: 1px solid var(--gray-300);
    border-radius: 5px;
    background: var(--gray-50);
    color: var(--gray-600);
    font-family: var(--font-body);
    font-size: 0.78em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
}

.edit-suggest-btn { text-transform: uppercase; letter-spacing: 0.5px; }

.edit-revert-btn:hover:not(:disabled),
.edit-suggest-btn:hover {
    border-color: var(--usmc-navy);
    color: var(--usmc-navy);
    background: rgba(0, 63, 135, 0.06);
}

.edit-revert-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.edit-revert-btn .action-icon {
    width: 14px;
    height: 14px;
}

.edit-file {
    flex: 1;
    min-width: 0;
    font-family: var(--font-body);
    font-size: 0.78em;
    color: var(--gray-600);
}
.edit-file::file-selector-button {
    margin-right: 8px;
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 5px;
    background: var(--gray-50);
    color: var(--usmc-navy);
    font-family: var(--font-body);
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
}
.edit-file::file-selector-button:hover {
    border-color: var(--usmc-navy);
    background: rgba(0, 63, 135, 0.06);
}

.edit-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.76em;
    color: var(--gray-500);
}

.edit-hint code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.95em;
    color: var(--usmc-navy);
    background: rgba(0, 63, 135, 0.07);
    border-radius: 3px;
    padding: 0 4px;
}

.detail-dim-row {
    display: flex;
    gap: 12px;
    font-size: 0.82em;
    color: var(--gray-600);
}

.detail-dim-row span strong {
    color: var(--gray-900);
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 960px) {
    .admin-shell {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }
    .sidebar-brand { flex: 1 1 100%; }
    .sidebar-stats, .sidebar-nav, .sidebar-footer { flex: 1 1 200px; }
    .detail-panel { width: 100vw; }
    .content-header { padding: 16px; }
    .grid-area { padding: 16px; }
}

/* ============================================================================
   Coverage view — logo coverage dashboard. Reuses the admin palette + tokens.
   ============================================================================ */

/* Sidebar: group label + Coverage nav item */
.nav-group-label {
    margin: 16px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}
.nav-item-coverage .nav-coverage-icon {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 6px;
}
.nav-item-coverage span:first-child { display: inline-flex; align-items: center; }

.coverage-area {
    flex: 1;
    padding: 0 0 60px;
}
.cov-empty { padding: 40px 28px; color: var(--gray-500); }

/* Header + summary stats */
.cov-header {
    position: sticky;
    top: 0;
    background: var(--parchment);
    padding: 22px 28px 18px;
    border-bottom: 1px solid var(--parchment-line);
    z-index: 40;
}
.cov-header h1 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}
.cov-coverage-pct {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    color: var(--usmc-navy);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 4px 12px;
    border-radius: 10px;
}
.cov-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
}
.cov-stat {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-top: 3px solid var(--gray-300);
    border-radius: 8px;
    padding: 12px 18px;
    min-width: 104px;
    box-shadow: var(--shadow-sm);
}
.cov-stat-val { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1.1; }
.cov-stat-label { font-size: 11px; color: var(--gray-500); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.04em; }
.cov-s-matched   { border-top-color: var(--usmc-navy); }
.cov-s-approved  { border-top-color: var(--status-green); }
.cov-s-pending   { border-top-color: var(--status-amber); }
.cov-s-secondpass{ border-top-color: var(--usmc-gold); }
.cov-s-nomatch   { border-top-color: var(--status-red); }
.cov-secondpass-progress {
    margin-top: 12px;
    font-size: 13px;
    color: var(--gray-600);
}
.cov-secondpass-progress strong { color: var(--gray-900); font-weight: 600; }

/* Per-category breakdown */
.cov-breakdown { padding: 22px 28px 8px; }
.cov-section-title {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-600);
    margin: 0 0 14px;
}
.cov-cat-row { display: grid; grid-template-columns: 180px 1fr 72px; align-items: center; gap: 14px; margin-bottom: 9px; }
.cov-cat-name { font-size: 13px; color: var(--gray-700); }
.cov-cat-bar { height: 10px; background: var(--gray-200); border-radius: 6px; overflow: hidden; }
.cov-cat-fill { height: 100%; background: linear-gradient(90deg, var(--usmc-navy), #2a63b0); border-radius: 6px; }
.cov-cat-num { font-size: 13px; font-weight: 600; color: var(--gray-800); text-align: right; }
.cov-cat-num span { color: var(--gray-400); font-weight: 400; }

/* Unit list */
.cov-list-section { padding: 22px 28px; }
.cov-list-controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.cov-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cov-search, .cov-select {
    font-family: var(--font-body);
    font-size: 13px;
    padding: 7px 11px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: #fff;
    color: var(--gray-800);
}
.cov-search { min-width: 200px; }
.cov-search:focus, .cov-select:focus { outline: none; border-color: var(--usmc-navy); box-shadow: 0 0 0 3px rgba(0, 63, 135, 0.12); }
.cov-export-btn {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600;
    padding: 7px 12px;
    border: 1px solid var(--gray-300); border-radius: 6px;
    background: #fff; color: var(--gray-700); cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
}
.cov-export-btn:hover { background: var(--gray-50); border-color: var(--gray-400); }
.cov-export-btn i { width: 13px; height: 13px; }

.cov-list-meta { font-size: 12px; color: var(--gray-500); margin-bottom: 8px; }
.cov-list-more { font-size: 12px; color: var(--gray-500); padding: 12px 4px; font-style: italic; }
.cov-row {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: #fff;
    margin-bottom: 6px;
    box-shadow: var(--shadow-sm);
}
.cov-row.is-open { border-color: var(--gray-300); }
.cov-row-main { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
.cov-row-toggle {
    appearance: none; border: none; background: none; cursor: pointer;
    color: var(--gray-400); padding: 2px; display: inline-flex; flex: 0 0 auto;
    transition: transform var(--t-fast), color var(--t-fast);
}
.cov-row-toggle i { width: 15px; height: 15px; }
.cov-row.is-open .cov-row-toggle { transform: rotate(90deg); color: var(--usmc-navy); }
.cov-row-name { font-size: 13px; font-weight: 600; color: var(--gray-800); flex: 1 1 auto; }
.cov-row-cat { font-size: 11px; color: var(--gray-500); flex: 0 0 auto; }
.cov-sub { font-size: 11px; color: var(--gray-500); font-style: italic; }
.cov-rename { font-size: 11px; color: var(--usmc-navy); font-style: italic; }
.cov-badge {
    font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 10px; flex: 0 0 auto;
    border: 1px solid transparent;
}
.cov-approved   { color: var(--status-green); background: rgba(45, 125, 70, 0.10); border-color: rgba(45, 125, 70, 0.25); }
.cov-pending    { color: var(--status-amber); background: rgba(200, 146, 10, 0.10); border-color: rgba(200, 146, 10, 0.25); }
.cov-secondpass { color: var(--usmc-navy); background: rgba(0, 63, 135, 0.08); border-color: rgba(0, 63, 135, 0.30); }
.cov-rejected   { color: var(--status-red); background: rgba(184, 50, 50, 0.10); border-color: rgba(184, 50, 50, 0.25); }
.cov-nomatch    { color: var(--gray-600); background: var(--gray-100); border-color: var(--gray-300); }
.cov-row-detail { padding: 4px 12px 12px 36px; border-top: 1px solid var(--gray-100); }
.cov-detail-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); margin: 8px 0 4px; }
.cov-queries { margin: 0; padding-left: 18px; }
.cov-queries li { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--gray-700); line-height: 1.6; }

/* ============================================================================
   Duplicate status — reviewer-flagged duplicate entities (kept in the DB).
   Distinct violet, so it reads apart from approved/pending/rejected.
   ============================================================================ */
:root { --status-violet: #6D5BD0; }

/* Sidebar rollup */
.stat-row-duplicate .stat-value { color: #b9aef0; }

/* Category count pill */
.count-pill.cp-duplicate { background: rgba(109, 91, 208, 0.13); color: var(--status-violet); }

/* Card + badge */
.asset-card.status-duplicate { border-left-color: var(--status-violet); }
.asset-card.status-duplicate .asset-image-wrap { opacity: 0.6; }
.asset-card.status-duplicate:hover .asset-image-wrap { opacity: 0.8; }
.status-badge.status-duplicate { background: var(--status-violet); }

/* Action button */
.action-btn.action-duplicate:hover {
    background: rgba(109, 91, 208, 0.12);
    border-color: var(--status-violet);
    color: var(--status-violet);
}
.action-btn.is-active.action-duplicate {
    background: var(--status-violet);
    color: #fff;
    border-color: var(--status-violet);
}

/* Coverage view badge */
.cov-duplicate { color: var(--status-violet); background: rgba(109, 91, 208, 0.10); border-color: rgba(109, 91, 208, 0.28); }

/* ============================================================================
   PRINT QUALITY (resolution audit) view — reuses the cov-* tokens, adds the
   audit-run row, progress bar, and the worst-first logo grid rows.
   ============================================================================ */
.nav-item-resolution .nav-coverage-icon { width: 15px; height: 15px; margin-right: 7px; }
.nav-item-resolution span:first-child { display: inline-flex; align-items: center; }

.rez-audit-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 14px; font-size: 13px; color: var(--gray-600);
}
.rez-updated { flex: 1 1 320px; min-width: 240px; }
.rez-updated strong { color: var(--gray-900); font-weight: 600; }
.rez-run-btn { white-space: nowrap; }
.rez-run-btn[disabled] { opacity: 0.6; cursor: progress; }
.rez-progress {
    flex: 1 1 180px; height: 8px; min-width: 140px;
    background: var(--gray-200); border-radius: 999px; overflow: hidden;
}
.rez-progress-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--usmc-navy), #2f6fd0);
    border-radius: 999px; transition: width 0.2s ease;
}
.rez-progress-text { font-variant-numeric: tabular-nums; color: var(--gray-500); min-width: 64px; }

/* Worst-first logo rows: aligned columns (Brian's pixel-alignment rule). */
.rez-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 56px 78px 96px 84px 90px 104px;
    align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--gray-200); border-left: 3px solid var(--gray-300);
    border-radius: 8px; padding: 9px 12px; margin-bottom: 6px;
    box-shadow: var(--shadow-sm); font-size: 13px;
}
.rez-row.is-fail { border-left-color: var(--status-red); }
.rez-row.is-err  { border-left-color: var(--status-red); background: rgba(184, 50, 50, 0.04); }
.rez-row.is-pass { border-left-color: var(--status-green); }
.rez-name { font-weight: 600; color: var(--gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rez-fmt  { font-size: 11px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.03em; }
.rez-grp  { font-size: 11px; color: var(--gray-500); }
.rez-px, .rez-ppi, .rez-deficit { font-variant-numeric: tabular-nums; color: var(--gray-700); text-align: right; }
.rez-deficit { font-weight: 600; color: var(--status-red); }
.rez-row.is-pass .rez-deficit, .rez-row.is-err .rez-deficit { color: var(--gray-400); font-weight: 400; }
.rez-row .cov-badge { justify-self: end; }

/* Clickable logo rows — open the full-resolution lightbox for print-quality review. */
.rez-row.is-clickable { cursor: pointer; transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.06s ease; }
.rez-row.is-clickable:hover { border-color: var(--usmc-navy); box-shadow: var(--shadow-md); }
.rez-row.is-clickable:active { transform: translateY(1px); }
.rez-row.is-clickable:focus-visible { outline: 2px solid var(--usmc-navy); outline-offset: 2px; }
.rez-row.is-clickable .rez-name::before {
    content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 7px; vertical-align: -2px;
    background: currentColor; opacity: 0.35; flex: none;
    -webkit-mask: no-repeat center / contain; mask: no-repeat center / contain;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/%3E%3C/svg%3E");
}
.rez-row.is-clickable:hover .rez-name::before { opacity: 0.7; }

/* ---- Full-resolution logo lightbox ---- */
.logo-lightbox {
    position: fixed; inset: 0; z-index: 11000;
    display: flex; align-items: center; justify-content: center; padding: 32px;
    background: rgba(0, 30, 66, 0.55); backdrop-filter: blur(4px);
    animation: logoLbIn 0.14s ease;
}
.logo-lightbox[hidden] { display: none; }
@keyframes logoLbIn { from { opacity: 0; } to { opacity: 1; } }
.logo-lightbox-card {
    display: flex; flex-direction: column; overflow: hidden;
    background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg);
    max-width: min(880px, 92vw); max-height: 90vh;
}
.logo-lightbox-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 20px; background: var(--usmc-navy); color: #fff; flex: none;
}
.logo-lightbox-title {
    font-family: var(--font-display); font-weight: 700; font-size: 14px; letter-spacing: 0.01em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.logo-lightbox-close {
    flex: none; width: 30px; height: 30px; border: 0; border-radius: 8px; cursor: pointer;
    background: rgba(255, 255, 255, 0.14); color: var(--usmc-gold);
    font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center;
    transition: background 0.12s ease;
}
.logo-lightbox-close:hover { background: rgba(255, 199, 44, 0.22); }
.logo-lightbox-stage {
    flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
    padding: 28px; overflow: auto;
    /* checkerboard reveals transparency + edges for print-quality judgement */
    background-color: #F4F4F3;
    background-image:
        linear-gradient(45deg, #dfdcd4 25%, transparent 25%),
        linear-gradient(-45deg, #dfdcd4 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #dfdcd4 75%),
        linear-gradient(-45deg, transparent 75%, #dfdcd4 75%);
    background-size: 22px 22px;
    background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}
.logo-lightbox-stage img {
    display: block; max-width: 100%; max-height: 62vh; object-fit: contain;
    background: transparent; box-shadow: 0 2px 14px rgba(15, 23, 42, 0.18);
}
.logo-lightbox-meta {
    flex: none; display: flex; flex-wrap: wrap; gap: 8px 10px;
    padding: 14px 20px; border-top: 1px solid var(--gray-200); background: #fff;
}
.logo-lightbox-chip {
    font-size: 12px; color: var(--gray-700); background: var(--gray-100);
    border: 1px solid var(--gray-200); border-radius: 999px; padding: 4px 11px;
    font-variant-numeric: tabular-nums;
}
.logo-lightbox-chip em { font-style: normal; color: var(--gray-500); margin-right: 6px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; }
