/* =========================================================
   MAILCOW AUTORESPONDER
   Modern SaaS Dashboard UI
   ========================================================= */

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-muted: #f1f5f9;

    --text: #172033;
    --text-soft: #667085;
    --text-muted: #98a2b3;

    --primary: #635bff;
    --primary-dark: #5148e8;
    --primary-soft: #eeecff;

    --success: #12b76a;
    --success-soft: #eafaf2;

    --warning: #f79009;
    --warning-soft: #fff5e6;

    --danger: #f04438;
    --danger-soft: #fff0ef;

    --border: #e4e7ec;
    --border-light: #edf0f5;

    --sidebar-width: 250px;
    --header-height: 72px;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .05);
    --shadow: 0 4px 16px rgba(16, 24, 40, .06);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .08);

    --transition: .2s ease;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

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

img {
    max-width: 100%;
}

/* =========================================================
   APP SHELL
   ========================================================= */

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: var(--sidebar-width);
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), width var(--transition);
}

.main-area {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--header-height);
    padding: 0 28px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-content {
    padding: 30px;
    max-width: 1600px;
    margin: 0 auto;
}

/* =========================================================
   BRAND
   ========================================================= */

.brand {
    height: 72px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #635bff, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 17px;
    box-shadow: 0 5px 14px rgba(99, 91, 255, .24);
}

.brand-text {
    min-width: 0;
}

.brand-name {
    display: block;
    color: var(--text);
    font-weight: 750;
    font-size: 15px;
    letter-spacing: -.2px;
}

.brand-subtitle {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 1px;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 18px 12px;
}

.nav-section {
    margin-bottom: 22px;
}

.nav-section-title {
    padding: 0 11px;
    margin: 0 0 8px;
    color: #98a2b3;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.nav-item {
    width: 100%;
    min-height: 42px;
    margin: 2px 0;
    padding: 9px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #667085;
    display: flex;
    align-items: center;
    gap: 11px;
    text-align: left;
    font-size: 13px;
    font-weight: 550;
    transition: all var(--transition);
}

.nav-item:hover {
    background: #f5f6ff;
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 650;
}

.nav-item svg,
.nav-item i,
.nav-item .icon {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

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

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid var(--border-light);
}

.sidebar-account {
    padding: 10px;
    border-radius: 11px;
    background: var(--surface-soft);
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 750;
    font-size: 12px;
}

.account-info {
    min-width: 0;
    flex: 1;
}

.account-name {
    overflow: hidden;
    color: var(--text);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.account-email {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    display: none;
    align-items: center;
    justify-content: center;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -.35px;
}

.topbar-subtitle {
    color: var(--text-muted);
    font-size: 12px;
}

.icon-button {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: #667085;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.icon-button:hover {
    color: var(--primary);
    border-color: #d7d3ff;
    background: var(--primary-soft);
}

/* =========================================================
   PAGE HEADER
   ========================================================= */

.page-header {
    margin-bottom: 26px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.page-title {
    margin: 0;
    color: var(--text);
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -.7px;
    font-weight: 750;
}

.page-description {
    margin: 7px 0 0;
    color: var(--text-soft);
    font-size: 13px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

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

.btn {
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 650;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 3px 8px rgba(99, 91, 255, .18);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(99, 91, 255, .22);
}

.btn-secondary {
    background: #fff;
    color: #475467;
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-soft);
    border-color: #d0d5dd;
}

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

.btn-danger:hover {
    background: #d92d20;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-sm {
    min-height: 34px;
    padding: 7px 11px;
    font-size: 12px;
}

.btn-lg {
    min-height: 46px;
    padding: 11px 19px;
}

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

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
}

.card-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.card-description {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================================================
   DASHBOARD STATS
   ========================================================= */

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

.stat-card {
    padding: 19px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-label {
    margin-top: 14px;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 550;
}

.stat-value {
    margin-top: 3px;
    color: var(--text);
    font-size: 25px;
    line-height: 1.15;
    font-weight: 750;
    letter-spacing: -.6px;
}

.stat-change {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

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

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr);
    gap: 18px;
    margin-bottom: 18px;
}

.dashboard-grid-wide {
    grid-column: 1 / -1;
}

/* =========================================================
   STATUS / BADGES
   ========================================================= */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
}

.badge-success {
    background: var(--success-soft);
    color: #087443;
}

.badge-warning {
    background: var(--warning-soft);
    color: #b54708;
}

.badge-danger {
    background: var(--danger-soft);
    color: #b42318;
}

.badge-primary {
    background: var(--primary-soft);
    color: #5148d8;
}

.badge-neutral {
    background: var(--surface-muted);
    color: #475467;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

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

.form-group {
    margin-bottom: 17px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: #344054;
    font-size: 12px;
    font-weight: 650;
}

.form-hint {
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 11px;
}

.form-control,
.form-select,
.form-input,
textarea,
select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"] {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    transition: all var(--transition);
}

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

.form-control::placeholder,
.form-input::placeholder,
input::placeholder,
textarea::placeholder {
    color: #98a2b3;
}

.form-control:focus,
.form-select:focus,
.form-input:focus,
textarea:focus,
select:focus,
input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, .10);
}

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

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

