/* ============================================================
   HRCo Loyalty V2 — Maan Design System
   Aligned with portal mockup (Maan brand) + PRD v1 (3 surfaces, bilingual + RTL)
   ============================================================ */
:root {
    /* Maan brand palette (extracted from portal mockup) */
    --brand: #29A9E1;
    --brand-dark: #1691CF;
    --brand-deep: #0E78B0;
    --brand-50: #ECF7FD;
    --brand-100: #D6EEFA;
    --brand-200: #B6E1F4;

    /* Stat-card accent colors (match mockup) */
    --stat-red: #EF3E3E;
    --stat-red-50: #FEEFEF;
    --stat-green: #16A765;
    --stat-green-50: #E8F7EF;
    --stat-blue: var(--brand);
    --stat-blue-50: var(--brand-50);

    /* Surfaces */
    --surface: #ffffff;
    --surface-alt: #FCFCFD;
    --surface-muted: #F4F6F9;
    --surface-canvas: #F7F9FC;
    --border: #E5E9F0;
    --border-soft: #EEF1F5;

    /* Text */
    --text: #0F172A;
    --text-body: #475569;
    --text-muted: #6B7280;
    --text-placeholder: #9CA3AF;

    /* Legacy blue (kept for backwards compat with existing pages) */
    --blue-25: var(--brand-50);
    --blue-50: var(--brand-50);
    --blue-100: var(--brand-100);
    --blue-500: var(--brand);
    --blue-600: var(--brand-dark);
    --blue-700: var(--brand-deep);

    /* Semantic colors */
    --green-50: var(--stat-green-50);
    --green-500: var(--stat-green);
    --green-600: #0F8C54;

    --amber-50: #FFF8E6;
    --amber-500: #F1A516;
    --amber-600: #B97A0C;

    --red-50: var(--stat-red-50);
    --red-500: var(--stat-red);
    --red-600: #C92929;

    --purple-50: #F3E8FF;
    --purple-500: #8B5CF6;
    --purple-600: #7C3AED;

    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-900: #0F172A;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.04);

    --font: "Work Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-ar: "Tajawal", "IBM Plex Sans Arabic", "Work Sans", system-ui, sans-serif;
}

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

