/* TipSep — Design system & application shell */

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

:root {
    --primary: #ff6000;
    --primary-hover: #e55500;
    --primary-active: #cc4d00;
    --primary-light: #fff4ed;
    --primary-soft: rgba(255, 96, 0, 0.14);
    --primary-glow: rgba(255, 96, 0, 0.35);
    --navy: #0d1b2a;
    --navy-soft: #1b2d42;
    --bg: #f4f7fe;
    --card: #ffffff;
    --text: #0d1b2a;
    --text-secondary: #334155;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --danger: #ef4444;
    --success: #10b981;
    --info: #3b82f6;
    --whatsapp: #25d366;
    --shadow-sm: 0 1px 3px rgba(13, 27, 42, 0.06);
    --shadow-md: 0 8px 24px rgba(13, 27, 42, 0.08);
    --shadow-lg: 0 16px 40px rgba(13, 27, 42, 0.12);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --radius-btn: 999px;
    --radius-input: 999px;
    --font-sans: Inter, 'Segoe UI', system-ui, sans-serif;
    --font-arabic: 'Tajawal', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
    --sidebar-w: 268px;
    --header-h: 68px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-bg: rgba(255, 255, 255, 0.9);
    --input-bg: #ffffff;
    --table-hover: #f8fafc;
    --stat-green-bg: #ecfdf5;
    --stat-blue-bg: #eff6ff;
    --stat-purple-bg: #f5f3ff;
    --alert-success-bg: #ecfdf5;
    --alert-success-text: #065f46;
    --alert-success-border: #a7f3d0;
    --alert-error-bg: #fef2f2;
    --alert-error-text: #991b1b;
    --alert-error-border: #fecaca;
    --alert-warning-bg: #fffbeb;
    --alert-warning-text: #92400e;
    --alert-warning-border: #fde68a;
    --alert-info-bg: #eff6ff;
    --alert-info-text: #1e40af;
    --alert-info-border: #bfdbfe;
    --toast-shadow: 0 12px 40px rgba(13, 27, 42, 0.14), 0 4px 12px rgba(13, 27, 42, 0.08);
}

[data-theme="dark"] {
    --primary-light: rgba(255, 96, 0, 0.16);
    --primary-soft: rgba(255, 96, 0, 0.22);
    --primary-glow: rgba(255, 96, 0, 0.45);
    --navy: #e8edf4;
    --navy-soft: #cbd5e1;
    --bg: #0a1018;
    --card: #111b27;
    --text: #e8edf4;
    --text-secondary: #cbd5e1;
    --muted: #94a3b8;
    --border: #1e2d3d;
    --border-light: #172231;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
    --nav-bg: rgba(17, 27, 39, 0.92);
    --input-bg: #0d1520;
    --table-hover: #152030;
    --stat-green-bg: rgba(16, 185, 129, 0.15);
    --stat-blue-bg: rgba(59, 130, 246, 0.15);
    --stat-purple-bg: rgba(139, 92, 246, 0.15);
    --alert-success-bg: rgba(16, 185, 129, 0.12);
    --alert-success-text: #6ee7b7;
    --alert-success-border: rgba(16, 185, 129, 0.3);
    --alert-error-bg: rgba(239, 68, 68, 0.12);
    --alert-error-text: #fca5a5;
    --alert-error-border: rgba(239, 68, 68, 0.3);
    --alert-warning-bg: rgba(245, 158, 11, 0.12);
    --alert-warning-text: #fcd34d;
    --alert-warning-border: rgba(245, 158, 11, 0.3);
    --alert-info-bg: rgba(59, 130, 246, 0.12);
    --alert-info-text: #93c5fd;
    --alert-info-border: rgba(59, 130, 246, 0.3);
    --toast-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 4px 12px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .auth-panel-brand {
    background: linear-gradient(145deg, #060b12 0%, #0d1b2a 50%, #111b27 100%);
}

[data-theme="dark"] .home-nav {
    background: rgba(17, 27, 39, 0.82);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.2),
        0 12px 32px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .home-nav.scrolled {
    background: rgba(17, 27, 39, 0.94);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.25),
        0 20px 48px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .home-nav-toggle {
    color: var(--primary);
}

[data-theme="dark"] .home-footer {
    background: #060b12;
}

[data-theme="dark"] .home-hero-overlay {
    background: linear-gradient(180deg, rgba(6, 11, 18, 0.7) 0%, rgba(6, 11, 18, 0.85) 50%, rgba(6, 11, 18, 0.92) 100%);
}

[data-theme="dark"] .home-hero-desc-panel {
    background: rgba(6, 11, 18, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .home-hero-slogan {
    color: rgba(255, 255, 255, 0.98);
    background: rgba(6, 11, 18, 0.35);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.18);
    text-shadow: none;
}

[data-theme="dark"] .home-hero-headline-fixed {
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .home-hero-slogan-accent {
    background: linear-gradient(135deg, #ffc46b 0%, #ff8c42 40%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    filter: none;
}

[data-theme="dark"] .home-hero-slogan-brand {
    color: #6ef0a8;
    -webkit-text-fill-color: #6ef0a8;
    text-shadow: none;
}

[data-theme="dark"] .home-feature-icon--navy { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; }
[data-theme="dark"] .home-chat-point-icon { background: rgba(37, 211, 102, 0.15); }
[data-theme="dark"] .home-chat-mockup-window { border-color: var(--border); }
[data-theme="dark"] .home-benefits { background: linear-gradient(135deg, #060b12 0%, #0f1a2a 100%); }

[data-theme="dark"] .home-section--alt { background: var(--card); }

[data-theme="dark"] .home-feature-card,
[data-theme="dark"] .home-service-card {
    background: var(--bg);
    border-color: var(--border);
}

[data-theme="dark"] .home-cta-card {
    background: linear-gradient(135deg, rgba(255, 96, 0, 0.08) 0%, var(--card) 50%, var(--bg) 100%);
}

[data-theme="dark"] .chat-sidebar {
    background: var(--card);
    border-color: var(--border);
}

[data-theme="dark"] .conv-item:hover,
[data-theme="dark"] .conv-item.active {
    background: var(--primary-light);
}

[data-theme="dark"] .search-input {
    background: var(--input-bg);
    color: var(--text);
    border-color: var(--border);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[lang="ar"] body,
[dir="rtl"] body {
    font-family: var(--font-arabic);
    letter-spacing: 0;
    line-height: 1.65;
}

html[lang="ar"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="color"]),
html[lang="ar"] textarea,
html[lang="ar"] select,
html[lang="ar"] button,
[dir="rtl"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="color"]),
[dir="rtl"] textarea,
[dir="rtl"] select,
[dir="rtl"] button {
    font-family: inherit;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; height: auto; }

/* ── Brand logo (admin-configured only) ── */
.brand-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    line-height: 0;
    flex-shrink: 0;
}

.brand-logo {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
}

.brand-logo--sidebar {
    height: 48px;
    max-width: 200px;
}

.brand-logo--nav {
    height: 42px;
    max-width: 180px;
    opacity: 1;
    visibility: visible;
}

.brand-logo--auth {
    height: 80px;
    max-width: 240px;
    margin: 0 auto;
    object-position: center center;
}

.brand-logo-link--auth {
    justify-content: center;
    width: 100%;
}

.brand-logo--footer {
    height: 40px;
    max-width: 180px;
    object-position: left center;
}

.brand-logo-link--footer:hover .brand-logo--footer {
    opacity: 0.92;
}

/* Logo blanc automatique sur fonds sombres (dark mode) */
[data-theme="dark"] .brand-logo--nav,
[data-theme="dark"] .brand-logo--sidebar,
[data-theme="dark"] .brand-logo--auth {
    filter: brightness(0) invert(1);
    -webkit-filter: brightness(0) invert(1);
}

.brand-logo-link--footer {
    justify-content: flex-start;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 76px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
}

/* ── Theme toggle ── */
.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-btn);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle:active { transform: scale(0.96); }

.theme-icon { display: none; }

html:not([data-theme="dark"]) .theme-icon--moon { display: block; }
html[data-theme="dark"] .theme-icon--sun { display: block; }

.auth-panel-toolbar {
    position: absolute;
    top: 20px;
    inset-inline-end: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-panel-form { position: relative; }

/* ── App layout (logged-in) ── */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.app-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    transition: transform var(--transition);
}

.app-sidebar-brand img {
    width: auto;
    height: auto;
}

.app-sidebar-brand-text,
.app-sidebar-brand-tag {
    display: none !important;
}

.app-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.app-nav-section {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 8px 12px 6px;
    margin-top: 8px;
}

.app-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--navy-soft);
    font-weight: 500;
    font-size: 14px;
    transition: background var(--transition), color var(--transition);
    margin-bottom: 2px;
}

.app-nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.75;
}

.app-nav-link:hover {
    background: var(--border-light);
    color: var(--navy);
}

.app-nav-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(255, 96, 0, 0.35);
}

