/* ==================== REZEH - Brand Portal Unified Design System ==================== */
:root {
    /* Neutral palette */
    --bg: #f0f2f5;
    --card: #ffffff;
    --text: #1c1e21;
    --text-secondary: #65676b;
    --text-muted: #8a8d91;
    --border: #e4e6eb;
    --border-light: #f0f2f5;
    --input-bg: #f0f2f5;
    --hover-bg: #f5f6f7;
    
    /* Accent colors */
    --primary: #1b74e4;
    --primary-hover: #1a6dd4;
    --success: #31a24c;
    --success-bg: #e6f4ea;
    --danger: #e41e3f;
    --danger-bg: #fbe9ec;
    --warning: #f59e0b;
    --warning-bg: #fef9e7;
    --info: #1b74e4;
    --info-bg: #e7f3ff;
    --purple: #8b5cf6;
    --purple-bg: #f3f0ff;
    
    /* Spacing system (4px grid) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    
    /* Typography */
    --font-sm: 13px;
    --font-base: 15px;
    --font-lg: 17px;
    --font-xl: 20px;
    --font-2xl: 24px;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 50%;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-xl: 0 12px 40px rgba(0,0,0,0.15);

    /* iOS specific additions */
    --ios-blue: #007AFF;
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-green: #34C759;
    --ios-purple: #AF52DE;
    --ios-pink: #FF2D55;
    --ios-bg: #F2F2F7;
    --ios-card: #FFFFFF;
    --ios-text: #000000;
    --ios-text-secondary: #8E8E93;
    --ios-separator: #E5E5EA;
    --ios-fill: #F2F2F7;
    --ios-fill-secondary: #E5E5EA;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ==================== RESET & BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    min-height: 100vh; 
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.4;
    font-size: var(--font-base);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

/* ==================== TYPOGRAPHY ==================== */
h1 { font-size: var(--font-xl); font-weight: var(--font-weight-bold); }
h2 { font-size: var(--font-lg); font-weight: var(--font-weight-semibold); }
h3 { font-size: var(--font-base); font-weight: var(--font-weight-semibold); }
h4 { font-size: var(--font-sm); font-weight: var(--font-weight-semibold); }

/* ==================== SHARED HEADER (iOS style) ==================== */
.nav-bar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--ios-separator);
    position: sticky; top: 0; z-index: 100;
}

.nav-content {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; max-width: 800px; margin: 0 auto;
}

.nav-brand { display: flex; align-items: center; gap: 8px; }

