/* ============================================================
   Fox Portals — B2B Client Portal CSS
   ============================================================
   Professional WooCommerce-style 3-tier header.
   Dual theme: light (default) + dark (toggle).
   Sprint: Portal-4 (AG2R — UI Overhaul v2)
   ============================================================ */

/* ---- Light Theme ---- */
:root {
    --portal-primary: #1B3A5C;
    --portal-primary-light: #24507a;
    --portal-accent: #E63946;
    --portal-bg: #f7f7f7;
    --portal-card-bg: #ffffff;
    --portal-nav-bg: var(--portal-primary);
    --portal-nav-text: rgba(255,255,255,0.85);
    --portal-nav-hover: rgba(255,255,255,0.12);
    --portal-nav-active: #ffffff;
    --portal-border: #e2e2e2;
    --portal-text: #2d2d2d;
    --portal-text-muted: #6b6b6b;
    --portal-input-bg: #ffffff;
    --portal-img-bg: #f0f0f0;
    --portal-hover-bg: rgba(0,0,0,0.025);
    --portal-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --portal-shadow-md: 0 2px 8px rgba(0,0,0,0.1);
    --portal-shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --portal-btn-text: #ffffff;
    --portal-header-bg: #ffffff;
    --portal-footer-bg: #2d2d2d;
    --portal-footer-text: rgba(255,255,255,0.7);
    --portal-breadcrumb-bg: #fafafa;
    --portal-topbar-bg: #1B3A5C;
    --portal-topbar-text: rgba(255,255,255,0.8);
    --portal-success: #059669;
    --portal-warning: #d97706;
    --portal-danger: #dc2626;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
    --portal-primary: #5bb8e8;
    --portal-primary-light: #4da6d9;
    --portal-accent: #E63946;
    --portal-bg: #0d0d1a;
    --portal-card-bg: #181830;
    --portal-nav-bg: #12122a;
    --portal-nav-text: rgba(255,255,255,0.7);
    --portal-nav-hover: rgba(255,255,255,0.08);
    --portal-nav-active: #5bb8e8;
    --portal-border: #2a2a42;
    --portal-text: #e4e4e4;
    --portal-text-muted: #8888a0;
    --portal-input-bg: #1e1e38;
    --portal-img-bg: #16162c;
    --portal-hover-bg: rgba(255,255,255,0.03);
    --portal-shadow: none;
    --portal-shadow-md: 0 2px 8px rgba(0,0,0,0.3);
    --portal-shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
    --portal-btn-text: #0d0d1a;
    --portal-header-bg: #181830;
    --portal-footer-bg: #0d0d1a;
    --portal-footer-text: rgba(255,255,255,0.5);
    --portal-breadcrumb-bg: #14142a;
    --portal-topbar-bg: #0d0d1a;
    --portal-topbar-text: rgba(255,255,255,0.6);
    --portal-success: #34d399;
    --portal-warning: #fbbf24;
    --portal-danger: #f87171;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body.portal-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--portal-bg);
    color: var(--portal-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background 0.3s, color 0.3s;
    font-size: 15px;
    line-height: 1.5;
}

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

a { color: var(--portal-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================================================================
   TOP UTILITY BAR
   ================================================================ */
.top-bar {
    background: var(--portal-topbar-bg);
    color: var(--portal-topbar-text);
    font-size: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.top-bar-inner {
    display: flex; justify-content: space-between; align-items: center;
    padding-top: 6px; padding-bottom: 6px;
}
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar-right {
    display: flex; align-items: center; gap: 12px;
}
.top-bar-right a {
    color: var(--portal-topbar-text); font-size: 12px;
    text-decoration: none; transition: color 0.15s;
}
.top-bar-right a:hover { color: #fff; text-decoration: underline; }

.theme-toggle {
    background: none; border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px; padding: 2px 6px; cursor: pointer;
    font-size: 13px; line-height: 1; color: var(--portal-topbar-text);
    transition: all 0.2s;
}
.theme-toggle:hover { border-color: rgba(255,255,255,0.5); color: #fff; }

/* ================================================================
   HEADER (Brand / Search / Cart)
   ================================================================ */
.portal-header {
    background: var(--portal-header-bg);
    border-bottom: 1px solid var(--portal-border);
}

.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding-top: 16px; padding-bottom: 16px;
    gap: 24px;
}

.header-brand { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.header-brand img { height: 48px; }
.header-titles h1 {
    font-size: 22px; font-weight: 800; color: var(--portal-primary);
    line-height: 1.15; letter-spacing: -0.3px;
}
.header-titles p {
    font-size: 13px; color: var(--portal-text-muted); margin-top: 2px;
}

.header-search { flex: 1; max-width: 500px; }
.search-wrapper {
    display: flex; border: 2px solid var(--portal-border); border-radius: 6px;
    overflow: hidden; transition: border-color 0.2s;
}
.search-wrapper:focus-within { border-color: var(--portal-primary); }
.search-wrapper input {
    flex: 1; padding: 10px 16px; border: none; outline: none;
    background: var(--portal-input-bg); color: var(--portal-text);
    font-size: 14px;
}
.search-btn {
    padding: 10px 16px; border: none; background: var(--portal-primary);
    color: #fff; cursor: pointer; font-size: 16px;
    transition: background 0.15s;
}
.search-btn:hover { background: var(--portal-primary-light); }

.header-cart { flex-shrink: 0; }
.header-cart-display {
    display: flex; align-items: center; gap: 12px;
    cursor: pointer; padding: 8px 16px; border-radius: 8px;
    border: 1px solid var(--portal-border);
    transition: all 0.2s; background: var(--portal-card-bg);
}
.header-cart-display:hover {
    border-color: var(--portal-primary); box-shadow: var(--portal-shadow-md);
}
.cart-icon-wrap {
    position: relative; font-size: 28px; line-height: 1;
}
.cart-icon-big { opacity: 0.7; }
.cart-icon-wrap .cart-badge {
    position: absolute; top: -6px; right: -10px;
    background: var(--portal-accent); color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}
.cart-text { display: flex; flex-direction: column; }
.cart-text .cart-label { font-size: 11px; color: var(--portal-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.cart-text .cart-amount { font-size: 16px; font-weight: 700; color: var(--portal-primary); }

/* ================================================================
   NAVIGATION BAR
   ================================================================ */
.portal-nav {
    background: var(--portal-nav-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky; top: 0; z-index: 100;
}
.nav-inner {
    display: flex; align-items: stretch; gap: 0;
    padding: 0;
}

.portal-nav .nav-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 14px 20px; color: var(--portal-nav-text);
    text-decoration: none; font-size: 14px; font-weight: 500;
    transition: all 0.2s; position: relative;
    border-bottom: 3px solid transparent;
    letter-spacing: 0.2px;
}
.portal-nav .nav-link:hover {
    color: var(--portal-nav-active); background: var(--portal-nav-hover);
    text-decoration: none;
}
.portal-nav .nav-link.active {
    color: var(--portal-nav-active);
    border-bottom-color: var(--portal-nav-active);
    font-weight: 600; background: var(--portal-nav-hover);
}

/* Cart badge in nav */
.nav-cart-badge {
    background: var(--portal-accent); color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0 5px; margin-left: 4px;
}

/* ---- Nav Dropdown ---- */
.nav-dropdown-wrapper { position: relative; display: flex; }
.nav-dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 0 0 8px 8px; box-shadow: var(--portal-shadow-lg);
    min-width: 220px; z-index: 210; padding: 8px 0;
}
.nav-dropdown-menu.open { display: block; }
.nav-dropdown-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 18px; color: var(--portal-text);
    text-decoration: none; font-size: 14px; transition: all 0.15s;
}
.nav-dropdown-menu a:hover {
    background: var(--portal-hover-bg); color: var(--portal-primary);
    text-decoration: none;
}
.nav-dropdown-menu a .dd-icon { font-size: 16px; width: 20px; text-align: center; opacity: 0.7; }

/* ================================================================
   BREADCRUMBS
   ================================================================ */
.breadcrumb-bar {
    background: var(--portal-breadcrumb-bg);
    border-bottom: 1px solid var(--portal-border);
    padding: 10px 0; font-size: 13px; color: var(--portal-text-muted);
}
.breadcrumb-bar a { color: var(--portal-primary); text-decoration: none; }
.breadcrumb-bar a:hover { text-decoration: underline; }
.home-icon { font-size: 14px; vertical-align: middle; margin-right: 4px; }

/* ================================================================
   MAIN
   ================================================================ */
.portal-main { flex: 1; padding: 32px 0; }

.section-title {
    font-size: 24px; font-weight: 700; color: var(--portal-text);
    margin-bottom: 24px; padding-bottom: 12px;
    border-bottom: 2px solid var(--portal-border);
}

/* ================================================================
   WELCOME BANNER
   ================================================================ */
.welcome-banner {
    background: linear-gradient(135deg, var(--portal-primary), var(--portal-primary-light));
    color: #fff; border-radius: 10px; padding: 28px 32px;
    margin-bottom: 28px; box-shadow: var(--portal-shadow-md);
}
.welcome-banner h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.welcome-banner .role-badge { background: rgba(255,255,255,0.2); color: #fff; }
.welcome-banner .role-info { color: rgba(255,255,255,0.85); margin-top: 8px; font-size: 15px; }

.welcome-card {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 24px; margin-bottom: 24px;
    box-shadow: var(--portal-shadow);
}
.welcome-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }

/* ---- Role Badges ---- */
.role-badge {
    display: inline-block; padding: 4px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
}
.role-viewer { background: #e0e7ff; color: #3730a3; }
.role-buyer { background: #dbeafe; color: #1e40af; }
.role-approver { background: #fef3c7; color: #92400e; }
.role-admin { background: #fce7f3; color: #9d174d; }
[data-theme="dark"] .role-viewer { background: rgba(99,102,241,0.2); color: #818cf8; }
[data-theme="dark"] .role-buyer { background: rgba(59,130,246,0.2); color: #60a5fa; }
[data-theme="dark"] .role-approver { background: rgba(245,158,11,0.2); color: #fbbf24; }
[data-theme="dark"] .role-admin { background: rgba(236,72,153,0.2); color: #f472b6; }

.role-info { color: var(--portal-text-muted); font-size: 14px; margin-top: 8px; }

/* ---- Role Info Box (gradient) ---- */
.role-info-box {
    padding: 20px 24px; border-radius: 10px; color: #fff;
    font-size: 15px; margin-bottom: 20px; box-shadow: var(--portal-shadow-md);
}
.role-info-box h4 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.role-info-box.admin { background: linear-gradient(135deg, #1B3A5C, #4f46e5); }
.role-info-box.buyer { background: linear-gradient(135deg, #059669, #34d399); }
.role-info-box.approver { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.role-info-box.viewer { background: linear-gradient(135deg, #6b7280, #9ca3af); }
[data-theme="dark"] .role-info-box.admin { background: linear-gradient(135deg, #312e81, #4f46e5); }
[data-theme="dark"] .role-info-box.buyer { background: linear-gradient(135deg, #065f46, #10b981); }
[data-theme="dark"] .role-info-box.approver { background: linear-gradient(135deg, #5b21b6, #7c3aed); }
[data-theme="dark"] .role-info-box.viewer { background: linear-gradient(135deg, #374151, #6b7280); }

/* ================================================================
   CATEGORIES (list with descriptions)
   ================================================================ */
.category-list { list-style: none; margin-bottom: 28px; }
.category-list-item {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 18px 24px; margin-bottom: 10px;
    cursor: pointer; transition: all 0.2s; box-shadow: var(--portal-shadow);
    display: flex; align-items: center; gap: 16px;
}
.category-list-item:hover {
    border-color: var(--portal-primary); box-shadow: var(--portal-shadow-md);
    transform: translateY(-1px);
}
.category-list-item .cat-icon {
    font-size: 28px; width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: var(--portal-hover-bg); border-radius: 10px; flex-shrink: 0;
}
.category-list-item .cat-content { flex: 1; }
.category-list-item h4 {
    font-size: 16px; font-weight: 600; color: var(--portal-text);
    margin-bottom: 4px;
}
.category-list-item p {
    font-size: 14px; color: var(--portal-text-muted); line-height: 1.4;
    margin: 0;
}

/* ================================================================
   CATALOG
   ================================================================ */
.catalog-toolbar {
    display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
    align-items: center;
}
.catalog-toolbar input {
    flex: 1; min-width: 220px; padding: 10px 16px;
    border: 1px solid var(--portal-border); border-radius: 6px;
    background: var(--portal-input-bg); color: var(--portal-text);
    font-size: 14px; outline: none;
}
.catalog-toolbar input:focus { border-color: var(--portal-primary); }
.catalog-toolbar select {
    padding: 10px 16px; border: 1px solid var(--portal-border);
    border-radius: 6px; background: var(--portal-input-bg);
    color: var(--portal-text); font-size: 14px;
}

.product-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; overflow: hidden; cursor: pointer;
    transition: all 0.25s; box-shadow: var(--portal-shadow);
}
.product-card:hover {
    border-color: var(--portal-primary); box-shadow: var(--portal-shadow-lg);
    transform: translateY(-2px);
}
.product-card-img {
    height: 200px; background: var(--portal-img-bg);
    display: flex; align-items: center; justify-content: center;
    color: var(--portal-text-muted); overflow: hidden;
    padding: 12px;
}
.product-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.placeholder-icon { font-size: 52px; opacity: 0.3; }
.placeholder-icon.large { font-size: 100px; }

.product-card-body { padding: 16px; }
.product-card-body .product-code {
    font-size: 11px; color: var(--portal-text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace; margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.product-card-body h3 {
    font-size: 15px; font-weight: 600; margin-bottom: 10px;
    color: var(--portal-text); line-height: 1.3;
}
.product-card-body .product-price {
    font-size: 18px; font-weight: 700; color: var(--portal-primary);
    margin-bottom: 12px;
}

/* ================================================================
   PRODUCT DETAIL
   ================================================================ */
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--portal-primary); text-decoration: none;
    font-size: 14px; margin-bottom: 20px; font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

.product-detail {
    display: grid; grid-template-columns: 1fr 1fr; gap: 36px;
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 28px; box-shadow: var(--portal-shadow-md);
}
.product-detail-img {
    background: var(--portal-img-bg); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    min-height: 320px; overflow: hidden;
}
.product-detail-img img { width: 100%; height: 100%; object-fit: contain; }
.product-detail-info .product-code {
    font-family: 'SF Mono', monospace; color: var(--portal-text-muted);
    font-size: 12px; margin-bottom: 8px; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.product-detail-info h2 { font-size: 24px; font-weight: 700; margin-bottom: 12px; line-height: 1.2; }
.product-detail-price { font-size: 28px; font-weight: 800; color: var(--portal-primary); margin-bottom: 8px; }
.eco-line { font-size: 13px; color: var(--portal-text-muted); margin-bottom: 20px; font-style: italic; }
.product-detail-desc { font-size: 15px; line-height: 1.6; color: var(--portal-text-muted); margin-bottom: 16px; }
.product-detail-cat { font-size: 14px; color: var(--portal-text-muted); margin-bottom: 20px; }
.product-detail-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.qty-input { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.qty-input input {
    width: 64px; padding: 8px; text-align: center;
    border: 1px solid var(--portal-border); border-radius: 6px;
    background: var(--portal-input-bg); color: var(--portal-text);
    font-size: 15px; font-weight: 600;
}

.viewer-warning {
    background: #fef3c7; color: #92400e; padding: 14px 18px;
    border-radius: 8px; font-size: 14px; font-weight: 600;
    border-left: 4px solid #f59e0b; margin-top: 20px;
}
[data-theme="dark"] .viewer-warning {
    background: rgba(245,158,11,0.12); color: #fbbf24;
    border-left-color: #fbbf24;
}

/* ---- Product Tabs ---- */
.product-tabs { margin-top: 28px; }
.product-tab-headers {
    display: flex; gap: 0; border-bottom: 2px solid var(--portal-border);
}
.product-tab-header {
    padding: 12px 24px; font-size: 14px; font-weight: 600;
    color: var(--portal-text-muted); cursor: pointer;
    border-bottom: 3px solid transparent; margin-bottom: -2px;
    transition: all 0.2s; background: none;
    border-top: none; border-left: none; border-right: none;
}
.product-tab-header:hover { color: var(--portal-primary); }
.product-tab-header.active {
    color: var(--portal-primary); border-bottom-color: var(--portal-primary);
}
.product-tab-content {
    display: none; padding: 24px;
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-top: none; border-radius: 0 0 10px 10px;
}
.product-tab-content.active { display: block; }

.attributes-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.attributes-table th, .attributes-table td {
    padding: 10px 14px; text-align: left;
    border-bottom: 1px solid var(--portal-border);
}
.attributes-table th { font-weight: 600; color: var(--portal-text-muted); width: 200px; }

/* ================================================================
   CART (2-column layout)
   ================================================================ */
.cart-layout {
    display: grid; grid-template-columns: 1fr 360px; gap: 28px;
    align-items: start;
}

.cart-items-card {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 24px; box-shadow: var(--portal-shadow);
}

.cart-row {
    display: flex; align-items: center; gap: 16px; padding: 16px 0;
    border-bottom: 1px solid var(--portal-border);
}
.cart-row:last-child { border-bottom: none; }
.cart-row-img {
    width: 64px; height: 64px; background: var(--portal-img-bg);
    border-radius: 8px; display: flex; align-items: center;
    justify-content: center; overflow: hidden; flex-shrink: 0;
    font-size: 28px;
}
.cart-row-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-row-info { flex: 1; }
.cart-row-info h4 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.cart-row-info span { font-size: 13px; color: var(--portal-text-muted); }
.cart-row-details { font-size: 12px; color: var(--portal-text-muted); margin-top: 4px; }
.cart-row-total { font-weight: 700; font-size: 15px; min-width: 90px; text-align: right; }

/* ---- Qty Selector (+/- buttons) ---- */
.qty-selector {
    display: inline-flex; align-items: center; border: 2px solid var(--portal-border);
    border-radius: 6px; overflow: hidden;
}
.qty-selector button {
    width: 34px; height: 34px; border: none; background: var(--portal-hover-bg);
    color: var(--portal-text); font-size: 18px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; font-weight: 600;
}
.qty-selector button:hover { background: var(--portal-border); }
.qty-selector input {
    width: 44px; height: 34px; border: none;
    border-left: 1px solid var(--portal-border);
    border-right: 1px solid var(--portal-border);
    text-align: center; background: var(--portal-input-bg);
    color: var(--portal-text); font-size: 14px; font-weight: 700;
}

.cart-summary {
    background: var(--portal-card-bg); border: 2px solid var(--portal-border);
    border-radius: 10px; padding: 24px; box-shadow: var(--portal-shadow-md);
    position: sticky; top: 70px;
}
.cart-summary h3 {
    font-size: 18px; font-weight: 700; margin-bottom: 20px;
    padding-bottom: 12px; border-bottom: 1px solid var(--portal-border);
    color: var(--portal-text);
}
.summary-line {
    display: flex; justify-content: space-between; padding: 8px 0;
    font-size: 15px;
}
.summary-line.eco { color: var(--portal-text-muted); font-style: italic; font-size: 13px; }
.summary-line.total {
    font-size: 20px; font-weight: 800; color: var(--portal-primary);
    border-top: 2px solid var(--portal-border); padding-top: 14px; margin-top: 10px;
}
.cart-actions { display: flex; gap: 10px; margin-top: 20px; flex-direction: column; }
.cart-actions .btn { width: 100%; justify-content: center; padding: 12px 20px; font-size: 15px; }

/* ================================================================
   ORDERS TABLE
   ================================================================ */
.orders-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
    background: var(--portal-card-bg); border-radius: 10px;
    overflow: hidden; box-shadow: var(--portal-shadow);
    border: 1px solid var(--portal-border);
}
.orders-table th, .orders-table td {
    padding: 12px 16px; text-align: left;
    border-bottom: 1px solid var(--portal-border);
}
.orders-table th {
    font-weight: 600; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--portal-text-muted);
    background: var(--portal-hover-bg);
}
.orders-table tbody tr { transition: background 0.15s; }
.orders-table tbody tr:hover { background: var(--portal-hover-bg); }

/* ---- Order Action Buttons ---- */
.btn-view {
    background: var(--portal-success); color: #fff; padding: 5px 12px;
    border: none; border-radius: 5px; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: opacity 0.2s;
}
.btn-view:hover { opacity: 0.85; }
.btn-cancel {
    background: transparent; color: var(--portal-danger); padding: 5px 12px;
    border: 1.5px solid var(--portal-danger); border-radius: 5px; font-size: 12px;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-cancel:hover { background: var(--portal-danger); color: #fff; }

/* ---- Status Badges ---- */
.status-badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600; letter-spacing: 0.3px;
}
.status-draft { background: rgba(107,114,128,0.12); color: #6b7280; }
.status-pending_approval { background: rgba(245,158,11,0.12); color: #d97706; }
.status-approved { background: rgba(16,185,129,0.12); color: #059669; }
.status-rejected { background: rgba(239,68,68,0.12); color: #dc2626; }
.status-confirmed { background: rgba(59,130,246,0.12); color: #2563eb; }
.status-delivered { background: rgba(16,185,129,0.18); color: #047857; }
.status-cancelled { background: rgba(107,114,128,0.12); color: #9ca3af; }
[data-theme="dark"] .status-draft { background: rgba(136,136,136,0.15); color: #888; }
[data-theme="dark"] .status-pending_approval { background: rgba(255,170,0,0.15); color: #fbbf24; }
[data-theme="dark"] .status-approved { background: rgba(0,255,136,0.15); color: #34d399; }
[data-theme="dark"] .status-rejected { background: rgba(255,68,68,0.15); color: #f87171; }
[data-theme="dark"] .status-confirmed { background: rgba(0,150,255,0.15); color: #60a5fa; }
[data-theme="dark"] .status-delivered { background: rgba(0,255,136,0.2); color: #34d399; }
[data-theme="dark"] .status-cancelled { background: rgba(136,136,136,0.2); color: #9ca3af; }

/* ---- Filter Bar ---- */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

/* ---- Approval Info ---- */
.approval-info-box {
    background: #fffbeb; color: #92400e; padding: 14px 18px;
    border-radius: 8px; font-size: 14px; margin-bottom: 20px;
    border-left: 4px solid #f59e0b;
}
[data-theme="dark"] .approval-info-box {
    background: rgba(245,158,11,0.1); color: #fbbf24;
    border-left-color: #fbbf24;
}

/* ================================================================
   ACCOUNT
   ================================================================ */
.account-layout { display: grid; grid-template-columns: 240px 1fr; gap: 28px; }
.account-sidebar {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; box-shadow: var(--portal-shadow);
    overflow: hidden; align-self: start;
}
.account-nav { display: flex; flex-direction: column; }
.account-nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px; color: var(--portal-text);
    text-decoration: none; font-size: 14px; font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}
.account-nav-link .nav-icon {
    font-size: 18px; width: 22px; text-align: center; opacity: 0.6;
}
.account-nav-link:hover {
    background: var(--portal-hover-bg); color: var(--portal-primary);
    text-decoration: none;
}
.account-nav-link.active {
    color: var(--portal-primary); background: rgba(27,58,92,0.06);
    border-left-color: var(--portal-primary); font-weight: 600;
}
.account-nav-link.active .nav-icon { opacity: 1; }
.account-nav-link.logout {
    color: var(--portal-accent); border-top: 1px solid var(--portal-border);
}
.account-nav-link.logout:hover { background: rgba(230,57,70,0.05); }

.account-content { min-height: 300px; }

/* ---- Addresses (2 columns) ---- */
.addresses-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.address-card {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 22px; box-shadow: var(--portal-shadow);
}
.address-card h3 {
    font-size: 16px; margin-bottom: 10px; color: var(--portal-primary);
    display: flex; align-items: center; justify-content: space-between;
}
.address-card .edit-icon { cursor: pointer; font-size: 14px; opacity: 0.5; transition: opacity 0.2s; }
.address-card .edit-icon:hover { opacity: 1; }
.address-card p { font-size: 14px; line-height: 1.7; color: var(--portal-text); }

/* ---- Details / Settings Cards ---- */
.details-card, .settings-card {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 28px; box-shadow: var(--portal-shadow);
}
.details-card table { width: 100%; }
.details-card td { padding: 10px 0; font-size: 15px; }
.details-card td.label { color: var(--portal-text-muted); width: 160px; font-weight: 500; }
.text-muted { color: var(--portal-text-muted); }

/* ---- Admin Action Bar ---- */
.admin-action-bar {
    display: flex; gap: 8px; margin-bottom: 24px; padding: 14px 18px;
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; box-shadow: var(--portal-shadow); flex-wrap: wrap;
}

/* ---- Admin Buttons ---- */
.admin-buttons {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px; margin-top: 20px;
}
.admin-btn {
    padding: 20px; background: var(--portal-card-bg);
    border: 1px solid var(--portal-border); border-radius: 10px;
    font-size: 15px; font-weight: 600; color: var(--portal-primary);
    cursor: pointer; transition: all 0.2s; text-align: center;
    box-shadow: var(--portal-shadow);
}
.admin-btn:hover {
    border-color: var(--portal-primary); box-shadow: var(--portal-shadow-md);
    transform: translateY(-1px);
}

/* ---- Admin Users ---- */
.add-user-form {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 24px; margin-bottom: 24px;
    box-shadow: var(--portal-shadow);
}
.add-user-form h3 { font-size: 16px; margin-bottom: 14px; color: var(--portal-primary); }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.form-row input, .form-row select {
    padding: 10px 14px; border: 1px solid var(--portal-border);
    border-radius: 6px; background: var(--portal-input-bg);
    color: var(--portal-text); font-size: 14px;
}
.form-row input { flex: 1; min-width: 160px; }

.role-group-title { font-size: 15px; margin: 20px 0 10px; display: flex; align-items: center; gap: 10px; }
.user-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 20px; }
.user-card {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 8px; padding: 14px; box-shadow: var(--portal-shadow);
}
.user-card-info { display: flex; flex-direction: column; gap: 2px; }
.user-card-info strong { font-size: 14px; }
.user-card-info span { font-size: 13px; color: var(--portal-text-muted); }
.user-card-actions { display: flex; gap: 8px; align-items: center; }

.btn-delete-user {
    background: transparent; color: var(--portal-danger); padding: 5px 10px;
    border: 1.5px solid var(--portal-danger); border-radius: 5px; font-size: 11px;
    font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-delete-user:hover { background: var(--portal-danger); color: #fff; }

/* ---- Order Detail ---- */
.order-detail-card {
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; padding: 28px; box-shadow: var(--portal-shadow-md);
}
.order-detail-card h2 { font-size: 20px; margin-bottom: 20px; }
.order-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.order-meta-item { font-size: 14px; }
.order-meta-item .meta-label { color: var(--portal-text-muted); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.order-items-table {
    width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 20px;
}
.order-items-table th, .order-items-table td {
    padding: 10px 14px; text-align: left;
    border-bottom: 1px solid var(--portal-border);
}
.order-items-table th {
    font-weight: 600; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--portal-text-muted);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 10px 22px; border: none; border-radius: 6px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: all 0.2s; text-decoration: none;
    letter-spacing: 0.2px;
}
.btn:hover { opacity: 0.9; transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--portal-primary); color: var(--portal-btn-text); }
.btn-outline {
    background: transparent; color: var(--portal-primary);
    border: 1.5px solid var(--portal-primary);
}
.btn-outline:hover { background: var(--portal-primary); color: var(--portal-btn-text); }
.btn-danger { background: var(--portal-danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-filter {
    background: var(--portal-card-bg); color: var(--portal-text);
    border: 1px solid var(--portal-border); border-radius: 20px;
    padding: 7px 16px; font-size: 13px;
}
.btn-filter.active {
    background: var(--portal-primary); color: var(--portal-btn-text);
    border-color: var(--portal-primary);
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center; padding: 48px;
    color: var(--portal-text-muted); font-size: 15px;
}

/* ================================================================
   FOOTER
   ================================================================ */
.portal-footer {
    background: var(--portal-footer-bg); color: var(--portal-footer-text);
    padding: 32px 0; margin-top: auto;
}
.footer-inner {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 16px;
}
.footer-brand { display: flex; flex-direction: column; gap: 2px; }
.footer-brand strong { color: #fff; font-size: 15px; }
.footer-brand span { font-size: 13px; }
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--portal-footer-text); text-decoration: none; font-size: 13px; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-copy { font-size: 12px; }
.footer-copy strong { color: #fff; }

/* ================================================================
   ORDER TIMELINE
   ================================================================ */
.order-timeline {
    margin: 24px 0; padding: 24px;
    background: var(--portal-card-bg); border: 1px solid var(--portal-border);
    border-radius: 10px; box-shadow: var(--portal-shadow);
}
.timeline-track {
    display: flex; justify-content: space-between; align-items: flex-start;
    position: relative; padding: 0 8px;
}
.timeline-step {
    flex: 1; text-align: center; position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.timeline-marker {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; border: 3px solid var(--portal-border);
    background: var(--portal-card-bg); position: relative; z-index: 2;
    transition: all 0.3s;
}
.timeline-connector {
    position: absolute; top: 22px; left: calc(50% + 22px);
    width: calc(100% - 44px); height: 3px;
    background: var(--portal-border); z-index: 1;
}
.timeline-step:last-child .timeline-connector { display: none; }

.timeline-step.completed .timeline-marker {
    background: var(--portal-success); border-color: var(--portal-success); color: #fff;
}
.timeline-step.completed .timeline-connector { background: var(--portal-success); }
.timeline-step.current .timeline-marker {
    background: var(--portal-primary); border-color: var(--portal-primary); color: #fff;
    box-shadow: 0 0 0 4px rgba(27, 58, 92, 0.2);
}
[data-theme="dark"] .timeline-step.current .timeline-marker {
    box-shadow: 0 0 0 4px rgba(91, 184, 232, 0.25);
}
.timeline-step.current .timeline-marker.pulse { animation: timelinePulse 2s infinite; }
@keyframes timelinePulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(27, 58, 92, 0.2); }
    50% { box-shadow: 0 0 0 8px rgba(27, 58, 92, 0.08); }
}
[data-theme="dark"] .timeline-step.current .timeline-marker.pulse {
    animation: timelinePulseDark 2s infinite;
}
@keyframes timelinePulseDark {
    0%, 100% { box-shadow: 0 0 0 4px rgba(91, 184, 232, 0.25); }
    50% { box-shadow: 0 0 0 8px rgba(91, 184, 232, 0.1); }
}
.timeline-step.pending .timeline-marker {
    background: var(--portal-hover-bg); border-color: var(--portal-border);
    color: var(--portal-text-muted); opacity: 0.6;
}
.timeline-label {
    font-size: 12px; font-weight: 600; color: var(--portal-text);
    max-width: 90px; line-height: 1.3;
}
.timeline-step.pending .timeline-label { color: var(--portal-text-muted); }
.timeline-date {
    font-size: 11px; color: var(--portal-text-muted);
    min-height: 16px;
}
.timeline-progress-bar {
    height: 6px; background: var(--portal-border); border-radius: 3px;
    margin-top: 16px; overflow: hidden;
}
.timeline-progress-fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--portal-success), var(--portal-primary));
    transition: width 0.5s ease;
}

/* ---- Mini Progress (orders list) ---- */
.mini-progress {
    width: 80px; height: 8px; background: var(--portal-border);
    border-radius: 4px; overflow: hidden; display: inline-flex;
    align-items: center; position: relative;
}
.mini-progress-fill {
    height: 100%; border-radius: 4px;
    background: linear-gradient(90deg, var(--portal-success), var(--portal-primary));
    transition: width 0.3s;
}
.mini-progress-label {
    position: absolute; right: -32px; font-size: 11px;
    color: var(--portal-text-muted); font-weight: 600; white-space: nowrap;
}

/* ---- Order Shipping Info ---- */
.order-shipping-info {
    margin: 16px 0; padding: 16px;
    background: var(--portal-hover-bg); border-radius: 8px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}

/* ================================================================
   CHECKOUT FORM
   ================================================================ */
.checkout-form { max-width: 700px; }
.checkout-section { margin-bottom: 24px; }
.checkout-section h3 {
    font-size: 16px; font-weight: 600; color: var(--portal-primary);
    margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid var(--portal-border);
}
.checkout-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.chk-input {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--portal-border); border-radius: 6px;
    background: var(--portal-input-bg); color: var(--portal-text);
    font-size: 14px; font-family: inherit;
}
.chk-input:focus { border-color: var(--portal-primary); outline: none; }
.chk-textarea { min-height: 80px; resize: vertical; }
.chk-label {
    display: block; font-size: 13px; color: var(--portal-text-muted);
    margin-bottom: 4px; font-weight: 500;
}
.chk-copy-label {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; color: var(--portal-text); margin-bottom: 8px;
    cursor: pointer;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .container { padding: 0 16px; }
    .top-bar-inner { flex-direction: column; gap: 4px; text-align: center; }
    .header-inner { flex-wrap: wrap; gap: 12px; }
    .header-search { flex: 100%; max-width: none; order: 3; }
    .header-cart { order: 2; }
    .nav-inner { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .portal-nav .nav-link { padding: 12px 14px; font-size: 13px; white-space: nowrap; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
    .product-detail { grid-template-columns: 1fr; }
    .account-layout { grid-template-columns: 1fr; }
    .account-sidebar { order: -1; }
    .cart-layout { grid-template-columns: 1fr; }
    .cart-summary { position: static; }
    .addresses-layout { grid-template-columns: 1fr; }
    .admin-action-bar { flex-direction: column; }
    .order-meta { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; text-align: center; }
    /* Timeline vertical on mobile */
    .timeline-track { flex-direction: column; gap: 0; padding: 0; }
    .timeline-step {
        flex-direction: row; text-align: left; gap: 12px;
        padding: 8px 0; align-items: center;
    }
    .timeline-connector {
        position: absolute; left: 22px; top: calc(50% + 22px);
        width: 3px; height: calc(100% - 22px);
    }
    .timeline-label { max-width: none; }
    .checkout-grid { grid-template-columns: 1fr; }
    .order-shipping-info { grid-template-columns: 1fr; }
}