/* =========================================================
   TOGGLE
   ========================================================= */

.toggle {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 42px;
}

.toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: #d0d5dd;
    border-radius: 999px;
    transition: .2s ease;
}

.toggle-slider::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
    transition: .2s ease;
}

.toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle input:checked + .toggle-slider::after {
    transform: translateX(18px);
}

/* =========================================================
   TEMPLATE / EMAIL DESIGNER
   ========================================================= */

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

.template-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all var(--transition);
}

.template-card:hover {
    border-color: #d7d3ff;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.template-preview {
    min-height: 170px;
    padding: 18px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border-light);
}

.template-info {
    padding: 15px;
}

.template-name {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
}

.template-meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
}

.template-actions {
    margin-top: 12px;
    display: flex;
    gap: 7px;
}

/* =========================================================
   TABLE
   ========================================================= */

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

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

.table th {
    padding: 11px 15px;
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
    color: #667085;
    font-size: 10px;
    font-weight: 750;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .045em;
    white-space: nowrap;
}

.table td {
    padding: 14px 15px;
    border-bottom: 1px solid var(--border-light);
    color: #475467;
    font-size: 12px;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: #fafbff;
}

/* =========================================================
   EMPTY STATES
   ========================================================= */

.empty-state {
    padding: 55px 25px;
    text-align: center;
}

.empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 13px;
    border-radius: 13px;
    background: var(--surface-muted);
    color: #98a2b3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.empty-state p {
    max-width: 430px;
    margin: 6px auto 17px;
    color: var(--text-muted);
    font-size: 12px;
}

/* =========================================================
   ALERTS
   ========================================================= */

.alert {
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
}

.alert-success {
    background: var(--success-soft);
    border-color: #abefc6;
    color: #067647;
}

.alert-warning {
    background: var(--warning-soft);
    border-color: #fedf89;
    color: #b54708;
}

.alert-danger {
    background: var(--danger-soft);
    border-color: #fecdca;
    color: #b42318;
}

.alert-info {
    background: #eff8ff;
    border-color: #b2ddff;
    color: #175cd3;
}

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

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    padding: 20px;
    background: rgba(16, 24, 40, .52);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all .2s ease;
}

.modal-backdrop.show,
.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 70px rgba(16, 24, 40, .2);
    transform: translateY(10px) scale(.98);
    transition: all .2s ease;
}

.modal-backdrop.show .modal,
.modal-backdrop.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 19px 21px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.modal-body {
    padding: 21px;
}

.modal-footer {
    padding: 15px 21px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* =========================================================
   SEARCH / FILTERS
   ========================================================= */

.filter-bar {
    padding: 13px;
    margin-bottom: 17px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-box input {
    padding-left: 38px;
}

.search-box-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    width: 16px;
    height: 16px;
    color: #98a2b3;
    transform: translateY(-50%);
}

/* =========================================================
   PAGINATION
   ========================================================= */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding-top: 15px;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 11px;
}

