/* ==========================================================================
   Dealers Marketing — UI Revamp (dark)
   Design system per Developer Handover §3. Poppins + lime/lavender on ink.

   NOTE ON LEGACY TOKENS
   ---------------------
   app.js renders most views from template literals that carry inline
   style="…" attributes referencing the OLD variable names (--accent-gold,
   --bg-surface, --border-color, …). Inline styles beat this stylesheet, so
   those names are kept alive below as aliases pointing at the NEW palette.
   Deleting an alias will silently un-theme whatever inline style used it.
   ========================================================================== */

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

:root {
    /* ---- design system (handover §3, dark column) ---- */
    --bg: #0C0C0E;
    --nav: #161619;
    --surface: #17171B;
    --surface-2: #212127;
    --surface-3: #2A2A31;

    --ink: #171719;
    --lime: #D3F26A;
    --lime-600: #C2E84F;
    --purple: #AD7BFF;
    --purple-700: #9B63FF;

    --text: #F0F0F2;
    --text-dim: #9A9AA2;
    --text-mute: #66666E;

    --line: rgba(255, 255, 255, .08);
    --line-2: rgba(255, 255, 255, .13);

    --tag-green-bg: rgba(211, 242, 106, .14);
    --tag-green-tx: #D3F26A;
    --tag-purple-bg: rgba(173, 123, 255, .18);
    --tag-purple-tx: #C4A2FF;
    --tag-pink-bg: rgba(255, 138, 180, .15);
    --tag-pink-tx: #FF9CBF;

    --field: #212127;
    --field-focus: #26262E;

    --r-lg: 24px;
    --r-md: 16px;
    --r-sm: 11px;

    --danger: #E5484D;
    --warn: #E8913C;

    /* ---- legacy aliases — consumed by inline styles in app.js ---- */
    --bg-body: var(--bg);
    --bg-surface: var(--surface);
    --bg-card: var(--surface);
    --border-color: var(--line);

    --text-primary: var(--text);
    --text-secondary: var(--text-dim);
    --text-tertiary: var(--text-mute);

    /* gold is gone; every legacy gold reference resolves to the lime accent */
    --accent-gold: var(--lime);
    --accent-gold-hover: var(--lime-600);

    --status-success: var(--lime);
    --status-info: var(--purple);
    --status-warning: var(--warn);
    --status-danger: var(--danger);

    --font-main: 'Poppins', sans-serif;

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    --radius-sm: var(--r-sm);
    --radius-md: var(--r-md);
    --radius-lg: var(--r-lg);
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: inherit;
}

::selection {
    background: var(--lime);
    color: var(--ink);
}

/* ==========================================================================
   LAYOUT SHELL
   The old build was a fixed 280px sidebar + scrolling main. The approved
   design is a floating dark top bar over a centred, page-scrolling column.
   ========================================================================== */

/* auth.js reveals the app with an inline `display:flex`, so this MUST stay a
   flex container — it is made a column so the nav stacks above the content
   instead of sitting beside it. */
.app-container {
    display: flex;
    flex-direction: column;
    max-width: 1320px;
    margin: 0 auto;
    padding: 16px 22px 60px;
}

.main-content {
    display: block;
}

/* ---------- TOP NAV (was .sidebar) ---------- */
.sidebar {
    background: var(--nav);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 14px 20px 14px 18px;
    display: flex;
    align-items: center;
    gap: 32px;
    color: #fff;
    position: sticky;
    top: 16px;
    z-index: 50;
}

.sidebar-header {
    flex-shrink: 0;
}

.sidebar-header .logo img {
    height: 30px;
    width: auto;
    object-fit: contain;
    display: block;
}

.sidebar-nav {
    display: flex;
    align-items: center;
    gap: 26px;
}

/* nav-item + data-target are JS hooks — class name must not change */
.sidebar-nav .nav-item {
    color: #9C9CA4;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: color .18s;
}

.sidebar-nav .nav-item svg {
    display: none;
    /* the approved nav is text-only tabs */
}

.sidebar-nav .nav-item:hover {
    color: #fff;
}

.sidebar-nav .nav-item.active {
    color: var(--lime);
    font-weight: 600;
}

