/* =============================================================
   Downtown Clinics CRM — Modern UI System
   Inspired by ATG Group approvals dashboard
   - Pink/purple primary, dark navy sidebar
   - RTL + LTR aware
   ============================================================= */

:root {
    /* Brand */
    --brand-pink: #ec3a8f;
    --brand-pink-light: #ff5fa6;
    --brand-pink-dark: #c8126b;
    --brand-violet: #8b5cf6;
    --brand-violet-dark: #6d28d9;
    --brand-blue: #4485f4;
    --brand-blue-dark: #2d6ad4;

    /* Surface */
    --bg: #f6f7fb;
    --bg-soft: #fbfbfd;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #f2f4f9;

    /* Sidebar */
    --sidebar-bg: #1d1c2c;
    --sidebar-bg-2: #161522;
    --sidebar-border: rgba(255, 255, 255, .06);
    --sidebar-text: #c5c8d6;
    --sidebar-text-muted: #7a7d92;
    --sidebar-heading: #6b6e85;
    --sidebar-hover: rgba(255, 255, 255, .055);

    /* Ink (text) */
    --ink: #1d1c2c;
    --ink-2: #2a2a3a;
    --ink-soft: #4a4d63;
    --muted: #818598;
    --muted-2: #a4a8b7;
    --line: #ebedf3;
    --line-2: #e2e5ed;

    /* Status colors */
    --teal: #1ac8a8;
    --teal-dark: #0f9d83;
    --green: #16a981;
    --green-dark: #0f7d62;
    --pink: #ec3a8f;
    --pink-soft: #fff0f7;
    --orange: #f59e0b;
    --orange-dark: #d97706;
    --amber: #f59e0b;
    --violet: #8b5cf6;
    --blue: #4485f4;
    --cyan: #06b6d4;
    --rose: #ef4444;
    --rose-dark: #dc2626;
    --yellow: #fbbf24;

    /* Gradients */
    --grad-primary: linear-gradient(135deg, #ff4287 0%, #b431ec 100%);
    --grad-primary-soft: linear-gradient(135deg, rgba(255, 66, 135, .9), rgba(180, 49, 236, .9));
    --grad-pink: linear-gradient(135deg, #ff4287, #ec3a8f);
    --grad-teal: linear-gradient(135deg, #2bd4b4, #0e9d83);
    --grad-blue: linear-gradient(135deg, #5d9af7, #2d6ad4);
    --grad-orange: linear-gradient(135deg, #ffba38, #f7821a);
    --grad-violet: linear-gradient(135deg, #a78bfa, #6d28d9);
    --grad-cyan: linear-gradient(135deg, #22d3ee, #0891b2);
    --grad-green: linear-gradient(135deg, #34d399, #059669);
    --grad-rose: linear-gradient(135deg, #fb7185, #e11d48);
    --grad-yellow: linear-gradient(135deg, #ffd166, #f59e0b);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 1px rgba(15, 23, 42, .03);
    --shadow: 0 6px 18px rgba(15, 23, 42, .06), 0 2px 6px rgba(15, 23, 42, .04);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, .1), 0 6px 14px rgba(15, 23, 42, .06);
    --shadow-card: 0 4px 18px rgba(15, 23, 42, .06);
    --shadow-pink: 0 12px 28px rgba(236, 58, 143, .35);
    --shadow-pink-soft: 0 6px 18px rgba(236, 58, 143, .22);

    /* Radii */
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --r-xl: 20px;
    --r-pill: 999px;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    scrollbar-color: rgba(139, 92, 246, .72) rgba(139, 92, 246, .08);
    scrollbar-width: thin;
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    min-height: 100vh;
    padding-bottom: 56px;
    background: var(--bg);
    color: var(--ink);
    font-family: "Inter", "Segoe UI", "Cairo", "Tajawal", Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: var(--ink); }
h1, h2, h3, h4, h5, h6 { color: var(--ink); }

input[readonly],
textarea[readonly] {
    background: var(--surface-3);
    color: var(--ink-soft);
    border-color: var(--line-2);
    cursor: not-allowed;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track {
    background: linear-gradient(180deg, rgba(139, 92, 246, .06), rgba(236, 58, 143, .05));
    border-radius: 999px;
}
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand-violet), var(--brand-pink));
    border: 3px solid rgba(255, 255, 255, .82);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--brand-violet-dark), var(--brand-pink-dark));
}

/* =============================================================
   Layout primitives
   ============================================================= */
.app-frame { min-height: 100vh; }

.main {
    padding: 18px 22px 84px;
    max-width: 1880px;
    margin: 0 auto;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    padding: 12px 18px;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.brand-lockup,
.identity {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-lockup h1,
.brand-lockup p,
.brand-lockup strong,
.brand-lockup small { margin: 0; }

.brand-lockup h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }

.brand-lockup small,
.identity small,
td small,
.request-item small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.brand-lockup.compact strong { display: block; font-size: 15px; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--r);
    background: var(--grad-primary);
    color: #ffffff;
    font-weight: 900;
    box-shadow: var(--shadow-pink-soft);
}

.brand-logo {
    display: block;
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.header-logo {
    width: 44px;
    height: 44px;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.top-nav a {
    padding: 9px 13px;
    border-radius: var(--r-sm);
    color: #637188;
    font-weight: 700;
    white-space: nowrap;
}

.top-nav a.active,
.top-nav a:hover {
    background: var(--pink-soft);
    color: var(--brand-pink-dark);
}

.topbar-actions,
.action-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =============================================================
   User chip / avatars
   ============================================================= */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, border-color .15s;
}
[dir="rtl"] .user-chip { padding: 6px 6px 6px 12px; }
.user-chip:hover { border-color: var(--line-2); box-shadow: var(--shadow); }

.avatar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.user-chip > span,
.identity > span,
.user-avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--grad-violet);
    color: #ffffff;
    font-weight: 800;
    overflow: hidden;
    font-size: 13px;
}

.user-avatar { object-fit: cover; }

.user-chip strong { display: block; font-size: 13px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.user-chip strong a { color: var(--ink); font-size: inherit; font-weight: inherit; }
.user-chip strong a:hover { color: var(--brand-pink-dark); }
.user-chip > div > a { color: var(--muted); font-size: 11px; font-weight: 600; }
.user-chip > div > a:hover { color: var(--brand-pink); }

.text-link,
.row-action,
.lang-toggle {
    color: var(--brand-pink);
    font-weight: 800;
}

.text-link:hover, .row-action:hover { color: var(--brand-pink-dark); }

.lang-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 36px;
    border-radius: var(--r-sm);
    padding: 0 12px;
    background: var(--pink-soft);
    color: var(--brand-pink-dark);
    border: 1px solid rgba(236, 58, 143, .14);
}
.lang-toggle:hover { background: rgba(236, 58, 143, .12); }

.login-lang {
    position: absolute;
    top: 18px;
    right: 18px;
}

/* =============================================================
   Footer
   ============================================================= */
.app-footer {
    position: fixed !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100%;
    z-index: 9999;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, .04);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    backdrop-filter: blur(10px);
}

.login-footer {
    width: 100%;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, .85);
    box-shadow: none;
    position: static !important;
}

/* =============================================================
   Hero band
   ============================================================= */
.hero-band {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    min-height: 116px;
    padding: 22px 28px;
    margin-bottom: 16px;
    color: #ffffff;
    border-radius: var(--r-lg);
    background: var(--grad-primary);
    box-shadow: var(--shadow-pink-soft);
    overflow: hidden;
    position: relative;
}

.hero-band::before {
    content: "";
    position: absolute;
    inset: -40% -10% auto auto;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(255, 255, 255, .18), transparent 60%);
    pointer-events: none;
}
[dir="rtl"] .hero-band::before { inset: -40% auto auto -10%; }

.hero-band h1,
.hero-band p { margin: 0; position: relative; z-index: 1; }

.hero-band h1 {
    font-size: clamp(24px, 2.6vw, 36px);
    font-weight: 800;
    letter-spacing: -.01em;
}

.hero-band p {
    margin-top: 6px;
    color: rgba(255, 255, 255, .92);
}

.hero-meta {
    display: grid;
    gap: 8px;
    justify-items: end;
    min-width: 160px;
    position: relative;
    z-index: 1;
}

.hero-meta span,
.hero-meta strong {
    padding: 7px 12px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .22);
    backdrop-filter: blur(6px);
    font-size: 12px;
    font-weight: 700;
}