.pagination-actions {
    display: flex;
    gap: 5px;
}

.pagination-button {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: #667085;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.pagination-button:hover,
.pagination-button.active {
    background: var(--primary-soft);
    border-color: #d7d3ff;
    color: var(--primary);
}

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

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 11px;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--primary);
}

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

.activity-text {
    margin: 0;
    color: #475467;
    font-size: 12px;
}

.activity-time {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10px;
}

/* =========================================================
   PROGRESS
   ========================================================= */

.progress {
    width: 100%;
    height: 7px;
    overflow: hidden;
    background: #eaecf0;
    border-radius: 999px;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: inherit;
    transition: width .3s ease;
}

/* =========================================================
   LOADING
   ========================================================= */

.loading {
    position: relative;
    min-height: 100px;
}

.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(
            90deg,
            rgba(255,255,255,0) 0%,
            rgba(255,255,255,.7) 50%,
            rgba(255,255,255,0) 100%
        );
    transform: translateX(-100%);
    animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
    to {
        transform: translateX(100%);
    }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e4e7ec;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

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

/* =========================================================
   TOAST
   ========================================================= */

.toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 5000;
    width: min(370px, calc(100vw - 40px));
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.toast {
    padding: 13px 15px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 11px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: toastIn .22s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.toast-title {
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
}

.toast-message {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 11px;
}

/* =========================================================
   LOGIN PAGE
   ========================================================= */

.login-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 10% 10%, rgba(99, 91, 255, .11), transparent 30%),
        radial-gradient(circle at 90% 90%, rgba(139, 92, 246, .10), transparent 32%),
        #f7f8fc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px;
}

.login-container {
    width: min(430px, 100%);
}

.login-brand {
    margin-bottom: 25px;
    text-align: center;
}

.login-brand .brand-logo {
    margin: 0 auto 12px;
}

.login-card {
    padding: 30px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
}

.login-title {
    margin: 0;
    text-align: center;
    font-size: 23px;
    font-weight: 750;
    letter-spacing: -.5px;
}

.login-description {
    margin: 7px 0 25px;
    color: var(--text-muted);
    text-align: center;
    font-size: 12px;
}

/* =========================================================
   EMAIL PREVIEW
   ========================================================= */

.email-preview {
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.email-preview-toolbar {
    min-height: 42px;
    padding: 8px 12px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 7px;
}

.email-preview-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d0d5dd;
}

.email-preview-body {
    min-height: 300px;
    padding: 25px;
}

/* =========================================================
   DIVIDERS / UTILITIES
   ========================================================= */

