/* ============================================================
   OKAZ SMP — Design System v2 (OKAZ Arabia Standards)
   Two worlds: Marketing (violet→magenta→amber)
               Project   (indigo→teal)
   ============================================================ */

:root {
    --primary: #5B3BA0;
    --primary-dark: #44297D;
    --secondary: #7B52C9;
    --success: #19B077;
    --danger: #E54D4D;
    --warning: #E88A3A;
    --info: #4A8FE7;

    --bg: #F5F4FA;
    --card: #FFFFFF;
    --text: #2A2440;
    --muted: #8B86A0;
    --border: #E6E3F0;

    --sidebar-w: 250px;
    --radius: 14px;
    --shadow: 0 2px 10px rgba(42,36,64,.07);
    --shadow-lg: 0 14px 40px rgba(42,36,64,.16);

    /* Category worlds */
    --mk-a: #8B30C9;  --mk-b: #D93690;  --mk-c: #F2A03D;
    --mk-soft: #FBEFF7; --mk-ink: #A32C77;
    --pj-a: #2D3A8C;  --pj-b: #1D7FA8;  --pj-c: #14B8A6;
    --pj-soft: #E9F6F4; --pj-ink: #14718C;

    /* Active accent (defaults to brand purple) */
    --accent: var(--primary);
    --accent-2: var(--secondary);
    --accent-soft: #F3EFFB;
    --accent-grad: linear-gradient(120deg, var(--primary-dark), var(--primary), var(--secondary));
}

body[data-theme="marketing"] {
    --accent: var(--mk-b);
    --accent-2: var(--mk-a);
    --accent-soft: var(--mk-soft);
    --accent-grad: linear-gradient(120deg, var(--mk-a), var(--mk-b), var(--mk-c));
}
body[data-theme="project"] {
    --accent: var(--pj-b);
    --accent-2: var(--pj-a);
    --accent-soft: var(--pj-soft);
    --accent-grad: linear-gradient(120deg, var(--pj-a), var(--pj-b), var(--pj-c));
}

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

[hidden] { display: none !important; }

/* Vendor approval ask */
.vendor-ask { display: flex; gap: 14px; justify-content: center; margin: 6px 0 4px; }
.vbtn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 26px; border-radius: 14px; border: 2px solid var(--border);
    background: var(--card); font-family: inherit; font-size: 15px; font-weight: 800;
    color: var(--text); cursor: pointer;
    transition: transform .18s, border-color .18s, box-shadow .18s;
}
.vbtn i { font-size: 18px; }
.vbtn.approved i { color: var(--success); }
.vbtn.notyet i { color: var(--warning); }
.vbtn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.vbtn.selected { border-color: var(--accent); background: var(--accent-soft); }

.mail-card {
    max-width: 640px; margin: 16px auto 0;
    background: var(--card); border-radius: 16px; box-shadow: var(--shadow);
    padding: 20px; text-align: center; animation: popIn .3s ease both;
}
.mail-card p { color: var(--muted); font-size: 14px; margin-bottom: 14px; }

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

a { color: var(--accent); text-decoration: none; }

/* ---------------- Motion ---------------- */

@keyframes fadeUp   { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform:none; } }
@keyframes popIn    { from { opacity:0; transform: scale(.94); } to { opacity:1; transform:none; } }
@keyframes slideIn  { from { opacity:0; transform: translateX(26px); } to { opacity:1; transform:none; } }
@keyframes floaty   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes sheen    { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes pulseOk  { 0% { box-shadow: 0 0 0 0 rgba(25,176,119,.45); } 100% { box-shadow: 0 0 0 16px rgba(25,176,119,0); } }

.content > * { animation: fadeUp .45s ease both; }
.content > *:nth-child(2) { animation-delay: .06s; }
.content > *:nth-child(3) { animation-delay: .12s; }
.content > *:nth-child(4) { animation-delay: .18s; }

/* ---------------- Layout ---------------- */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    color: #fff;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 22px 20px;
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand i {
    width: 40px; height: 40px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--mk-b), var(--secondary));
    box-shadow: 0 6px 18px rgba(217,54,144,.4);
    font-size: 17px;
    animation: floaty 5s ease-in-out infinite;
}