.eyebrow {
    color: rgba(255, 255, 255, .85);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .14em;
    margin-bottom: 6px;
}

/* =============================================================
   Metric cards (color cards)
   ============================================================= */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.panel,
.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
}

.metric-card {
    position: relative;
    min-height: 124px;
    padding: 18px 18px 16px;
    color: #ffffff;
    overflow: hidden;
    border: 0;
}

.metric-card::after {
    content: "";
    position: absolute;
    inset: -50% -30% auto auto;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 70%);
    pointer-events: none;
}
[dir="rtl"] .metric-card::after { inset: -50% auto auto -30%; }

.metric-card small,
.metric-card em {
    display: block;
    color: rgba(255, 255, 255, .92);
    font-style: normal;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.45;
    position: relative;
}

.metric-card strong {
    display: block;
    margin: 12px 0 4px;
    font-size: clamp(24px, 2.2vw, 34px);
    font-weight: 800;
    letter-spacing: -.01em;
    position: relative;
}

.metric-icon {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .22);
    color: #ffffff;
    font-weight: 900;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, .28);
}
[dir="rtl"] .metric-icon { right: auto; left: 14px; }

.metric-card.teal   { background: var(--grad-teal);   }
.metric-card.pink   { background: var(--grad-pink);   }
.metric-card.blue   { background: var(--grad-blue);   }
.metric-card.orange { background: var(--grad-orange); }
.metric-card.violet { background: var(--grad-violet); }
.metric-card.cyan   { background: var(--grad-cyan);   }
.metric-card.green  { background: var(--grad-green);  }
.metric-card.rose   { background: var(--grad-rose);   }
.metric-card.yellow { background: var(--grad-yellow); }

/* =============================================================
   Dashboard layout
   ============================================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
    gap: 16px;
    margin-bottom: 16px;
}

.dashboard-grid.thirds {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* =============================================================
   Panels
   ============================================================= */
.panel { padding: 20px; }

.panel-header {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.panel-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -.005em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2::before {
    content: "";
    width: 6px;
    height: 22px;
    border-radius: var(--r-pill);
    background: var(--grad-primary);
    flex-shrink: 0;
}

.panel-header.accent-pink   h2::before { background: var(--grad-pink);   }
.panel-header.accent-orange h2::before { background: var(--grad-orange); }
.panel-header.accent-violet h2::before { background: var(--grad-violet); }
.panel-header.accent-blue   h2::before { background: var(--grad-blue);   }
.panel-header.accent-green  h2::before { background: var(--grad-green);  }
.panel-header.accent-cyan   h2::before { background: var(--grad-cyan);   }

.panel-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
}

/* =============================================================
   Pills, chips, badges
   ============================================================= */
.pill,
.source-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: var(--r-pill);
    padding: 4px 12px;
    background: var(--pink-soft);
    color: var(--brand-pink-dark);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.source-chip {
    background: var(--surface-3);
    color: var(--ink-soft);
}

.chart-canvas { width: 100%; max-width: 100%; }

/* =============================================================
   Funnels, ranks, timelines
   ============================================================= */
.funnel-list,
.rank-list,
.timeline,
.request-list {
    display: grid;
    gap: 11px;
}

.funnel-row,
.rank-row {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.funnel-row { grid-template-columns: 1fr auto; }
.funnel-row:last-child,
.rank-row:last-child { border-bottom: 0; }

.rank-row > b {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--pink-soft);
    color: var(--brand-pink-dark);
    font-weight: 800;
    font-size: 12px;
}

.funnel-row i,
.rank-row i {
    grid-column: 1 / -1;
    display: block;
    height: 7px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    overflow: hidden;
}

.funnel-row i::after,
.rank-row i::after {
    content: "";
    display: block;
    width: var(--w);
    height: 100%;
    border-radius: inherit;
    background: var(--grad-primary);
}

.rank-row small { color: var(--muted); font-size: 11.5px; font-weight: 500; }

/* =============================================================
   Status badges
   ============================================================= */
.status-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.import-columns { align-content: start; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 26px;
    padding: 4px 12px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge b {
    margin-inline-start: 4px;
    padding: 0 6px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .55);
    font-size: 11px;
    font-weight: 800;
}

