/* =========================================================================
   OMS redesign — theme layer (phase 1: the shared look)
   -------------------------------------------------------------------------
   Linked on all three portals immediately BEFORE oms-mobile.css, so it beats
   every head stylesheet and admin's tail <style> block, while the mobile layer
   still has the last word. Delete that one <link> per portal to revert.

   Design reference: the "OMS Redesign" Claude Design canvas.
   Rules:
     - Re-point tokens first; restyle components second.
     - The signature gradient outline is retired: containers are flat cards with
       a 1px hairline. Any rule below that sets `background` on a card-family
       element sets it FLAT on purpose (orderflow-design.css used a double
       background to paint the gradient border).
     - The sidebar is navy. Inside it the ink tokens are re-scoped to light
       values, which also defeats orderflow's `!important` sidebar colour rules
       without adding new !important.
     - No remote assets. Plus Jakarta Sans is self-hosted in /fonts.css.
   ========================================================================= */

/* ---------- 1. Tokens -------------------------------------------------- */
:root {
    --of-accent:      #3D4EE8;
    --of-accent-2:    #5A6BFF;
    --of-accent-grad: #3D4EE8;             /* flat: primary buttons are solid now */
    --of-green:       #157A4A;             /* darker so white labels pass contrast */
    --of-amber:       #B26A00;
    --of-red:         #C0283A;

    --of-page-bg:     #F3F4F8;
    --of-app-bg:      #FFFFFF;
    --of-side-bg:     #202944;
    --of-card:        #FFFFFF;
    --of-card-inset:  #F7F8FB;
    --of-ink:         #1F2340;
    --of-ink-2:       #454A68;
    --of-muted:       #62678A;             /* was #9CA0B8 — 2.6:1, now ~5:1 */
    --of-faint:       #B4B8CC;
    --of-line:        #E4E7EF;
    --of-line-strong: #D3D7E4;
    --of-chip:        #ECEEFD;
    --of-chip-ink:    #2A37B8;
    --of-nav-hover:   #F5F6FA;
    --of-nav-active:  #ECEEFD;
    --of-heading:     #1F2340;

    --of-shadow-card: 0 1px 2px rgba(20,24,60,.05);
    --of-shadow-pop:  0 18px 44px -12px rgba(27,32,82,.30);
    --of-shadow-app:  0 30px 80px -20px rgba(20,24,45,.45);
    --of-outline-grad: linear-gradient(var(--of-line), var(--of-line));   /* kept defined for pages still on the old look */
    --of-shadow-outline: 0 1px 2px rgba(20,24,60,.05);

    --rd-radius-card: 12px;
    --rd-radius-ctl:  9px;
    --rd-ok-soft:     #E3F5EC;
    --rd-warn-soft:   #FFF1D6;
    --rd-bad-soft:    #FDE7EA;
}

/* ---------- 2. Base ---------------------------------------------------- */
body { background: var(--of-page-bg); color: var(--of-ink); }
h1, h2, h3, h4, .card-title, .settings-card h3, .quick-action h4 { color: var(--of-heading); }
a { color: var(--of-accent); }
:focus-visible { outline: 2px solid var(--of-accent); outline-offset: 2px; }