body {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--surface-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
html[dir="rtl"] body { font-family: var(--font-ar); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }

/* ============================================================
   Layout shell — sidebar + main with separate top bar above both
   ============================================================ */
.shell {
    display: grid;
    grid-template-columns: 272px 1fr;
    min-height: calc(100vh - 72px);
    background: var(--surface-canvas);
}

/* Top header bar — spans full width above the shell */
.app-topbar {
    height: 72px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.app-topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.app-topbar__brand-mark { width: 40px; height: 40px; flex-shrink: 0; }
.app-topbar__brand-meta { line-height: 1.1; }
.app-topbar__brand-name { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -0.01em; }
.app-topbar__brand-sub { font-size: 11px; color: var(--text-muted); font-family: var(--font-ar); font-weight: 600; margin-top: 2px; }

.app-topbar__right { display: flex; align-items: center; gap: 14px; }

.topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    transition: background 0.15s, border-color 0.15s;
}
.topbar-pill:hover { background: var(--gray-50); border-color: var(--gray-200); }
.topbar-pill__icon { width: 16px; height: 16px; color: var(--text-body); }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: var(--radius-pill);
    background: var(--surface);
}
.topbar-user__avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-deep));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
}
.topbar-user__avatar img { width: 100%; height: 100%; object-fit: cover; }
.topbar-user__meta { line-height: 1.2; }
.topbar-user__name { font-size: 13px; font-weight: 600; color: var(--text); }
.topbar-user__role { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   Sidebar — expandable nav groups
   ============================================================ */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border-soft);
    padding: 18px 14px;
    position: sticky;
    top: 72px;
    height: calc(100vh - 72px);
    overflow-y: auto;
}
html[dir="rtl"] .sidebar {
    border-right: none;
    border-left: 1px solid var(--border-soft);
}

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: var(--text-body);
    font-weight: 500;
    font-size: 14px;
    border-radius: var(--radius-md);
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    position: relative;
}
.nav__item:hover { background: var(--gray-50); color: var(--text); }
.nav__item--active {
    background: var(--gray-100);
    color: var(--text);
    font-weight: 600;
}
.nav__icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); }
.nav__item--active .nav__icon { color: var(--brand-dark); }
.nav__badge {
    margin-inline-start: auto;
    background: var(--stat-red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
}
.nav__chevron {
    margin-inline-start: auto;
    width: 14px; height: 14px;
    color: var(--text-muted);
    transition: transform 0.2s;
}
html[dir="rtl"] .nav__chevron { transform: rotate(180deg); }

/* Nav group (expandable) */
.nav__group { display: flex; flex-direction: column; }
.nav__group--open > .nav__item .nav__chevron { transform: rotate(90deg); }
html[dir="rtl"] .nav__group--open > .nav__item .nav__chevron { transform: rotate(-90deg); }
.nav__group--open > .nav__item { background: var(--gray-100); color: var(--text); font-weight: 600; }
.nav__group--open > .nav__item .nav__icon { color: var(--brand-dark); }

.nav__subnav {
    display: none;
    flex-direction: column;
    margin: 4px 0 6px;
    padding-inline-start: 30px;
    position: relative;
}
.nav__group--open > .nav__subnav { display: flex; }
.nav__subnav::before {
    content: "";
    position: absolute;
    inset-inline-start: 21px;
    top: 4px; bottom: 4px;
    width: 1px;
    background: var(--border);
}

.nav__subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: var(--text-body);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: background 0.15s, color 0.15s;
}
.nav__subitem:hover { background: var(--gray-50); color: var(--text); }
.nav__subitem--active {
    background: var(--gray-100);
    color: var(--text);
    font-weight: 600;
}
.nav__subitem .nav__icon { width: 16px; height: 16px; }