.status-badge.neutral { background: #eef0f5; color: #4a5b70; }
.status-badge.won     { background: #defaee; color: #0e7a51; }
.status-badge.warm    { background: #fff1de; color: #9a5a04; }
.status-badge.cold    { background: #e2eaff; color: #2e62c5; }
.status-badge.lost    { background: #ffe1ec; color: #c1206a; }

.header-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.score-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.score-pill em {
    min-width: 26px;
    padding: 2px 7px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .78);
    font-size: 11px;
    font-style: normal;
    text-align: center;
    font-weight: 800;
}

.score-pill.hot   { background: var(--grad-pink);   color: #ffffff; }
.score-pill.warm  { background: var(--grad-orange); color: #ffffff; }
.score-pill.watch { background: var(--grad-teal);   color: #ffffff; }
.score-pill.cold  { background: var(--grad-blue);   color: #ffffff; }
.score-pill em { color: var(--ink); }

/* =============================================================
   Filters & toolbars
   ============================================================= */
.filters {
    display: grid;
    grid-template-columns: 1.2fr repeat(4, minmax(150px, .75fr)) auto;
    gap: 10px;
    align-items: end;
}

.filters .grow { grid-column: span 4; }

.bulk-bar {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) minmax(220px, .5fr) auto;
    gap: 10px;
    align-items: center;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
}

.table-action-bar {
    display: grid;
    grid-template-columns: auto minmax(170px, 1fr) minmax(170px, .55fr) minmax(160px, .45fr) minmax(160px, .45fr) auto;
    gap: 10px;
    align-items: center;
    padding: 14px;
    margin: 0 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
}

.table-action-bar strong { color: var(--ink); font-weight: 800; }
.table-action-bar strong span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.select-all-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-soft);
    font-weight: 700;
    white-space: nowrap;
}

.select-all-control input,
.select-col input {
    width: 17px;
    height: 17px;
    accent-color: var(--brand-pink);
}

/* =============================================================
   Forms
   ============================================================= */
label span {
    display: block;
    margin-bottom: 7px;
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 800;
}

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--ink);
    padding: 11px 13px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}

input::placeholder, textarea::placeholder { color: var(--muted-2); }

textarea { resize: vertical; min-height: 96px; }

input:hover, select:hover, textarea:hover { border-color: var(--line-2); }

input:focus, select:focus, textarea:focus {
    border-color: var(--brand-pink);
    background: var(--surface);
    box-shadow: 0 0 0 4px rgba(236, 58, 143, .12);
}

input[type="file"] {
    padding: 10px;
    background: var(--surface-2);
    cursor: pointer;
}

.password-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.password-field button {
    border: 0;
    border-radius: var(--r);
    padding: 0 14px;
    background: var(--pink-soft);
    color: var(--brand-pink-dark);
    cursor: pointer;
    font-weight: 800;
    font-size: 12px;
    transition: background-color .15s;
}
.password-field button:hover { background: rgba(236, 58, 143, .12); }

.profile-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.profile-summary strong,
.profile-summary span,
.profile-summary small { display: block; }

.profile-summary strong { font-size: 18px; font-weight: 800; }
.profile-summary span,
.profile-summary small {
    margin-top: 4px;
    color: var(--muted);
}

.profile-avatar {
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: var(--grad-primary);
    color: #ffffff;
    object-fit: cover;
    font-size: 28px;
    font-weight: 800;
    box-shadow: var(--shadow-pink-soft);
}

.readonly-grid input[readonly] {
    background: var(--surface-3);
    color: var(--muted);
    cursor: default;
}

/* =============================================================
   Buttons
   ============================================================= */
.primary-button,
.secondary-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    border-radius: var(--r);
    padding: 0 18px;
    color: #ffffff;
    background: var(--grad-primary);
    cursor: pointer;
    font-weight: 800;
    font-size: 13.5px;
    letter-spacing: 0;
    box-shadow: var(--shadow-pink-soft);
    transition: transform .12s ease, box-shadow .15s ease, opacity .15s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-pink);
}

.primary-button:active { transform: translateY(0); }

.secondary-button {
    color: var(--brand-pink-dark);
    background: var(--pink-soft);
    border: 1px solid rgba(236, 58, 143, .15);
    box-shadow: none;
}
.secondary-button:hover {
    background: rgba(236, 58, 143, .12);
    border-color: rgba(236, 58, 143, .25);
}

.danger-button {
    background: linear-gradient(135deg, #f87171, #dc2626);
    box-shadow: 0 6px 16px rgba(220, 38, 38, .25);
}
.danger-button:hover {
    box-shadow: 0 10px 24px rgba(220, 38, 38, .32);
    transform: translateY(-1px);
}

.primary-button.compact,
.secondary-button.compact,
.danger-button.compact {
    min-height: 34px;
    padding: 0 14px;
    font-size: 12.5px;
    border-radius: 10px;
}

/* =============================================================
   Alerts
   ============================================================= */
.alert {
    padding: 12px 16px;
    border-radius: var(--r);
    margin-bottom: 14px;
    background: linear-gradient(180deg, #ecfdf5, #d1fae5);
    color: #065f46;
    border: 1px solid #a7f3d0;
    font-weight: 700;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
}

.alert.danger {
    background: linear-gradient(180deg, #fff1f2, #ffe4e6);
    color: #9f1239;
    border-color: #fecdd3;
}

/* =============================================================
   Tables
   ============================================================= */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--r);
    border: 1px solid var(--line);
    background: var(--surface);
}

table {
    width: 100%;
    min-width: 1060px;
    border-collapse: separate;
    border-spacing: 0;
}

th, td {
    padding: 14px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

[dir="rtl"] th,
[dir="rtl"] td { text-align: right; }

th {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--bg-soft);
    position: sticky;
    top: 0;
    z-index: 2;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    padding-right: 30px;
}

[dir="rtl"] .sortable-th {
    padding-right: 14px;
    padding-left: 30px;
}

.sortable-th::after {
    content: "^";
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-55%) rotate(180deg);
    color: var(--muted-2);
    font-size: 10px;
    opacity: .6;
}

[dir="rtl"] .sortable-th::after {
    right: auto;
    left: 12px;
}

.sortable-th.sorted-asc,
.sortable-th.sorted-desc {
    color: var(--brand-pink-dark);
    background: #fff0f7;
}

.sortable-th.sorted-asc::after {
    content: "^";
    transform: translateY(-55%);
    color: var(--brand-pink);
    opacity: 1;
}

.sortable-th.sorted-desc::after {
    content: "v";
    transform: translateY(-55%);
    color: var(--brand-pink);
    opacity: 1;
}

.column-filter-row th {
    top: 45px;
    padding: 8px;
    background: rgba(255, 255, 255, .96);
    text-transform: none;
    letter-spacing: 0;
    z-index: 3;
}

.column-filter-row input {
    width: 100%;
    min-width: 90px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    outline: none;
    padding: 7px 9px;
}

.column-filter-row input:focus {
    border-color: rgba(168, 85, 247, .55);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, .12);
}

tbody tr { transition: background-color .15s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }

.select-col {
    width: 44px;
    text-align: center;
}

td strong { display: block; font-weight: 800; }

/* =============================================================
   Detail grid
   ============================================================= */
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr);
    gap: 16px;
    margin-bottom: 16px;
}

.facts-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.compact-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.facts-grid div {
    padding: 14px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--r);
    min-width: 0;
}

.facts-grid dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px;
}

.facts-grid dd {
    margin: 0;
    font-weight: 800;
    overflow-wrap: anywhere;
    color: var(--ink);
}

.notes-block {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.notes-block p {
    color: var(--ink-soft);
    line-height: 1.8;
}

/* =============================================================
   Duplicates
   ============================================================= */
.duplicate-alert {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #fecdd3;
    border-radius: var(--r);
    background: linear-gradient(180deg, #fff1f2, #ffe4e6);
}

.duplicate-alert a,
.duplicate-list a { color: inherit; }
.duplicate-alert a { font-weight: 800; color: var(--brand-pink-dark); }

.duplicate-list { display: grid; gap: 10px; }

.duplicate-list a {
    display: grid;
    gap: 7px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
    transition: border-color .15s, box-shadow .15s;
}
.duplicate-list a:hover {
    border-color: rgba(236, 58, 143, .3);
    box-shadow: var(--shadow-sm);
}

.duplicate-list span,
.duplicate-list em {
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.stacked-form { display: grid; gap: 14px; }
.stacked-form.panel { margin: 0; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.compact-form {
    box-shadow: none;
    border: 0;
    padding: 0;
    background: transparent;
}

/* =============================================================
   Timeline
   ============================================================= */
.timeline-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.timeline-item > span {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--grad-violet);
    color: #ffffff;
    font-weight: 800;
    font-size: 12px;
}

.timeline-item p {
    margin: 4px 0 0;
    color: var(--muted);
}

.timeline-item small {
    display: block;
    margin-top: 8px;
    color: var(--ink-soft);
    line-height: 1.55;
}

.task-timeline {
    gap: 14px;
}

.task-create-box {
    margin: 14px 0;
    border: 1px solid rgba(168, 85, 247, .2);
    border-radius: var(--r);
    background: linear-gradient(135deg, rgba(168, 85, 247, .07), rgba(236, 58, 143, .05));
    padding: 10px 12px;
}

.task-create-box summary {
    cursor: pointer;
    color: var(--brand-violet-dark);
    font-weight: 800;
}

.task-create-box .stacked-form {
    margin-top: 12px;
}

.inline-task-form {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
}

.inline-task-form select {
    min-width: 120px;
}

/* =============================================================
   Requests
   ============================================================= */
.request-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
}

.request-item p {
    margin: 7px 0;
    color: var(--ink-soft);
    line-height: 1.7;
}

/* =============================================================
   Campaigns
   ============================================================= */
.campaign-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.campaign-card {
    display: grid;
    gap: 14px;
    min-height: 178px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    position: relative;
    overflow: hidden;
}

.campaign-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--grad-primary);
    opacity: 0;
    transition: opacity .15s;
}