.sidebar-nav { padding: 14px 12px; overflow-y: auto; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: rgba(255,255,255,.82);
    border-radius: 12px;
    margin-bottom: 4px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    animation: navIn .4s ease both;
    transition: background .2s, color .2s, transform .2s;
}
.sidebar-nav a:nth-child(1) { animation-delay: .03s; }
.sidebar-nav a:nth-child(2) { animation-delay: .07s; }
.sidebar-nav a:nth-child(3) { animation-delay: .11s; }
.sidebar-nav a:nth-child(4) { animation-delay: .15s; }
.sidebar-nav a:nth-child(5) { animation-delay: .19s; }
.sidebar-nav a:nth-child(6) { animation-delay: .23s; }

/* icon chip */
.sidebar-nav a i {
    width: 36px; height: 36px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 11px;
    background: rgba(255,255,255,.10);
    font-size: 14px;
    transition: background .25s, transform .25s, box-shadow .25s;
}

.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(4px); }
.sidebar-nav a:hover i { background: rgba(255,255,255,.20); transform: scale(1.08) rotate(-4deg); }

.sidebar-nav a.active {
    background: rgba(255,255,255,.14);
    color: #fff;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.sidebar-nav a.active i {
    background: linear-gradient(135deg, var(--mk-b), var(--secondary));
    box-shadow: 0 4px 14px rgba(217,54,144,.45);
}
.sidebar-nav a.active::after {
    content: ''; position: absolute; right: 10px; top: 50%;
    width: 7px; height: 7px; border-radius: 50%;
    background: #fff; transform: translateY(-50%);
    box-shadow: 0 0 10px rgba(255,255,255,.9);
    animation: popIn .3s ease both;
}

@keyframes navIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

.sidebar-section {
    display: flex; align-items: center; gap: 8px;
    padding: 18px 14px 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: rgba(255,255,255,.5);
}
.sidebar-section::after {
    content: ''; flex: 1; height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,.18), transparent);
}

.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
    background: var(--card);
    box-shadow: var(--shadow);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 800; flex: 1; }

.topbar-user { display: flex; align-items: center; gap: 14px; }
.user-region { color: var(--muted); font-size: 13px; }
.user-name { font-weight: 700; }

.menu-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--primary); cursor: pointer; }

.content { padding: 24px; flex: 1; }