.sidebar-nav .nav-item.active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -14px;
    height: 2px;
    background: var(--lime);
    border-radius: 2px;
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.sidebar-nav::after {
    display: none;
}

/* Terms / Privacy live in the nav markup but do not belong in the top tab
   row — they are relocated to a quiet footer strip below the views. The
   .nav-item + data-target hooks are untouched, so app.js still routes them. */
.sidebar-legal {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center;
    align-items: center;
    gap: 22px;
    margin: 40px 0 0 !important;
    padding: 22px 0 0 !important;
    border-top: 1px solid var(--line);
}

.sidebar-legal .nav-item {
    color: var(--text-mute) !important;
    font-size: 11.5px !important;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color .18s;
}

.sidebar-legal .nav-item:hover {
    color: var(--text) !important;
}

.sidebar-legal .nav-item svg {
    width: 11px;
    height: 11px;
}

.sidebar-footer {
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), #7B45D6);
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    font-size: 13px;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.user-name {
    font-size: 13.5px;
    font-weight: 500;
    color: #fff;
}

.user-avatar:empty {
    visibility: hidden;
}

.user-name:empty {
    visibility: hidden;
}

/* the email does not fit the top bar — kept in the DOM for app.js */
.user-role {
    display: none;
}

/* ---------- PAGE HEADER ---------- */
.top-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin: 30px 4px 20px;
}

#page-title {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.05;
}

.subtitle {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 400;
    margin: -8px 4px 20px;
}

.dealers-page-header .subtitle {
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ---------- VIEWS ---------- */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--lime);
    color: var(--ink);
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 22px;
    border-radius: 12px;
    cursor: pointer;
    transition: background .18s;
}

.btn-primary:hover {
    background: var(--lime-600);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-primary.full-width,
.full-width {
    width: 100%;
}

.btn-outline,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line);
    font-family: inherit;
    font-weight: 600;
    font-size: 13.5px;
    padding: 11px 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .18s, background .18s;
}

.btn-outline:hover,
.btn-secondary:hover {
    border-color: var(--line-2);
    background: var(--surface-3);
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--line);
    font-family: inherit;
    font-weight: 600;
    font-size: 12.5px;
    padding: 8px 14px;
    border-radius: 9px;
    cursor: pointer;
    transition: border-color .18s, background .18s;
}

.btn-sm:hover {
    border-color: var(--line-2);
    background: var(--surface-3);
}

.btn-sm.btn-primary {
    background: var(--lime);
    color: var(--ink);
    border-color: transparent;
}

.btn-sm.btn-primary:hover {
    background: var(--lime-600);
}

/* "New Campaign" in the page header */
#btn-new-campaign {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: var(--surface-2);
    color: #fff;
    border: 1px solid var(--line);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    padding: 13px 22px;
    border-radius: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .18s, border-color .18s;
}

#btn-new-campaign:hover {
    transform: translateY(-2px);
    border-color: var(--line-2);
    background: var(--surface-2);
}

#btn-new-campaign svg {
    display: block;
    flex-shrink: 0;
}

#btn-new-campaign span {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

/* search collapses to a round icon button in the dark bar */
.btn-icon,
#btn-top-search {
    width: 40px;
    height: 40px;
    min-width: 40px !important;
    padding: 0 !important;
    border-radius: 50%;
    background: var(--surface-2);
    border: none;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s;
}

.btn-icon:hover,
#btn-top-search:hover {
    background: var(--surface-3);
}

.btn-icon svg,
#btn-top-search svg {
    display: block;
    width: 18px;
    height: 18px;
    color: #D6D6DC;
    flex-shrink: 0;
}

.btn-delete-dealer:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.link {
    font-size: 13px;
    color: var(--purple);
    font-weight: 600;
    text-decoration: none;
}

.link:hover {
    color: var(--purple-700);
}

/* ==========================================================================
   NAV BAR EXTRAS — dealer-limit ring + upgrade pill
   ========================================================================== */

.nav-limit {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--surface-2);
    border-radius: 11px;
    padding: 7px 13px 7px 9px;
    flex-shrink: 0;
}

.nav-limit .ring {
    position: relative;
    width: 26px;
    height: 26px;
}

.nav-limit .ring svg {
    transform: rotate(-90deg);
}