.campaign-card:hover {
    transform: translateY(-3px);
    border-color: rgba(236, 58, 143, .2);
    box-shadow: var(--shadow-lg);
}
.campaign-card:hover::before { opacity: 1; }

.campaign-card strong {
    display: block;
    font-size: 16px;
    font-weight: 800;
}

.campaign-card small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
}

.campaign-card > span {
    align-self: start;
    color: var(--brand-pink);
    font-size: 22px;
    font-weight: 800;
}

.campaign-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.campaign-stats em {
    padding: 8px 10px;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-style: normal;
    font-weight: 700;
}

.campaign-title-panel { margin-bottom: 14px; }

/* =============================================================
   Outbound / buckets / agents
   ============================================================= */
.bucket-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.bucket-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 13px;
    transition: all .15s;
}

.bucket-tabs a:hover {
    border-color: rgba(236, 58, 143, .25);
    color: var(--brand-pink-dark);
    background: var(--pink-soft);
}

.bucket-tabs a.active {
    background: var(--grad-primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: var(--shadow-pink-soft);
}

.agent-switcher {
    display: grid;
    grid-template-columns: minmax(220px, 320px) auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.outbound-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.single-outbound {
    max-width: 1180px;
}

.outbound-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
}

.outbound-card p {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.6;
    min-height: 44px;
}

.queue-intel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    gap: 14px;
    margin-top: 14px;
}

.queue-intel-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.compact-score {
    width: 50px;
    height: 50px;
    font-size: 12px;
}

.compact-next {
    padding: 12px 14px;
}

.compact-next p {
    font-size: 13px;
    line-height: 1.45;
}

.compact-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-summary span {
    min-width: 0;
    padding: 10px;
}

.compact-summary b {
    font-size: 16px;
}

.compact-alerts {
    gap: 6px;
}

.compact-alerts span {
    padding: 8px 10px;
}

.compact-script {
    padding: 12px 14px;
}

.compact-script ul {
    margin-top: 6px;
}

.queue-compact-timeline {
    max-height: 285px;
}

.outbound-phone {
    padding: 12px;
    border: 1px dashed rgba(236, 58, 143, .35);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--brand-pink-dark);
    font-weight: 800;
    text-align: center;
    letter-spacing: .04em;
}

.outbound-actions { justify-content: stretch; }
.outbound-actions > * { flex: 1; }

.touch-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.4fr) minmax(170px, 1fr) minmax(170px, 1fr);
    gap: 8px;
    align-items: end;
}

.touch-form textarea { grid-column: 1 / -1; }

.touch-field {
    display: grid;
    gap: 4px;
    margin: 0;
}

.touch-field span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
}

.touch-field input {
    width: 100%;
}

.touch-form input:read-only,
.touch-form input:disabled {
    background: var(--surface-3);
    color: var(--muted);
}

.touch-form input:disabled {
    cursor: not-allowed;
    opacity: .72;
}

.mini-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-facts span {
    padding: 6px 10px;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
}

.booking-box {
    border-top: 1px solid var(--line);
    padding-top: 12px;
}

.booking-box summary {
    cursor: pointer;
    color: var(--brand-violet-dark);
    font-weight: 800;
    list-style: none;
}
.booking-box summary::-webkit-details-marker { display: none; }
.booking-box summary::before {
    content: "+";
    display: inline-block;
    width: 22px;
    height: 22px;
    margin-inline-end: 6px;
    border-radius: 6px;
    background: rgba(139, 92, 246, .14);
    color: var(--brand-violet-dark);
    text-align: center;
    line-height: 22px;
    font-weight: 900;
}

.booking-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.booking-form button { grid-column: 1 / -1; }

.appointment-repeat {
    display: grid;
    gap: 10px;
    grid-column: 1 / -1;
}

.appointment-row {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
}

.subsection-title {
    color: var(--ink);
    font-weight: 900;
    font-size: 13px;
    margin-top: 4px;
}

.incoming-inbound-form .appointment-repeat {
    margin-top: -4px;
}

/* =============================================================
   FAQ
   ============================================================= */
.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.faq-item h2 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 800;
}

.faq-item p {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.85;
}

.inline-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* =============================================================
   Permissions
   ============================================================= */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.permission-grid > div {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
}

.permission-grid span {
    padding: 6px 10px;
    border-radius: var(--r-sm);
    font-size: 11.5px;
    font-weight: 800;
}

.permission-grid .yes {
    background: #d1fae5;
    color: #065f46;
}

.permission-grid .no {
    background: #f1f3f8;
    color: var(--muted);
}

.matrix-table { min-width: 720px; }

.matrix-table th:not(:first-child),
.matrix-table td:not(:first-child) {
    text-align: center;
}

.matrix-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-pink);
}

/* =============================================================
   Settings
   ============================================================= */
.lookup-section { margin-top: 14px; }

.settings-subnav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.settings-subnav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 13px;
    transition: all .15s;
}

.settings-subnav a:hover {
    border-color: rgba(236, 58, 143, .2);
    color: var(--brand-pink-dark);
    background: var(--pink-soft);
}

.settings-subnav a.active {
    border-color: transparent;
    background: var(--grad-primary);
    color: #ffffff;
    box-shadow: var(--shadow-pink-soft);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.settings-card {
    display: grid;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    position: relative;
    overflow: hidden;
}
.settings-card::after {
    content: "\2192";
    position: absolute;
    top: 16px;
    right: 18px;
    color: var(--brand-pink);
    font-weight: 900;
    font-size: 18px;
    opacity: 0;
    transition: opacity .15s, transform .15s;
}
[dir="rtl"] .settings-card::after { right: auto; left: 18px; content: "\2190"; }
.settings-card:hover {
    transform: translateY(-2px);
    border-color: rgba(236, 58, 143, .25);
    box-shadow: var(--shadow-lg);
}
.settings-card:hover::after { opacity: 1; transform: translateX(4px); }
[dir="rtl"] .settings-card:hover::after { transform: translateX(-4px); }

.settings-card p,
.muted-copy {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.75;
}

.settings-card span {
    color: var(--brand-pink);
    font-weight: 800;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 24px;
    font-weight: 700;
    color: var(--ink-soft);
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-pink);
}