/* ---------- 3. Sidebar (navy) ----------------------------------------- */
.sidebar {
    --of-ink: #FFFFFF;
    --of-ink-2: #CBD1DE;
    --of-muted: #CBD1DE;
    --of-faint: rgba(205,209,242,.6);
    --of-line: rgba(255,255,255,.10);
    --of-chip: #3A418A;
    --of-accent: #FFFFFF;
    background: var(--of-side-bg);
    border: 0;
    color: #CBD1DE;
}
.sidebar-header { border-bottom: 1px solid rgba(255,255,255,.10); }
/* Top-left logo sits straight on the sidebar: no tile behind it (owner, 24-10-2026). */
.sidebar-logo img { background: none; border-radius: 0; padding: 0; }
.nav-section-title { color: rgba(205,209,242,.6); letter-spacing: .12em; }
.nav-item {
    color: #CBD1DE;
    margin: 1px 12px;
    padding: 8px 12px;
    border-radius: var(--rd-radius-ctl);
    font-weight: 600;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #FFFFFF; }
.nav-item.active {
    background: #36415B;
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: inset 3px 0 0 #8C97FF;
}
.nav-item.active::before { display: none; }
.nav-badge { background: #FF8A97; color: #202944; }
.nav-badge.warning { background: #F5C451; color: #202944; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.10); }
.user-avatar { border-radius: 50%; }

/* ---------- 4. Page header -------------------------------------------- */
.page-header { border-bottom: 0; padding-bottom: 0; margin-bottom: 20px; }
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--of-ink); }
.page-subtitle { color: var(--of-muted); font-size: 13.5px; }

/* ---------- 5. Buttons ------------------------------------------------ */
.btn { border-radius: var(--rd-radius-ctl); font-weight: 700; font-size: 13.5px; padding: 8px 14px; }
.btn-primary { background: var(--of-accent); border-color: var(--of-accent); color: #FFFFFF; box-shadow: none; }
.btn-primary:hover { background: #2F3FD0; border-color: #2F3FD0; color: #FFFFFF; filter: none; }
.btn-secondary { background: var(--of-chip); color: var(--of-chip-ink); border-color: transparent; }
.btn-secondary:hover { background: #DCE0FB; color: var(--of-chip-ink); }
.btn-outline { background: #FFFFFF; color: var(--of-ink); border-color: var(--of-line-strong); }
.btn-outline:hover { background: var(--of-nav-hover); border-color: var(--of-line-strong); color: var(--of-ink); }
.btn-success { background: var(--of-green); border-color: var(--of-green); color: #FFFFFF; }
.btn-warning { background: #F5C451; border-color: #F5C451; color: #3D2A00; }
.btn-danger  { background: #FFFFFF; border-color: #F0BCC4; color: var(--of-red); }
.btn-danger:hover { background: var(--rd-bad-soft); }
.btn-icon { border-radius: var(--rd-radius-ctl); }
.action-btn { border-radius: 8px; border-color: var(--of-line-strong); background: #FFFFFF; color: var(--of-ink); font-weight: 600; }
.action-btn:hover { background: var(--of-nav-hover); color: var(--of-ink); border-color: var(--of-line-strong); }
.action-btn.primary { background: var(--of-accent); border-color: var(--of-accent); color: #FFFFFF; }
.action-btn.success { background: var(--of-green); border-color: var(--of-green); color: #FFFFFF; }

/* ---------- 6. Cards, stats, containers (flat) ------------------------ */
.card, .table-container, .quick-action, .stat-card, .settings-card {
    background: var(--of-card);
    border: 1px solid var(--of-line);
    border-radius: var(--rd-radius-card);
    box-shadow: var(--of-shadow-card);
}
.settings-card.settings-card--inset { background: var(--of-card-inset); border: 1px solid var(--of-line); }
.card-header { border-bottom: 1px solid var(--of-line); }
.stat-card:hover, .stat-card.active {
    background: var(--of-card);
    border-color: var(--of-line-strong);
    box-shadow: var(--of-shadow-card);
    transform: none;
}
.stat-card.active { border-color: var(--of-accent); box-shadow: 0 0 0 3px var(--of-chip); }
.stat-value { color: var(--of-ink); font-weight: 800; letter-spacing: -.02em; }
.stat-label { color: var(--of-muted); font-weight: 700; }
.quick-action-icon { background: var(--of-accent); border-radius: var(--rd-radius-ctl); }
.quick-action:hover { transform: none; border-color: var(--of-line-strong); }

/* ---------- 7. Tables ------------------------------------------------- */
th {
    background: var(--of-card-inset);
    color: var(--of-muted);
    font-size: 11px;
    letter-spacing: .07em;
    border-bottom: 1px solid var(--of-line);
}
td { border-bottom: 1px solid var(--of-line); color: var(--of-ink); }
tbody tr:hover { background: #F7F8FF; }
.table-toolbar { border-bottom: 1px solid var(--of-line); background: var(--of-card); }
.table-toolbar .search-input, .table-toolbar .filter-select {
    border: 1px solid var(--of-line-strong);
    border-radius: var(--rd-radius-ctl);
    background: var(--of-card-inset);
}

/* ---------- 8. Badges, tags, pills ------------------------------------ */
.badge { border-radius: 999px; padding: 2px 9px; letter-spacing: .02em; font-weight: 700; text-transform: none; font-size: 11.5px; }
.badge-active, .badge-synced, .badge-completed { background: #dcfce7; color: #166534; }
.tag { border-radius: 7px; }
.tag-factory { background: var(--of-side-bg); color: #FFFFFF; border-color: transparent; }
.tag-customer { background: var(--of-chip); color: var(--of-chip-ink); border-color: transparent; }
.tab-count { background: var(--of-accent); color: #FFFFFF; }

/* ---------- 9. Forms -------------------------------------------------- */
.form-input, .form-select, .edit-input, input, select, textarea { border-radius: var(--rd-radius-ctl); }
.form-input, .form-select, .edit-input,
input[type="text"], input[type="number"], input[type="email"], input[type="password"],
input[type="search"], input[type="tel"], input[type="url"], input[type="date"],
input[type="datetime-local"], input[type="time"], select, textarea { border-color: var(--of-line-strong); }
.form-label { font-weight: 700; color: var(--of-ink-2); }

/* ---------- 10. Tabs -------------------------------------------------- */
.tabs, .filter-tabs {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--of-line-strong);
    border-radius: 0;
    box-shadow: none;
}
.tab-btn, .filter-tab { background: transparent; color: var(--of-muted); font-weight: 700; flex: 0 0 auto; }
.tab-btn:hover, .filter-tab:hover { background: transparent; color: var(--of-ink); }
.tab-btn.active, .filter-tab.active {
    background: transparent;
    color: var(--of-ink);
    border-bottom: 2px solid var(--of-accent);
    font-weight: 800;
}
.modal-tab.active { color: var(--of-ink); border-bottom-color: var(--of-accent); }

/* ---------- 11. Modals, side panels, menus ---------------------------- */
.modal {
    background: var(--of-card);
    border: 1px solid var(--of-line);
    border-radius: 16px;
    box-shadow: 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-ink); font-weight: 800; }
.modal-close, .panel-close { background: #FFFFFF; color: var(--of-ink-2); border: 1px solid var(--of-line-strong); border-radius: var(--rd-radius-ctl); }
.modal-close:hover, .panel-close:hover { background: var(--of-nav-hover); color: var(--of-ink); }
.modal-footer, .panel-footer { background: var(--of-card-inset); border-top: 1px solid var(--of-line); }
.side-panel, .msg-drawer { background: var(--of-card); border-left: 1px solid var(--of-line); }
.side-panel.open, .msg-drawer.open { box-shadow: -24px 0 60px -30px rgba(27,32,82,.45); }
.dropdown-menu { background: var(--of-card); border: 1px solid var(--of-line); border-radius: 12px; box-shadow: var(--of-shadow-pop); }

/* ---------- 12. Alerts ------------------------------------------------ */
.alert { border-radius: 10px; }
.alert-success { background: var(--rd-ok-soft); color: var(--of-green); }
.alert-warning { background: var(--rd-warn-soft); color: #8A5300; }
.alert-error   { background: var(--rd-bad-soft); color: var(--of-red); }
.alert-info    { background: var(--of-chip); color: var(--of-chip-ink); }

/* ---------- 13. Sidebar scrollbar (the page-colour track showed as a light strip) */
.sidebar ::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track { background: var(--of-side-bg); }
.sidebar ::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); }
.sidebar-nav { scrollbar-color: rgba(255,255,255,.18) var(--of-side-bg); }

/* ---------- 14. List toolbars: one row, not full-width stacked controls ----------
   oms-design-system.css gives every bare select/input width:100%, which made each
   filter take a whole row inside the new .ord-toolbar flex row. */
.ord-toolbar select, .ord-toolbar .filter-select, .ord-toolbar .form-select {
    width: auto; flex: 0 0 auto; min-width: 150px; max-width: 230px;
}
.ord-toolbar .search-input, .ord-toolbar input[type="text"], .ord-toolbar input[type="search"] {
    width: auto; flex: 1 1 240px; min-width: 200px; max-width: 360px;
}

/* ---------- 15. Orders table fits a laptop width without sideways scroll ---------- */
.ord-tbl th, .ord-tbl td { padding-left: 10px; padding-right: 10px; }
.ord-tbl th:nth-child(2), .ord-tbl td:nth-child(2) { width: 120px; }
.ord-tbl th:nth-child(3), .ord-tbl td:nth-child(3) { max-width: 150px; }
.ord-tbl th:nth-child(4), .ord-tbl td:nth-child(4) { min-width: 220px; }
.ord-tbl th:nth-child(5), .ord-tbl td:nth-child(5) { max-width: 140px; }
.ord-tbl th:nth-child(6), .ord-tbl td:nth-child(6) { width: 140px; }
.ord-tbl th:nth-child(7), .ord-tbl td:nth-child(7) { width: 130px; }