.nav-limit .ring i {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 8px;
    font-weight: 700;
    font-style: normal;
    color: var(--lime);
}

.nav-limit .lt {
    font-size: 12px;
    line-height: 1.2;
    color: #fff;
    white-space: nowrap;
}

.nav-limit .lt span {
    display: block;
    font-size: 10px;
    color: #8A8A92;
}

.btn-upgrade {
    background: var(--lime);
    color: var(--ink);
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 9px 16px;
    border-radius: 11px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s;
}

.btn-upgrade:hover {
    background: var(--lime-600);
}

.ic-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    border: none;
    transition: background .18s;
}

.ic-circle:hover {
    background: var(--surface-3);
}

.ic-circle svg {
    width: 18px;
    height: 18px;
    color: #D6D6DC;
}

.ic-circle .dot {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--lime);
    border: 2px solid var(--nav);
}

/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 26px;
}

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

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.step-indicator {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    background: var(--surface-2);
    padding: 6px 12px;
    border-radius: 9px;
    white-space: nowrap;
}

/* ==========================================================================
   KPI CARDS
   ========================================================================== */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
}

.kpi-card .kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
}

.kpi-card .kpi-ic {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    color: var(--text);
}

.kpi-card .kpi-ic svg {
    width: 21px;
    height: 21px;
}

/* .kpi-trend is the status chip — app.js writes a real value ("Live") into
   it, so it carries meaning rather than a decorative hardcoded label. */
.kpi-trend {
    font-size: 11.5px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 9px;
    background: var(--tag-green-bg);
    color: var(--tag-green-tx);
    white-space: nowrap;
}

.kpi-value {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1;
}

/* .kpi-label is the caption under the number */
.kpi-label {
    display: block;
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 500;
    margin-top: 8px;
    text-transform: none;
    letter-spacing: 0;
}

/* the lavender "upgrade" tile */
.kpi-card.feat {
    background: var(--purple);
    border-color: transparent;
    color: #fff;
    justify-content: space-between;
}

.kpi-card.feat .kpi-value {
    font-size: 28px;
    font-weight: 700;
}

.kpi-card.feat .kpi-label {
    color: rgba(255, 255, 255, .85);
}

.kpi-card.feat .kpi-trend {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.kpi-card.feat .kpi-ic {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

.kpi-card.feat .arw {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .22);
    display: grid;
    place-items: center;
    margin-left: auto;
}

.kpi-card.feat .arw svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

/* ==========================================================================
   DASHBOARD GRID / UPLOAD
   ========================================================================== */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: stretch;
}

.campaign-upload {
    display: flex;
    flex-direction: column;
}

.upload-zone {
    border: 2px dashed var(--line-2);
    border-radius: var(--r-md);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .18s, background .18s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--purple);
    background: rgba(173, 123, 255, .06);
}

.upload-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: var(--lime);
    display: grid;
    place-items: center;
    margin: 0 auto 14px;
}

.upload-icon svg {
    width: 27px;
    height: 27px;
    color: var(--ink);
    stroke: var(--ink);
}

.upload-zone h3 {
    font-size: 15.5px;
    font-weight: 600;
    margin-bottom: 5px;
}

.upload-zone p {
    color: var(--text-mute);
    font-size: 13px;
    margin-bottom: 16px;
}

/* Excel-sheet row */
.file-item {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-top: 18px;
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 15px 16px;
}

.file-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.file-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text);
    stroke: var(--text);
}

.file-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.file-name {
    font-size: 13.5px;
    font-weight: 600;
}

.file-meta {
    font-size: 11.5px;
    color: var(--text-mute);
    margin-top: 2px;
}

.divider-text {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--text-mute);
    font-size: 11px;
    letter-spacing: .08em;
    font-weight: 600;
}

.divider-text::before,
.divider-text::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.mt-auto {
    margin-top: auto;
}

/* ==========================================================================
   FORMS
   ========================================================================== */