.app-nav-link.active svg { opacity: 1; }

.app-sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-light);
    margin-top: auto;
    flex-shrink: 0;
}

.app-sidebar-footer .app-nav-link {
    margin-bottom: 0;
}

.app-sidebar-help {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.app-sidebar-help p {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.45;
}

.app-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 42, 0.45);
    z-index: 190;
    opacity: 0;
    transition: opacity var(--transition);
}

.app-sidebar-backdrop.visible {
    display: block;
    opacity: 1;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.app-header {
    height: var(--header-h);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 12px;
    padding: 0 28px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: visible;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.app-header-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-sub {
    font-size: 13px;
    color: var(--muted);
    margin-top: 2px;
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 1;
    min-width: 0;
    margin-inline-start: auto;
    justify-content: flex-end;
}

.app-user-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px 6px 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
}

/* ── Header profile menu ── */
.profile-menu {
    position: relative;
    flex-shrink: 0;
}

.profile-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.profile-menu-trigger:hover,
.profile-menu.is-open .profile-menu-trigger,
.profile-menu:focus-within .profile-menu-trigger {
    border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
    box-shadow: var(--shadow-sm);
}

.profile-menu-trigger:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.profile-menu-chevron {
    color: var(--muted);
    flex-shrink: 0;
    transition: transform var(--transition);
}

.profile-menu.is-open .profile-menu-chevron,
.profile-menu:hover .profile-menu-chevron,
.profile-menu:focus-within .profile-menu-chevron {
    transform: rotate(180deg);
}

.profile-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 220px;
    padding: 6px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--navy);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    text-align: start;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.profile-menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--muted);
}

.profile-menu-item:hover,
.profile-menu-item:focus-visible {
    background: var(--primary-light);
    color: var(--primary);
    outline: none;
}

.profile-menu-item:hover svg,
.profile-menu-item:focus-visible svg {
    color: var(--primary);
}

.profile-menu-item--danger {
    color: var(--danger);
}

.profile-menu-item--danger svg {
    color: var(--danger);
}

.profile-menu-item--danger:hover,
.profile-menu-item--danger:focus-visible {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.profile-menu-divider {
    height: 1px;
    margin: 4px 6px;
    background: var(--border-light);
}

.profile-menu-logout {
    margin: 0;
}

.profile-menu.is-open .profile-menu-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

@media (min-width: 1025px) {
    .profile-menu:hover .profile-menu-dropdown,
    .profile-menu:focus-within .profile-menu-dropdown {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }
}

.app-user-pill-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    border-radius: 999px;
    padding-right: 4px;
    transition: opacity var(--transition);
}

.app-user-pill-link:hover {
    opacity: 0.85;
}

.app-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff8c42);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    overflow: hidden;
    flex-shrink: 0;
}

.app-user-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-user-logout-form {
    margin: 0;
    display: flex;
    align-items: center;
}

.app-user-logout-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.app-user-logout-btn:hover {
    background: var(--border-light);
    color: var(--danger);
}

