@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

/* ==========================================================================
   idiibi POS Cloud — Professional Design System v2
   Dark / Light modes · Animations · Full branding
   ========================================================================== */

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --brand-h: 181;
    --brand-s: 95%;
    --brand-l: 27%;
    --brand:          hsl(var(--brand-h), var(--brand-s), var(--brand-l));
    --brand-light:    hsl(var(--brand-h), var(--brand-s), 38%);
    --brand-dark:     hsl(var(--brand-h), var(--brand-s), 18%);
    --brand-xlight:   hsl(var(--brand-h), var(--brand-s), 55%);
    --brand-glow:     hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.28);
    --brand-glow-lg:  hsla(var(--brand-h), var(--brand-s), var(--brand-l), 0.15);
    --brand-gradient: linear-gradient(135deg, hsl(181,95%,27%), hsl(190,80%,35%));
    --brand-gradient-v: linear-gradient(180deg, hsl(181,95%,27%) 0%, hsl(190,80%,20%) 100%);

    /* Semantic */
    --success:      #10b981;
    --success-light:#34d399;
    --success-bg:   rgba(16,185,129,0.12);
    --success-border:rgba(16,185,129,0.3);
    --warning:      #f59e0b;
    --warning-light:#fbbf24;
    --warning-bg:   rgba(245,158,11,0.12);
    --warning-border:rgba(245,158,11,0.3);
    --danger:       #ef4444;
    --danger-light: #f87171;
    --danger-bg:    rgba(239,68,68,0.12);
    --danger-border:rgba(239,68,68,0.3);
    --info:         #3b82f6;
    --info-light:   #60a5fa;
    --info-bg:      rgba(59,130,246,0.12);
    --info-border:  rgba(59,130,246,0.3);

    /* Typography */
    --font-en: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-ar: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font: var(--font-en);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    /* Radii */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out:    cubic-bezier(0, 0, 0.2, 1);
    --t-fast: 0.15s;
    --t-base: 0.25s;
    --t-slow: 0.4s;
}

/* ── Dark Mode (default) ────────────────────────────────────────────────── */
:root,
[data-theme="dark"] {
    --bg-page:     #080f11;
    --bg-surface:  #0d1a1d;
    --bg-elevated: #122124;
    --bg-overlay:  #162829;
    --bg-input:    rgba(255,255,255,0.05);
    --bg-input-focus: rgba(3,131,135,0.08);
    --bg-hover:    rgba(255,255,255,0.04);
    --bg-active:   rgba(3,131,135,0.12);

    --glass-bg:    rgba(13,26,29,0.75);
    --glass-blur:  blur(20px) saturate(1.4);

    --border:       rgba(3,131,135,0.15);
    --border-subtle:rgba(255,255,255,0.06);
    --border-strong:rgba(3,131,135,0.35);
    --border-focus: var(--brand);

    --text-primary:   #f0f6f7;
    --text-secondary: #8da8ad;
    --text-muted:     #4d6b70;
    --text-inverse:   #080f11;
    --text-brand:     var(--brand-xlight);

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow:     0 4px 16px rgba(0,0,0,0.45), 0 2px 6px rgba(0,0,0,0.3);
    --shadow-md:  0 8px 30px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.35);
    --shadow-lg:  0 20px 60px rgba(0,0,0,0.55), 0 8px 24px rgba(0,0,0,0.4);
    --shadow-brand: 0 4px 20px var(--brand-glow);
    --shadow-brand-lg: 0 8px 40px var(--brand-glow);

    --scrollbar-track: #0d1a1d;
    --scrollbar-thumb: #1e3c40;

    color-scheme: dark;
}