.manual-form {
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.form-row:has(> .form-group:only-child) {
    grid-template-columns: 1fr;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea,
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="search"],
select {
    background: var(--field);
    border: 1.5px solid transparent;
    border-radius: 11px;
    padding: 12px 14px;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    width: 100%;
    transition: border-color .18s, background .18s;
}

input::placeholder {
    color: var(--text-mute);
}

.form-group input:focus,
.form-group select:focus,
input:focus,
select:focus {
    border-color: var(--purple);
    background: var(--field-focus);
}

input[type="file"] {
    background: var(--field);
    border: 1px dashed var(--line-2);
    border-radius: var(--r-sm);
    color: var(--text-dim);
    padding: 10px;
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
    width: 100%;
}

input[type="file"]::file-selector-button {
    background: var(--surface-3);
    color: var(--text);
    border: none;
    border-radius: 7px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
    cursor: pointer;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239A9AA2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 15px;
    padding-right: 34px;
}

select option {
    background: var(--surface-2);
    color: var(--text);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0 16px;
    height: 46px;
    color: var(--text-mute);
}

.search-bar svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.search-bar input {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    height: 100%;
    font-size: 14px;
    color: var(--text);
}

.search-bar input:focus {
    background: transparent !important;
}

/* ==========================================================================
   ACTIVITY LIST
   ========================================================================== */

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 12px;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: background .18s;
}

.activity-item:hover {
    background: var(--surface-2);
}

.status-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--tag-green-bg);
    color: var(--tag-green-tx);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.status-icon svg {
    width: 19px;
    height: 19px;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-title {
    font-size: 13.5px;
    font-weight: 600;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-time {
    font-size: 11.5px;
    color: var(--text-mute);
    margin-top: 2px;
    display: block;
}

.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 9px;
    background: var(--tag-green-bg);
    color: var(--tag-green-tx);
    white-space: nowrap;
}

/* ==========================================================================
   DEALERS PAGE
   ========================================================================== */

.dealers-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tb-search {
    flex: 1;
    min-width: 240px;
}

.tb-select {
    width: auto;
    min-width: 150px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    height: 46px;
    padding: 0 34px 0 16px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
}

.quota-pill {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    padding: 4px 14px 4px 0;
    margin-right: 4px;
    border-right: 1px solid var(--line);
}

.quota-pill .l {
    font-size: 10px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}

.quota-pill .v {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

.btn-danger:hover:not(:disabled) {
    background: #CF3B40;
    border-color: transparent;
}

.btn-danger:disabled,
.btn-danger.is-disabled {
    background: rgba(229, 72, 77, .16);
    color: rgba(255, 255, 255, .45);
    border-color: transparent;
    cursor: not-allowed;
}

.dealers-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.dealer-manage-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px;
    transition: border-color .18s, box-shadow .18s;
}

.dealer-logo-preview {
    height: 118px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    overflow: hidden;
    margin-bottom: 14px;
    background: var(--surface-2);
}

.dealer-logo-preview img {
    max-height: 78%;
    max-width: 78%;
    object-fit: contain;
}

.dealer-logo-fallback {
    place-items: center;
    width: 100%;
    height: 100%;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--text-mute);
}

.drow {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.dname {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 700;
}

.dname svg {
    width: 9px;
    height: 9px;
    color: var(--purple);
    flex-shrink: 0;
}

.dloc {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 2px;
}

.dmeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 15px 0;
    padding-top: 15px;
    border-top: 1px solid var(--line);
}

.dmeta .l {
    font-size: 12px;
    color: var(--text-mute);
}

.dmeta .v {
    font-size: 15px;
    font-weight: 700;
}

/* square icon buttons (edit / delete) */
.icbtn {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    border: 1px solid var(--line-2);
    background: var(--surface);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: border-color .18s, color .18s;
}

.icbtn svg {
    width: 17px;
    height: 17px;
    color: var(--text);
}

.icbtn:hover {
    border-color: var(--text);
}

.icbtn.danger:hover {
    border-color: var(--danger);
}

.icbtn.danger:hover svg {
    color: var(--danger);
}

/* bulk-select tick */
.bulk-select-checkbox-container {
    position: absolute;
    top: 26px;
    left: 26px;
    z-index: 10;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 2px solid var(--line-2);
    background: rgba(12, 12, 14, .65);
    backdrop-filter: blur(3px);
    transition: background .18s, border-color .18s;
}

.bulk-select-checkbox-container.on {
    background: var(--lime);
    border-color: var(--lime);
}