/* =============================================================
   Pagination
   ============================================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding-top: 18px;
}

.pagination a {
    display: grid;
    place-items: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink-soft);
    font-weight: 800;
    font-size: 13px;
    transition: all .15s;
}

.pagination a:hover {
    border-color: rgba(236, 58, 143, .25);
    color: var(--brand-pink-dark);
}

.pagination a.active {
    background: var(--grad-primary);
    color: #ffffff;
    border-color: transparent;
    box-shadow: var(--shadow-pink-soft);
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 24px;
}

/* =============================================================
   Login page
   ============================================================= */
.login-page {
    min-height: 100vh;
    padding-bottom: 0;
    background: linear-gradient(135deg, #ec3a8f 0%, #b431ec 60%, #4485f4 130%);
    color: var(--ink);
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .55;
    pointer-events: none;
}
.login-page::before {
    width: 520px;
    height: 520px;
    top: -120px;
    left: -180px;
    background: rgba(255, 255, 255, .22);
}
.login-page::after {
    width: 420px;
    height: 420px;
    right: -120px;
    bottom: -160px;
    background: rgba(180, 49, 236, .55);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 18px;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.login-panel {
    position: relative;
    width: min(460px, 100%);
    background: #ffffff;
    border: 0;
    border-radius: 22px;
    box-shadow: 0 32px 60px rgba(15, 23, 42, .25), 0 0 0 1px rgba(255, 255, 255, .25);
    padding: 36px 32px 30px;
    overflow: hidden;
}

.login-panel .brand-lockup {
    display: grid;
    place-items: center;
    text-align: center;
    margin-bottom: 28px;
    gap: 4px;
}

.login-panel .brand-logo {
    width: 84px;
    height: 84px;
    border-radius: 22px;
    object-fit: contain;
    padding: 10px;
    background: var(--grad-primary);
    box-shadow: var(--shadow-pink);
    margin: 0 auto 14px;
}

.login-panel .brand-lockup h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -.015em;
}

.login-panel .brand-lockup p {
    color: var(--muted);
    margin: 4px 0 0;
    font-size: 13px;
}

.login-panel .stacked-form { gap: 16px; }

.login-panel .primary-button {
    margin-top: 6px;
    min-height: 48px;
    font-size: 14px;
    border-radius: 14px;
}

.login-panel .alert { margin: 0 0 14px; }

/* =============================================================
   Command center frame (main app layout)
   ============================================================= */
.command-center {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --soft: #f9fafc;
    background:
        radial-gradient(1100px 600px at -20% -10%, rgba(236, 58, 143, .07), transparent 60%),
        radial-gradient(900px 500px at 110% 10%, rgba(139, 92, 246, .06), transparent 60%),
        var(--bg);
    min-height: 100vh;
}

.command-frame {
    display: grid;
    grid-template-columns: 244px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100vh;
}

.command-sidebar {
    position: sticky;
    top: 0;
    grid-row: 1 / span 2;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 18px;
    height: 100vh;
    padding: 18px 14px 18px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    border-right: 1px solid var(--sidebar-border);
    box-shadow: 8px 0 30px rgba(15, 23, 42, .08);
    color: var(--sidebar-text);
    overflow: hidden;
}

[dir="rtl"] .command-sidebar {
    border-right: 0;
    border-left: 1px solid var(--sidebar-border);
    box-shadow: -8px 0 30px rgba(15, 23, 42, .08);
}

.command-side-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 16px;
    border-bottom: 1px solid var(--sidebar-border);
    color: #ffffff;
    text-decoration: none;
}

.command-side-brand .brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: contain;
    padding: 5px;
    background: rgba(255, 255, 255, .08);
    box-shadow: var(--shadow-pink-soft);
    flex: 0 0 auto;
}

.command-brand-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.command-brand-text strong {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -.005em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-brand-text span {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--sidebar-text-muted);
    letter-spacing: .02em;
}

.command-side-nav {
    display: grid;
    align-content: start;
    gap: 4px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(236, 58, 143, .8) rgba(255, 255, 255, .06);
}

.command-side-nav::-webkit-scrollbar { width: 6px; }
.command-side-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .05);
    border-radius: 999px;
}
.command-side-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand-pink), var(--brand-violet));
    border-radius: 999px;
}

.command-side-nav a {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 44px;
    padding: 7px 12px;
    border-radius: 12px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 700;
    transition: background-color .15s, color .15s;
    position: relative;
}

.command-side-nav a:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.command-side-nav a.active {
    background: var(--grad-primary);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(236, 58, 143, .35), inset 0 1px 0 rgba(255, 255, 255, .15);
}

.command-side-nav a.active::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 4px;
    width: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 0 10px rgba(255, 255, 255, .6);
}
[dir="rtl"] .command-side-nav a.active::before {
    left: auto;
    right: 4px;
}

.command-side-nav span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    transition: background-color .15s, color .15s;
}

.command-side-nav a:hover span { background: rgba(255, 255, 255, .12); }
.command-side-nav a.active span {
    background: rgba(255, 255, 255, .22);
    color: #ffffff;
}

.command-side-nav b {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-upcoming {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(236, 58, 143, .18), rgba(139, 92, 246, .18));
    border: 1px solid rgba(255, 255, 255, .08);
    color: #ffffff;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}

.sidebar-upcoming:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(236, 58, 143, .25);
}

.sidebar-upcoming span,
.sidebar-upcoming em,
.sidebar-upcoming i { font-style: normal; }

.sidebar-upcoming span,
.sidebar-upcoming em {
    color: rgba(255, 255, 255, .8);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sidebar-upcoming strong {
    font-size: 28px;
    line-height: 1;
    font-weight: 800;
}

.sidebar-upcoming i {
    width: fit-content;
    margin-top: 4px;
    padding: 7px 12px;
    border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .95);
    color: var(--brand-pink-dark);
    font-size: 11.5px;
    font-weight: 800;
}

/* =============================================================
   Top header (command bar)
   ============================================================= */
.command-header {
    position: sticky;
    top: 0;
    z-index: 25;
    grid-column: 2;
    display: grid;
    grid-template-columns: auto minmax(260px, 520px) minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 64px;
    padding: 10px 22px;
    background: rgba(255, 255, 255, .85);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
    box-shadow: none;
}

.menu-chip {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: var(--surface-3);
    color: var(--ink-2);
    font-size: 0;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.menu-chip::before {
    content: "";
    width: 16px;
    height: 10px;
    border-top: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
}

.menu-chip::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 2px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.menu-chip:hover { background: var(--pink-soft); color: var(--brand-pink-dark); }

/* Header icon glyphs */
.top-icon-chip .icon-glyph {
    position: relative;
    display: inline-block;
    width: 18px;
    height: 18px;
    color: currentColor;
}

.icon-bell .icon-glyph::before {
    content: "";
    position: absolute;
    top: 1px;
    left: 50%;
    width: 14px;
    height: 13px;
    transform: translateX(-50%);
    background: currentColor;
    border-radius: 8px 8px 4px 4px;
}
.icon-bell .icon-glyph::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 6px;
    height: 4px;
    background: currentColor;
    border-radius: 0 0 999px 999px;
    transform: translateX(-50%);
}

