:root {
    --primary: #6c5ce7;
    --primary-dark: #5a4bd1;
    --sidebar-bg: #1e1a3c;
    --bg: #f3f4f9;
    --card: #ffffff;
    --border: #e6e8f0;
    --text: #1f2430;
    --text-muted: #7a8092;
    --green: #1f9d55;
    --red: #e0403f;
    --blue: #2563eb;
    --orange: #e08a1f;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Plus Jakarta Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13.5px;
}

a { color: inherit; text-decoration: none; }
svg { display: block; flex-shrink: 0; }
.hidden { display: none !important; }

/* ---------------------------------- Shell layout ---------------------------------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 216px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    gap: 6px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-logo { color: #fff; margin: 0 8px 20px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.side-icon {
    height: 40px; border-radius: 10px; padding: 0 12px;
    display: flex; align-items: center; gap: 12px;
    color: #a9a3d6; cursor: pointer; position: relative; font-size: 13px; font-weight: 500;
}
.side-icon:hover { background: rgba(255,255,255,0.08); color: #fff; }
.side-icon.active { background: var(--primary); color: #fff; }
.side-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 3px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.side-bell { position: relative; }
.side-badge {
    position: absolute; top: 6px; right: 10px; background: var(--red); color: #fff;
    font-size: 9px; border-radius: 8px; min-width: 14px; text-align: center; line-height: 14px;
}
.side-avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
    color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.side-profile { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; }
.side-profile-info { min-width: 0; flex: 1; }
.side-profile-name { color: #fff; font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-profile-role { color: #a9a3d6; font-size: 11px; }
.side-profile-more { background: none; border: none; color: #a9a3d6; cursor: pointer; padding: 4px; display: flex; }
.side-profile-more:hover { color: #fff; }

.main-col { flex: 1; min-width: 0; padding: 16px 20px; }

/* ---------------------------------- Buttons ---------------------------------- */
.btn {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12.5px;
    cursor: pointer;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn:hover { border-color: var(--primary); color: var(--primary-dark); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; margin-top: 10px; }
.btn-danger-text { color: var(--red); border-color: #f3caca; }
.btn-create { white-space: nowrap; }

.icon-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.icon-btn:hover { background: var(--bg); color: var(--primary-dark); }
.icon-btn.active { color: var(--primary); }
.link-btn {
    background: none; border: none; color: var(--blue); cursor: pointer;
    display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px;
}
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------- Top bar ---------------------------------- */
.topbar { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.topbar-search {
    flex: 1; min-width: 260px; position: relative; display: flex; align-items: center;
    background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
}
.search-icon { color: var(--text-muted); display: flex; }
.topbar-search input[type="search"] {
    flex: 1; border: none; outline: none; padding: 10px 10px; font-size: 13px; background: transparent;
}
.topbar-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-pill, .pill-select, .icon-pill, .select-pill {
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 12px; font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px;
}
.date-pill input[type="date"] { border: none; background: transparent; font-size: 12px; width: 110px; }
.icon-pill { padding: 8px; cursor: pointer; }
.icon-pill:hover, .icon-pill.active { color: var(--primary); border-color: var(--primary); }
.icon-pill.btn-label { padding: 8px 12px; }
.select-pill { padding: 0 6px 0 12px; cursor: pointer; }
.select-pill select {
    border: none; background: transparent; font-size: 12.5px; color: var(--text); padding: 8px 4px 8px 0;
    cursor: pointer; outline: none; max-width: 130px;
}
.search-kbd {
    border: 1px solid var(--border); border-radius: 5px; padding: 1px 6px; font-size: 11px;
    color: var(--text-muted); background: var(--bg); margin-left: 6px;
}

/* ---------------------------------- Filters panel ---------------------------------- */
.filters-panel {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: end;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px; margin-bottom: 12px;
}
.filters-panel label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.filters-panel select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.filters-panel .checkbox { flex-direction: row; align-items: center; gap: 6px; }

/* ---------------------------------- Content grid ---------------------------------- */
.content-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.content-main { min-width: 0; }

/* ---------------------------------- Bulk bar ---------------------------------- */
.bulk-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 10px;
}
.bulk-label { font-weight: 600; font-size: 13px; }
.bulk-buttons { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.result-count { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.checkbox { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* Bulk Actions dropdown (native <details>, no JS needed) */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown[open] > summary { border-color: var(--primary); }
.dropdown-end .dropdown-menu { left: auto; right: 0; }
.dropdown-menu {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 190px; z-index: 20;
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 10px 30px rgba(20,18,40,0.12); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.dropdown-menu button {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
    background: none; border: none; padding: 8px 10px; border-radius: 6px; font-size: 12.5px;
    color: var(--text); cursor: pointer;
}
.dropdown-menu button:hover { background: var(--bg); }

/* ---------------------------------- Tabs ---------------------------------- */
.tabs {
    display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 4px; margin-bottom: 6px; overflow-x: auto;
}
.tab {
    padding: 9px 16px; border-radius: 8px; white-space: nowrap; color: var(--text-muted);
    font-weight: 500; display: flex; gap: 6px; align-items: center;
}
.tab:hover { background: var(--bg); }
.tab.active { background: var(--primary); color: #fff; }
.tab-count { background: rgba(0,0,0,0.08); border-radius: 10px; padding: 1px 7px; font-size: 11px; }
.tab.active .tab-count { background: rgba(255,255,255,0.25); }
.tab-caret { opacity: 0.6; margin-left: -2px; }

.subtabs {
    display: flex; gap: 18px; padding: 8px 4px; margin-bottom: 12px; overflow-x: auto;
    border-bottom: 2px solid var(--border);
}
.subtab { padding-bottom: 8px; color: var(--text-muted); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; }
.subtab.active { color: var(--orange); border-color: var(--orange); font-weight: 700; }

/* ---------------------------------- Orders table ---------------------------------- */
.empty-state {
    text-align: center; padding: 60px 0; color: var(--text-muted);
    background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius);
}

.orders-table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.orders-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.orders-table-scroll { overflow-x: auto; }
.orders-table th, .orders-table td { padding: 8px 9px; text-align: left; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--border); }
.orders-table th { background: #fafbfe; color: var(--text-muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.02em; }
.th-controls { width: 9%; }
.th-order-number { width: 15%; }
.th-status { width: 11%; }
.th-items { width: 8%; }
.th-price { width: 9%; }
.th-payment { width: 8%; }
.th-profit { width: 11%; }
.th-date { width: 10%; }
.th-store { width: 13%; }
.th-actions { width: 6%; }
.cell-controls { display: flex; align-items: center; gap: 4px; overflow: visible; }
.cell-sub { display: block; color: var(--text-muted); font-size: 10.5px; font-weight: 500; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
.orders-table .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: middle; }
.orders-table td.cell-controls, .orders-table td:last-child { overflow: visible; }
.orders-table tbody tr { cursor: pointer; }
.orders-table tbody tr:hover td { background: #fafbff; }
.orders-table tbody tr.selected td { background: #f2effe; }
.orders-table tbody tr:last-child td { border-bottom: none; }
.orders-table tbody tr.detail-row { cursor: default; }
.orders-table tbody tr.detail-row:hover td { background: transparent; }
.orders-table tbody tr.detail-row > td { padding: 0; white-space: normal; background: #fafbff; }
.order-number { font-weight: 700; color: var(--blue); display: block; }
.order-number:hover { text-decoration: underline; }
.orders-table .sla-badge { display: inline-block; margin-top: 3px; }
.cell-store { display: flex; align-items: center; gap: 5px; color: var(--text-muted); }
.cell-platform { display: flex; align-items: center; gap: 5px; color: var(--text-muted); }
.platform-logo { width: 16px; height: 16px; border-radius: 3px; }
.cell-profit.positive { color: var(--green); font-weight: 700; }
.cell-profit.negative { color: var(--red); font-weight: 700; }
.cell-profit .margin { display: block; font-size: 10.5px; font-weight: 500; color: var(--text-muted); }
.cell-actions { display: flex; gap: 2px; }
.star-btn { border: none; background: none; cursor: pointer; color: var(--border); display: flex; padding: 2px; }
.star-btn.active { color: #f0a622; }
.expand-btn {
    display: flex; align-items: center; justify-content: center; width: 24px; height: 24px;
    border-radius: 6px; color: var(--text-muted); transition: transform 0.15s ease, background 0.15s ease;
}
.expand-btn:hover { background: var(--bg); color: var(--primary); }
.expand-btn.open { background: var(--primary); color: #fff; transform: rotate(-180deg); }

.sla-badge { font-size: 11px; padding: 3px 9px; border-radius: 10px; background: #e6f4ea; color: var(--green); font-weight: 600; white-space: nowrap; }
.sla-badge.urgent { background: #fff4e0; color: var(--orange); }
.sla-badge.overdue { background: #fdeaea; color: var(--red); }

.badge { font-size: 11px; padding: 3px 9px; border-radius: 10px; background: var(--bg); color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.badge-customer.badge-new { background: #e6f0ff; color: var(--blue); }
.badge-customer.badge-repeat { background: #edeaff; color: var(--primary); }
.badge-customer.badge-vip { background: #fff0d6; color: #b7791f; }
.badge-customer.badge-flagged { background: #fdeaea; color: var(--red); }

.status-unpaid { background: #fdeaea; color: var(--red); }
.status-to_pack, .status-to_arrange_shipment, .status-to_handover { background: #fff4e0; color: var(--orange); }
.status-shipped, .status-out_for_delivery { background: #e6f0ff; color: var(--blue); }
.status-delivered { background: #e6f4ea; color: var(--green); }
[class*="status-failed"] { background: #fdeaea; color: var(--red); }
[class*="status-return"] { background: #fdeee0; color: #b7550f; }
[class*="status-cancelled"] { background: #eee; color: var(--text-muted); }
.payment-cod { background: #fff4e0; color: var(--orange); }
.payment-prepaid { background: #e6f4ea; color: var(--green); }

/* ---------------------------------- Selected-order detail panel ---------------------------------- */
.order-detail { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.detail-topbar {
    display: flex; align-items: center; gap: 18px; padding: 12px 16px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border); background: #fafbfe; font-size: 12.5px; color: var(--text-muted);
}
.detail-topbar strong { color: var(--text); font-weight: 700; }
.detail-topbar .cell-platform { color: var(--text); }
.detail-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }

.detail-toolstrip {
    display: flex; align-items: center; gap: 16px; padding: 8px 16px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.dup-check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--green); }
.dup-check.dup-warning { color: var(--orange); }

.detail-body { display: grid; grid-template-columns: 280px 1fr; }
.customer-panel { padding: 16px; border-right: 1px solid var(--border); }
.customer-panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.customer-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0;
}
.customer-name { font-weight: 700; }
.customer-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.flag-btn { margin-left: auto; }
.customer-line { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; margin-bottom: 6px; }
.customer-stats-box { display: flex; gap: 16px; margin: 10px 0; padding: 10px; background: var(--bg); border-radius: 8px; }
.customer-stats-box div { font-size: 11.5px; color: var(--text-muted); }
.customer-stats-box strong { display: block; font-size: 14px; color: var(--text); }

.dup-check-box { background: #eefaf1; border: 1px solid #bfe8cb; border-radius: 8px; padding: 10px 12px; margin: 4px 0 12px; }
.dup-check-box.dup-warning { background: #fff8ec; border-color: #f4dfb0; }
.dup-check-title { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.dup-check-box .dup-check { color: var(--green); }
.dup-check-box.dup-warning .dup-check { color: var(--orange); }

.detail-items { overflow-x: auto; }
.detail-items table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.detail-items th { text-align: left; padding: 10px 10px; font-size: 12px; font-weight: 600; color: var(--text-muted); background: #fafbfe; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-items td { padding: 12px 10px; border-top: 1px solid var(--border); vertical-align: middle; font-size: 12.5px; white-space: normal; overflow: hidden; word-break: break-word; }
.th-di-product { width: 26%; }
.th-di-sku { width: 18%; }
.th-di-qty { width: 6%; }
.th-di-price { width: 12%; }
.th-di-status { width: 18%; }
.th-di-profit { width: 13%; }
.th-di-actions { width: 7%; }
.detail-items tr:first-child td { border-top: none; }
.product-image { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); flex-shrink: 0; }
.item-cell-product { display: flex; align-items: flex-start; gap: 10px; }
.item-name { font-weight: 700; font-size: 12.5px; }
.item-codes { display: flex; flex-direction: column; gap: 6px; color: var(--text-muted); font-size: 11px; }
.sku-line { display: flex; flex-direction: column; gap: 1px; }
.sku-label { color: var(--text-muted); font-size: 10.5px; }
.sku-value { font-weight: 600; font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; }
.copy-icon { border: none; background: none; cursor: pointer; color: var(--text-muted); padding: 0; display: inline-flex; }
.copy-icon:hover { color: var(--primary); }
.item-price-cell { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; font-weight: 600; }
.item-logistics { font-size: 11.5px; display: flex; flex-direction: column; gap: 4px; }
.item-logistics .tracking { color: var(--text-muted); font-size: 11px; }
.progress-dots { display: flex; align-items: center; gap: 0; margin-top: 4px; position: relative; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border); border: 2px solid var(--border); flex-shrink: 0; position: relative; z-index: 1; }
.dot:not(:last-child) { margin-right: 14px; }
.dot:not(:last-child)::after {
    content: ""; position: absolute; top: 50%; left: 100%; width: 14px; height: 2px;
    background: var(--border); transform: translateY(-50%); z-index: 0;
}
.dot.filled { background: var(--primary); border-color: var(--primary); }
.dot.filled:not(:last-child)::after { background: var(--primary); }
.dot.current { background: var(--orange); border-color: var(--orange); }
.item-profit-box {
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; background: var(--card);
    cursor: pointer; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 90px;
}
.item-profit-box.positive { color: var(--green); }
.item-profit-box.negative { color: var(--red); }
.item-profit-box .margin { font-size: 10.5px; font-weight: 500; color: var(--text-muted); }

/* ---------------------------------- Order timeline (horizontal stepper) ---------------------------------- */
.detail-timeline { padding: 16px; border-top: 1px solid var(--border); }
.detail-timeline-head { display: flex; align-items: center; margin-bottom: 14px; }
.detail-timeline-head .panel-title { margin-bottom: 0; }
.detail-timeline-head .link-btn { margin-left: auto; }
.timeline-stepper { display: flex; align-items: flex-start; overflow-x: auto; padding-bottom: 4px; }
.timeline-step { display: flex; flex-direction: column; align-items: center; min-width: 110px; position: relative; text-align: center; }
.timeline-step-dot {
    width: 22px; height: 22px; border-radius: 50%; background: var(--bg); border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center; color: var(--text-muted); z-index: 1;
}
.timeline-step.done .timeline-step-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.timeline-step-line { position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.timeline-step:first-child .timeline-step-line { display: none; }
.timeline-step.done .timeline-step-line { background: var(--primary); }
.timeline-step-label { font-size: 11.5px; font-weight: 600; margin-top: 8px; }
.timeline-step-time { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.timeline-empty { color: var(--text-muted); font-size: 12.5px; }

/* ---------------------------------- Shared card-list (used by products.php) ----------------------------------
   Orders moved to a table layout (see "Orders table" above), but the
   Products page still uses this stacked-card component - keep it defined. */
.order-list { display: flex; flex-direction: column; gap: 12px; }
.order-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.order-header {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}
.hdr-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.order-toolstrip {
    display: flex; align-items: center; gap: 16px; padding: 8px 14px; flex-wrap: wrap;
    border-bottom: 1px solid var(--border); background: #fafbfe;
}
.order-quick-actions { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.item-main { flex: 1.4; min-width: 160px; }

/* ---------------------------------- Pagination ---------------------------------- */
.pagination {
    display: flex; align-items: center; gap: 14px; justify-content: space-between;
    margin: 16px 0; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 10px 14px;
}
.pagination-info { font-size: 12px; color: var(--text-muted); }
.pagination-pages { display: flex; gap: 4px; }
.pagination-pages a { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); font-size: 12px; }
.pagination-pages a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-pages a.disabled { opacity: 0.4; pointer-events: none; }

/* ---------------------------------- Right side panel ---------------------------------- */
.side-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.panel-title { font-weight: 700; margin-bottom: 10px; font-size: 13px; }
.panel-card hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.summary-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; color: var(--text-muted); }
.summary-row span { margin-left: auto; font-weight: 700; color: var(--text); }
.summary-row.good svg { color: var(--green); }
.summary-row.good span { color: var(--green); }
.summary-row.bad svg { color: var(--red); }

.top-customer-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; border-top: 1px solid var(--border); }
.top-customer-row:first-child { border-top: none; }
.rank {
    width: 20px; height: 20px; border-radius: 50%; background: var(--bg); color: var(--text-muted);
    display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.tc-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-meta { color: var(--text-muted); font-size: 11px; }
.tc-spend { font-weight: 700; color: var(--green); font-size: 11.5px; }

.notif-row { display: flex; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.notif-row:first-child { border-top: none; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.notif-new_order .notif-dot { background: var(--blue); }
.notif-shipment_delay .notif-dot { background: var(--orange); }
.notif-return_request .notif-dot { background: var(--red); }
.notif-payment_received .notif-dot { background: var(--green); }
.notif-sla_warning .notif-dot { background: var(--orange); }
.notif-duplicate_order .notif-dot { background: var(--red); }
.notif-msg { font-size: 12px; line-height: 1.4; }
.notif-time { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

/* ---------------------------------- Modals ---------------------------------- */
.modal { position: fixed; inset: 0; background: rgba(20,18,40,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: #fff; border-radius: 12px; padding: 20px; width: 480px; max-width: 92vw; max-height: 86vh; overflow-y: auto; position: relative; }
.modal-box-sm { width: 320px; }
.picker-option { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.picker-tag { display: inline-flex; align-items: center; gap: 6px; }
.modal-close { position: absolute; top: 10px; right: 12px; border: none; background: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal h3 { margin-top: 0; }
.modal-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.modal-row:last-child { border-bottom: none; }
.modal-row .label { color: var(--text-muted); }
.copy-row { display: flex; align-items: center; gap: 8px; }
.copy-row button { border: none; background: var(--bg); border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: 11px; }
.timeline-event { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.timeline-event:last-child { border-bottom: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }

/* ---------------------------------- Login ---------------------------------- */
.auth-body { background: var(--bg); min-height: 100vh; margin: 0; }
.auth-shell { min-height: 100vh; display: flex; }

/* Left brand panel */
.auth-brand {
    flex: 1 1 44%; max-width: 560px; position: relative; overflow: hidden;
    background: linear-gradient(160deg, #241f4d 0%, var(--sidebar-bg) 55%, #15122b 100%);
    display: flex; align-items: center; padding: 60px;
}
.auth-brand-glow {
    position: absolute; width: 620px; height: 620px; border-radius: 50%;
    background: radial-gradient(circle, rgba(108,92,231,0.35) 0%, rgba(108,92,231,0) 70%);
    top: -180px; right: -220px; pointer-events: none;
}
.auth-brand-glow::after {
    content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
    background: radial-gradient(circle, rgba(108,92,231,0.22) 0%, rgba(108,92,231,0) 70%);
    bottom: -260px; left: -160px;
}
.auth-brand-content { position: relative; z-index: 1; color: #fff; max-width: 400px; animation: authFadeUp 0.6s ease both; }
.auth-brand-logo {
    width: 52px; height: 52px; border-radius: 14px; background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12); display: flex; align-items: center; justify-content: center;
    color: #a99bf5; margin-bottom: 28px;
}
.auth-brand-content h2 { font-size: 30px; margin: 0 0 14px; font-weight: 800; letter-spacing: -0.01em; }
.auth-brand-content p { color: #c3bef0; font-size: 14.5px; line-height: 1.65; margin: 0 0 32px; }
.auth-brand-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-brand-points li { display: flex; align-items: center; gap: 10px; color: #e3e0fa; font-size: 13.5px; }
.auth-brand-points li svg { color: #8b7ff0; flex-shrink: 0; }

/* Right form panel */
.auth-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; animation: authFadeUp 0.6s ease 0.1s both; }
.auth-card-head { margin-bottom: 28px; }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.auth-sub { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.auth-error {
    display: flex; align-items: center; gap: 8px; background: #fdeaea; color: var(--red);
    border-radius: 9px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 18px;
}
.auth-field { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 18px; }
.auth-input-wrap { position: relative; display: flex; align-items: center; }
.auth-input-icon { position: absolute; left: 13px; color: var(--text-muted); display: flex; pointer-events: none; transition: color 0.15s ease; }
.auth-field input {
    width: 100%; padding: 12px 14px 12px 38px; border: 1.5px solid var(--border); border-radius: 10px;
    font-size: 14px; font-family: inherit; color: var(--text); background: var(--card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-field input::placeholder { color: #b7bacb; }
.auth-field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(108,92,231,0.12); }
.auth-field input:focus + .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon { color: var(--primary); }
.auth-submit {
    padding: 12px; font-size: 14px; font-weight: 700; border-radius: 10px; margin-top: 6px;
    box-shadow: 0 8px 20px rgba(108,92,231,0.28); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(108,92,231,0.36); }
.auth-footnote { text-align: center; color: var(--text-muted); font-size: 12px; margin: 20px 0 0; }

@keyframes authFadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
    .auth-brand { display: none; }
    .auth-form-panel { flex: 1 1 100%; }
}

/* ---------------------------------- Toast ---------------------------------- */
.toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #1f2430; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 200;
}

/* ---------------------------------- Notification dropdown ---------------------------------- */
.notif-dropdown {
    position: fixed; left: 68px; bottom: 70px; width: 300px; max-height: 400px; overflow-y: auto;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15); z-index: 150;
}
.notif-dropdown-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.notif-dropdown-body .notif-row { padding: 8px 12px; }
.notif-dropdown-body .notif-row.unread { background: #f5f4ff; }

/* ---------------------------------- Simple pages (Home/Inventory/Shipping/Customers/Settings/Help) ---------------------------------- */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.page-header h1 { font-size: 19px; margin: 0; }
.page-header p { margin: 2px 0 0; color: var(--text-muted); font-size: 12.5px; }

.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.stat-tile .stat-label { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; }
.stat-tile .stat-value { font-size: 22px; font-weight: 700; margin-top: 8px; }
.stat-tile.good .stat-value { color: var(--green); }
.stat-tile.bad .stat-value { color: var(--red); }

/* ---------------------------------- Premium dashboard ---------------------------------- */
.stat-tiles.premium { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat-tile-p {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px;
    display: flex; align-items: center; gap: 13px; transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.stat-tile-p:hover { box-shadow: 0 10px 24px rgba(20,18,40,0.08); transform: translateY(-1px); }
.stat-tile-icon {
    width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-tile-icon.tint-primary { background: #efecfd; color: var(--primary); }
.stat-tile-icon.tint-green { background: #e6f6ec; color: var(--green); }
.stat-tile-icon.tint-blue { background: #e8f0fe; color: var(--blue); }
.stat-tile-icon.tint-orange { background: #fdf1e0; color: var(--orange); }
.stat-tile-p .stat-value { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.stat-tile-p .stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.chart-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; align-items: stretch; }
.chart-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.chart-card-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.chart-title { font-size: 14px; font-weight: 700; }
.chart-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* Trend area/line chart */
.trend-chart-wrap { position: relative; }
.trend-chart { width: 100%; height: 170px; display: block; overflow: visible; }
.trend-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.trend-dot { fill: #fff; stroke: var(--primary); stroke-width: 2.2; transition: r 0.1s ease; }
.trend-dot:has(+ .trend-dot-hit:hover) { r: 6; }
.trend-dot-hit { fill: transparent; cursor: pointer; }
.trend-x-labels { display: flex; justify-content: space-between; margin-top: 6px; padding: 0 2px; }
.trend-x-labels span { font-size: 10.5px; color: var(--text-muted); flex: 1; text-align: center; }
.chart-tooltip {
    position: absolute; transform: translate(-50%, calc(-100% - 12px)); background: #1f2430; color: #fff;
    padding: 7px 11px; border-radius: 8px; font-size: 11.5px; line-height: 1.5; white-space: nowrap;
    pointer-events: none; box-shadow: 0 8px 20px rgba(0,0,0,0.25); z-index: 5;
}
.chart-tooltip strong { font-size: 11.5px; }

/* Donut chart */
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: center; }
.donut-chart { width: 168px; height: 168px; flex-shrink: 0; }
.donut-seg { transition: stroke-width 0.15s ease, opacity 0.15s ease; cursor: pointer; }
.donut-seg:hover { stroke-width: 26; }
.donut-center-value { font-size: 26px; font-weight: 800; fill: var(--text); font-family: inherit; }
.donut-center-label { font-size: 10.5px; fill: var(--text-muted); font-family: inherit; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 160px; }
.donut-legend-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.donut-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-legend-label { color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend-value { font-weight: 700; }

/* Store revenue bars */
.store-bars { display: flex; flex-direction: column; gap: 16px; }
.store-bar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 12.5px; }
.store-bar-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.store-bar-name { font-weight: 700; }
.store-bar-meta { color: var(--text-muted); font-size: 11.5px; }
.store-bar-value { margin-left: auto; font-weight: 700; }
.store-bar-track { background: var(--bg); border-radius: 6px; height: 10px; overflow: hidden; }
.store-bar-fill { height: 100%; border-radius: 6px; transition: width 0.5s ease; }

@media (max-width: 1100px) {
    .chart-grid { grid-template-columns: 1fr; }
}

.data-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.data-table th { background: #fafbfe; color: var(--text-muted); font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbff; }

.panel-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel-block h2 { font-size: 14px; margin: 0 0 12px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12.5px; }
.masked-secret { font-family: monospace; letter-spacing: 1px; color: var(--text-muted); }
.status-pill { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.status-pill.active { background: #e6f4ea; color: var(--green); }
.status-pill.inactive { background: #eee; color: var(--text-muted); }
.low-stock { color: var(--red); font-weight: 700; }

@media (max-width: 1500px) {
    .content-grid { grid-template-columns: 1fr; }
    .side-panel { order: -1; }
}
@media (max-width: 900px) {
    .sidebar { width: 64px; padding: 18px 8px; }
    .side-label, .side-profile-info, .side-profile-more { display: none; }
    .side-icon { justify-content: center; padding: 0; }
    .side-profile { justify-content: center; padding: 10px 0 2px; }
}
@media (max-width: 800px) {
    .detail-body { grid-template-columns: 1fr; }
    .customer-panel { border-right: none; border-bottom: 1px solid var(--border); }
}