.app-user-logout-btn svg {
    width: 18px;
    height: 18px;
}

.app-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
}

.btn-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--navy);
    flex-shrink: 0;
    position: relative;
    z-index: 3;
}

.app-content {
    flex: 1;
    padding: 28px;
    max-width: 1400px;
    width: 100%;
}

.app-content--chat {
    max-width: none;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.app-content--chat .chat-app {
    flex: 1;
    min-height: 0;
}

.app-content--api-docs {
    width: 100%;
    max-width: min(1200px, 100%);
    box-sizing: border-box;
    overflow-x: clip;
}

@media (max-width: 900px) {
    .app-content--api-docs {
        padding: 14px 12px;
    }
}

@media (max-width: 480px) {
    .app-content--api-docs {
        padding: 10px 8px;
    }
}

.app-layout:has(.app-content--api-docs) .app-main {
    min-width: 0;
    overflow-x: clip;
}

.app-footer-mini {
    padding: 14px 28px;
    font-size: 12px;
    color: var(--muted);
    border-top: 1px solid var(--border-light);
    background: var(--card);
}

/* ── Page components ── */
.page-head {
    margin-bottom: 24px;
}

.page-head h1 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.03em;
}

.page-head .muted { font-size: 15px; }

.card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.card-head h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
}

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

.admin-dashboard .kpi-grid,
.metric-grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1200px) {
    .admin-dashboard .kpi-grid,
    .metric-grid--4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .admin-dashboard .kpi-grid,
    .metric-grid--4 {
        grid-template-columns: 1fr;
    }
}

/* ── Metric / KPI cards (soft UI) ── */
.metric-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 168px;
    padding: 20px 20px 16px;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 18px rgba(13, 27, 42, 0.05);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

a.metric-card.metric-card--link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(13, 27, 42, 0.09);
    border-color: color-mix(in srgb, var(--metric-accent, var(--primary)) 22%, var(--border));
}

.metric-card-glow {
    position: absolute;
    top: -40%;
    left: -20%;
    width: 70%;
    height: 85%;
    background: radial-gradient(circle at 30% 30%, var(--metric-glow, rgba(255, 96, 0, 0.14)) 0%, transparent 68%);
    pointer-events: none;
}

.metric-card-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.metric-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--metric-icon-bg, var(--primary-light));
    color: var(--metric-accent, var(--primary));
    flex-shrink: 0;
}

.metric-card-icon svg {
    width: 22px;
    height: 22px;
}

.metric-card-trend {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.metric-card-trend--up {
    color: #059669;
    background: #ecfdf5;
}

.metric-card-trend--down {
    color: #dc2626;
    background: #fef2f2;
}

.metric-card-trend--neutral {
    color: var(--muted);
    background: var(--border-light);
}

.metric-card-main {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.metric-card-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
    line-height: 1.35;
}

.metric-card-value {
    display: block;
    font-size: clamp(26px, 3vw, 32px);
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.03em;
    line-height: 1.05;
}

.metric-card-foot {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 4px;
}

.metric-card-meta {
    font-size: 12px;
    line-height: 1.45;
    color: var(--muted);
    font-weight: 500;
    max-width: 58%;
}

.metric-card-spark {
    width: 88px;
    height: 36px;
    flex-shrink: 0;
    color: var(--metric-accent, var(--primary));
    opacity: 0.85;
}

.metric-card--orange {
    --metric-accent: var(--primary);
    --metric-icon-bg: var(--primary-light);
    --metric-glow: rgba(255, 96, 0, 0.16);
}

.metric-card--green {
    --metric-accent: var(--success);
    --metric-icon-bg: var(--stat-green-bg);
    --metric-glow: rgba(16, 185, 129, 0.14);
}

.metric-card--blue {
    --metric-accent: var(--info);
    --metric-icon-bg: var(--stat-blue-bg);
    --metric-glow: rgba(59, 130, 246, 0.14);
}

.metric-card--purple {
    --metric-accent: #8b5cf6;
    --metric-icon-bg: var(--stat-purple-bg);
    --metric-glow: rgba(139, 92, 246, 0.14);
}

.metric-card--navy {
    --metric-accent: #0d1b2a;
    --metric-icon-bg: #e8edf4;
    --metric-glow: rgba(13, 27, 42, 0.1);
}

.metric-card--teal {
    --metric-accent: #0d9488;
    --metric-icon-bg: #ccfbf1;
    --metric-glow: rgba(13, 148, 136, 0.14);
}

.metric-card--amber {
    --metric-accent: #d97706;
    --metric-icon-bg: #fffbeb;
    --metric-glow: rgba(217, 119, 6, 0.14);
}

.metric-card--red {
    --metric-accent: var(--danger);
    --metric-icon-bg: #fef2f2;
    --metric-glow: rgba(239, 68, 68, 0.12);
}

.metric-card--compact {
    min-height: 132px;
    padding: 16px;
}

.metric-card--compact .metric-card-value {
    font-size: 24px;
}

.metric-card--compact .metric-card-spark {
    width: 72px;
    height: 30px;
}

[dir="rtl"] .metric-card-foot {
    flex-direction: row-reverse;
}

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

@media (max-width: 520px) {
    .metric-grid--2 {
        grid-template-columns: 1fr;
    }
}

/* Legacy aliases — same layout when using old markup (minimal) */
.stat-card,
.kpi-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 168px;
    padding: 20px 20px 16px;
    background: var(--card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 18px rgba(13, 27, 42, 0.05);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.stat-card-icon,
.kpi-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
}

.stat-card-icon--orange,
.kpi-card--orange .kpi-card-icon { background: var(--primary-light); color: var(--primary); }
.stat-card-icon--green,
.kpi-card--green .kpi-card-icon { background: var(--stat-green-bg); color: var(--success); }
.stat-card-icon--blue,
.kpi-card--blue .kpi-card-icon { background: var(--stat-blue-bg); color: var(--info); }
.stat-card-icon--purple,
.kpi-card--purple .kpi-card-icon { background: var(--stat-purple-bg); color: #8b5cf6; }

.stat-card > span:first-of-type,
.kpi-card-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}

.stat-card strong,
.kpi-card-value {
    font-size: clamp(26px, 3vw, 32px);
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.03em;
}

.kpi-card {
    flex-direction: row;
    align-items: center;
    min-height: 88px;
    gap: 14px;
    padding: 14px 16px;
}

.kpi-card-body { min-width: 0; flex: 1; }

.kpi-card-meta {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: var(--muted);
}

/* ── Dashboard message quota ── */
.dashboard-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    gap: 24px;
    margin-bottom: 24px;
    align-items: stretch;
}