.nav__section-label {
    padding: 16px 14px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

/* Cluster shell variant */
.shell--cluster .nav__item--active,
.shell--cluster .nav__group--open > .nav__item {
    background: var(--green-50);
    color: var(--green-600);
}
.shell--cluster .nav__item--active .nav__icon,
.shell--cluster .nav__group--open > .nav__item .nav__icon { color: var(--green-600); }
.shell--cluster .nav__subitem--active {
    background: var(--green-50);
    color: var(--green-600);
}

/* ============================================================
   Main content area
   ============================================================ */
.main { display: flex; flex-direction: column; min-width: 0; }

.content { padding: 28px 32px; flex: 1; }

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.breadcrumb a:hover { color: var(--brand-dark); }
.breadcrumb__sep { opacity: 0.5; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.page-subtitle { color: var(--text-body); margin-top: 6px; max-width: 720px; font-size: 14px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }

.btn--success { background: var(--green-500); color: #fff; }
.btn--success:hover { background: var(--green-600); }

.btn--danger { background: var(--red-500); color: #fff; }
.btn--danger:hover { background: var(--red-600); }

.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--gray-50); }

.btn--text { padding: 6px 12px; color: var(--brand-dark); border-radius: var(--radius-md); }
.btn--text:hover { background: var(--brand-50); }

.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn--lg { padding: 12px 22px; font-size: 15px; }

.btn--square { border-radius: var(--radius-md); }

/* Icon-only button */
.icon-action {
    width: 32px; height: 32px;
    border-radius: var(--radius-md);
    display: inline-grid;
    place-items: center;
    color: var(--text-body);
    background: transparent;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-action:hover { background: var(--gray-100); color: var(--text); }
.icon-action--danger:hover { background: var(--red-50); color: var(--red-500); border-color: #FCC; }

/* ============================================================
   Cards & list panels (matches mockup)
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-soft);
    gap: 12px;
}
.card__title { font-size: 15px; font-weight: 600; color: var(--text); }
.card__body { padding: 22px; }

/* Big stat card with colored numeral (matches dashboard mockup) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-2xl);
    padding: 26px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: var(--shadow-xs);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card__numeral {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    color: var(--stat-blue);
    letter-spacing: -0.02em;
}
.stat-card__label {
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
    margin-top: 10px;
}
.stat-card__icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    display: grid; place-items: center;
    background: var(--stat-blue-50);
    color: var(--stat-blue);
    flex-shrink: 0;
}
.stat-card--red .stat-card__numeral { color: var(--stat-red); }
.stat-card--red .stat-card__icon { background: var(--stat-red-50); color: var(--stat-red); }
.stat-card--green .stat-card__numeral { color: var(--stat-green); }
.stat-card--green .stat-card__icon { background: var(--stat-green-50); color: var(--stat-green); }
.stat-card--blue .stat-card__numeral { color: var(--stat-blue); }
.stat-card--blue .stat-card__icon { background: var(--stat-blue-50); color: var(--stat-blue); }
.stat-card--amber .stat-card__numeral { color: var(--amber-500); }
.stat-card--amber .stat-card__icon { background: var(--amber-50); color: var(--amber-500); }
.stat-card--purple .stat-card__numeral { color: var(--purple-500); }
.stat-card--purple .stat-card__icon { background: var(--purple-50); color: var(--purple-500); }

/* List panel (Offers by Cluster / Vendor — matches mockup) */
.list-panel {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-2xl);
    padding: 22px 24px;
    box-shadow: var(--shadow-xs);
}
.list-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.list-panel__title { font-size: 15px; font-weight: 600; color: var(--text); }
.list-panel__icon {
    width: 28px; height: 28px;
    border-radius: var(--radius-md);
    display: grid; place-items: center;
    color: var(--brand-dark);
}

.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.list-row:hover { border-color: var(--brand-100); background: var(--brand-50); }
.list-row:last-child { margin-bottom: 0; }
.list-row__icon {
    width: 24px; height: 24px;
    color: var(--brand-dark);
    flex-shrink: 0;
}
.list-row__label { font-weight: 500; font-size: 14px; color: var(--text); flex: 1; }
.list-row__value { font-weight: 600; font-size: 14px; color: var(--text); }

/* KPI legacy class (kept for reports/etc.) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kpi {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-xs);
}
.kpi__label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.kpi__value { font-size: 28px; font-weight: 700; color: var(--text); }
.kpi__delta { font-size: 12px; color: var(--green-600); font-weight: 600; }
.kpi__delta--down { color: var(--red-500); }
.kpi__icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md);
    display: grid; place-items: center;
    background: var(--brand-50);
    color: var(--brand-dark);
    margin-bottom: 6px;
}
.kpi__icon--green { background: var(--green-50); color: var(--green-600); }
.kpi__icon--amber { background: var(--amber-50); color: var(--amber-600); }
.kpi__icon--purple { background: var(--purple-50); color: var(--purple-600); }
.kpi__icon--red { background: var(--red-50); color: var(--red-500); }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th, .table td {
    text-align: start;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}
.table thead th {
    background: var(--gray-50);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.table tbody tr:hover { background: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}
.pill--green { background: var(--green-50); color: var(--green-600); }
.pill--amber { background: var(--amber-50); color: var(--amber-600); }
.pill--red { background: var(--red-50); color: var(--red-500); }
.pill--blue { background: var(--brand-50); color: var(--brand-dark); }
.pill--gray { background: var(--gray-100); color: var(--gray-600); }
.pill--purple { background: var(--purple-50); color: var(--purple-600); }
.pill__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    padding: 10px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab--active {
    color: var(--brand-dark);
    border-color: var(--brand-dark);
    font-weight: 600;
}

/* ============================================================
   Forms
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--text); }
.field__label .req { color: var(--red-500); }
.field__hint { font-size: 12px; color: var(--text-muted); }
.field__error { font-size: 12px; color: var(--red-500); }

.input, .select, .textarea {
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-50);
}
.textarea { resize: vertical; min-height: 96px; }

.field-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}
.switch__track {
    width: 40px;
    height: 22px;
    background: var(--gray-300);
    border-radius: var(--radius-pill);
    position: relative;
    transition: background 0.2s;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 2px; inset-inline-start: 2px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input { display: none; }
.switch input:checked ~ .switch__track { background: var(--green-500); }
.switch input:checked ~ .switch__track::after { transform: translateX(18px); }
html[dir="rtl"] .switch input:checked ~ .switch__track::after { transform: translateX(-18px); }
.switch__label { font-size: 13px; font-weight: 500; }

.checkbox, .radio {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
.checkbox input, .radio input { accent-color: var(--brand-dark); }

/* Form section (used in CRUD edit pages) */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-2xl);
    padding: 24px 28px;
    box-shadow: var(--shadow-xs);
    margin-bottom: 20px;
}
.form-card__title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.form-card__sub { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 8px;
    padding-top: 18px;
    border-top: 1px solid var(--border-soft);
}

/* Emoji picker grid (used in category edit) */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    max-height: 180px;
    overflow-y: auto;
}
.emoji-grid button {
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 20px;
    border: 1px solid transparent;
    transition: border-color 0.15s, background 0.15s;
}
.emoji-grid button:hover { border-color: var(--brand-200); }
.emoji-grid button.is-selected { background: var(--brand-50); border-color: var(--brand); }

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search {
    position: relative;
    flex: 1;
    min-width: 240px;
    max-width: 380px;
}
.search input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-family: inherit;
}
html[dir="rtl"] .search input { padding: 10px 38px 10px 14px; }
.search__icon {
    position: absolute;
    inset-inline-start: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ============================================================
   Modal (used for delete confirmations)
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-backdrop.is-open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 440px;
    width: 100%;
    padding: 28px;
    text-align: start;
}
.modal__icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--red-50);
    color: var(--red-500);
    display: grid; place-items: center;
    margin-bottom: 16px;
}
.modal__title { font-size: 18px; font-weight: 700; color: var(--text); }
.modal__body { font-size: 14px; color: var(--text-body); margin-top: 8px; }
.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* Toast (success after action) */
.toast {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    background: var(--text);
    color: #fff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
}
.toast.is-show { opacity: 1; transform: translateY(0); }

