/* =========================================================================
   OrderFlow skin — shared light reskin for ALL portals
   -------------------------------------------------------------------------
   Applied to admin-new.html, factory-new.html, customers.html (and the
   generated Demo OMS copies). Loads AFTER oms-design-system.css so it
   wins the cascade. Light theme only. No JS/markup logic changes.

   Strategy:
     1. Re-point every design token (--sez-* + legacy --primary etc.) at the
        OrderFlow palette. Because almost every component references these
        vars, this recolors the whole app for free.
     2. Restyle only the components whose *structure* differs from the mono
        look: sidebar, primary buttons, badges, modal/panel headers, tabs.
     3. Kill the closed side-panel's shadow so it stops bleeding a gradient
        onto the page's right edge (long-standing artifact).
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ---------- 1. OrderFlow tokens (LIGHT) -------------------------------- */
:root {
    /* brand */
    --of-accent:      #3D4EE8;
    --of-accent-2:    #5A6BFF;
    --of-accent-grad: linear-gradient(135deg, #4A5BF0 0%, #3A3FD8 100%);
    --of-green:       #34C77B;
    --of-amber:       #F5A623;
    --of-red:         #FF5B6E;

    /* surfaces */
    --of-page-bg:     #EFF1F7;
    --of-app-bg:      #FFFFFF;
    --of-side-bg:     #FFFFFF;
    --of-card:        #FFFFFF;
    --of-card-inset:  #F6F7FB;
    --of-ink:         #2A2E45;
    --of-ink-2:       #4B4F6B;
    --of-muted:       #9CA0B8;
    --of-faint:       #C2C6D8;
    --of-line:        #EEF0F6;
    --of-line-strong: #E5E7F0;
    --of-chip:        #F1F2FB;
    --of-chip-ink:    #3D4EE8;
    --of-nav-hover:   #F5F6FC;
    --of-nav-active:  #F0F1FD;

    /* shadows */
    --of-shadow-card: 0 10px 30px -14px rgba(40, 50, 100, 0.16);
    --of-shadow-pop:  0 14px 36px -10px rgba(40, 50, 100, 0.22);
    --of-shadow-app:  0 30px 70px -30px rgba(40, 50, 100, 0.25);

    /* Signature container treatment — the login card's gradient outline + colored
       shadow (see .lp-wrap in login.css), shared by every card-family container.
       Change these two tokens to re-theme every container in all three portals. */
    --of-outline-grad: linear-gradient(148deg, rgba(90,107,255,.62) 0%, rgba(61,78,232,.28) 38%, rgba(61,78,232,.09) 72%, rgba(238,240,246,.7) 100%);
    --of-shadow-outline: 0 20px 60px -20px rgba(61,78,232,.22), 0 8px 24px -8px rgba(40,50,100,.16), 0 0 0 1px rgba(61,78,232,.05);

    /* Headings — deep navy with a clear blue cast (body text stays --of-ink). */
    --of-heading: #28306E;

    --of-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* ---- override the OMS design-system tokens ---- */
    --sez-text:              var(--of-ink);
    --sez-text-secondary:    var(--of-ink-2);
    --sez-text-muted:        var(--of-muted);
    --sez-bg:                var(--of-app-bg);
    --sez-bg-secondary:      var(--of-card-inset);
    --sez-bg-tertiary:       var(--of-nav-hover);
    --sez-border:            var(--of-line);
    --sez-border-strong:     var(--of-line-strong);

    --sez-dark-bg:           var(--of-side-bg);
    --sez-dark-bg-secondary: var(--of-chip);
    --sez-dark-text:         var(--of-ink);
    --sez-dark-text-muted:   var(--of-muted);
    --sez-dark-border:       var(--of-line);

    --sez-amber:    var(--of-amber);   --sez-amber-bg: rgba(245,166,35,.16);
    --sez-red:      var(--of-red);     --sez-red-bg:   rgba(255,91,110,.15);
    --sez-green:    var(--of-green);   --sez-green-bg: rgba(52,199,123,.16);
    --sez-blue:     var(--of-accent);  --sez-blue-bg:  rgba(61,78,232,.12);

    --sez-font-sans: var(--of-font);

    --sez-radius-sm:   10px;
    --sez-radius-md:   16px;
    --sez-radius-pill: 999px;

    --sez-shadow-xs:  0 1px 2px rgba(40,50,100,.05);
    --sez-shadow-sm:  0 4px 14px -8px rgba(40,50,100,.18);
    --sez-shadow-md:  var(--of-shadow-card);
    --sez-shadow-lg:  var(--of-shadow-pop);
    --sez-shadow-xl:  var(--of-shadow-app);

    /* ---- override the legacy variable map ---- */
    --primary:        var(--of-accent);
    --primary-dark:   #3A3FD8;
    --primary-light:  var(--of-accent-2);
    --secondary:      var(--of-ink-2);
    --bg:             var(--of-page-bg);
    --surface:        var(--of-card);
    --text:           var(--of-ink);
    --text-secondary: var(--of-ink-2);
    --text-muted:     var(--of-muted);
    --border:         var(--of-line);
    --shadow:         var(--of-shadow-card);
    --success:        var(--of-green);
    --warning:        var(--of-amber);
    --error:          var(--of-red);
    --info:           var(--of-accent);
}

/* ---------- 2. BASE ----------------------------------------------------- */
body {
    font-family: var(--of-font);
    background: var(--of-page-bg);
    color: var(--of-ink);
}
::selection { background: var(--of-accent); color: #fff; }
::-webkit-scrollbar-track { background: var(--of-page-bg); }
::-webkit-scrollbar-thumb { background: var(--of-faint); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--of-muted); }
:focus-visible { outline: 2px solid var(--of-accent); outline-offset: 2px; }
a { color: var(--of-accent); }

/* ---------- 3. SIDEBAR -------------------------------------------------- */
/* Same signature gradient as the drawers, painted into a 2px right edge. */
.sidebar {
    background:
        linear-gradient(var(--of-side-bg), var(--of-side-bg)) padding-box,
        var(--of-outline-grad) border-box;
    color: var(--of-ink);
    border: none;
    border-right: 2px solid transparent;
    padding-top: 4px;
}
.sidebar-header {
    border-bottom: 1px solid var(--of-line);
    padding: 22px 20px;
}
/* Company logo shows as-is on the light sidebar (any colour, transparent bg). */
.sidebar-logo img { max-height: 56px; width: auto; }
/* notification bell (inline color:white) */
.sidebar .sidebar-header button { color: var(--of-ink) !important; }

.nav-section-title { color: var(--of-faint); letter-spacing: .12em; }
.nav-item {
    color: var(--of-muted);
    border-left: none;
    margin: 1px 12px;
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
}
.nav-item svg { opacity: 1; }
.nav-item:hover { background: var(--of-nav-hover); color: var(--of-ink-2); }
.nav-item.active {
    background: var(--of-nav-active);
    color: var(--of-accent);
    border-left: none;
    font-weight: 700;
}
.nav-item.active::before {
    content: ""; position: absolute; left: -12px; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 22px; border-radius: 0 4px 4px 0;
    background: var(--of-accent);
}
.nav-badge { background: var(--of-red); }
.nav-badge.warning { background: var(--of-amber); }

.sidebar-footer { border-top: 1px solid var(--of-line); }
.user-avatar { background: var(--of-chip) !important; color: var(--of-accent) !important; border-radius: 13px; }
.sidebar .user-info > div > div { color: var(--of-ink) !important; }
.sidebar .user-info > div > div + div { color: var(--of-muted) !important; font-weight: 500; }

/* ---------- 4. PAGE HEADER / HEADINGS ----------------------------------- */
.main-content { background: transparent; }
.page-header { border-bottom: 1px solid var(--of-line); }
.page-title { font-size: 26px; letter-spacing: -0.02em; color: var(--of-heading); }
.page-subtitle { color: var(--of-muted); }
/* All heading-family text goes navy. Element selectors catch the untyped
   headings; the class list catches the ones oms-design-system/inline styles
   colored explicitly. */
h1, h2, h3, h4,
.card-title, .settings-card h3, .quick-action h4 { color: var(--of-heading); }

/* ---------- 5. BUTTONS -------------------------------------------------- */
.btn { border-radius: 12px; font-weight: 700; }
.btn-primary {
    background: var(--of-accent-grad);
    color: #fff; border-color: transparent;
    box-shadow: 0 10px 22px -10px rgba(61,78,232,.75);
}
.btn-primary:hover { filter: brightness(1.06); background: var(--of-accent-grad); color: #fff; border-color: transparent; }
.btn-outline {
    background: var(--of-card); color: var(--of-ink-2);
    border-color: var(--of-line-strong);
}
.btn-outline:hover { border-color: var(--of-accent); color: var(--of-accent); background: var(--of-card); }
.btn-secondary { background: var(--of-chip); color: var(--of-accent); border-color: transparent; }
.btn-secondary:hover { background: var(--of-accent); color: #fff; border-color: transparent; }
.btn-success { background: var(--of-green); border-color: var(--of-green); }
.btn-warning { background: var(--of-amber); border-color: var(--of-amber); }
.btn-danger  { background: var(--of-red);  border-color: var(--of-red); }
.btn-icon { border-radius: 12px; }

.action-btn { border-radius: 9px; border-color: var(--of-line-strong); }
.action-btn:hover { background: var(--of-accent); border-color: var(--of-accent); color: #fff; }
.action-btn.primary { background: var(--of-accent); border-color: var(--of-accent); }
.action-btn.success { background: var(--of-green); border-color: var(--of-green); }

/* ---------- 6. CARDS / STATS ------------------------------------------- */
/* Signature container skin: the login card's gradient outline + colored shadow
   (.lp-wrap in login.css), collapsed onto one element via the padding-box /
   border-box double-background trick so no wrapper div is needed. This rule
   loads LAST in every portal (after each page's inline <style> block and
   oms-design-system.css), so it — not the inline .card/.settings-card rules —
   is what actually paints. Edit the --of-outline-grad / --of-shadow-outline
   tokens in :root above to re-theme every container at once. */
.card, .table-container, .tabs, .filter-tabs, .quick-action, .stat-card, .settings-card {
    border-radius: 16px;
    border: 2px solid transparent;
    background:
        linear-gradient(var(--of-card), var(--of-card)) padding-box,
        var(--of-outline-grad) border-box;
    box-shadow: var(--of-shadow-outline);
}
/* Inset variant — same outline, muted fill. Used for cards nested inside another
   card (e.g. the per-vendor cards in Settings → Vendors). */
.settings-card.settings-card--inset {
    background:
        linear-gradient(var(--of-card-inset), var(--of-card-inset)) padding-box,
        var(--of-outline-grad) border-box;
}
.card-header { border-bottom: 1px solid var(--of-line); }
.stat-card { transition: transform .15s ease, box-shadow .15s ease; }
/* oms-design-system paints hover/active stat-cards with a near-black border
   (border-color: var(--sez-text)) and a flat fill that kills the gradient
   outline — re-assert the signature background and keep the states blue. */
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--of-shadow-pop);
    border-color: transparent;
    background:
        linear-gradient(var(--of-card), var(--of-card)) padding-box,
        var(--of-outline-grad) border-box;
}
.stat-card.active {
    box-shadow: var(--of-shadow-pop);
    border-color: var(--of-accent);
    background:
        linear-gradient(var(--of-card), var(--of-card)) padding-box,
        var(--of-outline-grad) border-box;
}
.stat-value { color: var(--of-accent); letter-spacing: -0.02em; }
.stat-label { color: var(--of-muted); }
.quick-action-icon { background: var(--of-accent-grad); color: #fff; border-radius: 12px; }
.quick-action:hover { box-shadow: var(--of-shadow-pop); transform: translateY(-2px); }

/* ---------- 7. TABLES --------------------------------------------------- */
th { background: var(--of-card-inset); color: var(--of-muted); border-bottom: 1px solid var(--of-line); letter-spacing: .07em; }
thead tr { border-bottom: 1px solid var(--of-line); }
td { border-bottom: 1px solid var(--of-line); color: var(--of-ink); }
tbody tr:hover { background: var(--of-nav-hover); }
.table-toolbar { border-bottom: 1px solid var(--of-line); }
.table-toolbar .search-input, .table-toolbar .filter-select { border-color: var(--of-line-strong) !important; border-radius: 10px; background: var(--of-card-inset); }

/* ---------- 8. BADGES / TAGS / PILLS ----------------------------------- */
.badge { border-radius: 8px; letter-spacing: .05em; padding: 3px 9px; }
/* Completed-family badges (Artwork Approved, Synced, Completed): solid light
   green fill + dark green text — a proper "done" chip, not the translucent
   accent-green the design system maps them to. */
.badge-active, .badge-synced, .badge-completed { background: #dcfce7; color: #166534; }
.tag { border-radius: 8px; }
.tag-factory { background: var(--of-accent); color: #fff; border-color: transparent; }
.tag-customer { background: var(--of-chip); color: var(--of-accent); border-color: transparent; }
.tab-count { background: var(--of-accent); color: #fff; }

/* ---------- 9. FORMS --------------------------------------------------- */
.form-input, .form-select, .edit-input, input, select, textarea { border-radius: 10px; }
.form-input:focus, .form-select:focus, .edit-input:focus,
input:focus, select:focus, textarea:focus {
    border-color: var(--of-accent) !important;
    box-shadow: 0 0 0 3px rgba(61,78,232,.15) !important;
}

/* ---------- 10. TABS --------------------------------------------------- */
.tab-btn.active, .filter-tab.active { color: var(--of-accent); background: var(--of-card); border-bottom-color: var(--of-accent); }
.modal-tab.active { color: var(--of-accent); border-bottom-color: var(--of-accent); }

/* ---------- 11. MODALS / SIDE PANELS ----------------------------------- */
/* Same signature outline as the card family (section 6). Modals keep the deep
   app shadow for lift off the overlay; the colored outline shadow stacks on top. */
.modal {
    border-radius: 16px;
    border: 2px solid transparent;
    background:
        linear-gradient(var(--of-card), var(--of-card)) padding-box,
        var(--of-outline-grad) border-box;
    box-shadow: var(--of-shadow-outline), var(--of-shadow-app);
}
.modal-header, .panel-header {
    background: var(--of-card);
    color: var(--of-ink);
    border-bottom: 1px solid var(--of-line);
}
.modal-title, .panel-title { color: var(--of-heading); }
/* modal-header/panel-header went from a dark-primary to a light card background
   above, but .panel-nav-pos (prev/next "1/1" indicator) still hardcodes a
   near-white text colour meant for a dark header — invisible on the light one. */
.panel-nav-pos { color: var(--of-ink-2); }
.modal-close, .panel-close {
    background: var(--of-chip);
    color: var(--of-ink-2);
    border: 1px solid var(--of-line-strong);
    border-radius: 10px;
}
.modal-close:hover, .panel-close:hover { background: var(--of-accent); color: #fff; border-color: transparent; }
.modal-footer, .panel-footer { background: var(--of-card-inset); border-top: 1px solid var(--of-line); }
.panel-section-title, .panel-section-header { border-bottom: 1px solid var(--of-line); color: var(--of-muted); }

/* Edge-attached sheets (detail side panel, message drawer): the signature
   gradient painted only into a 2px left border via the same padding-box /
   border-box trick — a full outline would fight the screen edge. */
.side-panel, .msg-drawer {
    border: none;
    border-left: 2px solid transparent;
    background:
        linear-gradient(var(--of-card), var(--of-card)) padding-box,
        var(--of-outline-grad) border-box;
}
/* The side panel sits off-screen to the right when closed. Its old shadow
   (-4px 0 20px / shadow-xl) bled a gradient strip onto the page's right edge
   on every screen. Show the shadow ONLY when the panel is open (same rule for
   the message drawer, which parks off-screen via translateX). */
.side-panel, .msg-drawer { box-shadow: none; }
.side-panel.open, .msg-drawer.open { box-shadow: var(--of-shadow-outline), var(--of-shadow-app); }

/* Dropdown / actions menus — hairline version of the outline (1px reads better
   at popover scale) with the pop shadow. */
.dropdown-menu {
    border-radius: 12px;
    border: 1px solid transparent;
    background:
        linear-gradient(var(--of-card), var(--of-card)) padding-box,
        var(--of-outline-grad) border-box;
    box-shadow: var(--of-shadow-pop);
}

/* ---------- 12. ALERTS / SYNC ------------------------------------------ */
.alert { border-radius: 12px; }
.sync-indicator { border-radius: 10px; background: var(--of-card-inset); border-color: var(--of-line); color: var(--of-muted); }