.dashboard-quota-card {
    margin-bottom: 0;
    height: 100%;
}

.dashboard-send-chart-card {
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-send-chart-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
}

.dashboard-send-chart-head p {
    margin: 0;
}

.dashboard-send-chart-body {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex: 1;
}

.dashboard-send-chart-card--standalone .dashboard-send-chart-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 42%);
    align-items: center;
    justify-content: stretch;
    gap: 28px 40px;
    padding: 8px 4px 4px;
    width: 100%;
}

.dashboard-send-chart-visual {
    position: relative;
    width: min(100%, 220px);
    aspect-ratio: 1;
    flex: 0 0 auto;
    order: -1;
}

.dashboard-send-chart-card--standalone .dashboard-send-chart-visual {
    width: 100%;
    max-width: 360px;
    justify-self: center;
    margin-inline: auto;
    order: unset;
}

.dashboard-send-chart-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.dashboard-send-chart-segments circle {
    fill: none;
    stroke-linecap: round;
    transform-origin: 0 0;
    transition: stroke-dashoffset 0.9s cubic-bezier(0.4, 0, 0.2, 1);
}

.dashboard-send-chart-segments circle.dashboard-send-chart-track {
    stroke: var(--border-light);
    transition: none;
}

.dashboard-send-chart-labels text {
    font-size: 11px;
    font-weight: 700;
    fill: var(--text);
    opacity: 0;
    transition: opacity 0.35s ease 0.55s;
}

.dashboard-send-chart-labels .dashboard-send-chart-label-percent {
    font-size: 10px;
    font-weight: 600;
    fill: var(--muted);
}

.dashboard-send-chart-card.is-ready .dashboard-send-chart-labels text {
    opacity: 1;
}

.dashboard-send-chart-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
    text-align: center;
}

.dashboard-send-chart-total {
    font-size: 28px;
    font-weight: 800;
    color: var(--navy);
    line-height: 1.1;
}

.dashboard-send-chart-center span {
    font-size: 12px;
}

.dashboard-send-chart-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 180px;
    min-width: 180px;
    max-width: 260px;
}

.dashboard-send-chart-card--standalone .dashboard-send-chart-legend {
    max-width: none;
    min-width: 0;
    width: 100%;
    gap: 12px;
}

.dashboard-send-chart-legend-item {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--border-light) 55%, transparent);
    transition: background-color 0.18s ease, transform 0.18s ease;
}

.dashboard-send-chart-card--standalone .dashboard-send-chart-legend-item {
    padding: 12px 16px;
    border-radius: 14px;
}

.dashboard-send-chart-legend-item:hover {
    background: color-mix(in srgb, var(--primary) 8%, var(--card));
    transform: translateX(2px);
}

.dashboard-send-chart-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--card) 80%, transparent);
    border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
}

.dashboard-send-chart-legend-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
}

.dashboard-send-chart-legend-stat {
    text-align: end;
    white-space: nowrap;
}

.dashboard-send-chart-legend-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.3;
}

.dashboard-send-chart-empty {
    margin: 0 0 4px;
    text-align: center;
    font-size: 13px;
}

.dashboard-send-chart-card--standalone {
    margin-bottom: 24px;
}

.dashboard-send-chart-card--standalone .dashboard-send-chart-total {
    font-size: 32px;
}

.dashboard-quota-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-quota-head h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
}

.dashboard-quota-head p {
    margin: 0;
}