/* ============================================================
   Stat bars (used for reports / budget rings)
   ============================================================ */
.bar-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.bar-row__label { width: 160px; font-size: 13px; color: var(--text-body); flex-shrink: 0; }
.bar-row__bar { flex: 1; height: 10px; background: var(--gray-100); border-radius: var(--radius-pill); overflow: hidden; }
.bar-row__fill { height: 100%; background: var(--brand); border-radius: var(--radius-pill); }
.bar-row__fill--green { background: var(--green-500); }
.bar-row__fill--amber { background: var(--amber-500); }
.bar-row__fill--purple { background: var(--purple-500); }
.bar-row__value { width: 80px; text-align: end; font-weight: 600; font-size: 13px; flex-shrink: 0; }

/* Budget donut (CSS only) */
.donut {
    width: 120px; height: 120px;
    border-radius: 50%;
    background: conic-gradient(var(--brand-dark) calc(var(--p, 0) * 1%), var(--gray-100) 0);
    display: grid; place-items: center;
    position: relative;
}
.donut::after {
    content: "";
    position: absolute; inset: 14px;
    background: var(--surface);
    border-radius: 50%;
}
.donut__value {
    position: relative;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.donut--green { background: conic-gradient(var(--green-500) calc(var(--p, 0) * 1%), var(--gray-100) 0); }
.donut--amber { background: conic-gradient(var(--amber-500) calc(var(--p, 0) * 1%), var(--gray-100) 0); }

/* ============================================================
   Banners / alerts
   ============================================================ */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    color: var(--brand-deep);
    font-size: 13px;
    margin-bottom: 18px;
}
.banner--warn { background: var(--amber-50); border-color: #FCE7B0; color: var(--amber-600); }
.banner--success { background: var(--green-50); border-color: #BFE9D2; color: var(--green-600); }
.banner--danger { background: var(--red-50); border-color: #FACFCF; color: var(--red-600); }

/* ============================================================
   Portal landing
   ============================================================ */
.portal-page { background: var(--surface-alt); min-height: 100vh; }
.portal-page .topbar { background: var(--surface); }

.hero {
    padding: 60px 28px 32px;
    text-align: center;
    background: linear-gradient(180deg, #fff 0%, var(--brand-50) 100%);
    border-bottom: 1px solid var(--border-soft);
}
.hero__eyebrow {
    display: inline-block;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--brand-50);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 16px;
}
.hero__title { font-size: 36px; font-weight: 700; line-height: 1.15; max-width: 760px; margin: 0 auto 14px; }
.hero__sub { color: var(--text-body); max-width: 620px; margin: 0 auto; font-size: 15px; }

.surface-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 36px auto;
    padding: 0 28px;
}
.surface-card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    padding: 28px;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.surface-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--brand-100); }

