@font-face {
    font-family: Geist;
    src: url("fonts/Geist-Variable.woff2") format("woff2");
    font-display: swap;
    font-style: normal;
    font-weight: 100 900;
}

:root {
    --background-color: #fff;
    --card-background: #fff;
    --sidebar-surface: #fafafa;
    --input-background: #fff;
    --raised-background: #f5f5f5;
    --border-color: #e5e5e5;
    --text-primary: #171717;
    --text-secondary: #656565;
    --secondary-color: #656565;
    --primary-color: #262626;
    --primary-hover: #1d49ab;
    --primary-solid: #255acf;
    --on-primary: #fafafa;
    --ring-color: #737373;
    --success-color: #16764c;
    --error-color: #bd262c;
    --warning-color: #915218;
    --shadow-sm: 0 1px 2px #1111110a;
    --shadow-md: 0 6px 20px #11111112;
    --radius-md: 7px;
    --radius-lg: 12px;
    --chart-open: #255acf;
    --chart-click: #202020;
    --chart-delivered: #8a8a8a;
    --chart-tablet: #696969;
    --chart-unknown: #a0a0a0;
    --chart-track: #eeeeee;
    --chart-label: #656565;
}

:root[data-theme="dark"] {
    --background-color: #141414;
    --card-background: #1c1c1c;
    --sidebar-surface: #1a1a1a;
    --input-background: #1c1c1c;
    --raised-background: #292929;
    --border-color: #383838;
    --text-primary: #fafafa;
    --text-secondary: #b3b3b3;
    --secondary-color: #b3b3b3;
    --primary-color: #eee;
    --primary-hover: #3065dc;
    --primary-solid: #255acf;
    --on-primary: #fff;
    --ring-color: #b3b3b3;
    --success-color: #73d7a1;
    --error-color: #f38b92;
    --warning-color: #f2c277;
    --shadow-sm: 0 1px 2px #0003;
    --shadow-md: 0 8px 24px #0006;
    --chart-open: #8db9ff;
    --chart-click: #f5f5f5;
    --chart-delivered: #8b8b8b;
    --chart-tablet: #9a9a9a;
    --chart-unknown: #707070;
    --chart-track: #323232;
    --chart-label: #b3b3b3;
}

.dashboard-page, .dashboard-auth {
    font-family: Geist, system-ui, sans-serif;
    font-size: .875rem;
}
.dashboard-page *, .dashboard-auth * { font-family: inherit; }
.dashboard-page .fas, .dashboard-auth .fas { font-family: "Font Awesome 6 Free"; }
.dashboard-page :where(button, a, input, select, textarea, summary):focus-visible,
.dashboard-auth :where(button, input, summary):focus-visible {
    outline: 2px solid var(--ring-color);
    outline-offset: 2px;
}