.dashboard-api-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.dashboard-api-status--active {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.dashboard-api-status--suspended {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.dashboard-api-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dashboard-api-status--active .dashboard-api-dot {
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.dashboard-api-status--suspended .dashboard-api-dot {
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

.dashboard-quota-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-quota-usage-top {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.dashboard-quota-usage-top strong {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
}

.dashboard-progress {
    height: 12px;
    background: var(--border-light);
    border-radius: 999px;
    overflow: hidden;
}

.dashboard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #6366f1);
    border-radius: 999px;
    transition: width 0.4s ease;
    min-width: 0;
}

.dashboard-progress-bar--warning {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.dashboard-quota-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.dashboard-quota-meta-item span {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
}

.dashboard-quota-meta-item strong {
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
}

.dashboard-quota-alert {
    margin-bottom: 16px;
}

@media (max-width: 960px) {
    .dashboard-top-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-send-chart-body {
        gap: 6px;
    }

    .dashboard-send-chart-card--standalone .dashboard-send-chart-body {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .dashboard-send-chart-card--standalone .dashboard-send-chart-visual {
        max-width: 280px;
        order: -1;
    }

    .dashboard-send-chart-legend {
        width: 100%;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .dashboard-send-chart-total {
        font-size: 24px;
    }

    .dashboard-send-chart-visual {
        width: min(100%, 190px);
    }
}

/* ── Admin quota section ── */
.admin-quota-section {
    margin-top: 28px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.admin-quota-section h3 {
    margin: 0 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--navy);
}

.admin-quota-section > p {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
}

.admin-quota-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--surface-alt, #f8fafc);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

.admin-quota-summary-item span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.admin-quota-summary-item strong {
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
}

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

.admin-quota-suspend {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-alt, #f8fafc);
}

.admin-quota-suspend label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
}

/* ── Subscription pages ── */
.subscription-notice {
    margin-bottom: 20px;
}

.subscription-notice-detail {
    margin: 8px 0 0;
    font-size: 14px;
}

.subscription-current-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .subscription-current-grid {
        grid-template-columns: 1fr;
    }
}

.subscription-plan-name {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 800;
    color: var(--navy);
}

.subscription-plan-price {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
}

.subscription-detail-list {
    margin: 0;
}

.subscription-feature-list {
    margin: 0;
    padding-left: 18px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

.subscription-feature-list--compact {
    font-size: 13px;
    margin-bottom: 16px;
}

.subscription-plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.subscription-plan-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    background: var(--surface-alt, #f8fafc);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.subscription-plan-card.is-current {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.subscription-plan-card--gold {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.08), var(--surface-alt, #f8fafc));
}

.subscription-plan-card--platinum {
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.12), var(--surface-alt, #f8fafc));
}

.subscription-plan-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.subscription-plan-card-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.subscription-plan-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: var(--primary);
    white-space: nowrap;
}

.subscription-plan-card-price {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
    color: var(--navy);
}

.subscription-plan-card-volume {
    margin: 0;
}

.subscription-plan-form {
    margin-top: auto;
}

.subscription-plan-current-label {
    margin-top: auto;
    align-self: flex-start;
}

.subscription-plan-disabled {
    margin: auto 0 0;
    font-size: 13px;
}

.subscription-custom-card {
    margin-top: 24px;
}

.admin-subscription-offer-card {
    margin-top: 24px;
}

/* ── Buttons (premium, unified) ── */
.btn, .btn-primary, .btn-success, .btn-info, .btn-outline, .btn-hero-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-btn);
    border: 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition), border-color var(--transition),
        transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-outline:focus-visible,
.btn-hero-outline:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

.btn:active,
.btn-primary:active,
.btn-outline:active {
    transform: scale(0.97);
}

.btn {
    background: var(--border-light);
    color: var(--navy);
    border: 1px solid var(--border);
}

.btn:hover {
    background: var(--border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #ff7a26 100%);
    color: #fff;
    box-shadow: 0 4px 18px var(--primary-glow);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--primary-glow);
}

.btn-primary:active { background: var(--primary-active); }

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover { transform: translateY(-1px); }

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #60a5fa 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-1px);
}

.btn-hero-outline {
    background: transparent;
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.btn-hero-outline:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.btn-link {
    background: none;
    border: 0;
    color: var(--primary);
    cursor: pointer;
    padding: 4px 0;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    border-radius: var(--radius-sm);
    transition: color var(--transition), opacity var(--transition);
}

.btn-link:hover { color: var(--primary-hover); }
.btn-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-link.danger { color: var(--danger); }

.btn-sm { padding: 9px 16px; font-size: 13px; }
.btn-lg { padding: 15px 30px; font-size: 16px; }

.btn-menu-toggle {
    border-radius: var(--radius-btn);
    transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.btn-menu-toggle:hover { border-color: var(--primary); color: var(--primary); }
.btn-menu-toggle:active { transform: scale(0.96); }

.inline-form { display: inline; }

/* ── Forms ── */
.form-grid { display: grid; gap: 12px; }
.form-grid.two-col { grid-template-columns: 1fr 1fr; }
.form-grid label { font-size: 14px; font-weight: 600; color: var(--navy); }

.form-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    text-align: start;
    min-width: 0;
}

.form-field label {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.35;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="color"]),
textarea,
select,
.search-input {
    width: 100%;
    padding: 11px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    font-family: inherit;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

textarea {
    border-radius: var(--radius-xl);
    min-height: 96px;
    line-height: 1.55;
    resize: vertical;
}

select {
    cursor: pointer;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"] {
    min-height: 44px;
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="hidden"]):not([type="file"]):not([type="color"]):focus,
textarea:focus,
select:focus,
.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="file"] {
    padding: 10px 14px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-xl);
    background: var(--input-bg);
    font-size: 14px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

input[type="file"]:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 8px 16px;
    border: 0;
    border-radius: var(--radius-btn);
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
}

.form-grid input, .form-grid textarea, .form-grid select, .search-input {
    width: 100%;
}

.form-grid input:focus, .form-grid textarea:focus, .form-grid select:focus, .search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.span-2 { grid-column: span 2; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-weight: 500; }

/* ── ON/OFF switch (feature toggles) ── */
.tipsep-switch-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-weight: 600;
    color: var(--navy);
    cursor: pointer;
    user-select: none;
}

.tipsep-switch-text {
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1.45;
}

.tipsep-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-height: 28px;
    padding-inline: 52px 0;
}

.tipsep-switch-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.tipsep-switch-ui {
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: var(--border, #cbd5e1);
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.08));
    transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
    pointer-events: none;
}

.tipsep-switch-ui::after {
    content: '';
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.22);
    transition: transform 0.22s ease, inset-inline-start 0.22s ease;
}