.icon-cal .icon-glyph::before {
    content: "";
    position: absolute;
    inset: 4px 0 0 0;
    border: 2px solid currentColor;
    border-radius: 4px;
}
.icon-cal .icon-glyph::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    width: 14px;
    height: 4px;
    background: currentColor;
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 6px 0 currentColor inset;
}

.icon-notification .icon-glyph::before {
    content: "";
    position: absolute;
    inset: 2px 3px 3px 3px;
    border: 2px solid currentColor;
    border-radius: 5px;
}

.icon-notification .icon-glyph::after {
    content: "";
    position: absolute;
    top: 7px;
    left: 6px;
    width: 6px;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    box-shadow: 0 4px 0 currentColor;
}

.notification-list {
    display: grid;
    gap: 12px;
}

.notification-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
}

.notification-row.unread {
    border-color: rgba(139, 92, 246, .28);
    background: linear-gradient(135deg, rgba(139, 92, 246, .1), rgba(236, 58, 143, .07));
}

.notification-row small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
}

.dot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--grad-primary);
    color: #ffffff;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(236, 58, 143, .4);
    border: 2px solid var(--surface);
}
[dir="rtl"] .dot-badge { right: auto; left: -4px; }

.patient-360-grid {
    align-items: stretch;
}

.ai-assistant-card,
.patient-360-card,
.ai-mini-card {
    overflow: hidden;
}

.score-ring {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, var(--surface) 55%, transparent 57%),
        conic-gradient(var(--brand-pink) var(--score, 72%), rgba(139, 92, 246, .18) 0);
    color: var(--brand-pink-dark);
    font-weight: 900;
    box-shadow: inset 0 0 0 1px rgba(236, 58, 143, .14);
}

.assistant-next {
    padding: 14px 16px;
    border: 1px solid rgba(236, 58, 143, .16);
    border-radius: var(--r);
    background: linear-gradient(135deg, rgba(236, 58, 143, .08), rgba(139, 92, 246, .08));
}

.assistant-next p {
    margin: 6px 0 0;
    color: var(--ink);
    font-weight: 700;
}

.assistant-summary,
.patient-360-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.assistant-summary span,
.patient-360-metrics span {
    display: grid;
    gap: 3px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.assistant-summary b,
.patient-360-metrics b {
    color: var(--ink);
    font-size: 20px;
}

.assistant-alerts {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.assistant-alerts span {
    padding: 9px 11px;
    border-radius: var(--r);
    background: rgba(245, 158, 11, .12);
    color: #9a5a00;
    font-weight: 800;
    font-size: 12px;
}

.script-box {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
}

.script-box ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: var(--ink-soft);
}

.compact-timeline {
    margin-top: 12px;
    max-height: 420px;
    overflow: auto;
    padding-right: 4px;
}

.touch-form + .booking-box {
    margin-top: 12px;
}

.icon-bell { color: var(--brand-pink-dark); }
.icon-bell:hover {
    background: var(--pink-soft);
    border-color: rgba(236, 58, 143, .2);
}
.icon-cal { color: var(--brand-violet-dark); }
.icon-cal:hover {
    background: rgba(139, 92, 246, .1);
    border-color: rgba(139, 92, 246, .2);
    color: var(--brand-violet-dark);
}

.command-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 540px;
    padding: 4px 4px 4px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s;
}
[dir="rtl"] .command-search { padding: 4px 14px 4px 4px; }
.command-search:focus-within {
    border-color: rgba(236, 58, 143, .4);
    box-shadow: 0 0 0 4px rgba(236, 58, 143, .1);
}

.command-search input {
    min-height: 34px;
    border: 0;
    background: transparent;
    padding: 0;
}
.command-search input:focus { box-shadow: none; background: transparent; }

.command-search button {
    min-height: 34px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--grad-primary);
    color: #ffffff;
    font-weight: 800;
    font-size: 12.5px;
    cursor: pointer;
    box-shadow: var(--shadow-pink-soft);
    transition: transform .12s;
}
.command-search button:hover { transform: translateY(-1px); }

.top-icon-chip {
    display: grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    padding: 0 11px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
    transition: all .15s;
    position: relative;
}
.top-icon-chip:hover {
    border-color: rgba(236, 58, 143, .2);
    color: var(--brand-pink-dark);
}

.command-center .topbar-actions {
    grid-column: 4;
    justify-self: end;
    gap: 8px;
}

.command-center .main {
    grid-column: 2;
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: 22px 24px 96px;
}

.command-center .app-footer {
    left: 244px !important;
    width: calc(100% - 244px);
}

.command-center .command-page-title {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-card);
    min-height: 92px;
    padding: 18px 24px;
    border: 1px solid var(--line);
}
.command-center .command-page-title::before { display: none; }
.command-center .command-page-title .eyebrow { color: var(--brand-pink); }
.command-center .command-page-title h1 { color: var(--ink); font-size: clamp(22px, 2.2vw, 30px); }
.command-center .command-page-title p { color: var(--muted); }

.command-center .command-page-title .hero-meta span,
.command-center .command-page-title .hero-meta strong {
    background: var(--pink-soft);
    color: var(--brand-pink-dark);
    border: 1px solid rgba(236, 58, 143, .14);
}

.command-center .metric-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
}

.metric-grid.campaign-money-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.command-center .metric-card {
    min-height: 124px;
    padding: 18px 18px 16px;
    color: #ffffff;
}

.command-center .metric-card small,
.command-center .metric-card em { color: rgba(255, 255, 255, .92); }

.command-center .metric-card strong { color: #ffffff; }

.command-center .metric-icon {
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, .22);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, .28);
}
[dir="rtl"] .command-center .metric-icon { right: auto; left: 14px; }

/* =============================================================
   Command dashboard layouts
   ============================================================= */
.command-dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr) minmax(220px, .45fr);
    gap: 14px;
    margin-bottom: 14px;
}

.command-dashboard-layout .wide { min-width: 0; }
.tasks-panel { min-width: 0; }

.command-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr) minmax(260px, .58fr);
    gap: 14px;
    margin-bottom: 14px;
}

/* =============================================================
   Task stack
   ============================================================= */
.task-stack { display: grid; gap: 10px; }

.task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
    transition: transform .12s, border-color .15s, background-color .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
}

.task-row::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--brand-pink);
    transition: width .15s;
}
[dir="rtl"] .task-row::before { inset: 0 0 0 auto; }