.divider {
    width: 100%;
    height: 1px;
    margin: 18px 0;
    background: var(--border-light);
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-soft {
    color: var(--text-soft) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.fw-600 {
    font-weight: 600;
}

.fw-700 {
    font-weight: 700;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

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

.gap-1 {
    gap: 5px;
}

.gap-2 {
    gap: 9px;
}

.gap-3 {
    gap: 14px;
}

.gap-4 {
    gap: 20px;
}

.mt-1 {
    margin-top: 5px;
}

.mt-2 {
    margin-top: 9px;
}

.mt-3 {
    margin-top: 14px;
}

.mt-4 {
    margin-top: 20px;
}

.mb-1 {
    margin-bottom: 5px;
}

.mb-2 {
    margin-bottom: 9px;
}

.mb-3 {
    margin-bottom: 14px;
}

.mb-4 {
    margin-bottom: 20px;
}

/* =========================================================
   MOBILE SIDEBAR OVERLAY
   ========================================================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: rgba(16, 24, 40, .45);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.sidebar-overlay.show,
.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

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

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

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

@media (max-width: 900px) {
    :root {
        --sidebar-width: 250px;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 35px rgba(16, 24, 40, .12);
    }

    .sidebar.open,
    .sidebar.active {
        transform: translateX(0);
    }

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

    .mobile-menu {
        display: inline-flex;
    }

    .topbar {
        padding: 0 20px;
    }

    .page-content {
        padding: 24px 20px;
    }
}

@media (max-width: 700px) {
    .topbar-title {
        font-size: 16px;
    }

    .topbar-subtitle {
        display: none;
    }

    .page-header {
        flex-direction: column;
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 23px;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-value {
        font-size: 21px;
    }

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

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

    .card-header {
        padding: 15px;
    }

    .card-body {
        padding: 15px;
    }

    .table th,
    .table td {
        padding: 11px 12px;
    }
}

@media (max-width: 480px) {
    .topbar {
        height: 64px;
        padding: 0 14px;
    }

    .page-content {
        padding: 18px 14px;
    }

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

    .stat-card {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 13px;
        align-items: center;
    }

    .stat-label {
        margin-top: 0;
    }

    .stat-value {
        margin-top: 2px;
    }

    .stat-change {
        grid-column: 2;
        margin-top: 3px;
    }

    .login-page {
        padding: 15px;
    }

    .login-card {
        padding: 22px 18px;
    }

    .modal-backdrop {
        padding: 10px;
    }

    .modal {
        max-height: calc(100vh - 20px);
        border-radius: 16px;
    }

    .modal-body {
        padding: 17px;
    }

    .modal-footer {
        padding: 13px 17px;
    }
}

/* =========================================================
   DARK MODE SUPPORT
   ========================================================= */

[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #111827;
    --surface-soft: #151e2e;
    --surface-muted: #1b2536;

    --text: #f2f4f7;
    --text-soft: #b7c0ce;
    --text-muted: #8d98aa;

    --border: #263247;
    --border-light: #202b3e;
}

[data-theme="dark"] body {
    background: var(--bg);
    color: var(--text);
}

[data-theme="dark"] .sidebar,
[data-theme="dark"] .topbar,
[data-theme="dark"] .card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .template-card,
[data-theme="dark"] .filter-bar,
[data-theme="dark"] .login-card,
[data-theme="dark"] .modal,
[data-theme="dark"] .toast,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .icon-button,
[data-theme="dark"] .mobile-menu,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .email-preview-toolbar {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

[data-theme="dark"] .table th {
    background: var(--surface-soft);
}

[data-theme="dark"] .table tbody tr:hover {
    background: var(--surface-soft);
}

[data-theme="dark"] .sidebar-account,
[data-theme="dark"] .template-preview {
    background: var(--surface-soft);
}

[data-theme="dark"] .nav-item {
    color: var(--text-soft);
}

[data-theme="dark"] .nav-item:hover {
    background: rgba(99, 91, 255, .12);
    color: #a8a1ff;
}

[data-theme="dark"] .nav-item.active {
    background: rgba(99, 91, 255, .16);
    color: #a8a1ff;
}

/* =========================================================
   ACCESSIBILITY
   ========================================================= */

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
/* =========================================================
   MAIL RESPONDER
   DASHBOARD UI
   ========================================================= */

.app-body {
    margin: 0;
    min-height: 100vh;
    background: #f5f7fb;
    color: #172033;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    z-index: 1000;
    background: #0b1020;
    color: #fff;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand {
    height: 76px;
    padding: 0 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, #6d5dfc, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 7px 20px rgba(109,93,252,.3);
}

.brand-name {
    color: #fff;
    font-size: 14px;
    font-weight: 750;
}

.brand-subtitle {
    margin-top: 2px;
    color: #8790a5;
    font-size: 10px;
}

.sidebar-nav {
    flex: 1;
    padding: 22px 12px;
    overflow-y: auto;
}

.nav-label {
    padding: 0 11px;
    margin: 0 0 8px;
    color: #69738a;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .1em;
}

.nav-label + .nav-item {
    margin-top: 0;
}

.nav-item {
    width: 100%;
    min-height: 42px;
    margin: 3px 0;
    padding: 9px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #9ca6ba;
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
    text-align: left;
    font-size: 12px;
    font-weight: 550;
    transition: .2s ease;
}

.nav-item:hover {
    background: rgba(109,93,252,.09);
    color: #d8d4ff;
}

.nav-item.active {
    background: linear-gradient(
        90deg,
        rgba(109,93,252,.22),
        rgba(109,93,252,.09)
    );
    color: #fff;
    box-shadow: inset 3px 0 0 #6d5dfc;
}

.nav-icon {
    width: 19px;
    height: 19px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    font-size: 16px;
}

.sidebar-footer {
    padding: 15px 12px;
    border-top: 1px solid rgba(255,255,255,.07);
}

.system-status {
    padding: 11px;
    margin-bottom: 9px;
    border-radius: 10px;
    background: rgba(255,255,255,.035);
    display: flex;
    align-items: center;
    gap: 9px;
}

.system-status .status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #12b76a;
    box-shadow: 0 0 0 4px rgba(18,183,106,.1);
}

.system-status strong {
    display: block;
    color: #dfe3ec;
    font-size: 10px;
    font-weight: 650;
}

.system-status small {
    display: block;
    margin-top: 2px;
    color: #69738a;
    font-size: 9px;
}

.logout-button {
    width: 100%;
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7f899d;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    cursor: pointer;
    font-size: 11px;
    transition: .2s ease;
}

.logout-button:hover {
    color: #fff;
    background: rgba(255,255,255,.05);
}

/* =========================================================
   MAIN
   ========================================================= */

.main-content {
    min-height: 100vh;
    margin-left: 250px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: 74px;
    padding: 0 30px;
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid #e8ebf1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-button {
    display: none;
    width: 38px;
    height: 38px;
    border: 1px solid #e2e6ed;
    border-radius: 9px;
    background: #fff;
    color: #475467;
    cursor: pointer;
}

.topbar-heading {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.topbar-eyebrow {
    color: #98a2b3;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .1em;
}

.topbar h1 {
    margin: 0;
    color: #172033;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 750;
    letter-spacing: -.35px;
}

.topbar-actions {
    display: flex;
    align-items: center;
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg,#6d5dfc,#8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 750;
}

.user-details strong {
    display: block;
    color: #344054;
    font-size: 11px;
}

.user-details span {
    display: block;
    margin-top: 1px;
    color: #98a2b3;
    font-size: 9px;
}

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

.page-section {
    display: none;
    padding: 30px;
    max-width: 1500px;
    margin: 0 auto;
}

.page-section.active {
    display: block;
}

.page-intro {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
}

.eyebrow {
    color: #6d5dfc;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
}

.page-intro h2 {
    margin: 5px 0 5px;
    color: #172033;
    font-size: 25px;
    line-height: 1.2;
    font-weight: 760;
    letter-spacing: -.65px;
}

.page-intro p {
    max-width: 600px;
    margin: 0;
    color: #667085;
    font-size: 12px;
    line-height: 1.6;
}

.primary-button {
    min-height: 40px;
    padding: 9px 15px;
    border: 0;
    border-radius: 9px;
    background: #6d5dfc;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 5px 15px rgba(109,93,252,.2);
    transition: .2s ease;
}

.primary-button:hover {
    background: #5949ed;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(109,93,252,.26);
}

/* =========================================================
   STATISTICS
   ========================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    min-height: 110px;
    padding: 17px;
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 13px;
    box-shadow: 0 2px 8px rgba(16,24,40,.035);
    transition: .2s ease;
}

.stat-card:hover {
    border-color: #d9d5ff;
    box-shadow: 0 8px 22px rgba(16,24,40,.06);
    transform: translateY(-1px);
}

.stat-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 700;
}

.stat-icon.purple {
    background: #efedff;
    color: #6d5dfc;
}

.stat-icon.green {
    background: #e9f9f1;
    color: #12b76a;
}

.stat-icon.blue {
    background: #edf5ff;
    color: #2e90fa;
}

.stat-icon.orange {
    background: #fff5e8;
    color: #f79009;
}

.stat-content {
    min-width: 0;
}

.stat-content span {
    display: block;
    color: #667085;
    font-size: 10px;
    font-weight: 550;
}

.stat-content strong {
    display: block;
    margin-top: 3px;
    color: #172033;
    font-size: 22px;
    line-height: 1.15;
    font-weight: 760;
    letter-spacing: -.45px;
}

.stat-content .status-text {
    color: #12b76a;
    font-size: 15px;
    margin-top: 6px;
}

/* =========================================================
   CONTENT GRID
   ========================================================= */

.content-grid {
    display: grid;
    grid-template-columns: minmax(0,1.55fr) minmax(310px,1fr);
    gap: 16px;
}

.panel {
    min-width: 0;
    background: #fff;
    border: 1px solid #e5e9f0;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(16,24,40,.035);
}

.panel-header {
    min-height: 66px;
    padding: 15px 18px;
    border-bottom: 1px solid #edf0f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-header h3 {
    margin: 4px 0 0;
    color: #172033;
    font-size: 14px;
    font-weight: 720;
}

.text-button {
    border: 0;
    background: transparent;
    color: #6d5dfc;
    cursor: pointer;
    font-size: 10px;
    font-weight: 700;
}

.text-button:hover {
    color: #5141df;
}

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

.activity-list {
    min-height: 220px;
}

.activity-item {
    padding: 13px 18px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 11px;
}

.activity-item:last-child {
    border-bottom: 0;
}

.activity-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
    background: #efedff;
    color: #6d5dfc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

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

.activity-content strong {
    display: block;
    overflow: hidden;
    color: #344054;
    font-size: 11px;
    font-weight: 650;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.activity-content span {
    display: block;
    margin-top: 2px;
    color: #98a2b3;
    font-size: 9px;
}

/* =========================================================
   EMPTY
   ========================================================= */

.empty-state {
    min-height: 220px;
    padding: 35px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-icon {
    width: 42px;
    height: 42px;
    margin-bottom: 11px;
    border-radius: 11px;
    background: #f1f3f7;
    color: #98a2b3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state strong {
    color: #344054;
    font-size: 12px;
}

.empty-state p {
    max-width: 330px;
    margin: 5px auto 0;
    color: #98a2b3;
    font-size: 10px;
    line-height: 1.6;
}

/* =========================================================
   QUICK ACTIONS
   ========================================================= */

.quick-actions {
    padding: 7px;
}

.quick-action {
    width: 100%;
    min-height: 68px;
    padding: 11px;
    border: 0;
    border-bottom: 1px solid #f0f2f5;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    cursor: pointer;
    transition: .2s ease;
}

.quick-action:last-child {
    border-bottom: 0;
}

.quick-action:hover {
    background: #faf9ff;
    border-radius: 9px;
}

.quick-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 9px;
    background: #efedff;
    color: #6d5dfc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.quick-action > span:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.quick-action strong {
    display: block;
    color: #344054;
    font-size: 11px;
    font-weight: 650;
}

.quick-action small {
    display: block;
    margin-top: 3px;
    color: #98a2b3;
    font-size: 9px;
}

.quick-arrow {
    color: #b4bcc9;
    font-size: 19px;
}

/* =========================================================
   MOBILE
   ========================================================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: rgba(10,15,30,.5);
    opacity: 0;
    visibility: hidden;
    transition: .2s ease;
}

.sidebar-overlay.active,
.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

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

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

@media (max-width: 850px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .22s ease;
    }

    .sidebar.open,
    .sidebar.active {
        transform: translateX(0);
    }

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

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .topbar {
        padding: 0 20px;
        gap: 15px;
    }

    .topbar-heading {
        margin-right: auto;
    }

    .page-section {
        padding: 24px 20px;
    }
}

@media (max-width: 600px) {
    .topbar {
        height: 65px;
    }

    .user-details {
        display: none;
    }

    .page-intro {
        align-items: stretch;
        flex-direction: column;
        gap: 15px;
    }

    .primary-button {
        width: 100%;
    }

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

    .page-intro h2 {
        font-size: 22px;
    }

    .page-section {
        padding: 20px 14px;
    }
}