.footer { padding: 16px 24px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------------- Cards ---------------- */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: box-shadow .25s;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.card-header i:first-child { color: var(--accent); }

.card-body { padding: 20px; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    transition: transform .22s, box-shadow .22s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: grid; place-items: center; font-size: 20px; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    flex-shrink: 0;
}
.stat-icon.success { background: linear-gradient(135deg, #12996A, #2BD095); }
.stat-icon.warning { background: linear-gradient(135deg, #D97B26, #F2A03D); }
.stat-icon.info    { background: linear-gradient(135deg, #2D6FD1, #64A6F5); }
.stat-icon.danger  { background: linear-gradient(135deg, #C93A3A, #F06D6D); }

.stat-value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 13px; }

/* ---------------- Buttons ---------------- */

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border: none; border-radius: 10px;
    font-family: inherit; font-size: 14px; font-weight: 700;
    cursor: pointer;
    transition: transform .16s, box-shadow .16s, filter .16s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.btn-primary { background: var(--accent-grad); background-size: 180% 180%; color: #fff; }
.btn-primary:hover { animation: sheen 2.6s ease infinite; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------------- Forms ---------------- */

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }

input, select, textarea {
    width: 100%; padding: 11px 13px;
    border: 1.5px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 14px; background: #fff; color: var(--text);
    transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------- Tables ---------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tbody tr { transition: background .15s, transform .15s; }
tbody tr:hover { background: var(--accent-soft); }

/* ---------------- Badges & alerts ---------------- */

.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-success   { background: #E2F6EE; color: var(--success); }
.badge-danger    { background: #FBE7E7; color: var(--danger); }
.badge-warning   { background: #FBEEDF; color: var(--warning); }
.badge-info      { background: #E5EFFC; color: var(--info); }
.badge-secondary { background: #EFEDF6; color: var(--muted); }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.chip-mk { background: var(--mk-soft); color: var(--mk-ink); }
.chip-pj { background: var(--pj-soft); color: var(--pj-ink); }

.alert { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; animation: popIn .3s ease both; }
.alert-success { background: #E2F6EE; color: #0E7A52; }
.alert-danger  { background: #FBE7E7; color: #B03030; }
.alert-warning { background: #FBEEDF; color: #A85E1C; }
.alert-info    { background: #E5EFFC; color: #2C64AF; }

/* ============================================================
   REQUESTS PAGE — category worlds selector
   ============================================================ */

.seg-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.seg-tab {
    position: relative;
    display: flex; align-items: center; gap: 14px;
    padding: 18px 20px;
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    color: var(--text);
    font-weight: 800;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.seg-tab i {
    width: 44px; height: 44px; border-radius: 12px;
    display: grid; place-items: center; font-size: 18px; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    flex-shrink: 0;
}
.seg-tab.mk i { background: linear-gradient(135deg, var(--mk-a), var(--mk-b)); }
.seg-tab.pj i { background: linear-gradient(135deg, var(--pj-a), var(--pj-c)); }
.seg-tab small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.seg-tab:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.seg-tab.active { color: #fff; }
.seg-tab.active small { color: rgba(255,255,255,.8); }
.seg-tab.active i { background: rgba(255,255,255,.2); }
.seg-tab.all.active { background: var(--accent-grad); background-size: 180% 180%; animation: sheen 7s ease infinite; }
.seg-tab.mk.active  { background: linear-gradient(120deg, var(--mk-a), var(--mk-b), var(--mk-c)); background-size: 180% 180%; animation: sheen 7s ease infinite; }
.seg-tab.pj.active  { background: linear-gradient(120deg, var(--pj-a), var(--pj-b), var(--pj-c)); background-size: 180% 180%; animation: sheen 7s ease infinite; }

/* ============================================================
   NEW REQUEST — two doors + one-question flow
   ============================================================ */

.flow-shell { max-width: 860px; margin: 0 auto; }

/* Progress rail */
.flow-rail { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.flow-track { flex: 1; height: 7px; border-radius: 7px; background: #E9E6F2; overflow: hidden; }
.flow-fill {
    height: 100%; width: 0;
    border-radius: 7px;
    background: var(--accent-grad); background-size: 180% 180%;
    animation: sheen 4s ease infinite;
    transition: width .45s cubic-bezier(.6,0,.2,1);
}
.flow-count { font-size: 13px; font-weight: 800; color: var(--muted); white-space: nowrap; }

/* Steps */
.fstep { display: none; }
.fstep.on { display: block; animation: slideIn .4s cubic-bezier(.5,0,.2,1) both; }

.flow-q { text-align: center; margin-bottom: 26px; }
.flow-q .eyebrow {
    display: inline-block; font-size: 12px; font-weight: 800;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft);
    padding: 5px 14px; border-radius: 20px; margin-bottom: 12px;
}
.flow-q h2 { font-size: 26px; font-weight: 800; }
.flow-q p { color: var(--muted); margin-top: 6px; }

/* Two doors */
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.door {
    position: relative;
    border-radius: 22px;
    padding: 44px 28px 36px;
    min-height: 320px;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    background-size: 220% 220%;
    animation: sheen 9s ease infinite;
    box-shadow: 0 10px 30px rgba(42,36,64,.18);
    transition: transform .3s cubic-bezier(.3,0,.2,1), box-shadow .3s;
}
.door.mk { background-image: linear-gradient(135deg, var(--mk-a), var(--mk-b) 55%, var(--mk-c)); }
.door.pj { background-image: linear-gradient(135deg, var(--pj-a), var(--pj-b) 55%, var(--pj-c)); }

.door::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 20% 15%, rgba(255,255,255,.28), transparent 45%);
    pointer-events: none;
}
.door:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 24px 55px rgba(42,36,64,.30); }
.door:active { transform: scale(.985); }

.door .door-icon {
    width: 84px; height: 84px; border-radius: 26px;
    display: grid; place-items: center;
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(3px);
    font-size: 36px; margin-bottom: 20px;
    animation: floaty 4.5s ease-in-out infinite;
}
.door h3 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.door p  { font-size: 14px; opacity: .9; max-width: 260px; }
.door .door-go {
    margin-top: 20px; font-size: 13px; font-weight: 800;
    background: rgba(255,255,255,.2); padding: 8px 18px; border-radius: 20px;
    transition: background .2s;
}
.door:hover .door-go { background: rgba(255,255,255,.32); }

/* Option cards (one-per-click) */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }

.opt {
    position: relative;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 18px;
    padding: 26px 18px 22px;
    text-align: center;
    cursor: pointer;
    transition: transform .22s, border-color .22s, box-shadow .22s;
    animation: popIn .35s ease both;
}
.opt:nth-child(2) { animation-delay: .06s; }
.opt:nth-child(3) { animation-delay: .12s; }
.opt:nth-child(4) { animation-delay: .18s; }

.opt i {
    width: 58px; height: 58px; border-radius: 17px;
    display: grid; place-items: center; margin: 0 auto 14px;
    font-size: 24px; color: #fff;
    background: var(--accent-grad); background-size: 180% 180%;
}
.opt h4 { font-size: 16px; font-weight: 800; }
.opt p  { font-size: 13px; color: var(--muted); margin-top: 5px; }

.opt:hover { transform: translateY(-5px); border-color: var(--accent); box-shadow: 0 14px 34px var(--accent-soft), var(--shadow-lg); }
.opt.selected { border-color: var(--accent); background: var(--accent-soft); }
.opt.selected::after {
    content: '\2713';
    position: absolute; top: 10px; right: 12px;
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: 13px; font-weight: 800;
    animation: popIn .25s ease both;
}

/* Input step panel */
.flow-panel {
    background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
    padding: 26px; max-width: 560px; margin: 0 auto;
}

/* Nav */
.flow-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 26px; gap: 12px; }

/* CBD toast */
.cbd-toast {
    margin: 18px auto 0; max-width: 560px;
    display: flex; gap: 12px; align-items: center;
    background: var(--accent-soft); color: var(--text);
    border-left: 4px solid var(--accent);
    padding: 13px 16px; border-radius: 10px; font-size: 14px;
    animation: popIn .3s ease both;
}
.cbd-toast i { color: var(--accent); font-size: 18px; }

/* Review */
.review-grid {
    background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
    overflow: hidden; max-width: 640px; margin: 0 auto;
}
.review-hero {
    background: var(--accent-grad); background-size: 180% 180%;
    animation: sheen 8s ease infinite;
    color: #fff; padding: 22px 24px;
    display: flex; align-items: center; gap: 14px;
}
.review-hero i { font-size: 26px; }
.review-hero h3 { font-size: 18px; font-weight: 800; }
.review-hero small { opacity: .85; }
.review-rows { padding: 8px 24px 18px; }
.review-rows > div {
    display: flex; justify-content: space-between; gap: 14px;
    padding: 11px 0; border-bottom: 1px dashed var(--border); font-size: 14px;
}
.review-rows > div:last-child { border-bottom: none; }
.review-rows span:first-child { color: var(--muted); }
.review-rows span:last-child  { font-weight: 800; text-align: right; }

/* Legacy wizard classes kept for compatibility */
.wizard-steps { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; }
.wizard-step { flex: 1; min-width: 110px; text-align: center; padding: 10px 6px; border-radius: 8px; background: #EFEDF6; color: var(--muted); font-size: 13px; font-weight: 700; }
.wizard-step.active { background: var(--accent); color: #fff; }
.wizard-step.done { background: #E2F6EE; color: var(--success); }
.wizard-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.choice-card { border: 2px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.choice-card i { font-size: 26px; color: var(--accent); margin-bottom: 10px; display: block; }
.choice-card h4 { margin-bottom: 4px; }
.choice-card p { font-size: 13px; color: var(--muted); }
.choice-card:hover { border-color: var(--accent-2); }
.choice-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.summary-panel > div,
.summary-panel .card-body > div {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 18px; padding: 10px 0;
    border-bottom: 1px dashed var(--border); font-size: 14px;
}
.summary-panel > div:last-child,
.summary-panel .card-body > div:last-child { border-bottom: none; }
.summary-panel > div span:first-child,
.summary-panel .card-body > div span:first-child { color: var(--muted); flex-shrink: 0; }
.summary-panel > div span:last-child,
.summary-panel .card-body > div span:last-child { font-weight: 700; text-align: right; overflow-wrap: anywhere; }

.disc-toggle { display: flex; gap: 10px; }
.dtog {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 10px; border-radius: 10px; border: 2px solid var(--border);
    background: var(--card); font-family: inherit; font-size: 14px; font-weight: 800;
    color: var(--text); cursor: pointer;
    transition: border-color .18s, background .18s, transform .18s;
}
.dtog:hover { border-color: var(--accent); transform: translateY(-2px); }
label.dtog { cursor: pointer; }
label.dtog:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dtog.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Finance bulk bar */
.bulk-bar {
    display: flex; gap: 12px; align-items: center;
    background: var(--accent-soft);
    border: 1.5px dashed var(--accent);
    border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
    animation: popIn .3s ease both;
}
.bulk-bar input[type="text"] { flex: 1; }
@media (max-width: 900px) { .bulk-bar { flex-wrap: wrap; } }

.noref-filter {
    display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
    background: var(--accent-soft); border-radius: 12px; padding: 14px;
}
.noref-filter .form-group { min-width: 150px; }
@media (max-width: 700px) { .noref-filter { flex-direction: column; align-items: stretch; } }

/* ---------------- Budgets ---------------- */

.budget-hero { background: var(--accent-grad); background-size: 200% 200%; animation: sheen 10s ease infinite; color: #fff; border: none; }
.budget-hero .card-body { padding: 26px; }
.bh-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.bh-label { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; opacity: .85; font-weight: 700; }
.bh-value { font-size: 34px; font-weight: 800; line-height: 1.15; }
.bh-value small { font-size: 16px; opacity: .8; }
.bh-year select {
    background: rgba(255,255,255,.18); border: 1.5px solid rgba(255,255,255,.35);
    color: #fff; font-weight: 800; width: auto; padding: 8px 12px;
}
.bh-year select option { color: var(--text); }
.bh-bar { height: 12px; border-radius: 12px; background: rgba(255,255,255,.25); overflow: hidden; margin: 20px 0 14px; }
.bh-fill { height: 100%; border-radius: 12px; background: #fff; transition: width .6s cubic-bezier(.6,0,.2,1); }
.bh-stats { display: flex; gap: 30px; flex-wrap: wrap; }
.bh-num { display: block; font-size: 22px; font-weight: 800; }
.bh-cap { font-size: 12px; opacity: .85; }

details.brand-budget {
    border: 1.5px solid var(--border); border-radius: 14px;
    margin-bottom: 10px; background: var(--card); overflow: hidden;
    transition: box-shadow .2s, border-color .2s;
}
details.brand-budget:hover { box-shadow: var(--shadow); }
details.brand-budget.over { border-color: var(--danger); }
details.brand-budget summary {
    list-style: none; cursor: pointer; padding: 14px 18px;
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
details.brand-budget summary::-webkit-details-marker { display: none; }
details.brand-budget summary::after {
    content: '\25BC'; font-size: 11px; color: var(--muted); transition: transform .2s;
}
details.brand-budget[open] summary::after { transform: rotate(180deg); }
.bb-name { font-weight: 800; min-width: 140px; }
.bb-name i { color: var(--accent); }
.bb-track { flex: 1; min-width: 120px; height: 9px; border-radius: 9px; background: #EDEAF5; overflow: hidden; }
.bb-fill { display: block; height: 100%; border-radius: 9px; background: var(--accent-grad); background-size: 180% 180%; transition: width .5s ease; }
details.brand-budget.over .bb-fill { background: var(--danger); }
.bb-pct { font-size: 12px; font-weight: 800; color: var(--muted); white-space: nowrap; }
details.brand-budget.over .bb-pct { color: var(--danger); }
.bb-nums { text-align: right; white-space: nowrap; }
.bb-nums strong { font-size: 15px; }
.bb-nums small { display: block; color: var(--muted); font-size: 12px; }
.bb-body { padding: 0 18px 16px; border-top: 1px dashed var(--border); }
.bb-edit { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; }
.bb-edit .form-group { min-width: 190px; }

.mini-track { display: inline-block; width: 70px; height: 6px; border-radius: 6px; background: #EDEAF5; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.mini-fill { display: block; height: 100%; border-radius: 6px; background: var(--accent); }

.region-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.region-card { background: var(--accent-soft); border-radius: 14px; padding: 16px; transition: transform .2s; }
.region-card:hover { transform: translateY(-3px); }
.rc-name { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rc-value { font-size: 20px; font-weight: 800; margin: 6px 0 10px; }
.rc-value small { font-size: 12px; color: var(--muted); }
.rc-share { font-size: 12px; color: var(--muted); margin-top: 6px; }

@media (max-width: 700px) {
    .bb-nums { text-align: left; width: 100%; }
    .bb-track { order: 5; width: 100%; flex-basis: 100%; }
}

.returned-panel { border: 2px solid var(--danger); }
.returned-panel .card-header { color: var(--danger); background: #FBE7E7; }
.returned-row {
    display: flex; justify-content: space-between; align-items: center; gap: 14px;
    padding: 12px 6px; border-bottom: 1px dashed var(--border); color: var(--text);
    border-radius: 8px; transition: background .18s, transform .18s;
}
.returned-row:last-child { border-bottom: none; }
.returned-row:hover { background: #FBE7E7; transform: translateX(3px); }
.rr-main small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; font-weight: 500; }
.rr-cta { color: var(--danger); font-weight: 800; font-size: 13px; white-space: nowrap; }

.deny-form { display: flex; gap: 6px; align-items: center; }
.deny-form input[type="text"] { min-width: 150px; padding: 6px 10px; font-size: 13px; }

.fund-toggle { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; padding: 14px;
    border: 2px solid var(--border); border-radius: 14px; transition: border-color .2s, background .2s; }
.fund-toggle:hover { border-color: var(--accent); background: var(--accent-soft); }
.fund-toggle input { width: auto; margin-top: 3px; flex-shrink: 0; }
.fund-toggle small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }

.cn-table td, .cn-table th { vertical-align: middle; }
.cn-table .bSel { min-width: 130px; padding: 7px 9px; font-size: 13px; }
.cn-table th, .cn-table td { border-right: 1px solid var(--border); }
.cn-table th:last-child, .cn-table td:last-child { border-right: none; }
.rebate-cell { text-align: center; width: 90px; background: #FCFBFE; }
.prod-cell { max-width: 340px; }
.prod-cell strong { display: block; white-space: normal; line-height: 1.35; }
.prod-code { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .04em;
    color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 5px; margin-bottom: 4px; }
.prod-desc { display: block; color: var(--muted); font-size: 12px; margin-top: 3px;
    white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
td.prod-cell, th:first-child { white-space: normal; }
.cn-table th:nth-child(2) { text-align: center; width: 90px; }
.rebate-box { display: inline-grid; place-items: center; width: 34px; height: 34px;
    border-radius: 9px; border: 2px solid var(--border); cursor: pointer;
    transition: border-color .18s, background .18s; }
.rebate-box:hover { border-color: var(--accent); background: var(--accent-soft); }
.rebate-box input { width: auto; margin: 0; cursor: pointer; }
.rebate-box:has(input:checked) { border-color: var(--warning); background: #FBEEDF; }
tr.no-rebate td { background: #FFFBF5; }
tr.no-rebate .rebate-cell { position: relative; }
.brand-warn { font-size: 11px; color: var(--warning); margin-top: 4px; font-weight: 700; }
.brand-src { font-size: 11px; color: var(--muted); margin-top: 4px; }
.brand-src.warn { color: var(--warning); font-weight: 700; }
tr.rule-brand td { background: var(--accent-soft); }
.disc-cell { display: flex; gap: 6px; }
.disc-cell select { width: 78px; padding: 8px; }
.disc-cell input { width: 110px; padding: 8px; }
tr.line-muted { opacity: .55; }

/* Total Discounts — brand rows */
.brand-logo-sm { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: #fff;
    border: 1px solid var(--border); display: inline-grid; place-items: center; flex-shrink: 0; }
.brand-logo-fallback { font-size: 12px; font-weight: 800; color: var(--accent); background: var(--accent-soft); }

.bd-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px;
    background: #FAF9FD; margin-bottom: 8px; transition: background .2s, transform .2s;
    animation: fadeUp .3s ease both; }
.bd-row.has-disc { background: var(--accent-soft); }
.bd-row:hover { transform: translateX(3px); }
.bd-n { font-weight: 800; color: var(--muted); width: 20px; flex-shrink: 0; }
.bd-logo { width: 42px; height: 42px; border-radius: 10px; object-fit: contain; background: #fff;
    border: 1px solid var(--border); flex-shrink: 0; padding: 3px; }
.bd-logo-fallback { display: grid; place-items: center; font-size: 14px; font-weight: 800;
    color: var(--accent); background: #fff; }
.bd-name { flex: 1; min-width: 130px; font-weight: 800; }
.bd-name small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 2px; }
.bd-bar { width: 120px; height: 8px; border-radius: 8px; background: #E9E6F2; overflow: hidden; flex-shrink: 0; }
.bd-fill { display: block; height: 100%; border-radius: 8px; background: var(--accent-grad);
    background-size: 180% 180%; transition: width .35s ease; }
.bd-pct { font-size: 18px; font-weight: 800; min-width: 68px; text-align: right; }
.bd-row.has-disc .bd-pct { color: var(--accent); }
.bd-amt { min-width: 120px; text-align: right; font-weight: 700; }
.bd-amt small { color: var(--muted); font-weight: 500; }

.grand-total { display: flex; justify-content: space-between; align-items: center; gap: 16px;
    flex-wrap: wrap; margin-top: 14px; padding: 18px; border-radius: 14px;
    background: var(--accent-grad); background-size: 200% 200%; animation: sheen 9s ease infinite; color: #fff; }
.gt-left span { font-weight: 800; font-size: 15px; }
.gt-left small { display: block; opacity: .85; font-size: 12px; margin-top: 2px; }
.gt-right { text-align: right; }
.gt-amt { display: block; font-size: 26px; font-weight: 800; }
.gt-amt small { font-size: 14px; opacity: .85; }
.gt-pct { font-size: 12px; opacity: .9; }

@media (max-width: 760px) {
    .bd-bar { display: none; }
    .bd-amt, .bd-pct { min-width: auto; }
}

.route-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.route-step { display: inline-flex; align-items: center; gap: 8px; background: var(--card);
    border: 1.5px solid var(--accent); color: var(--accent); border-radius: 20px;
    padding: 8px 14px; font-weight: 700; font-size: 13px; animation: popIn .25s ease both; }
.route-step small { color: var(--muted); font-weight: 500; }
.rs-n { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-size: 11px; }
.route-arrow { color: var(--muted); }

.stage-head { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); padding: 12px 0 6px; display: flex; align-items: center; gap: 8px; }
.stage-head small { text-transform: none; letter-spacing: 0; font-weight: 600; }
.stage-head.live { color: var(--accent); }
.stage-head.live::after { content: 'now'; background: var(--accent); color: #fff; border-radius: 20px;
    padding: 1px 8px; font-size: 10px; }

.appr-step { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.appr-step:last-child { border-bottom: none; }
.as-icon { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: #EFEDF6; color: var(--muted); flex-shrink: 0; }
.appr-step.approved .as-icon { background: #E2F6EE; color: var(--success); }
.appr-step.rejected .as-icon { background: #FBE7E7; color: var(--danger); }
.appr-step.pending .as-icon  { background: var(--accent-soft); color: var(--accent); animation: pulseOk 1.8s infinite; }
.as-body small { display: block; color: var(--muted); font-size: 12px; }
.as-note { color: var(--text) !important; margin-top: 4px; font-style: italic; }

/* Notification bell */
.notif-bell {
    position: relative; width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center; color: var(--accent);
    background: var(--accent-soft); font-size: 16px;
    transition: transform .18s;
}
.notif-bell:hover { transform: translateY(-2px) rotate(-8deg); }
.notif-count {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 10px; background: var(--danger); color: #fff;
    font-size: 11px; font-weight: 800;
    display: grid; place-items: center;
    animation: popIn .3s ease both;
}
.notif-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 6px; border-bottom: 1px dashed var(--border);
    color: var(--text); font-size: 14px;
}
.notif-row i { color: var(--muted); }
.notif-row small { margin-left: auto; color: var(--muted); white-space: nowrap; }
.notif-row.unread { background: var(--accent-soft); border-radius: 8px; font-weight: 700; }
.notif-row.unread i { color: var(--accent); }

/* Batches */
details.batch {
    border: 1.5px solid var(--border); border-radius: 14px;
    margin-bottom: 12px; overflow: hidden; background: var(--card);
    transition: box-shadow .2s;
}
details.batch:hover { box-shadow: var(--shadow); }
details.batch summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    padding: 14px 18px; font-size: 14px;
}
details.batch summary::-webkit-details-marker { display: none; }
details.batch summary::after {
    content: '\25BC'; margin-left: auto; font-size: 11px; color: var(--muted);
    transition: transform .2s;
}
details.batch[open] summary::after { transform: rotate(180deg); }
.batch-ref { font-weight: 800; color: var(--accent); }
.batch-body { padding: 0 18px 16px; border-top: 1px dashed var(--border); }
.batch-body .table-wrap { margin-top: 12px; }
.batch-hist { margin-top: 12px; font-size: 13px; display: grid; gap: 6px; }
.batch-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.batch-actions input[type="text"] { flex: 1; min-width: 180px; }

/* ---------------- Login ---------------- */

.login-page {
    min-height: 100vh; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary), var(--mk-b));
    background-size: 220% 220%;
    animation: sheen 12s ease infinite;
    padding: 20px;
}
.login-box {
    background: #fff; border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    padding: 36px; width: 100%; max-width: 400px;
    animation: popIn .45s ease both;
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo i { font-size: 40px; color: var(--primary); }
.login-logo h1 { margin-top: 10px; font-size: 26px; }
.login-logo p { color: var(--muted); font-size: 14px; }
.login-footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .form-row { grid-template-columns: 1fr; }
    .wizard-layout { grid-template-columns: 1fr; }
    .doors { grid-template-columns: 1fr; }
    .seg-tabs { grid-template-columns: 1fr; }
    .user-region { display: none; }
    .flow-q h2 { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