.brand-logo {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: linear-gradient(135deg, #FF9500, #FF2D55);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: white;
}

.nav-brand .brand-text { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.nav-brand .brand-sub { font-size: 10px; color: var(--ios-text-secondary); font-weight: 400; }

.nav-title { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.nav-actions { display: flex; align-items: center; gap: 8px; }

.avatar-ring {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #FF9500, #FF2D55);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 14px;
}

/* ==================== LEGACY HEADER (Material style) ==================== */
.header { 
    background: var(--card); 
    padding: var(--space-3) var(--space-4); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: var(--space-3); 
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header h1 { font-size: var(--font-lg); font-weight: var(--font-weight-bold); color: var(--text); }
.header-right { display: flex; align-items: center; gap: var(--space-3); font-size: var(--font-sm); }

/* ==================== CONNECTION STATUS ==================== */
.connection-dot { 
    width: 8px; height: 8px; 
    border-radius: var(--radius-full); 
    background: var(--success); 
    flex-shrink: 0;
}
.connection-dot.offline { background: var(--danger); animation: pulse 2s infinite; }

/* ==================== BADGES & PILLS ==================== */
.badge-pill { 
    background: var(--input-bg); 
    padding: var(--space-1) var(--space-3); 
    border-radius: 20px; 
    font-size: var(--font-sm); 
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    display: inline-flex;
}
.badge { 
    display: inline-block;
    background: var(--primary); 
    color: white; 
    padding: 2px 8px; 
    border-radius: 10px; 
    font-size: 11px; 
    font-weight: var(--font-weight-bold); 
    min-width: 20px; 
    text-align: center; 
    line-height: 1.4;
}
.badge.urgent { background: var(--danger); animation: pulse 2s infinite; }

/* Status Badges */
.badge-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-active, .badge-instock { background: var(--success-bg); color: #15803d; }
.badge-inactive, .badge-outstock { background: var(--danger-bg); color: #991b1b; }
.badge-lowstock { background: var(--warning-bg); color: #92400e; }
.badge-role { background: rgba(27,116,228,0.1); color: var(--primary); }

/* Stock Badges */
.stock-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.stock-badge.stock-in { background: #E8F8ED; color: var(--ios-green); }
.stock-badge.stock-low { background: #FFF3E0; color: var(--ios-orange); }
.stock-badge.stock-out { background: #FFE5E5; color: var(--ios-red); }

/* iOS Badges */
.ios-badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 12px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.ios-badge.blue { background: #E8F2FF; color: var(--ios-blue); }
.ios-badge.orange { background: #FFF3E0; color: var(--ios-orange); }
.ios-badge.green { background: #E8F8ED; color: var(--ios-green); }
.ios-badge.purple { background: #F3E8FF; color: var(--ios-purple); }
.ios-badge.red { background: #FFE5E5; color: var(--ios-red); }
.ios-badge.gray { background: var(--ios-fill); color: var(--ios-text-secondary); }

.ios-pill {
    display: inline-flex; padding: 2px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 600; text-transform: uppercase; white-space: nowrap;
}
.ios-pill.paid { background: #E8F8ED; color: var(--ios-green); }
.ios-pill.pending { background: #FFF3E0; color: var(--ios-orange); }
.ios-pill.cod { background: #E8F2FF; color: var(--ios-blue); }

/* Payment Status */
.payment-status { 
    padding: 2px 10px; 
    border-radius: 20px; 
    font-size: 11px; 
    font-weight: var(--font-weight-semibold); 
    text-transform: uppercase;
}
.payment-paid { background: var(--success-bg); color: var(--success); }
.payment-pending { background: var(--warning-bg); color: #92400e; }
.payment-cod { background: var(--info-bg); color: var(--primary); }

/* Status Badges (Order) */
.status { 
    padding: var(--space-1) var(--space-3); 
    border-radius: 20px; 
    font-size: 12px; 
    font-weight: var(--font-weight-semibold); 
    display: inline-flex; 
    align-items: center;
    gap: 4px;
    text-transform: uppercase; 
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.status-confirmed { background: var(--info-bg); color: var(--primary); }
.status-preparing { background: var(--warning-bg); color: #92400e; }
.status-ready { background: var(--success-bg); color: var(--success); }
.status-delivering { background: var(--purple-bg); color: var(--purple); }
.status-delivered { background: var(--success-bg); color: #059669; }
.status-cancelled { background: var(--danger-bg); color: var(--danger); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ==================== GATEWAY & SEGMENTED TABS ==================== */
.gateway-tabs, .segmented-wrapper {
    display: flex; gap: 4px;
    padding: 8px 16px;
    background: var(--ios-card);
    border-bottom: 0.5px solid var(--ios-separator);
    position: sticky; top: 60px; z-index: 99;
}
.segmented-scroll {
    display: flex; gap: 4px; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.segmented-scroll::-webkit-scrollbar { display: none; }

.gateway-tab, .segment-item {
    flex: 1;
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px; font-weight: 500;
    color: var(--ios-text-secondary);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    border: 1px solid var(--ios-separator);
    font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    white-space: nowrap;
}
.gateway-tab:active, .segment-item:active { transform: scale(0.96); }
.gateway-tab.active, .segment-item.active {
    background: var(--ios-text); color: white; border-color: var(--ios-text);
    font-weight: 600;
}

.tab-badge, .segment-badge {
    background: var(--ios-red); color: white;
    padding: 1px 7px; border-radius: 10px;
    font-size: 10px; font-weight: 600;
    min-width: 18px; text-align: center;
}
.gateway-tab.active .tab-badge, .segment-item.active .segment-badge { background: rgba(255,255,255,0.3); color: white; }
.segment-item:not(.active) .segment-badge { background: var(--ios-fill-secondary); color: var(--ios-text-secondary); }
.segment-badge.urgent { background: var(--ios-red); color: white; animation: badgePulse 2s infinite; }

@keyframes badgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

/* ==================== LEGACY TABS ==================== */
.tabs { 
    background: var(--card); 
    padding: 0 var(--space-4); 
    display: flex; 
    gap: 0; 
    border-bottom: 1px solid var(--border); 
    overflow-x: auto; 
    scrollbar-width: none;
    position: sticky;
    top: 52px;
    z-index: 99;
}
.tabs::-webkit-scrollbar { display: none; }
.tab { 
    padding: var(--space-3) var(--space-4); 
    cursor: pointer; 
    font-weight: var(--font-weight-medium); 
    font-size: var(--font-sm); 
    color: var(--text-secondary); 
    border-bottom: 3px solid transparent; 
    margin-bottom: -1px; 
    white-space: nowrap; 
    transition: all 0.2s ease; 
    display: flex; 
    align-items: center; 
    gap: var(--space-2);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab:hover { color: var(--text); background: var(--hover-bg); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: var(--font-weight-semibold); }

/* ==================== OVERVIEW & STATS ==================== */
.overview-row, .stats-row {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; padding: 12px 16px;
}
.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); 
    gap: var(--space-3); 
    padding: var(--space-4); 
}

.overview-tile, .stat-tile {
    background: var(--ios-card); border-radius: var(--radius-md);
    padding: 12px 8px; text-align: center;
    cursor: pointer; transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.stat-card { 
    background: var(--card); 
    padding: var(--space-4); 
    border-radius: var(--radius-lg); 
    box-shadow: var(--shadow-xs); 
    cursor: pointer; 
    transition: all 0.2s ease; 
    display: flex; 
    align-items: center; 
    gap: var(--space-3);
    border: 1px solid transparent;
}
.overview-tile:active, .stat-tile:active { transform: scale(0.96); }
.stat-card:hover { 
    box-shadow: var(--shadow-sm); 
    transform: translateY(-1px); 
    border-color: var(--border);
}

.overview-tile h4, .stat-tile h4 {
    font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
    margin-bottom: 2px;
}
.overview-tile p, .stat-tile p {
    font-size: 10px; color: var(--ios-text-secondary);
    text-transform: uppercase; font-weight: 500;
}

/* Overview tile colors */
.overview-tile.new h4, .overview-tile.out h4 { color: var(--ios-red); }
.overview-tile.preparing h4, .overview-tile.low h4 { color: var(--ios-orange); }
.overview-tile.ready h4, .overview-tile.active h4 { color: var(--ios-green); }
.overview-tile.delivered h4 { color: var(--ios-purple); }
.overview-tile.total h4, .overview-tile.daily h4 { color: var(--ios-blue); }
.overview-tile.weekly h4 { color: var(--ios-purple); }

/* Stat card borders */
.stat-card.confirmed { border-left: 4px solid var(--primary); }
.stat-card.preparing { border-left: 4px solid var(--warning); }
.stat-card.ready { border-left: 4px solid var(--success); }
.stat-card.delivered { border-left: 4px solid var(--purple); }
.stat-card.revenue { border-left: 4px solid var(--text); }
.stat-info h3 { font-size: var(--font-2xl); font-weight: var(--font-weight-bold); line-height: 1.1; }
.stat-info p { color: var(--text-secondary); font-size: var(--font-sm); font-weight: var(--font-weight-medium); }

.stat-icon-circle {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 8px; font-size: 18px;
}

/* ==================== CONTENT ==================== */
.content { 
    padding: var(--space-4); 
    max-width: 960px; 
    margin: 0 auto; 
}
.content { padding: 16px; max-width: 800px; margin: 0 auto; } /* iOS override */

/* ==================== SEARCH & FILTERS ==================== */
.filters-bar { 
    display: flex; 
    gap: var(--space-2); 
    margin-bottom: var(--space-4); 
    flex-wrap: wrap; 
    align-items: center; 
}
.filter-row {
    display: flex; gap: 8px; margin-bottom: 16px; align-items: center;
}

.search-box { 
    padding: var(--space-3) var(--space-4); 
    border: 1px solid var(--border); 
    border-radius: var(--radius-md); 
    outline: none; 
    font-size: var(--font-base); 
    min-width: 200px; 
    background: var(--input-bg); 
    flex: 1; 
    transition: all 0.2s ease;
}
.search-box:focus { 
    border-color: var(--primary); 
    background: var(--card); 
    box-shadow: 0 0 0 3px rgba(27,116,228,0.1);
}

.search-wrapper { position: relative; flex: 1; min-width: 120px; }
.search-input {
    width: 100%; padding: 10px 16px 10px 36px;
    border: none; border-radius: 10px; outline: none;
    font-size: 15px; background: var(--ios-fill); color: var(--ios-text);
    font-family: inherit; transition: all 0.2s;
}
.search-input:focus { background: var(--ios-card); box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15); }
.search-icon {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--ios-text-secondary); font-size: 14px; pointer-events: none;
}

.filter-select { 
    padding: var(--space-3) var(--space-4); 
    border: 1px solid var(--border); 
    border-radius: var(--radius-md); 
    outline: none; 
    font-size: var(--font-sm); 
    background: var(--card); 
    cursor: pointer;
}
.filter-select-ios {
    padding: 8px 28px 8px 12px;
    border: 1px solid var(--ios-separator); border-radius: 10px;
    font-size: 13px; font-weight: 500; background: var(--ios-card);
    color: var(--ios-text); font-family: inherit;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238E8E93' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    cursor: pointer; outline: none; min-width: 90px;
}
.filter-select-ios:focus { box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15); }

.date-chips { display: flex; gap: 4px; flex: 1; justify-content: flex-end; }
.filter-chip {
    padding: 7px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 500;
    background: var(--ios-card); color: var(--ios-text);
    border: 1px solid var(--ios-separator);
    cursor: pointer; transition: all 0.15s;
    white-space: nowrap; font-family: inherit;
}
.filter-chip:active { transform: scale(0.96); }
.filter-chip.active { background: var(--ios-blue); color: white; border-color: var(--ios-blue); }

/* ==================== TABLE ==================== */
.table-container { overflow-x: auto; border-radius: var(--radius-lg); }
.table-wrapper {
    background: var(--ios-card); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: separate; border-spacing: 0; }
th { 
    background: var(--input-bg); 
    font-weight: var(--font-weight-semibold); 
    font-size: 12px; 
    text-transform: uppercase; 
    color: var(--text-secondary); 
    letter-spacing: 0.5px; 
    padding: var(--space-3) var(--space-4); 
    text-align: left; 
    border-bottom: 1px solid var(--border);
}
th:first-child { border-radius: var(--radius-lg) 0 0 0; }
th:last-child { border-radius: 0 var(--radius-lg) 0 0; }
td { 
    padding: var(--space-3) var(--space-4); 
    font-size: var(--font-sm); 
    border-bottom: 1px solid var(--border-light); 
    color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--hover-bg); }
tr.urgent-row td { background: #fff9f0; }

.table-header {
    display: grid; 
    grid-template-columns: 1fr 0.6fr 0.8fr 0.7fr 0.8fr 0.8fr 0.6fr;
    padding: 10px 16px; background: var(--ios-fill);
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: var(--ios-text-secondary); letter-spacing: 0.5px;
    border-bottom: 1px solid var(--ios-separator);
}
.table-row {
    display: grid; 
    grid-template-columns: 1fr 0.6fr 0.8fr 0.7fr 0.8fr 0.8fr 0.6fr;
    padding: 14px 16px; align-items: center; font-size: 14px;
    border-bottom: 0.5px solid var(--ios-separator); transition: background 0.15s;
}
.table-row:last-child { border-bottom: none; }
.table-row:active { background: var(--ios-fill); }
.table-row.urgent { background: #FFF5F5; }

/* ==================== CARDS ==================== */
.card { 
    background: var(--card); 
    border-radius: var(--radius-lg); 
    box-shadow: var(--shadow-xs); 
    overflow: hidden;
}
.card-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: var(--space-4); 
    border-bottom: 1px solid var(--border-light);
}
.card-header h2 { font-size: var(--font-lg); font-weight: var(--font-weight-bold); }
.card-header h3 { font-size: var(--font-base); font-weight: var(--font-weight-semibold); }

/* Nav Cards */
.cards-container {
    padding: 16px; max-width: 800px; margin: 0 auto;
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.nav-card {
    background: var(--ios-card); border-radius: var(--radius-lg);
    padding: 20px 16px; text-align: center; cursor: pointer;
    transition: all 0.2s; text-decoration: none; color: var(--ios-text);
    box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.nav-card:active { transform: scale(0.96); }
.nav-card .card-icon {
    width: 48px; height: 48px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.nav-card .card-icon.blue { background: #E8F2FF; }
.nav-card .card-icon.green { background: #E8F8ED; }
.nav-card .card-icon.purple { background: #F3E8FF; }
.nav-card .card-icon.orange { background: #FFF3E0; }
.nav-card h3 { font-size: 14px; font-weight: 600; }
.nav-card p { font-size: 11px; color: var(--ios-text-secondary); }

/* Mobile Order Cards */
.order-cards { display: none; }
.order-card, .order-card-ios {
    background: var(--card); border-radius: var(--radius-lg);
    margin-bottom: var(--space-3); padding: 16px;
    box-shadow: var(--shadow-xs); overflow: hidden;
    border: 1px solid var(--border); cursor: pointer;
    transition: box-shadow 0.2s ease;
}
.order-card:active, .order-card-ios:active { transform: scale(0.99); }
.order-card.urgent, .order-card-ios.urgent { border-left: 4px solid var(--danger); }
.order-card-ios.grouped { border-left: 4px solid var(--ios-blue); }

.card-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.card-detail { background: var(--ios-fill); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.card-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; border-top: 0.5px solid var(--ios-separator); }

/* ==================== PRODUCT CARDS ==================== */
.product-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); 
    gap: var(--space-3); 
}
.product-card { 
    background: var(--card); 
    border-radius: var(--radius-lg); 
    padding: var(--space-4); 
    box-shadow: var(--shadow-xs); 
    border: 1px solid var(--border); 
    transition: all 0.2s ease;
    display: flex; flex-direction: column;
}
.product-card:hover { 
    box-shadow: var(--shadow-md); 
    transform: translateY(-2px); 
}
.product-card:active { transform: scale(0.98); }
.product-card img { 
    width: 100%; 
    height: 140px; 
    object-fit: cover; 
    border-radius: var(--radius-sm); 
    margin-bottom: var(--space-3); 
    background: var(--input-bg); 
}
.product-card .no-image {
    width: 100%; height: 140px;
    background: var(--ios-fill); border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--ios-text-secondary); font-size: 32px;
}
.product-card h3 { font-size: 14px; font-weight: 600; margin: 8px 0 4px; line-height: 1.3; }
.product-card .brand { color: var(--primary); font-size: 12px; font-weight: 500; margin-bottom: 4px; }
.product-card .price { font-size: var(--font-lg); font-weight: var(--font-weight-bold); margin: var(--space-2) 0 6px; }
.product-card .discount { color: var(--danger); font-size: 13px; text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.product-card .product-meta { 
    display: flex; gap: var(--space-2); align-items: center; 
    margin: var(--space-2) 0; flex-wrap: wrap; 
}
.product-card .actions { 
    display: flex; gap: var(--space-2); margin-top: auto; 
    padding-top: var(--space-3); 
}
.product-card .actions .btn { flex: 1; justify-content: center; }

/* ==================== BUTTONS ==================== */
.btn { 
    border: none; 
    padding: var(--space-3) var(--space-4); 
    border-radius: var(--radius-md); 
    cursor: pointer; 
    font-weight: var(--font-weight-semibold); 
    font-size: var(--font-sm); 
    display: inline-flex; 
    align-items: center; 
    gap: var(--space-2);
    transition: all 0.15s ease; 
    background: var(--input-bg); 
    color: var(--text);
    white-space: nowrap;
    line-height: 1;
    text-decoration: none;
}
.btn:hover { background: #e4e6e9; transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn i { font-size: 14px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #2a8c3e; }
.btn-warning { background: var(--warning); color: #1c1e21; }
.btn-warning:hover { background: #e8960a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c71a32; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: var(--primary-hover); }

.btn-sm { padding: var(--space-2) var(--space-3); font-size: 12px; }
.btn-sm i { font-size: 12px; }
.btn-xs { padding: var(--space-1) var(--space-2); font-size: 11px; }
.btn-xs i { font-size: 11px; }
.btn-lg { 
    padding: var(--space-3) var(--space-5); 
    font-size: var(--font-base); 
    width: 100%; 
    justify-content: center; 
    border-radius: var(--radius-md); 
    font-weight: var(--font-weight-bold);
}

.btn-logout { 
    background: transparent; 
    color: var(--text); 
    padding: var(--space-2) var(--space-3); 
    border-radius: var(--radius-md); 
    border: 1px solid var(--border); 
    cursor: pointer; 
    font-weight: var(--font-weight-medium); 
    font-size: var(--font-sm); 
    transition: all 0.15s ease;
}
.btn-logout:hover { background: var(--input-bg); }

/* iOS Buttons */
.btn-ios {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 4px; padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 600; border: none; cursor: pointer;
    transition: all 0.2s; font-family: inherit; min-height: 32px;
    text-decoration: none; white-space: nowrap;
}
.btn-ios:active { transform: scale(0.96); }
.btn-ios.primary { background: var(--ios-blue); color: white; }
.btn-ios.success { background: var(--ios-green); color: white; }
.btn-ios.warning { background: var(--ios-orange); color: white; }
.btn-ios.danger { background: var(--ios-red); color: white; }
.btn-ios.ghost { background: transparent; color: var(--ios-blue); }
.btn-ios.gray { background: var(--ios-fill); color: var(--ios-text); }
.btn-ios.small { padding: 4px 10px; font-size: 11px; min-height: 26px; border-radius: 14px; }
.btn-ios.block { width: 100%; justify-content: center; padding: 12px; font-size: 15px; border-radius: 14px; }

.btn-refresh {
    padding: 8px 12px; border-radius: 20px;
    font-size: 13px; font-weight: 500; background: var(--ios-blue);
    color: white; border: none; cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; gap: 4px;
    flex-shrink: 0; white-space: nowrap;
}
.btn-refresh:active { transform: scale(0.96); }

/* ==================== LOGIN ==================== */
.login-container { 
    max-width: 400px; 
    margin: 60px auto; 
    background: var(--card); 
    padding: var(--space-8); 
    border-radius: var(--radius-xl); 
    text-align: center; 
    box-shadow: var(--shadow-lg); 
}
.login-icon { font-size: 48px; margin-bottom: var(--space-3); }
.login-container h2 { font-size: var(--font-2xl); margin-bottom: var(--space-1); }
.login-container p { color: var(--text-secondary); font-size: var(--font-sm); margin-bottom: var(--space-6); }

/* iOS Login */
.login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 1000;
    display: none; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
}
.login-overlay.show { display: flex; }
.login-card {
    background: var(--ios-card); padding: 32px 24px;
    border-radius: var(--radius-lg); text-align: center;
    max-width: 360px; width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-card .login-icon {
    width: 72px; height: 72px; border-radius: 18px;
    background: linear-gradient(135deg, #FF9500, #FF2D55);
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; margin: 0 auto 16px;
}
.login-card h2 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.login-card p { color: var(--ios-text-secondary); margin-bottom: 24px; font-size: 14px; }

/* ==================== MODAL ==================== */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 1000; 
    align-items: center; 
    justify-content: center; 
    padding: var(--space-4); 
}
.modal.show { display: flex; }
.modal-content { 
    background: var(--card); 
    width: 100%; 
    max-width: 540px; 
    border-radius: var(--radius-xl); 
    max-height: 85vh; 
    overflow-y: auto; 
    box-shadow: var(--shadow-xl);
}
.modal-content h3 { font-size: var(--font-lg); font-weight: var(--font-weight-bold); margin-bottom: var(--space-4); }

/* Sheet Modal */
.modal-sheet {
    display: none; position: fixed; top: 0; left: 0;
    width: 100%; height: 100%; background: rgba(0, 0, 0, 0.4);
    z-index: 1000; align-items: flex-end; justify-content: center;
}
.modal-sheet.show { display: flex; }
.sheet-content {
    background: var(--ios-card); width: 100%; max-width: 600px;
    max-height: 85vh; border-radius: 20px 20px 0 0;
    overflow-y: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    animation: sheetUp 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 36px; height: 5px; background: var(--ios-fill-secondary); border-radius: 3px; margin: 12px auto 8px; }
.sheet-header { padding: 8px 20px 16px; border-bottom: 0.5px solid var(--ios-separator); display: flex; justify-content: space-between; align-items: center; }
.sheet-body { padding: 16px 20px 32px; }
.sheet-section { background: var(--ios-fill); border-radius: 12px; padding: 14px; margin-bottom: 12px; }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: var(--space-3); }
.form-group label { 
    display: block; 
    margin-bottom: var(--space-1); 
    font-weight: var(--font-weight-semibold); 
    font-size: 11px; 
    text-transform: uppercase; 
    color: var(--text-secondary); 
}
.form-group input, 
.form-group select, 
.form-group textarea { 
    width: 100%; 
    padding: var(--space-3) var(--space-4); 
    border: 2px solid var(--border); 
    border-radius: var(--radius-sm); 
    outline: none; 
    font-size: var(--font-sm); 
    font-family: inherit; 
    background: var(--card); 
    color: var(--text); 
    transition: border-color 0.2s ease;
}
.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 3px rgba(27,116,228,0.1); 
}
.form-group input:disabled,
.form-group textarea:disabled { 
    background: var(--input-bg); 
    opacity: 0.7; 
}
.form-row { display: flex; gap: var(--space-3); }
.form-row .form-group { flex: 1; }

/* iOS Form overrides */
.form-group input { 
    border: 1px solid var(--ios-separator); border-radius: 10px;
    font-size: 15px; background: var(--ios-card);
}
.form-group input:focus { 
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15); border-color: var(--ios-blue); 
}

/* ==================== TIMELINE ==================== */
.timeline { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    padding: var(--space-3) 0; 
}
.timeline-dot { 
    width: 12px; height: 12px; 
    border-radius: var(--radius-full); 
    background: var(--border); 
    flex-shrink: 0; 
}
.timeline-dot.active { background: var(--primary); box-shadow: 0 0 0 4px rgba(27,116,228,0.2); }
.timeline-dot.done { background: var(--success); }
.timeline-line { 
    flex: 1; 
    height: 2px; 
    background: var(--border); 
    margin: 0 2px; 
}
.timeline-line.done { background: var(--success); }

/* iOS Timeline */
.timeline-ios { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; }
.timeline-dot-ios {
    width: 14px; height: 14px; border-radius: 50%; background: var(--ios-fill-secondary);
    border: 3px solid var(--ios-card); box-shadow: 0 0 0 2px var(--ios-fill-secondary);
    z-index: 1; transition: all 0.3s;
}
.timeline-dot-ios.active { background: var(--ios-blue); box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.2); animation: dotPulse 2s infinite; }
.timeline-dot-ios.done { background: var(--ios-green); box-shadow: 0 0 0 2px var(--ios-green); }
@keyframes dotPulse { 0%,100%{box-shadow:0 0 0 4px rgba(0,122,255,0.2)} 50%{box-shadow:0 0 0 8px rgba(0,122,255,0.1)} }
.timeline-line-ios { flex: 1; height: 2px; background: var(--ios-fill-secondary); margin: 0 -2px; transition: all 0.3s; }
.timeline-line-ios.done { background: var(--ios-green); }

/* ==================== TOAST ==================== */
.toast { 
    position: fixed; 
    bottom: 20px; 
    left: 50%; 
    transform: translateX(-50%); 
    padding: var(--space-3) var(--space-5); 
    border-radius: var(--radius-lg); 
    color: #fff; 
    z-index: 9999; 
    font-weight: var(--font-weight-semibold); 
    font-size: var(--font-sm); 
    box-shadow: var(--shadow-lg); 
    white-space: nowrap;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--text); }
.toast.warning { background: var(--warning); color: #1c1e21; }

/* ==================== LOADING ==================== */
.loading-overlay { 
    position: fixed; top: 0; left: 0; 
    width: 100%; height: 100%; 
    background: rgba(255,255,255,0.9); 
    z-index: 9998; 
    display: none; 
    align-items: center; 
    justify-content: center; 
    flex-direction: column; 
    gap: var(--space-3); 
}
.loading-overlay.show { display: flex; }
.spinner { 
    width: 32px; height: 32px; 
    border: 3px solid var(--border); 
    border-top-color: var(--primary); 
    border-radius: var(--radius-full); 
    animation: spin 0.6s linear infinite; 
}
.spinner-ios {
    width: 32px; height: 32px;
    border: 3px solid var(--ios-fill-secondary); border-top-color: var(--ios-blue);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== ALERT BAR ==================== */
.alert-bar { 
    background: var(--danger); 
    color: #fff; 
    padding: var(--space-3) var(--space-4); 
    text-align: center; 
    font-weight: var(--font-weight-semibold); 
    font-size: var(--font-sm); 
    cursor: pointer; 
    display: none; 
}
.alert-bar.show { display: block; }

.alert-banner {
    background: var(--ios-blue); color: white;
    padding: 10px 16px; text-align: center;
    font-size: 14px; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.alert-banner.show { display: flex; }
.alert-badge {
    background: rgba(255,255,255,0.25);
    padding: 2px 8px; border-radius: 10px;
    font-size: 12px; font-weight: 600;
}

/* ==================== PERMISSION NOTICE ==================== */
.permission-notice { 
    background: #fef9e7; 
    border: 1px solid #fde68a; 
    padding: var(--space-3) var(--space-4); 
    border-radius: var(--radius-sm); 
    font-size: 12px; 
    color: #92400e; 
    margin: 12px 16px 0; 
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.permission-notice i { margin-right: var(--space-1); }

/* ==================== EMPTY STATE ==================== */
.empty-state { 
    text-align: center; 
    padding: var(--space-8) var(--space-4); 
    color: var(--text-muted); 
    grid-column: 1 / -1;
}
.empty-state i { font-size: 48px; margin-bottom: var(--space-3); color: var(--border); display: block; }
.empty-state h3 { font-size: var(--font-lg); font-weight: var(--font-weight-semibold); margin-bottom: var(--space-1); }
.empty-state p { font-size: var(--font-sm); }

/* ==================== MESSAGE ==================== */
.message { 
    padding: var(--space-3); 
    border-radius: var(--radius-sm); 
    margin-top: var(--space-3); 
    font-size: 13px; 
}
.message.success { background: var(--success-bg); color: #15803d; border: 1px solid #bbf7d0; }
.message.error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }
.message.info { background: var(--info-bg); color: var(--primary); border: 1px solid #b8d4f0; }

/* ==================== IMAGES ==================== */
.product-img { 
    width: 50px; 
    height: 50px; 
    object-fit: cover; 
    border-radius: var(--radius-sm); 
    background: var(--input-bg); 
}
.product-img-lg { 
    width: 100%; 
    height: 140px; 
    object-fit: cover; 
    border-radius: var(--radius-sm); 
    background: var(--input-bg); 
}
.brand-logo { 
    width: 40px; 
    height: 40px; 
    object-fit: contain; 
    border-radius: var(--radius-sm); 
    background: var(--input-bg); 
    padding: 2px; 
}

/* ==================== PWA ==================== */
#pwa-install-btn {
    display: none; position: fixed;
    bottom: calc(20px + var(--safe-bottom));
    left: 50%; transform: translateX(-50%);
    background: var(--ios-blue); color: white;
    padding: 12px 24px; border-radius: 25px;
    cursor: pointer; z-index: 9999;
    font-size: 14px; font-weight: 600;
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
}

/* ==================== RESPONSIVE ==================== */
/* Tablet: 600px - 1024px */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
    .content { padding: var(--space-3); }
    .header { padding: var(--space-3); }
    .header h1 { font-size: var(--font-base); }
    .tabs { padding: 0 var(--space-3); }
    .tab { padding: var(--space-3); font-size: 12px; }
}

/* Mobile: 0 - 768px */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); padding: var(--space-3); }
    .stat-card { padding: var(--space-3); }
    .stat-info h3 { font-size: var(--font-xl); }
    
    .table-container { display: none; }
    .table-wrapper { display: none; }
    .order-cards { display: block; }
    
    .header { padding: var(--space-2) var(--space-3); }
    .header h1 { font-size: var(--font-base); }
    .tabs { padding: 0 var(--space-2); top: 48px; }
    .tab { padding: var(--space-2) var(--space-3); font-size: 12px; gap: var(--space-1); }
    .tab .badge { font-size: 10px; padding: 1px 6px; min-width: 16px; }
    
    .content { padding: var(--space-3); }
    .filters-bar { flex-direction: column; gap: var(--space-2); }
    .search-box { width: 100%; min-width: unset; }
    .filter-select { width: 100%; }
    
    .modal-content { max-width: 100%; margin: 0; border-radius: var(--radius-lg); }
    
    .login-container { margin: var(--space-8) var(--space-3); padding: var(--space-6) var(--space-4); }
    .login-container h2 { font-size: var(--font-xl); }
    
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .btn-xs { min-height: 32px; }
    
    .order-card { border-radius: var(--radius-lg); }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .form-row { flex-direction: column; }
    
    .overview-row { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .overview-tile h4 { font-size: 17px; }
    .filter-select-ios { min-width: 75px; font-size: 12px; }
    .table-header, .table-row { grid-template-columns: 1fr 0.5fr 0.7fr 0.6fr 0.7fr 0.7fr 0.5fr; font-size: 12px; }
}

/* Small phones */
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--space-1); }
    .stat-card { padding: var(--space-2); }
    .stat-info h3 { font-size: var(--font-lg); }
    .stat-info p { font-size: 11px; }
    .tabs { padding: 0 var(--space-1); }
    .tab { padding: var(--space-2); font-size: 11px; }
    
    .cards-container { gap: 10px; padding: 12px; }
    .nav-card { padding: 16px 12px; }
    .overview-row { grid-template-columns: repeat(2, 1fr); }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .product-card { padding: 8px; }
    .product-card h3 { font-size: 12px; }
    .segment-item { padding: 6px 10px; font-size: 11px; }
}