.tipsep-switch-input:checked + .tipsep-switch-ui {
    background: var(--primary, #ff6000);
    border-color: rgba(255, 96, 0, 0.45);
    box-shadow: 0 0 0 3px var(--primary-light, rgba(255, 96, 0, 0.15));
}

.tipsep-switch-input:checked + .tipsep-switch-ui::after {
    transform: translateX(20px);
}

[dir="rtl"] .tipsep-switch-input:checked + .tipsep-switch-ui::after {
    transform: translateX(-20px);
}

.tipsep-switch-input:focus-visible + .tipsep-switch-ui {
    outline: 2px solid var(--primary, #ff6000);
    outline-offset: 2px;
}

.tipsep-switch-input:disabled + .tipsep-switch-ui {
    opacity: 0.5;
}

.tipsep-switch-status {
    display: inline-flex;
    align-items: center;
    min-width: 4.5em;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    pointer-events: none;
}

.tipsep-switch-off {
    color: var(--muted);
}

.tipsep-switch-on {
    color: var(--primary, #ff6000);
    display: none;
}

.tipsep-switch-input:checked ~ .tipsep-switch-status .tipsep-switch-on {
    display: inline;
}

.tipsep-switch-input:checked ~ .tipsep-switch-status .tipsep-switch-off {
    display: none;
}

.tipsep-switch-input:not(:checked) ~ .tipsep-switch-status .tipsep-switch-on {
    display: none;
}

.tipsep-switch-input:not(:checked) ~ .tipsep-switch-status .tipsep-switch-off {
    display: inline;
}

[data-theme="dark"] .tipsep-switch-ui {
    background: #334155;
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .tipsep-switch-ui::after {
    background: #f8fafc;
}

.form-grid .tipsep-switch-field.span-2 {
    grid-column: span 2;
}

@media (max-width: 640px) {
    .form-grid .tipsep-switch-field.span-2 {
        grid-column: span 1;
    }
}

/* ── Alerts & tables ── */
.alert {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.alert-success {
    background: var(--alert-success-bg);
    color: var(--alert-success-text);
    border: 1px solid var(--alert-success-border);
}
.alert-error {
    background: var(--alert-error-bg);
    color: var(--alert-error-text);
    border: 1px solid var(--alert-error-border);
}

.alert-info {
    background: var(--alert-info-bg);
    color: var(--alert-info-text);
    border: 1px solid var(--alert-info-border);
}

.alert-info p {
    margin: 8px 0 0;
}

.status-badge--active { background: rgba(40, 167, 69, 0.14); color: #1e7e34; }
.status-badge--disabled { background: rgba(108, 117, 125, 0.15); color: #5c636a; }

.wa-numbers-notice {
    margin-bottom: 16px;
}

.wa-number-active-card {
    border-color: color-mix(in srgb, var(--success) 35%, var(--border));
}

.wa-number-active-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.wa-number-active-value {
    margin: 0;
    font-size: clamp(24px, 3vw, 32px);
    font-weight: 800;
    letter-spacing: 0.01em;
}

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    font-size: 14px;
}
.table th {
    font-weight: 600;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.table tbody tr:hover { background: var(--table-hover); }

.muted { color: var(--muted); font-size: 14px; line-height: 1.55; }

.code-block, .log-box {
    display: block;
    background: var(--navy);
    color: #9fef9f;
    padding: 14px;
    border-radius: var(--radius-md);
    overflow: auto;
    word-break: break-all;
    font-size: 12px;
    font-family: ui-monospace, monospace;
}

/* ── Auth layout ── */
.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-panel-brand {
    background: linear-gradient(145deg, var(--navy) 0%, #1a3050 50%, var(--navy-soft) 100%);
    color: #fff;
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.auth-panel-brand::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 96, 0, 0.25) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
}

.auth-panel-brand h2 {
    font-size: 36px;
    font-weight: 800;
    margin: 0 0 16px;
    letter-spacing: -0.03em;
    position: relative;
}

.auth-panel-brand h2 span { color: var(--primary); }

.auth-panel-brand p {
    font-size: 16px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.75);
    max-width: 400px;
    position: relative;
}

.auth-panel-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border-radius: var(--radius-xl);
    padding: 36px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.auth-logo-wrap { text-align: center; margin-bottom: 20px; }
.auth-brand-title { display: none; }
.auth-card h1 { margin: 0 0 8px; font-size: 26px; font-weight: 800; color: var(--navy); }
.auth-card .muted { margin-bottom: 24px; }

.auth-card--wide { max-width: 560px; }
.auth-card--confirm { max-width: 480px; text-align: center; }

.page-auth--wide .auth-panel-form--wide {
    align-items: flex-start;
    padding-top: 32px;
    overflow-y: auto;
}

.auth-switch { margin: 16px 0 0; font-size: 14px; text-align: center; }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.register-form,
.auth-form {
    grid-template-columns: 1fr;
}

.register-form .span-2,
.auth-form .span-2 {
    grid-column: 1 / -1;
}

.register-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.register-fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 0;
}

.register-fieldset legend {
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    padding: 0 4px;
    line-height: 1.4;
}

.radio-line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-top: 10px;
    cursor: pointer;
}

.radio-line input { margin-top: 3px; accent-color: var(--primary); }

.register-integration-fields {
    display: none;
    gap: 8px;
}

.register-integration-fields.is-visible { display: grid; }

.req { color: var(--primary); }

.confirm-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(255, 96, 0, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-message { text-align: left; margin-bottom: 24px; line-height: 1.65; }
.confirm-message p { margin: 0 0 12px; }

.confirm-steps {
    text-align: left;
    margin-bottom: 28px;
    display: grid;
    gap: 12px;
}

.confirm-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-muted);
}

.confirm-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--navy);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Registration admin */
.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-tab {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--card);
}
.filter-tab:hover { color: var(--navy); border-color: var(--primary); }
.filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}
.status-badge--pending { background: rgba(255, 193, 7, 0.15); color: #b8860b; }
.status-badge--in_review { background: rgba(13, 110, 253, 0.12); color: #0a58ca; }
.status-badge--changes_requested { background: rgba(255, 96, 0, 0.14); color: #c44f00; }
.status-badge--approved { background: rgba(40, 167, 69, 0.12); color: #1e7e34; }
.status-badge--rejected { background: rgba(220, 53, 69, 0.12); color: #c82333; }
.status-badge--submitted_to_meta { background: rgba(111, 66, 193, 0.12); color: #5a32a3; }
.status-badge--meta_approved { background: rgba(40, 167, 69, 0.12); color: #1e7e34; }
.status-badge--meta_rejected { background: rgba(220, 53, 69, 0.12); color: #c82333; }
.status-badge--closed { background: rgba(108, 117, 125, 0.15); color: #5c636a; }
.status-badge--accepted { background: rgba(40, 167, 69, 0.12); color: #1e7e34; }
.status-badge--paid { background: rgba(40, 167, 69, 0.12); color: #1e7e34; }
.status-badge--overdue { background: rgba(220, 53, 69, 0.12); color: #c82333; }
.status-badge--cancelled { background: rgba(108, 117, 125, 0.15); color: #5c636a; }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-list {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    margin: 0;
    font-size: 14px;
}

.detail-list dt { font-weight: 600; color: var(--text-muted); margin: 0; }
.detail-list dd { margin: 0; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.inline-form { display: inline; }

.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-nav-link { position: relative; }

@media (max-width: 768px) {
    .register-form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-list { grid-template-columns: 1fr; }
    .detail-list dt { margin-top: 8px; }
}

/* ── Admin extras ── */
.admin-bg-section, .admin-logo-section {
    margin-top: 8px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    display: grid;
    gap: 12px;
}

.admin-bg-preview {
    height: 160px;
    border-radius: var(--radius-md);
    background-size: cover;
    background-position: center;
    background-color: var(--navy);
    position: relative;
    overflow: hidden;
}

.admin-bg-preview::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.2), rgba(0,0,0,.5));
}

.admin-bg-preview-label, .admin-logo-preview-label {
    position: absolute;
    left: 12px;
    bottom: 10px;
    z-index: 1;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.profile-avatar-section {
    display: grid;
    gap: 10px;
}

.profile-avatar-preview {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
    background: var(--bg);
}

.profile-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), #ff8c42);
    color: #fff;
    font-size: 32px;
    font-weight: 700;
}

.profile-avatar-remove {
    margin-top: 4px;
}

.admin-logo-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px;
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px dashed var(--border);
}

.admin-logo-preview { max-width: 220px; max-height: 120px; object-fit: contain; }

.admin-logo-placeholder-text {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
}

.admin-settings-divider {
    border: 0;
    border-top: 1px solid var(--border-light);
    margin: 8px 0 4px;
}

/* ── Responsive app shell ── */
@media (max-width: 1024px) {
    .brand-logo--sidebar { height: 40px; max-width: 160px; }
    .brand-logo--nav { height: 36px; max-width: 140px; }

    .app-sidebar {
        transform: translateX(-100%);
    }

    .app-sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .app-main { margin-left: 0; }

    .btn-menu-toggle { display: inline-flex; }

    .app-header {
        padding: 0 12px;
        gap: 8px;
    }

    .app-header-right {
        gap: 8px;
    }

    .app-content { padding: 20px 16px; }

    .auth-layout { grid-template-columns: 1fr; }

    .auth-panel-brand { display: none; }
}

@media (max-width: 900px) {
    .app-layout:has(.app-content--chat) {
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    body.mobile-chat-active {
        overflow: hidden;
        overscroll-behavior: none;
    }

    body.mobile-chat-active .app-sidebar,
    body.mobile-chat-active .app-header,
    body.mobile-chat-active .app-footer-mini {
        display: none;
    }

    .app-content--chat {
        padding: 0;
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }
}

@media (max-width: 768px) {
    .brand-logo--nav { height: 32px; max-width: 120px; }
    .brand-logo--auth { height: 64px; max-width: 200px; }
    .brand-logo--footer { height: 36px; max-width: 150px; }

    .app-header {
        --header-h: 60px;
        padding: 0 10px;
        gap: 6px;
    }

    .btn-menu-toggle {
        width: 36px;
        height: 36px;
    }

    .btn-menu-toggle svg {
        width: 20px;
        height: 20px;
    }

    .app-header-right {
        gap: 6px;
    }

    .lang-switcher-toggle {
        height: 34px;
        padding: 0 8px;
        gap: 4px;
    }

    .lang-switcher-globe {
        width: 16px;
        height: 16px;
    }

    .lang-switcher-code,
    .lang-switcher-chevron {
        display: none;
    }

    .theme-toggle {
        width: 34px;
        height: 34px;
    }

    .theme-toggle svg {
        width: 18px;
        height: 18px;
    }

    .profile-menu-trigger {
        padding: 2px;
        gap: 0;
    }

    .profile-menu-chevron {
        display: none;
    }

    .profile-menu-dropdown {
        min-width: 200px;
        inset-inline-end: 0;
    }

    .app-user-name {
        display: none;
    }

    .app-user-avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 0 8px;
        gap: 4px;
    }

    .btn-menu-toggle {
        width: 34px;
        height: 34px;
    }

    .app-header-right {
        gap: 4px;
    }

    .lang-switcher-toggle {
        width: 34px;
        height: 34px;
        padding: 0;
        justify-content: center;
    }

    .theme-toggle {
        width: 32px;
        height: 32px;
    }
}

/* ── Language switcher ── */
.lang-switcher { position: relative; flex-shrink: 0; }

.lang-switcher-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-btn);
    background: var(--card);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.lang-switcher-toggle:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.lang-switcher-globe {
    flex-shrink: 0;
    opacity: 0.85;
}

.lang-switcher-code {
    letter-spacing: 0.04em;
    font-weight: 600;
    font-size: 13px;
}

.lang-switcher-option-code {
    font-weight: 600;
    font-size: 14px;
}

.lang-switcher-chevron {
    opacity: 0.55;
    transition: transform var(--transition);
}

.lang-switcher-toggle[aria-expanded="true"] .lang-switcher-chevron {
    transform: rotate(180deg);
}

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    min-width: 168px;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 500;
}

.lang-switcher-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition);
}

.lang-switcher-option:hover { background: var(--primary-light); }
.lang-switcher-option.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }

.home-nav-actions .lang-switcher-toggle {
    height: 36px;
    background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .home-nav-actions .lang-switcher-toggle {
    background: rgba(255, 255, 255, 0.06);
}

/* ── RTL support ── */
[dir="rtl"] .brand-logo { object-position: right center; }
[dir="rtl"] .brand-logo-link { justify-content: flex-end; }
[dir="rtl"] .brand-logo-link--auth { justify-content: center; }

[dir="rtl"] .app-sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-light);
}

[dir="rtl"] .app-main { margin-left: 0; margin-right: var(--sidebar-w); }

[dir="rtl"] .app-nav-link { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .app-nav-link .nav-badge { margin-left: 0; margin-right: auto; }

[dir="rtl"] .app-header-left,
[dir="rtl"] .app-header-right { flex-direction: row-reverse; }

[dir="rtl"] .detail-list { direction: rtl; }
[dir="rtl"] .radio-line { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .confirm-step { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .home-hero-slogan {
    font-family: var(--font-arabic);
    letter-spacing: 0;
    max-width: 36ch;
}

[dir="rtl"] .home-hero-content h1,
[dir="rtl"] .home-hero-headline,
[dir="rtl"] .home-section-head h2,
[dir="rtl"] .home-benefits h3,
[dir="rtl"] .home-cta-card h2 {
    font-family: var(--font-arabic);
    letter-spacing: 0;
}

[dir="rtl"] .home-hero-slogan-accent {
    font-style: normal;
}

[dir="rtl"] select {
    padding-right: 18px;
    padding-left: 40px;
    background-position: left 14px center;
}

[dir="rtl"] .home-section-head--left { text-align: right; }
[dir="rtl"] .home-chat-points li { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .home-benefits-grid { text-align: right; }
[dir="rtl"] .home-benefit-item { flex-direction: row-reverse; }
[dir="rtl"] .home-chat-mockup-status { margin-left: 0; margin-right: auto; }
[dir="rtl"] .home-chat-bubble--in { border-bottom-left-radius: 18px; border-bottom-right-radius: 4px; }
[dir="rtl"] .home-chat-bubble--out { border-bottom-right-radius: 18px; border-bottom-left-radius: 4px; }

[dir="rtl"] .home-nav-links { flex-direction: row-reverse; }
[dir="rtl"] .home-nav-actions { flex-direction: row-reverse; }
[dir="rtl"] .home-nav-inner { flex-direction: row-reverse; }
[dir="rtl"] .filter-tabs { flex-direction: row-reverse; }
[dir="rtl"] .detail-actions { flex-direction: row-reverse; }

[dir="rtl"] .btn-back svg { transform: scaleX(-1); }

@media (max-width: 1024px) {
    [dir="rtl"] .app-sidebar { transform: translateX(100%); }
    [dir="rtl"] .app-sidebar.open { transform: translateX(0); }
    [dir="rtl"] .app-main { margin-right: 0; }
}

/* ── Toast notifications ── */
.tipsep-toast-root {
    position: fixed;
    top: calc(var(--header-h, 68px) + 16px);
    inset-inline-end: 20px;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}

.page-auth .tipsep-toast-root,
.install-wrap ~ .tipsep-toast-root,
body:not(.app-layout) .tipsep-toast-root {
    top: 20px;
}

.tipsep-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 44px 16px 14px;
    border-radius: var(--radius-md);
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--toast-shadow);
    pointer-events: auto;
    overflow: hidden;
    opacity: 0;
    transform: translateX(24px) scale(0.96);
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

[dir="rtl"] .tipsep-toast {
    transform: translateX(-24px) scale(0.96);
}

.tipsep-toast--visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.tipsep-toast--leaving {
    opacity: 0;
    transform: translateX(24px) scale(0.96);
}

[dir="rtl"] .tipsep-toast--leaving {
    transform: translateX(-24px) scale(0.96);
}

.tipsep-toast-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tipsep-toast-icon svg {
    width: 20px;
    height: 20px;
}

.tipsep-toast--success .tipsep-toast-icon {
    background: var(--alert-success-bg);
    color: var(--success);
}

.tipsep-toast--error .tipsep-toast-icon {
    background: var(--alert-error-bg);
    color: var(--danger);
}

.tipsep-toast--warning .tipsep-toast-icon {
    background: var(--alert-warning-bg);
    color: #f59e0b;
}

.tipsep-toast--info .tipsep-toast-icon {
    background: var(--alert-info-bg);
    color: var(--info);
}

.tipsep-toast--validation .tipsep-toast-icon {
    background: var(--primary-light);
    color: var(--primary);
}

.tipsep-toast-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.tipsep-toast-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.tipsep-toast-message {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    word-break: break-word;
}

.tipsep-toast-message strong {
    color: var(--text);
    font-weight: 600;
}

.tipsep-toast-message ol,
.tipsep-toast-message ul {
    margin: 8px 0 0;
    padding-inline-start: 18px;
}

.tipsep-toast-subtitle {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}

.tipsep-toast-close {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.tipsep-toast-close:hover {
    background: var(--border-light);
    color: var(--text);
}

.tipsep-toast-close svg {
    width: 16px;
    height: 16px;
}

.tipsep-toast-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--border-light);
}

.tipsep-toast-progress-bar {
    height: 100%;
    width: 100%;
    transition: width 0.08s linear;
}

.tipsep-toast--success .tipsep-toast-progress-bar { background: var(--success); }
.tipsep-toast--error .tipsep-toast-progress-bar { background: var(--danger); }
.tipsep-toast--warning .tipsep-toast-progress-bar { background: #f59e0b; }
.tipsep-toast--info .tipsep-toast-progress-bar { background: var(--info); }
.tipsep-toast--validation .tipsep-toast-progress-bar { background: var(--primary); }

.tipsep-toast--success { border-color: var(--alert-success-border); }
.tipsep-toast--error { border-color: var(--alert-error-border); }
.tipsep-toast--warning { border-color: var(--alert-warning-border); }
.tipsep-toast--info { border-color: var(--alert-info-border); }
.tipsep-toast--validation { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }

@media (max-width: 640px) {
    .tipsep-toast-root {
        top: auto;
        bottom: 16px;
        inset-inline-end: 16px;
        inset-inline-start: 16px;
        width: auto;
    }

    .tipsep-toast {
        transform: translateY(20px) scale(0.96);
    }

    .tipsep-toast--visible {
        transform: translateY(0) scale(1);
    }

    .tipsep-toast--leaving {
        transform: translateY(20px) scale(0.96);
    }
}