.task-row:hover {
    transform: translateY(-1px);
    border-color: var(--line-2);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.task-row span { color: var(--ink-soft); font-weight: 700; font-size: 13px; }
.task-row strong { color: var(--ink); font-weight: 800; font-size: 18px; }

.task-row.pink::before   { background: var(--brand-pink);   } .task-row.pink   strong { color: var(--brand-pink-dark); }
.task-row.blue::before   { background: var(--brand-blue);   } .task-row.blue   strong { color: var(--brand-blue-dark); }
.task-row.teal::before   { background: var(--teal);         } .task-row.teal   strong { color: var(--teal-dark);  }
.task-row.orange::before { background: var(--orange);       } .task-row.orange strong { color: var(--orange-dark);  }

/* =============================================================
   Internal chat
   ============================================================= */
.chat-widget {
    position: fixed;
    right: 22px;
    bottom: 74px;
    z-index: 80;
    width: min(410px, calc(100vw - 28px));
    font-size: 13px;
}

[dir="rtl"] .chat-widget {
    right: auto;
    left: 22px;
}

.chat-widget details {
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, .18);
}

.chat-widget summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
    padding: 12px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--brand-pink), var(--brand-violet));
    color: #fff;
    cursor: pointer;
    font-weight: 850;
    list-style: none;
}

[dir="rtl"] .chat-widget summary { margin-left: 0; margin-right: 0; }
.chat-widget summary::-webkit-details-marker { display: none; }

.chat-widget summary em {
    min-width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    font-style: normal;
    font-size: 11px;
}

.chat-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    height: 430px;
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid rgba(168, 85, 247, .18);
    border-radius: 18px;
    background: rgba(255, 255, 255, .98);
}

.chat-thread {
    min-width: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
}

.chat-thread header {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    display: grid;
}

.chat-thread header small {
    color: var(--muted);
}

.chat-messages {
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, #fff, #fbf7ff);
}

.chat-messages article {
    max-width: 86%;
    padding: 9px 10px;
    border-radius: 14px;
}

.chat-messages article.mine {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--brand-pink), var(--brand-violet));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-messages article.theirs {
    align-self: flex-start;
    background: #fff;
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
}

.chat-messages p {
    margin: 0;
    line-height: 1.45;
    word-break: break-word;
}

.chat-messages small {
    display: block;
    margin-top: 5px;
    opacity: .72;
    font-size: 10px;
}

.chat-compose {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.chat-compose textarea {
    resize: none;
    min-height: 42px;
}

.chat-compose button {
    border: 0;
    border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--brand-pink), var(--brand-violet));
    color: #fff;
    font-weight: 850;
    padding: 0 14px;
    cursor: pointer;
}

.chat-compose button:disabled {
    opacity: .6;
    cursor: wait;
}

.json-preview {
    max-width: 420px;
    max-height: 240px;
    overflow: auto;
    padding: 10px;
    border-radius: var(--r-sm);
    background: var(--surface-3);
    color: var(--ink);
    font-size: 11px;
    white-space: pre-wrap;
}

/* =============================================================
   Pipeline board
   ============================================================= */
.pipeline-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.pipeline-column {
    display: grid;
    gap: 10px;
    min-height: 122px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
    color: inherit;
    text-decoration: none;
    transition: transform .15s, border-color .15s, box-shadow .15s, background-color .15s;
}

.pipeline-column:hover {
    transform: translateY(-2px);
    border-color: rgba(236, 58, 143, .2);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.pipeline-column span {
    color: var(--ink-soft);
    font-weight: 800;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.pipeline-column strong {
    font-size: 32px;
    line-height: 1;
    font-weight: 800;
    color: var(--ink);
}

.pipeline-column i {
    display: block;
    width: 48px;
    height: 5px;
    border-radius: var(--r-pill);
    background: var(--teal);
}

.pipeline-column.orange i { background: var(--orange); }
.pipeline-column.green i  { background: var(--green); }
.pipeline-column.pink i   { background: var(--brand-pink); }
.pipeline-column.blue i   { background: var(--brand-blue); }
.pipeline-column.violet i { background: var(--brand-violet); }
.pipeline-column.cyan i   { background: var(--cyan); }

/* =============================================================
   Active lead card
   ============================================================= */
.active-lead-card { display: grid; gap: 14px; }
.active-lead-card p {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.7;
}

.command-rail-metrics {
    display: grid;
    gap: 10px;
    margin-bottom: 12px;
}

.command-rail-metrics div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
}

.command-rail-metrics span {
    color: var(--muted);
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.command-rail-metrics strong { font-size: 16px; font-weight: 800; }

.full-button { width: 100%; justify-content: center; }

/* =============================================================
   Module import / search results
   ============================================================= */
.excel-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px;
    margin: 10px 0;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-soft);
}

.excel-tools > div {
    min-width: 220px;
    flex: 1 1 240px;
}

.excel-tools strong,
.excel-tools span { display: block; }
.excel-tools strong { font-weight: 800; }
.excel-tools span {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.excel-inline-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.excel-inline-upload input[type="file"] { max-width: 240px; }

.module-import-grid,
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.module-import-card {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.module-import-card .excel-tools { margin: 0; }

.search-result-list { display: grid; gap: 8px; }

.search-result-row {
    display: grid;
    gap: 3px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .12s;
}

.search-result-row:hover {
    border-color: rgba(236, 58, 143, .35);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.search-result-row span,
.search-result-row small { color: var(--muted); }

.campaign-list-table td { vertical-align: middle; }

/* =============================================================
   RTL tweaks
   ============================================================= */
[dir="rtl"] body,
[dir="rtl"] table,
[dir="rtl"] input,
[dir="rtl"] select,
[dir="rtl"] textarea { text-align: right; }

[dir="rtl"] .panel-header { padding-right: 0; padding-left: 12px; }

[dir="rtl"] .login-lang { right: auto; left: 18px; }

[dir="rtl"] .command-rail-metrics div,
[dir="rtl"] .task-row { flex-direction: row-reverse; }

/* =============================================================
   Legacy ops-console layout (preserved for compatibility)
   ============================================================= */
.ops-console {
    background:
        radial-gradient(circle at top left, rgba(59, 111, 134, .08), transparent 30%),
        linear-gradient(180deg, #f7fafc 0%, #eef3f8 100%);
}

.ops-frame {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
}

.side-rail {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 18px;
    height: 100vh;
    padding: 18px 14px 18px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    color: var(--sidebar-text);
}

.rail-brand {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: var(--r);
    background: rgba(255, 255, 255, .06);
}
.rail-brand .brand-logo {
    width: 48px;
    height: 48px;
    padding: 5px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .08);
}
.rail-brand span {
    display: inline-flex;
    width: fit-content;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    background: var(--pink-soft);
    color: var(--brand-pink-dark);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
}

.side-nav {
    display: grid;
    align-content: start;
    gap: 5px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(236, 58, 143, .8) rgba(255, 255, 255, .06);
}

.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .05);
    border-radius: 999px;
}
.side-nav::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--brand-pink), var(--brand-violet));
    border-radius: 999px;
}

.side-nav a {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 44px;
    padding: 6px 12px;
    border: 1px solid transparent;
    border-radius: var(--r);
    color: var(--sidebar-text);
    font-weight: 800;
}

.side-nav a:hover,
.side-nav a.active {
    color: #ffffff;
    background: var(--sidebar-hover);
    border-color: rgba(255, 255, 255, .1);
}

.side-nav a.active {
    background: var(--grad-primary);
    border-color: transparent;
    box-shadow: var(--shadow-pink-soft);
}

.side-nav i {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .07);
    color: #ffffff;
    font-size: 12px;
    font-style: normal;
    font-weight: 800;
}