.surface-card__icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    background: var(--brand-50);
    color: var(--brand-dark);
    display: grid; place-items: center;
}
.surface-card--cluster .surface-card__icon { background: var(--green-50); color: var(--green-600); }
.surface-card--employee .surface-card__icon { background: var(--purple-50); color: var(--purple-600); }

.surface-card__title { font-size: 20px; font-weight: 700; }
.surface-card__desc { color: var(--text-body); flex: 1; }
.surface-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-dark);
    font-weight: 600;
    font-size: 14px;
    margin-top: auto;
}
.surface-card--cluster .surface-card__cta { color: var(--green-600); }
.surface-card--employee .surface-card__cta { color: var(--purple-600); }

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { padding: 3px 8px; border-radius: var(--radius-pill); background: var(--gray-100); color: var(--text-body); font-size: 11px; font-weight: 500; }

.phase-strip {
    background: var(--surface);
    border-top: 1px solid var(--border-soft);
    padding: 30px 28px;
}
.phase-strip__inner { max-width: 1200px; margin: 0 auto; }
.phase-strip__title { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 14px; }
.phase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.phase {
    padding: 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
}
.phase__name { font-weight: 700; font-size: 13px; color: var(--text); }
.phase__what { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.phase--done { background: var(--green-50); border-color: #BFE9D2; }
.phase--done .phase__name { color: var(--green-600); }

/* ============================================================
   Employee mobile shell
   ============================================================ */
.mobile-page {
    background: linear-gradient(180deg, #eef2f7 0%, #e1e7ef 100%);
    min-height: 100vh;
    padding: 24px 16px 40px;
}
.mobile-frame {
    max-width: 420px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 760px;
}

.app-header {
    padding: 18px 18px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
}
.app-header__greet { font-size: 12px; color: var(--text-muted); }
.app-header__name { font-weight: 700; font-size: 16px; }
.app-header__actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--gray-100);
    display: grid; place-items: center;
    color: var(--text-body);
    position: relative;
}
.icon-btn__dot {
    position: absolute;
    top: 6px;
    inset-inline-end: 6px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--red-500);
    border: 2px solid var(--surface);
}

.app-body { flex: 1; padding: 18px 18px 90px; overflow-y: auto; }

.app-tabs {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border-soft);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 6px 0 14px;
}
.app-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
}
.app-tab--active { color: var(--brand-dark); }