.bulk-select-checkbox-container svg {
    width: 13px;
    height: 13px;
    color: var(--ink);
}

.dealer-avatar {
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.group-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 9px;
    background: var(--tag-purple-bg);
    color: var(--tag-purple-tx);
    white-space: nowrap;
}

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

/* ==========================================================================
   CAMPAIGN EDITOR
   ========================================================================== */

.editor-controls-sidebar,
.dealer-list-sidebar {
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--r-lg);
}

.editor-controls-sidebar h3 {
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-dim) !important;
    border-bottom: none !important;
}

.editor-controls-sidebar h3 svg {
    color: var(--purple);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.control-group label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.val-badge {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 12px;
}

.control-group-section {
    border-top: 1px solid var(--line) !important;
    padding-top: 16px !important;
}

.control-group-section > span {
    color: var(--purple) !important;
}

.preset-btn {
    background: var(--surface-2) !important;
    border: 1px solid var(--line) !important;
    color: var(--text) !important;
    font-size: 12px !important;
    font-weight: 500;
    padding: 9px !important;
    border-radius: 9px !important;
    cursor: pointer;
    transition: background .18s, border-color .18s;
}

.preset-btn:hover {
    border-color: var(--line-2) !important;
    background: var(--surface-3) !important;
}

.preset-btn.on {
    background: var(--tag-purple-bg) !important;
    color: var(--tag-purple-tx) !important;
    border-color: transparent !important;
}

/* range sliders — accent-color gives a natively filled track, which is what
   the mockup shows; a custom ::-webkit-slider-thumb would suppress it. */
.modern-slider {
    width: 100%;
    height: 6px;
    accent-color: var(--lime);
    cursor: pointer;
}

.modern-color,
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    border: 2px solid var(--line-2) !important;
    border-radius: 8px !important;
    background: transparent;
    cursor: pointer;
    padding: 0 !important;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.poster-preview-card {
    background: var(--surface) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--r-lg);
}

.preview-stage-container {
    background: var(--surface-2) !important;
    border: 1px solid var(--line) !important;
    border-radius: var(--r-md) !important;
}

.poster-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    overflow: hidden;
}

.poster-image,
.poster-video {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.poster-logo {
    position: absolute;
}

.poster-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-fallback {
    background: var(--surface-2) !important;
    border: 1px solid var(--lime) !important;
    color: var(--lime) !important;
    font-family: inherit !important;
    border-radius: 8px !important;
}

.poster-overlay-container {
    position: absolute;
}

/* dealer picker (right rail) */
.dealer-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.dealer-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border-radius: 11px;
    cursor: pointer;
    transition: background .18s;
}

.dealer-item:hover {
    background: var(--surface-2);
}

.dealer-item.active {
    background: var(--surface-2);
}

.dealer-item .dealer-avatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
}

.dealer-item .dealer-info {
    min-width: 0;
}

.dealer-item .name {
    font-size: 13px;
    font-weight: 600;
}

.dealer-item .location {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 11px;
    color: var(--text-mute);
}

/* compact chip inside the narrow picker rows */
.dealer-item .group-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 6px;
}

/* video controls */
.video-stage-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    background: var(--surface-2);
    border-radius: var(--r-md);
    padding: 10px 14px;
}

.video-control-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    border: none;
    background: var(--surface-3);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.video-control-btn:hover {
    background: var(--line-2);
}

.video-timecode {
    font-size: 11.5px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.video-scrubber {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 5px;
    border-radius: 999px;
    background: var(--surface-3);
    outline: none;
    cursor: pointer;
}

.video-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--lime);
    cursor: pointer;
}

.video-scrubber::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--lime);
    border: none;
    cursor: pointer;
}

.video-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--tag-purple-bg);
    color: var(--tag-purple-tx);
    white-space: nowrap;
}

/* ==========================================================================
   ANALYTICS
   ========================================================================== */

.a-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.empty-state {
    text-align: center;
    padding: 44px 24px;
    border: 1px dashed var(--line-2);
    border-radius: var(--r-md);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    color: var(--text-mute);
    margin-bottom: 14px;
}

.empty-state h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 5px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-mute);
}

.seg {
    display: inline-flex;
    background: var(--surface-2);
    border-radius: 10px;
    padding: 4px;
}