/* ── Light Mode ─────────────────────────────────────────────────────────── */
[data-theme="light"] {
    --bg-page:     #f0f5f5;
    --bg-surface:  #ffffff;
    --bg-elevated: #f8fbfb;
    --bg-overlay:  #eef4f4;
    --bg-input:    rgba(0,0,0,0.03);
    --bg-input-focus: rgba(3,131,135,0.06);
    --bg-hover:    rgba(3,131,135,0.05);
    --bg-active:   rgba(3,131,135,0.1);

    --glass-bg:    rgba(255,255,255,0.82);
    --glass-blur:  blur(20px) saturate(1.2);

    --border:       rgba(3,131,135,0.18);
    --border-subtle:rgba(0,0,0,0.08);
    --border-strong:rgba(3,131,135,0.4);
    --border-focus: var(--brand);

    --text-primary:   #0d2426;
    --text-secondary: #3d6467;
    --text-muted:     #7fa5a9;
    --text-inverse:   #f0f6f7;
    --text-brand:     var(--brand);

    --shadow-sm:  0 1px 3px rgba(0,80,90,0.08), 0 1px 2px rgba(0,80,90,0.05);
    --shadow:     0 4px 16px rgba(0,80,90,0.1), 0 2px 6px rgba(0,80,90,0.06);
    --shadow-md:  0 8px 30px rgba(0,80,90,0.12), 0 4px 12px rgba(0,80,90,0.08);
    --shadow-lg:  0 20px 60px rgba(0,80,90,0.15), 0 8px 24px rgba(0,80,90,0.1);
    --shadow-brand: 0 4px 20px var(--brand-glow);
    --shadow-brand-lg: 0 8px 40px var(--brand-glow);

    --scrollbar-track: #eef4f4;
    --scrollbar-thumb: #b0d0d3;

    color-scheme: light;
}

html[dir="rtl"] { --font: var(--font-ar); }

/* ── Backward-compatibility aliases (old var names → new) ───────────────── */
:root,
[data-theme="dark"],
[data-theme="light"] {
    --primary:          var(--brand);
    --primary-light:    var(--brand-light);
    --primary-dark:     var(--brand-dark);
    --primary-glow:     var(--brand-glow);
    --bg-dark:          var(--bg-page);
    --bg-card:          var(--glass-bg);
    --bg-card-hover:    var(--bg-hover);
    --bg-header:        var(--glass-bg);
    --border-color:     var(--border);
    --border-color-glow:var(--border-strong);
    --text-white:       var(--text-primary);
    --text-gray-100:    var(--text-primary);
    --text-gray-300:    var(--text-primary);
    --text-gray-400:    var(--text-secondary);
    --text-gray-500:    var(--text-muted);
    --text-gray-600:    var(--text-muted);
    --font-family:      var(--font);
}

/* ── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--t-slow) var(--ease-smooth),
                color var(--t-slow) var(--ease-smooth);
}

/* Background grid texture */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* Ambient orbs */
body::after {
    content: '';
    position: fixed;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--brand-glow-lg) 0%, transparent 70%);
    top: -200px; inset-inline-end: -100px;
    pointer-events: none;
    z-index: 0;
}

/* ── Glass Surface ──────────────────────────────────────────────────────── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
    transition: border-color var(--t-base) var(--ease-smooth),
                box-shadow var(--t-base) var(--ease-smooth),
                background var(--t-base) var(--ease-smooth);
}
.glass:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

/* Legacy alias — same properties as .glass */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    position: relative;
    z-index: 1;
    transition: border-color var(--t-base) var(--ease-smooth),
                box-shadow var(--t-base) var(--ease-smooth);
}
.glass-panel:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1 { font-size: clamp(20px, 3vw, 26px); font-weight: 800; line-height: 1.2; color: var(--text-primary); }
h2 { font-size: clamp(17px, 2.5vw, 22px); font-weight: 700; line-height: 1.25; color: var(--text-primary); }
h3 { font-size: clamp(15px, 2vw, 18px); font-weight: 700; line-height: 1.3; color: var(--text-primary); }
h4 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
h5 { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
p  { color: var(--text-secondary); line-height: 1.65; }

.text-brand   { color: var(--text-brand); }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 16px; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }

.gradient-text {
    background: var(--brand-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 9px 20px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 13.5px;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    transition:
        background var(--t-base) var(--ease-smooth),
        border-color var(--t-base) var(--ease-smooth),
        color var(--t-base) var(--ease-smooth),
        transform var(--t-fast) var(--ease-smooth),
        box-shadow var(--t-base) var(--ease-smooth);
    -webkit-user-select: none;
    user-select: none;
}

/* Ripple effect */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(255,255,255,0.08);
    opacity: 0;
    transition: opacity var(--t-fast);
}
.btn:active::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

/* Primary */
.btn-primary {
    background: var(--brand-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 8px var(--brand-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand);
    filter: brightness(1.1);
}

/* Secondary */
.btn-secondary {
    background: var(--bg-hover);
    border-color: var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: var(--bg-active);
    border-color: var(--brand);
    color: var(--text-brand);
}

/* Danger */
.btn-danger {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-light);
}
.btn-danger:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239,68,68,0.4);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    border-color: var(--brand);
    color: var(--text-brand);
}

/* Success */
.btn-success {
    background: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-light);
}
.btn-success:hover {
    background: var(--success);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16,185,129,0.4);
}

/* Sizes */
.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--radius-md); }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 5px; }

/* Icon button */
.btn-icon {
    padding: 8px;
    width: 34px; height: 34px;
    border-radius: var(--radius);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Loading spinner on button */
.btn.loading::before {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label .required {
    color: var(--danger);
    font-size: 14px;
    line-height: 1;
}

.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    line-height: 1.5;
    transition:
        border-color var(--t-base) var(--ease-smooth),
        background var(--t-base) var(--ease-smooth),
        box-shadow var(--t-base) var(--ease-smooth);
    -webkit-appearance: none;
    appearance: none;
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:hover:not(:focus) {
    border-color: var(--border-strong);
}

.form-control:focus {
    outline: none;
    border-color: var(--brand);
    background: var(--bg-input-focus);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

textarea.form-control { min-height: 90px; resize: vertical; }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23038387' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    padding-inline-end: 36px;
    cursor: pointer;
}
html[dir="rtl"] select.form-control {
    background-position: 12px center;
}

select.form-control option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.form-control.error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.form-control.success { border-color: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-4);
}

.form-help {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}
.form-error {
    font-size: 11.5px;
    color: var(--danger);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Input group */
.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .form-control {
    border-inline-end-radius: 0;
    border-inline-start-radius: var(--radius);
    flex: 1;
}
.input-group .btn {
    border-inline-start-radius: 0;
    border-inline-end-radius: var(--radius);
    border-inline-start: none;
}

/* Checkbox / Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 16px; height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
}
.toggle input { opacity: 0; position: absolute; }
.toggle-track {
    width: 42px; height: 23px;
    background: var(--border-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    transition: background var(--t-base), border-color var(--t-base);
    position: relative;
    flex-shrink: 0;
}
.toggle-track::after {
    content: '';
    position: absolute;
    width: 17px; height: 17px;
    border-radius: 50%;
    background: var(--text-muted);
    top: 2px; inset-inline-start: 2px;
    transition: transform var(--t-base) var(--ease-bounce), background var(--t-base);
}
.toggle input:checked ~ .toggle-track {
    background: var(--brand);
    border-color: var(--brand);
}
.toggle input:checked ~ .toggle-track::after {
    transform: translateX(19px);
    background: #fff;
}
html[dir="rtl"] .toggle input:checked ~ .toggle-track::after {
    transform: translateX(-19px);
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge-primary   { background: var(--brand-glow-lg); color: var(--text-brand); border-color: var(--border-strong); }
.badge-success   { background: var(--success-bg);    color: var(--success-light); border-color: var(--success-border); }
.badge-warning   { background: var(--warning-bg);    color: var(--warning-light); border-color: var(--warning-border); }
.badge-danger    { background: var(--danger-bg);     color: var(--danger-light);  border-color: var(--danger-border); }
.badge-info      { background: var(--info-bg);       color: var(--info-light);    border-color: var(--info-border); }
.badge-secondary { background: var(--bg-hover);      color: var(--text-secondary); border-color: var(--border); }

/* Dot badge */
.badge-dot::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--t-base), border-color var(--t-base), transform var(--t-base) var(--ease-smooth);
    position: relative;
    z-index: 1;
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border);
    transform: translateY(-1px);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: var(--space-6); }