.side-nav a.active i {
    background: rgba(255, 255, 255, .22);
    color: #ffffff;
}

.rail-footer {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--r);
    color: #ffffff;
    background: rgba(255, 255, 255, .04);
}

.rail-footer > span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--grad-primary);
    color: #ffffff;
    font-weight: 800;
}

.rail-footer strong,
.rail-footer a { display: block; }

.rail-footer a {
    margin-top: 3px;
    color: rgba(255, 255, 255, .7);
    font-size: 12px;
    font-weight: 800;
}

.workspace-shell { min-width: 0; }

.command-bar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: minmax(210px, .35fr) minmax(260px, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 74px;
    padding: 12px 22px;
    background: rgba(255, 255, 255, .9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.command-title p,
.command-title strong { display: block; margin: 0; }

.command-title p {
    color: var(--brand-pink);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.command-title strong { margin-top: 4px; font-size: 19px; font-weight: 800; }

.global-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.global-search input { min-height: 36px; border: 0; background: transparent; padding: 0 12px; }
.global-search input:focus { outline: 0; box-shadow: none; }

.global-search button {
    min-height: 36px;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--grad-primary);
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.ops-console .main { max-width: none; padding: 16px 22px 96px; }
.ops-console .app-footer { left: 252px !important; width: calc(100% - 252px); }
[dir="rtl"] .ops-console .app-footer { left: 0 !important; right: 252px !important; }

/* =============================================================
   Responsive breakpoints
   ============================================================= */
@media (max-width: 1320px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .command-center .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .command-overview { grid-template-columns: 1fr 1fr; }
    .command-dashboard-layout { grid-template-columns: 1fr 1fr; }
    .tasks-panel { grid-column: 1 / -1; }
    .command-analytics-panel { grid-column: 1 / -1; }
    .campaign-grid,
    .outbound-grid,
    .dashboard-grid.thirds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pipeline-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .command-frame { display: block; }

    .command-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        z-index: 80;
        width: 280px;
        height: 100vh;
        padding: 18px 14px;
        transform: translateX(-100%);
        transition: transform .25s ease;
        grid-template-rows: auto minmax(0, 1fr) auto;
        gap: 18px;
    }

    [dir="rtl"] .command-sidebar {
        transform: translateX(100%);
        left: auto;
        right: 0;
    }

    .command-sidebar.is-open {
        transform: translateX(0);
        box-shadow: 0 0 60px rgba(15, 23, 42, .35);
    }

    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 70;
        background: rgba(15, 23, 42, .42);
        backdrop-filter: blur(2px);
    }

    .command-side-brand .brand-logo { width: 40px; height: 40px; }

    .command-side-nav {
        display: grid;
        gap: 4px;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 4px 0;
    }

    .command-side-nav a {
        grid-template-columns: 30px minmax(0, 1fr);
    }

    .ops-frame { display: block; }
    .side-rail { position: static; height: auto; padding: 12px; }
    .rail-brand { grid-template-columns: auto 1fr; align-items: center; }

    .side-nav {
        display: flex;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    .side-nav a { grid-template-columns: 34px auto; min-width: max-content; }
    .rail-footer { display: none; }

    .command-bar,
    .command-header,
    .command-overview,
    .command-dashboard-layout,
    .pipeline-board { grid-template-columns: 1fr; }

    .command-center .topbar-actions { grid-column: auto; justify-self: stretch; }
    .command-center .main { padding: 16px; }
    .command-center .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .command-center .app-footer { left: 0 !important; width: 100%; }
    [dir="rtl"] .command-center .app-footer { right: 0 !important; }

    .ops-console .app-footer { left: 0 !important; width: 100%; }
    [dir="rtl"] .ops-console .app-footer { right: 0 !important; }

    .app-header,
    .hero-band,
    .dashboard-grid,
    .detail-grid,
    .queue-intel-grid {
        grid-template-columns: 1fr;
        display: grid;
    }

    .topbar-actions { justify-content: space-between; }

    .filters,
    .agent-switcher,
    .bulk-bar,
    .table-action-bar,
    .form-grid,
    .faq-grid,
    .permission-grid,
    .settings-grid,
    .module-import-grid,
    .search-results-grid { grid-template-columns: 1fr; }

    .filters .grow { grid-column: auto; }
    .facts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .main,
    .app-header,
    .command-bar,
    .command-header { padding: 12px; }

    .main { padding-bottom: 72px; }

    .hero-band { padding: 20px; min-height: auto; flex-direction: column; align-items: flex-start; }
    .hero-meta { justify-items: stretch; }

    .metric-grid,
    .settings-grid,
    .campaign-grid,
    .outbound-grid,
    .queue-intel-grid,
    .dashboard-grid.thirds,
    .facts-grid,
    .request-item,
    .touch-form,
    .booking-form,
    .command-center .metric-grid { grid-template-columns: 1fr; }

    .compact-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topbar-actions,
    .user-chip,
    .action-row {
        width: 100%;
        flex-wrap: wrap;
    }

    .login-panel { padding: 26px 22px; border-radius: 18px; }

    .ops-console .main { padding: 12px 12px 80px; }
    .command-center .main { padding: 12px 12px 80px; }
    .global-search { grid-template-columns: 1fr; }

    .inline-task-form {
        grid-template-columns: 1fr;
    }

    .chat-widget {
        right: 12px;
        left: 12px;
        bottom: 72px;
        width: auto;
    }

    [dir="rtl"] .chat-widget {
        right: 12px;
        left: 12px;
    }

    .chat-panel {
        grid-template-columns: 1fr;
        height: 440px;
    }

}

/* Android WebView polish */
.android-webview {
    overscroll-behavior-y: contain;
    -webkit-tap-highlight-color: rgba(124, 58, 237, .16);
}

.android-webview .main {
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

.android-webview .panel,
.android-webview .metric-card,
.android-webview .campaign-card,
.android-webview .outbound-card {
    border-radius: 14px;
}

.android-webview button,
.android-webview .primary-button,
.android-webview .secondary-button,
.android-webview .danger-button,
.android-webview .row-action,
.android-webview input,
.android-webview select,
.android-webview textarea {
    min-height: 44px;
}

.android-webview .table-wrap {
    -webkit-overflow-scrolling: touch;
}

.android-webview .table-wrap table {
    min-width: 760px;
}

.android-webview .touch-form,
.android-webview .booking-form {
    align-items: stretch;
}

.android-webview .app-footer {
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 520px) {
    .android-webview .command-header {
        gap: 8px;
        padding: 10px;
    }

    .android-webview .command-search input {
        font-size: 14px;
    }

    .android-webview .panel {
        padding: 12px;
    }

    .android-webview .panel-header {
        gap: 8px;
        align-items: flex-start;
    }

    .android-webview .panel-header h2 {
        font-size: 16px;
        line-height: 1.25;
    }

    .android-webview .metric-card strong {
        font-size: 24px;
    }

    .android-webview .facts-grid {
        grid-template-columns: 1fr;
    }

    .android-webview .table-action-bar select[multiple] {
        width: 100%;
        min-height: 116px;
    }

    .android-webview .single-outbound,
    .android-webview .outbound-card {
        width: 100%;
    }
}