.points-banner {
    background: linear-gradient(135deg, var(--brand), var(--purple-600));
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.points-banner__label { font-size: 12px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.04em; }
.points-banner__value { font-size: 24px; font-weight: 700; }
.points-banner__cta {
    padding: 6px 14px;
    background: rgba(255,255,255,0.18);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin: 18px 0 12px;
}
.section-title h3 { margin: 0; font-size: 15px; font-weight: 700; }
.section-title a { color: var(--brand-dark); font-size: 12px; font-weight: 600; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip-row::-webkit-scrollbar { display: none; }
.cat-chip {
    flex-shrink: 0;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    background: var(--gray-100);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-body);
    white-space: nowrap;
}
.cat-chip--active { background: var(--brand); color: #fff; }

.offer-card-mobile {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: var(--shadow-xs);
    position: relative;
}
.offer-card-mobile__img {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, var(--brand-100), var(--purple-50));
    background-size: cover;
    background-position: center;
    position: relative;
}
.offer-card-mobile__badge {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    padding: 4px 10px;
    background: var(--red-500);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-pill);
}
.offer-card-mobile__heart {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    display: grid; place-items: center;
    color: var(--text-body);
}
.offer-card-mobile__heart--saved { color: var(--red-500); }
.offer-card-mobile__body { padding: 12px 14px; }
.offer-card-mobile__vendor { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.offer-card-mobile__title { font-weight: 600; font-size: 14px; margin: 4px 0 6px; }
.offer-card-mobile__discount { color: var(--brand-dark); font-weight: 700; font-size: 14px; }
.offer-card-mobile__meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 11px; color: var(--text-muted); }
.offer-card-mobile__locked {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #fff;
    gap: 6px;
    border-radius: var(--radius-lg);
    text-align: center;
    padding: 16px;
}
.offer-card-mobile__locked-title { font-weight: 700; font-size: 14px; }
.offer-card-mobile__locked-sub { font-size: 12px; opacity: 0.9; }

.offer-row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 12px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}
.offer-row__img {
    width: 88px; height: 88px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--brand-100), var(--purple-50));
    background-size: cover; background-position: center;
}

/* Offer thumb in admin offer list */
.thumb { width: 56px; height: 40px; border-radius: var(--radius-sm); background: linear-gradient(135deg, var(--brand-100), var(--purple-50)); background-size: cover; background-position: center; flex-shrink: 0; }

/* Empty state */
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty__icon { font-size: 32px; margin-bottom: 8px; }

/* Generic layout helpers */
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 12px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 16px; }
.muted { color: var(--text-muted); }
.strong { font-weight: 600; }
.right { text-align: end; }
.center { text-align: center; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 980px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .app-topbar { padding: 0 16px; }
    .topbar-user__meta { display: none; }
    .content { padding: 20px 16px; }
}

/* Steps / wizard */
.steps { display: flex; gap: 0; margin-bottom: 24px; }
.step {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-right: none;
}
html[dir="rtl"] .step { border-right: 1px solid var(--border-soft); border-left: none; }
.step:first-child { border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
html[dir="rtl"] .step:first-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
.step:last-child { border-right: 1px solid var(--border-soft); border-top-right-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); }
html[dir="rtl"] .step:last-child { border-left: 1px solid var(--border-soft); border-top-right-radius: 0; border-bottom-right-radius: 0; border-top-left-radius: var(--radius-md); border-bottom-left-radius: var(--radius-md); }
.step__num {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--text-muted);
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}
.step--active { color: var(--brand-dark); background: var(--brand-50); }
.step--active .step__num { background: var(--brand); color: #fff; }
.step--done .step__num { background: var(--green-500); color: #fff; }

/* Avatar circle */
.avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--purple-500));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.avatar--lg { width: 48px; height: 48px; font-size: 16px; }
.avatar--green { background: linear-gradient(135deg, var(--green-500), var(--brand)); }

/* Detail strip cards */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.detail-cell {
    padding: 14px 16px;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
}
.detail-cell__label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.detail-cell__value { font-weight: 600; margin-top: 6px; font-size: 14px; }

/* Module toggle status banner */
.module-status {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}
.module-status__dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--green-500);
    flex-shrink: 0;
}
.module-status__dot--off { background: var(--gray-400); }
.module-status__title { font-weight: 600; font-size: 14px; }
.module-status__sub { font-size: 12px; color: var(--text-muted); }