.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}

/* Brand accent strip */
.card-accent {
    border-top: 3px solid var(--brand);
}
.card-accent-success { border-top: 3px solid var(--success); }
.card-accent-warning { border-top: 3px solid var(--warning); }
.card-accent-danger  { border-top: 3px solid var(--danger); }

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(6px) saturate(0.8);
    -webkit-backdrop-filter: blur(6px) saturate(0.8);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}
/* Single unified show state — both dashboard modals and POS receipt use .active */
.modal-overlay.active {
    display: flex;
    animation: overlayIn var(--t-base) var(--ease-out) both;
}
/* Legacy alias: pages that still use hidden/not-hidden pattern */
.modal-overlay:not([class*="hidden"]).modal-open {
    display: flex;
}

.modal-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg), 0 0 80px var(--brand-glow-lg);
    animation: modalIn var(--t-slow) var(--ease-bounce) both;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
}

.modal-box.modal-lg  { max-width: 740px; }
.modal-box.modal-xl  { max-width: 960px; }
.modal-box.modal-sm  { max-width: 400px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    margin: 0;
    color: var(--text-brand);
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.modal-close {
    width: 30px; height: 30px;
    border-radius: var(--radius);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
    flex-shrink: 0;
}
.modal-close:hover {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.modal-footer {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs-nav {
    display: flex;
    gap: 3px;
    background: var(--bg-overlay);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 18px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background var(--t-base) var(--ease-smooth),
        color var(--t-base) var(--ease-smooth),
        box-shadow var(--t-base) var(--ease-smooth);
    font-family: var(--font);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab-btn.active {
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: 0 2px 10px var(--brand-glow);
}

.tab-pane          { display: none; animation: fadeSlideIn 0.25s var(--ease-out); }
.tab-pane.active   { display: block; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.pos-table, table.pos-table {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
}

.pos-table thead th {
    padding: 13px 18px;
    background: var(--bg-overlay);
    color: var(--text-brand);
    font-weight: 700;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.pos-table tbody td {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13.5px;
    color: var(--text-primary);
    vertical-align: middle;
}

.pos-table tbody tr {
    transition: background var(--t-fast);
}
.pos-table tbody tr:hover {
    background: var(--bg-hover);
}
.pos-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── Toast Notifications ────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 24px;
    inset-inline-end: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
    max-width: 380px;
    width: calc(100vw - 48px);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    animation: toastIn 0.4s var(--ease-bounce) both;
    font-size: 13.5px;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

/* Accent line left */
.toast::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
}

.toast-success { border-color: var(--success-border); }
.toast-success::before { background: var(--success); }
.toast-error   { border-color: var(--danger-border); }
.toast-error::before   { background: var(--danger); }
.toast-warning { border-color: var(--warning-border); }
.toast-warning::before { background: var(--warning); }
.toast-info    { border-color: var(--info-border); }
.toast-info::before    { background: var(--info); }

.toast.toast-exit { animation: toastOut 0.3s var(--ease-smooth) forwards; }

.toast-icon { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: 13px; color: var(--text-primary); }
.toast-msg   { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.toast-close {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    font-size: 16px; padding: 0;
    line-height: 1; flex-shrink: 0;
    transition: color var(--t-fast); margin-top: 1px;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
}
.toast-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    font-size: 13.5px;
    border-inline-start: 3px solid;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    animation: fadeSlideIn var(--t-base) var(--ease-out);
}
.alert-success { background: var(--success-bg); border-color: var(--success); color: var(--success-light); }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning-light); }
.alert-danger  { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger-light); }
.alert-info    { background: var(--info-bg);     border-color: var(--info);    color: var(--info-light); }

/* ── Progress Bars ──────────────────────────────────────────────────────── */
.progress {
    width: 100%;
    height: 6px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--brand-gradient);
    border-radius: var(--radius-full);
    transition: width 0.8s var(--ease-smooth);
    position: relative;
}
.progress-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.25) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