.ui-icon {
    width: 1rem;
    height: 1rem;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dashboard-page .app-container {
    --workspace-sidebar-width: 232px;
    --workspace-gutter: clamp(1rem, 2.2vw, 2rem);
    --workspace-header: 56px;
}

.dashboard-page .workspace-sidebar {
    z-index: 30;
    inset: 0 auto 0 0;
    width: var(--workspace-sidebar-width);
    height: 100dvh;
    padding: .75rem;
    background: var(--sidebar-surface);
    overflow: auto;
    transition: width 200ms ease;
}
.sidebar-top, .workspace-brand, .workspace-nav a, .sidebar-action, .sidebar-theme-toggle {
    display: flex;
    align-items: center;
}
.sidebar-top { justify-content: space-between; }
.workspace-brand {
    gap: .55rem;
    min-width: 0;
    padding: .28rem .25rem;
    color: var(--text-primary);
    font-size: .98rem;
    font-weight: 650;
    letter-spacing: -.024em;
    text-decoration: none;
}
.workspace-brand .ui-icon {
    box-sizing: content-box;
    width: 1rem;
    height: 1rem;
    padding: .44rem;
    border-radius: var(--radius-md);
    background: var(--primary-solid);
    color: var(--on-primary);
}
.workspace-sidebar .workspace-brand { color: var(--accent-text); }
.sidebar-action, .workspace-nav a, .sidebar-theme-toggle {
    gap: .65rem;
    min-height: 36px;
    padding: .45rem .65rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 160ms ease, color 160ms ease;
}
.sidebar-action {
    margin-block: 1.2rem .95rem;
    background: var(--primary-solid);
    color: var(--on-primary);
}
.sidebar-action:hover { background: var(--primary-hover); }
.workspace-nav { list-style: none; display: grid; gap: .2rem; }
.workspace-nav-heading {
    margin-top: 1rem;
    padding: .35rem .65rem;
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 550;
}
.sidebar-theme-toggle {
    width: 100%;
    margin-top: .9rem;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    text-align: start;
    cursor: pointer;
}
.workspace-nav a, .sidebar-theme-toggle { color: var(--text-secondary); }
.workspace-nav a:is(:hover, [aria-current="page"]), .sidebar-theme-toggle:hover {
    background: var(--raised-background);
    color: var(--text-primary);
}
.workspace-nav a[aria-current="page"] { font-weight: 600; }
.workspace-nav a[data-review-unread] {
    position: relative;
    color: var(--accent-text);
    background: var(--accent-surface);
    font-weight: 600;
}
.workspace-nav a[data-review-unread]::after {
    content: attr(data-review-unread);
    margin-left: auto;
    min-width: 1.32rem;
    padding: .06rem .3rem;
    border-radius: 999px;
    text-align: center;
    color: #fff;
    background: var(--primary-solid);
    font-size: .69rem;
    font-variant-numeric: tabular-nums;
}
@media (width > 767px) {
    :root[data-sidebar-collapsed] .dashboard-page .app-container { --workspace-sidebar-width: 64px; }
    :root[data-sidebar-collapsed] .workspace-nav-heading {
        height: 1px;
        margin: .65rem .35rem .4rem;
        padding: 0;
        overflow: hidden;
        color: transparent;
        background: var(--border-color);
    }
    :root[data-sidebar-collapsed] .workspace-nav a[data-review-unread]::after {
        position: absolute;
        top: 1px;
        right: 1px;
        min-width: 0;
        padding-inline: .22rem;
        font-size: .6rem;
    }
    :root[data-sidebar-collapsed] .workspace-sidebar :is(.workspace-brand, .workspace-nav a, .sidebar-action, .sidebar-theme-toggle) {
        justify-content: center;
        padding-inline: 0;
    }
    :root[data-sidebar-collapsed] .workspace-sidebar :is(a, .sidebar-theme-toggle) span {
        position: absolute;
        width: 1px;
        height: 1px;
        clip-path: inset(50%);
        overflow: hidden;
    }
}
.navigation-scrim, .workspace-icon-button.sidebar-close { display: none; }

.dashboard-page .main-content {
    flex: 1;
    min-width: 0;
    max-width: none;
    margin-left: var(--workspace-sidebar-width);
    padding: 0 var(--workspace-gutter) var(--workspace-gutter);
    transition: margin-left 200ms ease;
}
.workspace-bar {
    z-index: 20;
    display: flex;
    position: sticky;
    top: 0;
    align-items: center;
    justify-content: space-between;
    height: var(--workspace-header);
    padding-inline: var(--workspace-gutter);
    margin-inline: calc(-1 * var(--workspace-gutter));
    border-bottom: 1px solid var(--border-color);
    background: var(--background-color);
}
.workspace-path { display: flex; align-items: center; gap: .75rem; font-weight: 500; }
.workspace-divider { width: 1px; height: 1rem; background: var(--border-color); }
.workspace-icon-button, .workspace-account summary, .workspace-account-popover button {
    display: flex;
    align-items: center;
    gap: .45rem;
    border: 0;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: transparent;
    cursor: pointer;
    transition: background-color 150ms ease;
}
.workspace-icon-button { justify-content: center; width: 2rem; height: 2rem; }
.workspace-icon-button:hover, .workspace-account summary:hover, .workspace-account[open] summary,
.workspace-account-popover button:hover { background: var(--raised-background); }
.workspace-account { position: relative; }
.workspace-account summary { list-style: none; padding: .2rem .35rem; }
.workspace-account summary::-webkit-details-marker { display: none; }
.workspace-avatar {
    display: grid;
    place-items: center;
    width: 1.85rem;
    height: 1.85rem;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--raised-background);
    font-size: .72rem;
    font-weight: 650;
}
.workspace-username { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-account summary .ui-icon { transition: transform 150ms ease; }
.workspace-account[open] summary .ui-icon { transform: rotate(180deg); }
.workspace-account-popover {
    position: absolute;
    top: calc(100% + .4rem);
    right: 0;
    min-width: 9rem;
    padding: .3rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}
.workspace-account[open] .workspace-account-popover { animation: menu-enter 150ms ease-out both; }
.workspace-account-popover button { width: 100%; padding: .45rem .6rem; font-size: .84rem; }

.dashboard-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-block: 1.45rem 1.1rem; }
.dashboard-heading h1, .dashboard-auth .auth-copy h1 {
    font-size: clamp(1.4rem, 2vw, 1.75rem);
    font-weight: 650;
    letter-spacing: -.037em;
    line-height: 1.24;
}
.dashboard-page .form-card, .dashboard-page .history-item {
    border: 1px solid var(--border-color);
    background: var(--card-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.dashboard-page .form-card { padding: 1.2rem; margin: 0; }
.dashboard-page .card-header h2 { font-size: 1rem; font-weight: 625; letter-spacing: -.02em; }
.dashboard-page .card-header i { color: var(--text-secondary); font-size: .95rem; }

.dashboard-page :is(.btn-primary, .btn-secondary, .tracking-button, #refreshButton),
.dashboard-auth .btn-primary {
    padding: .46rem .8rem;
    min-height: 2.125rem;
    gap: .45rem;
    width: auto;
    font-size: .83rem;
    font-weight: 550;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.dashboard-page .btn-primary, .dashboard-auth .btn-primary,
:root[data-theme="dark"] :is(.dashboard-page, .dashboard-auth) .btn-primary {
    background: var(--primary-solid);
    color: var(--on-primary);
    border-color: var(--primary-solid);
}
.dashboard-page .btn-primary:hover, .dashboard-auth .btn-primary:hover,
:root[data-theme="dark"] :is(.dashboard-page, .dashboard-auth) .btn-primary:hover { background: var(--primary-hover); }
.dashboard-page :is(.btn-secondary, .tracking-button, #refreshButton) {
    color: var(--text-primary);
    background: var(--card-background);
}
.dashboard-page :is(.btn-secondary, .tracking-button, #refreshButton):hover { background: var(--raised-background); }
.dashboard-page :is(input, textarea, select), .dashboard-auth input {
    background: var(--input-background);
    color: var(--text-primary);
    font-size: .875rem;
    padding: .52rem .7rem;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.dashboard-page input[type="checkbox"] { accent-color: var(--primary-color); }

.dashboard-page .campaign-form {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: stretch;
}
.campaign-form > .form-card:first-child { grid-row: span 2; display: flex; flex-direction: column; }
.campaign-form > .form-card:first-child .form-group { display: flex; flex-direction: column; flex: 1; }
.dashboard-page #recipient { min-height: 11rem; flex: 1; }
.dashboard-page .campaign-form .form-group { margin: 0; }
.dashboard-page .campaign-form .action-bar { grid-column: 1 / -1; margin-top: 0; }
.dashboard-page .sender-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.dashboard-page :is(.sender-option, .template-option) {
    border: 1px solid var(--border-color);
    background: var(--card-background);
    color: var(--text-primary);
    text-align: left;
    font: inherit;
    padding: .65rem .75rem;
    transition: background-color 160ms ease, border-color 160ms ease;
}
.dashboard-page :is(.sender-option, .template-option):is(:hover, .active) { background: var(--raised-background); }
.dashboard-page :is(.sender-option, .template-option).active { border-color: var(--ring-color); }

.dashboard-page .history-list { gap: .8rem; }
.dashboard-page .history-item { padding: .95rem; }
.dashboard-page .history-item-highlight { border-color: var(--ring-color); }
.dashboard-page .batch-status-badge, .dashboard-page .summary-chip { border-radius: 999px; }
.dashboard-page .history-item .history-header h3 { letter-spacing: -.018em; }
.dashboard-page .history-item .history-icon { background: var(--raised-background); }

.dashboard-auth { background: var(--sidebar-surface); }
.dashboard-auth .auth-card {
    padding: clamp(1.4rem, 4vw, 2rem);
    box-shadow: var(--shadow-sm);
}
.dashboard-auth .auth-shell { width: min(100%, 410px); }
.dashboard-auth .auth-form { gap: .85rem; }
.dashboard-auth .auth-form .form-group { margin: 0; }
.dashboard-auth .auth-card-header { justify-content: center; }
.dashboard-auth :is(.auth-logo, .auth-submit) {
    --primary-solid: #255acf;
    --on-primary: #fff;
}
.dashboard-auth .auth-logo { color: var(--primary-solid); }
:root[data-theme="dark"] .dashboard-auth .auth-logo { color: #8db9ff; }
.dashboard-auth .auth-submit {
    --primary-hover: #1d49ab;
    width: 100%;
    min-height: 2.4rem;
}
.dashboard-auth .auth-toggle {
    gap: .2rem;
    padding: .2rem;
    border-radius: var(--radius-md);
    background: var(--raised-background);
    margin-bottom: 1rem;
}
.dashboard-auth .auth-toggle-button { border-color: transparent; background: transparent; padding: .42rem .55rem; color: var(--text-secondary); }
.dashboard-auth .auth-toggle-button.active {
    color: var(--text-primary);
    background: var(--card-background);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.dashboard-page .tracking-status-strip { padding: 0; background: none; border: none; box-shadow: none; margin-bottom: 1rem; }
.dashboard-page .tracking-toolbar { gap: .65rem; margin-bottom: 1rem; }
.dashboard-page .tracking-presets { background: var(--raised-background); }
.dashboard-page .tracking-presets button.selected {
    background: var(--card-background);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}
.dashboard-page .tracking-search input { background: transparent; padding: 0; }
.dashboard-page .tracking-search { flex-basis: min(100%, 250px); max-width: 360px; }
.dashboard-page .tracking-table-scroll { border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.dashboard-page .tracking-table th { background: var(--raised-background); border-top: 0; }
.dashboard-page .tracking-table td { border-bottom-color: var(--border-color); padding-block: .65rem; }
.dashboard-page .tracking-table tbody tr:last-child td { border-bottom: 0; }
.dashboard-page .tracking-table tbody tr:hover { background: var(--raised-background); }
.dashboard-page .tracking-tabs { gap: .3rem; padding: .2rem; border: 0; width: fit-content; max-width: 100%; border-radius: var(--radius-md); background: var(--raised-background); }
.dashboard-page .tracking-tabs button { font-size: .8rem; padding: .32rem .62rem; border: 1px solid transparent; border-radius: 5px; }
.dashboard-page .tracking-tabs button[aria-selected="true"] {
    color: var(--text-primary);
    border-color: var(--border-color);
    background: var(--card-background);
    box-shadow: var(--shadow-sm);
}

.dashboard-page .dashboard-heading, .dashboard-page .content-area, .dashboard-page #rangeForm,
.dashboard-auth .auth-card { animation: surface-enter 210ms ease-out both; }
.dashboard-page .preview-content { animation: dialog-enter 180ms ease-out both; }
@keyframes surface-enter { from { opacity: 0; transform: translateY(5px); } }
@keyframes menu-enter { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes dialog-enter { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }

@media (max-width: 900px) {
    .dashboard-page .campaign-form { grid-template-columns: 1fr; }
    .campaign-form > .form-card:first-child { grid-row: auto; }
}
@media (max-width: 767px) {
    .dashboard-page .main-content { margin-left: 0; }
    .workspace-username { display: none; }
    .dashboard-page .workspace-sidebar {
        width: min(260px, 85vw);
        visibility: hidden;
        transform: translateX(-100%);
        transition: transform 200ms ease, visibility 0s 200ms;
    }
    .workspace-icon-button.sidebar-close { display: flex; }
    [data-nav-open] .workspace-sidebar {
        visibility: visible;
        transform: translateX(0);
        transition-delay: 0s;
    }
    .navigation-scrim {
        display: block;
        position: fixed;
        z-index: 25;
        inset: 0;
        visibility: hidden;
        opacity: 0;
        background: #0006;
        transition: opacity 200ms ease, visibility 0s 200ms;
    }
    [data-nav-open] .navigation-scrim { opacity: 1; visibility: visible; transition-delay: 0s; }
    .dashboard-page:has([data-nav-open]) { overflow: hidden; }
    .dashboard-page .tracking-toolbar .tracking-bot-toggle { margin-left: 0; }
    .dashboard-page .tracking-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
    .dashboard-page *, .dashboard-page *::before, .dashboard-page *::after, .dashboard-auth * {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
        transition-duration: .01ms !important;
    }
}

.dashboard-page, .dashboard-auth {
    --accent-text: #255acf;
    --accent-surface: #eff4ff;
}
:root[data-theme="dark"] :is(.dashboard-page, .dashboard-auth) {
    --accent-text: #8db9ff;
    --accent-surface: #1d2c4a;
}
.dashboard-page .workspace-nav a[aria-current="page"],
.dashboard-page :is(.sender-option, .template-option).active,
.dashboard-page .tracking-tabs button[aria-selected="true"],
.dashboard-page .tracking-presets button.selected,
.dashboard-auth .auth-toggle-button.active {
    color: var(--accent-text);
    background: var(--accent-surface);
}
.dashboard-page :is(.sender-option, .template-option).active {
    border-color: var(--accent-text);
}
.dashboard-page input[type="checkbox"] { accent-color: var(--primary-solid); }

.campaign-template-name {
    padding: .65rem .75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--raised-background);
    font-weight: 550;
}
.recipient-breakdown { margin-top: .8rem; }
.recipient-editor {
    display: flex;
    position: relative;
    flex: 1;
    isolation: isolate;
    border-radius: var(--radius-md);
    background: var(--input-background);
}
.recipient-marker-layer {
    position: absolute;
    overflow: hidden;
    pointer-events: none;
    color: transparent;
}
.recipient-editor #recipient {
    position: relative;
    z-index: 1;
    background: transparent;
}
.recipient-editor #recipient, #recipientMarkerText {
    font: inherit;
    line-height: 1.5;
    padding: .52rem .7rem;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    tab-size: 8;
}
.recipient-marker-layer mark {
    color: inherit;
    background: linear-gradient(var(--recipient-marker), var(--recipient-marker)) left 72% / 100% 1.05em no-repeat;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
.recipient-marker-layer .recipient-duplicate { --recipient-marker: #ffed68; }
.recipient-marker-layer .recipient-invalid { --recipient-marker: #ffa7b6; }
.recipient-marker-layer .recipient-bounced { --recipient-marker: #85ebdd; }
.recipient-marker-layer .recipient-suppressed { --recipient-marker: #d7b6ff; }
:root[data-theme="dark"] .recipient-marker-layer .recipient-duplicate { --recipient-marker: #665316; }
:root[data-theme="dark"] .recipient-marker-layer .recipient-invalid { --recipient-marker: #782b3c; }
:root[data-theme="dark"] .recipient-marker-layer .recipient-bounced { --recipient-marker: #175c58; }
:root[data-theme="dark"] .recipient-marker-layer .recipient-suppressed { --recipient-marker: #563580; }
.recipient-marker-layer .recipient-mark-new { animation: recipient-marker-sweep 340ms ease-out; }
@keyframes recipient-marker-sweep {
    from { background-size: 0 1.05em; }
}
.recipient-breakdown-bar {
    display: flex;
    height: .4rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--chart-track);
}
.recipient-breakdown-bar span {
    flex: 0 0 0;
    background: var(--recipient-segment);
    transition: flex-grow 180ms ease;
}
.recipient-ready { --recipient-segment: var(--primary-solid); }
.recipient-duplicate { --recipient-segment: #bc8d00; }
.recipient-invalid { --recipient-segment: #d02f4d; }
.recipient-bounced { --recipient-segment: #00867b; }
.recipient-suppressed { --recipient-segment: #8846cd; }
:root[data-theme="dark"] .recipient-duplicate { --recipient-segment: #f5d14a; }
:root[data-theme="dark"] .recipient-invalid { --recipient-segment: #ff819c; }
:root[data-theme="dark"] .recipient-bounced { --recipient-segment: #38cdb9; }
:root[data-theme="dark"] .recipient-suppressed { --recipient-segment: #bd8bff; }
.recipient-breakdown-key {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin-top: .55rem;
    color: var(--text-secondary);
    font-size: .77rem;
}
.recipient-breakdown-key li::before {
    content: '';
    display: inline-block;
    width: .45rem;
    height: .45rem;
    margin-right: .32rem;
    border-radius: 50%;
    background: var(--recipient-segment);
}
.recipient-breakdown-key strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
:is(#recipientIssues, #recipientRecordCheck) { color: var(--text-secondary); font-size: .78rem; }
:is(#recipientIssues, #recipientRecordCheck):not(:empty) { margin-top: .5rem; }
.dashboard-page #recipient[aria-invalid="true"] { border-color: var(--error-color); }
.dashboard-page .campaign-form .campaign-review {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .65rem 1rem;
    padding: .75rem 1rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.campaign-review-summary p { color: var(--text-secondary); font-size: .79rem; }
.campaign-review-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