.seg button {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-dim);
    padding: 7px 14px;
    border-radius: 7px;
    cursor: pointer;
}

.seg button.on {
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
}

.bars {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    height: 200px;
    padding-top: 10px;
}

.bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    height: 100%;
    justify-content: flex-end;
}

.bar .col {
    width: 100%;
    background: var(--surface-2);
    border-radius: 8px 8px 4px 4px;
    transition: background .18s;
}

.bar .col.hi {
    background: var(--lime);
}

.bar .col.hip {
    background: var(--purple);
}

.bar .lb {
    font-size: 11px;
    color: var(--text-mute);
    font-weight: 500;
}

.donut {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.donut .hole {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background: var(--surface);
    display: grid;
    place-items: center;
    text-align: center;
}

.donut .hole b {
    font-size: 26px;
    font-weight: 800;
    display: block;
    line-height: 1;
}

.donut .hole span {
    font-size: 11px;
    color: var(--text-mute);
}

.legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legend .li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.legend .li i {
    width: 11px;
    height: 11px;
    border-radius: 4px;
    display: block;
}

.legend .li b {
    margin-left: auto;
    font-weight: 600;
}

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

.tl {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 8px;
    border-radius: 11px;
}

.tl:hover {
    background: var(--surface-2);
}

.tl .a {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-weight: 700;
    color: #fff;
    font-size: 12px;
    flex-shrink: 0;
}

.tl .n {
    font-size: 13.5px;
    font-weight: 600;
}

.tl .l {
    font-size: 11.5px;
    color: var(--text-mute);
}

.tl .v {
    margin-left: auto;
    font-weight: 700;
    font-size: 15px;
}

/* ==========================================================================
   SETTINGS
   ========================================================================== */

.s-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 16px;
    align-items: start;
}

.legal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    text-decoration: none;
    color: var(--text);
    margin-bottom: 10px;
    transition: border-color .18s, background .18s;
}

.legal-row:last-child {
    margin-bottom: 0;
}

.legal-row:hover {
    border-color: var(--line-2);
    background: var(--surface-3);
}

.legal-row .lr-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legal-row .lr-main > svg {
    width: 18px;
    height: 18px;
    color: var(--lime);
    flex-shrink: 0;
}

.legal-row .t {
    font-size: 14px;
    font-weight: 600;
}

.legal-row .d {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 2px;
}

.legal-row .chev {
    width: 16px;
    height: 16px;
    color: var(--text-mute);
    flex-shrink: 0;
}

.prof {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

.prof .big-av {
    width: 66px;
    height: 66px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--purple), #7B45D6);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 22px;
    flex-shrink: 0;
}

.prof .nm {
    font-size: 18px;
    font-weight: 700;
}

.prof .em {
    font-size: 13px;
    color: var(--text-mute);
}

.row-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--line);
}

.row-item .t {
    font-size: 14px;
    font-weight: 600;
}

.row-item .d {
    font-size: 12px;
    color: var(--text-mute);
    margin-top: 2px;
}

.usage-ring {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
}

.usage-ring .rr {
    position: relative;
    width: 88px;
    height: 88px;
    flex-shrink: 0;
}

.usage-ring .rr svg {
    transform: rotate(-90deg);
}

.usage-ring .rr b {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 800;
}

.plan-name {
    font-size: 13px;
    color: var(--text-mute);
}

.plan-name b {
    color: var(--text);
    font-size: 15px;
    display: block;
    margin-top: 2px;
}

/* toggle — .toggle-track / .toggle-thumb are JS hooks */
.toggle-track {
    width: 46px;
    height: 26px;
    border-radius: 999px;
    background: var(--line-2);
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .18s;
}

.toggle-track.on,
.toggle-track.active {
    background: var(--lime);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: left .18s;
}

.toggle-track.on .toggle-thumb,
.toggle-track.active .toggle-thumb {
    left: 23px;
}

/* ==========================================================================
   ADMIN PANEL
   ========================================================================== */

/* the table card handles its own padding so rows can bleed to the edges */
.admin-card {
    padding: 26px 10px 10px;
    overflow: hidden;
}

.admin-card .card-header {
    padding: 0 16px;
}