/* ── Avatars ────────────────────────────────────────────────────────────── */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    border: 2px solid var(--border);
    letter-spacing: 0.5px;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }
.avatar-xl { width: 64px; height: 64px; font-size: 22px; }

/* ── Dividers ───────────────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: var(--space-5) 0;
}
.divider-brand { border-color: var(--border); }

/* ── Loaders ────────────────────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
.spinner-sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner-lg { width: 30px; height: 30px; border-width: 3px; }

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius);
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.d-flex       { display: flex; }
.d-grid       { display: grid; }
.d-none       { display: none !important; }
.d-block      { display: block; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.flex-shrink-0{ flex-shrink: 0; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.items-end    { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.w-full { width: 100%; }
.h-full { height: 100%; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.text-start  { text-align: start; }
.text-center { text-align: center; }
.text-end    { text-align: end; }

/* Spacing */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.ms-auto { margin-inline-start: auto; }
.me-auto { margin-inline-end: auto; }

.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

.rounded    { border-radius: var(--radius); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* ── Dark/Light mode Toggle Button ─────────────────────────────────────── */
.theme-toggle {
    width: 36px; height: 36px;
    border-radius: var(--radius);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: background var(--t-base), border-color var(--t-base), transform var(--t-fast);
    flex-shrink: 0;
}
.theme-toggle:hover {
    background: var(--bg-active);
    border-color: var(--brand);
    transform: rotate(20deg) scale(1.05);
}

/* ── Keyframe Animations ────────────────────────────────────────────────── */
@keyframes spin      { to { transform: rotate(360deg); } }
@keyframes shimmer   { to { background-position: -200% 0; } }
@keyframes skeleton  { 0%,100% { background-position: 200% 0; } 50% { background-position: -200% 0; } }

@keyframes fadeIn    { from { opacity: 0; } to { opacity: 1; } }
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn   {
    from { opacity: 0; transform: scale(0.9) translateY(24px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(50px) scale(0.9); }
    to   { opacity: 1; transform: translateX(0)    scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0) scale(1); max-height: 200px; }
    to   { opacity: 0; transform: translateX(50px) scale(0.9); max-height: 0; }
}
@keyframes pulse {
    0%,100% { opacity: 1; }
    50%     { opacity: 0.5; }
}
@keyframes floatUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes brandGlow {
    0%,100% { box-shadow: 0 0 20px var(--brand-glow); }
    50%      { box-shadow: 0 0 40px var(--brand-glow), 0 0 80px var(--brand-glow-lg); }
}

/* Animation utilities */
.animate-fade     { animation: fadeSlideIn 0.35s var(--ease-out) both; }
.animate-scale    { animation: scaleIn 0.3s var(--ease-bounce) both; }
.animate-float    { animation: floatUp 0.4s var(--ease-out) both; }
.animate-pulse    { animation: pulse 2s ease infinite; }
.animate-spin     { animation: spin 1s linear infinite; }

/* Staggered entry for lists */
.stagger > * { animation: fadeSlideIn 0.35s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .modal-box { padding: var(--space-5); }
    #toast-container { inset-inline-end: 12px; top: 12px; width: calc(100vw - 24px); }
}