.table-scroll {
    overflow-x: auto;
}

.admin-user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.au-name {
    font-weight: 600;
    font-size: 13.5px;
}

.au-mail {
    color: var(--text-mute);
    font-size: 11.5px;
    margin-top: 1px;
}

.au-count {
    font-weight: 600;
}

.au-count.over {
    color: var(--warn);
}

.au-dash {
    color: var(--text-mute);
}

.admin-role-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    white-space: nowrap;
    background: var(--surface-2);
    color: var(--text-dim);
}

.admin-role-badge.badge-super-admin {
    background: var(--tag-purple-bg);
    color: var(--tag-purple-tx);
}

.row-upgrade-requested td {
    background: rgba(173, 123, 255, .07);
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-users-table th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-mute);
    font-weight: 600;
    padding: 0 16px 14px;
}

.admin-users-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    font-size: 13.5px;
    vertical-align: middle;
}

.admin-users-table tr:hover td {
    background: var(--surface-2);
}

.admin-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.admin-limit-controls {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border-radius: 10px;
    padding: 5px 8px;
}

.admin-limit-btn {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    border: none;
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    font-family: inherit;
}

.admin-limit-btn:hover {
    background: var(--surface-3);
}

.admin-limit-value {
    min-width: 22px;
    text-align: center;
    font-weight: 700;
}

.admin-status-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    white-space: nowrap;
}

.admin-status-badge.status-active {
    background: var(--tag-green-bg);
    color: var(--tag-green-tx);
}

.admin-status-badge.status-upgrade-requested {
    background: var(--tag-purple-bg);
    color: var(--tag-purple-tx);
}

.admin-status-badge.status-at-limit {
    background: rgba(232, 145, 60, .16);
    color: var(--warn);
}

.admin-action-btn {
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 9px;
    border: none;
    font-family: inherit;
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text);
    transition: background .18s;
}

.admin-action-btn:hover {
    background: var(--surface-3);
}

.admin-action-btn.approve {
    background: var(--lime);
    color: var(--ink);
}

.admin-action-btn.approve:hover {
    background: var(--lime-600);
}

.badge-role {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-dim);
    white-space: nowrap;
}

.badge-role.sa {
    background: var(--tag-purple-bg);
    color: var(--tag-purple-tx);
}

/* ==========================================================================
   MODALS
   ========================================================================== */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 7, .72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay[style*="flex"] {
    display: flex !important;
}

.modal-card {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 28px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.close-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: 15px;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-family: inherit;
}

.close-btn:hover {
    color: var(--text);
    border-color: var(--line-2);
}

.upgrade-modal-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--tag-green-bg);
    display: grid;
    place-items: center;
    margin: 0 auto;
}

.upgrade-limit-count {
    color: var(--lime);
    font-weight: 700;
}

/* ==========================================================================
   TOASTS / LOADER / MISC
   ========================================================================== */

#global-loader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: grid;
    place-items: center;
    z-index: 500;
}

.spinner,
.spin-container {
    display: inline-grid;
    place-items: center;
}

.spin-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    color: var(--text);
    padding: 13px 20px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 500;
    z-index: 400;
}

.toast.success {
    border-color: var(--lime);
    color: var(--lime);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

/* ==========================================================================
   RESPONSIVE — 1440 / 1024 / 768 / 375
   ========================================================================== */

@media (max-width: 1180px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dealers-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .campaign-detail-layout {
        grid-template-columns: 260px 1fr 260px !important;
    }
}

@media (max-width: 980px) {
    .sidebar {
        flex-wrap: wrap;
        gap: 14px;
        row-gap: 16px;
    }

    .sidebar-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        gap: 20px;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-nav::after {
        display: none;
    }

    .sidebar-nav .nav-item.active::after {
        bottom: -6px;
    }

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

    .campaign-detail-layout {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    .app-container {
        padding: 12px 14px 48px;
    }

    .kpi-grid,
    .dealers-grid {
        grid-template-columns: 1fr;
    }

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

    #page-title {
        font-size: 26px;
    }

    .card {
        padding: 20px;
    }

    .nav-limit,
    .user-name {
        display: none;
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    #btn-new-campaign {
        flex: 1;
        justify-content: center;
    }
}

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