/* Mail Studio — refined lagoon + indigo palette */
:root {
    --mc-teal: #0d9488;
    --mc-teal-hover: #0f766e;
    --mc-teal-soft: #ccfbf1;
    --accent-indigo: #6366f1;
    --accent-indigo-soft: #e0e7ff;
    --accent-mint: #5eead4;
    --mc-yellow: #fde047;
    --bg: #f0f4fc;
    --bg-subtle: #e2ebf6;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 10px 32px rgba(15, 23, 42, 0.07);
    --shadow-soft: 0 1px 0 rgba(255, 255, 255, 0.95) inset, 0 1px 2px rgba(15, 23, 42, 0.04);
    --dash-canvas: #eef3fb;
    --dash-stat-card-shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
    --dash-stat-cta: #0d9488;
    --sidebar-w: 268px;
    --font: "Inter", "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --topbar-h: 64px;
    --rte-chrome: #f8fafc;
    --rte-chrome-border: #e2e8f0;
    --rte-icon: #475569;
}

*, *::before, *::after { box-sizing: border-box; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
html {
    -webkit-text-size-adjust: 100%;
    font-size: 13px;
}
body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

a { color: var(--mc-teal); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-size: 0.88em;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
    background: linear-gradient(180deg, var(--accent-indigo-soft), var(--mc-teal-soft));
    padding: 0.18em 0.45em;
    border-radius: 6px;
    border: 1px solid var(--border);
    color: #475569;
}

/* ----- App shell ----- */
.app-body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, #ffffff 0%, var(--surface-muted) 100%);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 200;
    transition: transform 0.25s ease;
    box-shadow: 1px 0 0 rgba(255, 255, 255, 0.85) inset;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1.25rem 1.25rem 1rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--mc-teal) 0%, #14b8a6 45%, var(--accent-indigo) 100%);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
}

.sidebar-nav {
    padding: 1rem 0.75rem;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.sidebar-nav-group {
    margin-top: 0.85rem;
}
.sidebar-nav-group:first-child {
    margin-top: 0;
}
.sidebar-nav-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0.35rem 0.85rem 0.4rem;
    margin: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    margin-bottom: 2px;
    text-decoration: none;
}
.nav-item:hover {
    background: var(--bg);
    text-decoration: none;
}
.nav-item.is-active {
    background: linear-gradient(90deg, rgba(204, 251, 241, 0.95) 0%, rgba(224, 231, 255, 0.75) 100%);
    color: var(--mc-teal-hover);
    box-shadow: 0 1px 0 rgba(13, 148, 136, 0.08) inset;
}

.nav-icon {
    width: 22px;
    height: 22px;
    opacity: 0.85;
    flex-shrink: 0;
    background: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}
.nav-icon[data-icon="home"] {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpath d='M9 22V12h6v10'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpath d='M9 22V12h6v10'/%3E%3C/svg%3E");
}
.nav-icon[data-icon="send"] {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E");
}
.nav-icon[data-icon="users"] {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}
.nav-icon[data-icon="server"] {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Crect x='2' y='2' width='20' height='8' rx='2'/%3E%3Crect x='2' y='14' width='20' height='8' rx='2'/%3E%3Cline x1='6' y1='6' x2='6.01' y2='6'/%3E%3Cline x1='6' y1='18' x2='6.01' y2='18'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Crect x='2' y='2' width='20' height='8' rx='2'/%3E%3Crect x='2' y='14' width='20' height='8' rx='2'/%3E%3Cline x1='6' y1='6' x2='6.01' y2='6'/%3E%3Cline x1='6' y1='18' x2='6.01' y2='18'/%3E%3C/svg%3E");
}
.nav-icon[data-icon="gear"] {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2m0 18v2M4.22 4.22l1.42 1.42m12.72 12.72l1.42 1.42M1 12h2m18 0h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 1v2m0 18v2M4.22 4.22l1.42 1.42m12.72 12.72l1.42 1.42M1 12h2m18 0h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42'/%3E%3C/svg%3E");
}
.nav-icon[data-icon="doc"] {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
}
.nav-icon[data-icon="whatsapp"] {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z'/%3E%3C/svg%3E");
}

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

.sidebar-user {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--mc-teal-soft);
    color: var(--mc-teal);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-name { font-weight: 600; font-size: 0.9rem; }
.sidebar-user-email { font-size: 0.8rem; color: var(--muted); word-break: break-all; }

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
    padding-bottom: 0;
    padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    background: linear-gradient(180deg, #ffffff 0%, var(--surface-muted) 100%);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.topbar-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
}

.topbar-actions {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
}

.main-content {
    padding: 1.5rem;
    padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
    padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    min-width: 0;
}

/* Mobile / tablet: menu control lives in the top bar (not a bottom FAB) */
.sidebar-toggle {
    display: none;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--mc-teal), var(--accent-indigo));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.28);
}
.sidebar-toggle::before {
    content: "";
    display: block;
    width: 20px;
    height: 20px;
    margin: 0 auto;
    background: #fff;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M3 12h18M3 6h18M3 18h18'/%3E%3C/svg%3E") center / contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M3 12h18M3 6h18M3 18h18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(36, 28, 21, 0.35);
    z-index: 150;
}

@media (max-width: 1180px) {
    .sidebar {
        width: min(300px, calc(100vw - 3rem));
        transform: translateX(-100%);
        box-shadow: none;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: 8px 0 36px rgba(36, 28, 21, 0.18);
    }
    .main-wrap {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: inline-flex;
    }
    .sidebar-backdrop.is-visible {
        display: block;
    }
}

@media (max-width: 600px) {
    .topbar {
        padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
        padding-bottom: 0.75rem;
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        flex-wrap: wrap;
        height: auto;
        min-height: var(--topbar-h);
        align-items: center;
        row-gap: 0.5rem;
    }
    .topbar-title {
        font-size: 1.15rem;
        flex: 1 1 calc(100% - 3.5rem);
        min-width: 0;
    }
    .topbar-actions {
        flex: 1 1 100%;
        margin-left: 0;
        justify-content: flex-start;
    }
    .main-content {
        padding: 1rem;
        padding-left: max(1rem, env(safe-area-inset-left, 0px));
        padding-right: max(1rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    }
}

/* ----- Cards & grid ----- */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem 1.35rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card h3 {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card .stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.panel {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.panel-header {
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.panel-header h2 {
    margin: 0;
    font-size: 1.08rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.panel-body { padding: 1.35rem; }

/* ----- Tables ----- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface-muted);
}
.data-table tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-draft { background: #eee; color: #444; }
.badge-scheduled { background: #e3f2fd; color: #1565c0; }
.badge-sent { background: var(--mc-teal-soft); color: var(--mc-teal-hover); }
.badge-sending { background: #fff8e1; color: #856404; }
.badge-partial { background: #fff3e0; color: #e65100; }
.badge-failed { background: #ffebee; color: #c62828; }
.badge-default { background: var(--accent-indigo-soft); color: #4338ca; }

.schedule-fieldset {
    border: 1px solid var(--border, #e0e0e0);
    border-radius: 8px;
    padding: 1rem 1rem 0.75rem;
    margin: 1rem 0 0;
}
.schedule-fieldset legend {
    padding: 0 0.35rem;
    font-weight: 600;
    font-size: 0.95rem;
}
.schedule-enable-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
}
.schedule-enable-label input {
    margin-top: 0.2rem;
}
.schedule-grid {
    margin-top: 0.25rem;
}
.schedule-hint {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

/* ----- Forms ----- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem 1.25rem;
}

.form-stack label {
    display: block;
    margin-bottom: 1rem;
}

label span.label-text {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 0.62rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { min-height: 120px; resize: vertical; }
textarea.code-area { min-height: 200px; font-family: ui-monospace, monospace; font-size: 0.88rem; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(13, 148, 136, 0.45);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.import-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
}

.import-file-form .import-file-label input[type="file"] {
    padding: 0.45rem 0;
    font-size: 0.92rem;
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    touch-action: manipulation;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: linear-gradient(135deg, #0f766e 0%, var(--mc-teal) 45%, #14b8a6 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(13, 148, 136, 0.28);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #115e59 0%, var(--mc-teal-hover) 50%, #0f766e 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
}
.btn-secondary {
    background: #fff;
    color: var(--text);
    border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger {
    background: #fff;
    color: #c0392b;
    border-color: #f5c6cb;
}
.btn-danger:hover { background: #fdeaea; }
.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-small { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ----- Auth pages ----- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(13, 148, 136, 0.14), transparent),
        radial-gradient(900px 500px at 100% 15%, rgba(99, 102, 241, 0.12), transparent),
        radial-gradient(700px 420px at 50% 100%, rgba(45, 212, 191, 0.1), transparent),
        var(--bg);
}

.auth-shell { width: 100%; max-width: 440px; }
.auth-card--wide { max-width: 520px; margin: 0 auto; }

.auth-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.auth-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--mc-teal) 0%, #14b8a6 50%, var(--accent-indigo) 100%);
    box-shadow: 0 4px 18px rgba(13, 148, 136, 0.32);
    flex-shrink: 0;
}

.auth-card h1 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

.text-muted { color: var(--muted); margin: 0; }
.text-small { font-size: 0.85rem; }

.split-auth {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}
.split-auth-visual {
    background: linear-gradient(155deg, #0f766e 0%, #0d9488 32%, #0e7490 58%, #4f46e5 100%);
    color: #fff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.split-auth-visual::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(224, 231, 255, 0.35) 0%, transparent 65%);
    top: -100px;
    right: -120px;
}
.split-auth-visual h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    margin: 0 0 1rem;
    position: relative;
    z-index: 1;
    letter-spacing: -0.03em;
}
.split-auth-visual p {
    opacity: 0.92;
    max-width: 360px;
    position: relative;
    z-index: 1;
}
.split-auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg);
}
.split-auth-form .auth-shell { max-width: 400px; }

@media (max-width: 900px) {
    .split-auth {
        grid-template-columns: 1fr;
    }
    .split-auth-visual {
        min-height: 220px;
        padding: 2rem;
    }
}

/* ----- Misc ----- */
.flash {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.92rem;
    border: 1px solid transparent;
}
.flash-success {
    background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
    color: #14532d;
    border-color: #bbf7d0;
}
.flash-error {
    background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
    color: #9f1239;
    border-color: #fecdd3;
}
.error-msg { color: #b71c1c; font-weight: 500; margin: 0 0 1rem; }
.success-msg { color: #1b5e20; font-weight: 500; margin: 0 0 1rem; }

.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
}
.empty-state strong { color: var(--text); display: block; margin-bottom: 0.5rem; }

.link-inline { font-weight: 600; }

.hint { font-size: 0.84rem; color: var(--muted); margin-top: 0.35rem; line-height: 1.5; }

/* SMTP test column */
.smtp-test-cell {
    min-width: 200px;
    vertical-align: top;
}
.smtp-test-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    margin: 0;
}
.smtp-test-inline input[type="email"] {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 220px;
    padding: 0.45rem 0.55rem;
    font-size: 0.88rem;
}
@media (max-width: 900px) {
    .smtp-test-inline {
        flex-direction: column;
        align-items: stretch;
    }
    .smtp-test-inline input[type="email"] {
        max-width: none;
    }
}

/* ----- Email templates ----- */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.template-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.template-card-preview {
    background: #e8e8e6;
    border-bottom: 1px solid var(--border);
    aspect-ratio: 16 / 11;
    min-height: 200px;
    position: relative;
}

.template-preview-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    transform: scale(0.5);
    transform-origin: top left;
    width: 200%;
    height: 200%;
}

.template-card-body {
    padding: 1.1rem 1.25rem 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-card-title {
    margin: 0 0 0.35rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.template-card-desc {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
    flex: 1;
}

.template-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: auto;
}

.template-editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

@media (max-width: 1180px) {
    .template-editor-layout {
        grid-template-columns: 1fr;
    }
}

.template-html-area {
    min-height: 420px;
    font-size: 0.82rem;
    line-height: 1.45;
}

.template-live-preview {
    width: 100%;
    min-height: 420px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.template-editor-preview-wrap .label-text {
    margin-top: 0;
}

.template-picker-bar {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    background: linear-gradient(135deg, rgba(204, 251, 241, 0.85) 0%, rgba(224, 231, 255, 0.75) 50%, rgba(255, 255, 255, 0.95) 100%);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(99, 102, 241, 0.18);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.06);
}

.template-picker-label {
    flex: 1;
    min-width: 220px;
    margin: 0;
}

.template-picker-label .label-text {
    margin-bottom: 0.35rem;
}

.template-picker-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.template-picker-select {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

/* Plain text → HTML toolbar (campaign & template editors) */
.html-body-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}
.html-body-toolbar .label-text {
    margin: 0;
    padding-top: 0.15rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text);
}
.html-body-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

/* Campaign edit — premium body + preview */
.premium-editor-section {
    margin-top: 0.35rem;
    padding: 1.2rem 1.3rem 1.35rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.premium-editor-shell,
.premium-preview-shell {
    min-width: 0;
}

.premium-preview-shell .campaign-preview-envelope {
    background: var(--surface);
    border: 1px solid var(--rte-chrome-border);
    border-radius: var(--radius-sm);
    padding: 0.95rem 1.05rem;
    margin-bottom: 0.6rem;
    box-shadow: 0 1px 2px rgba(22, 21, 19, 0.035);
}

.premium-preview-shell .template-live-preview {
    border-color: var(--rte-chrome-border);
    box-shadow: 0 1px 2px rgba(22, 21, 19, 0.04);
}

/* Campaign edit — message preview */
.campaign-preview-envelope {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 2px rgba(36, 28, 21, 0.04);
}
.campaign-preview-line {
    margin: 0 0 0.35rem;
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--text);
}
.campaign-preview-line:last-child {
    margin-bottom: 0;
}
.campaign-preview-value {
    color: var(--muted);
    font-weight: 500;
}
.campaign-message-preview-frame {
    min-height: 440px;
}
.campaign-editor-split .template-html-area {
    min-height: 400px;
}

/* TinyMCE — premium chrome (campaign HTML body) */
.premium-editor-shell .tox.tox-tinymce {
    border-radius: var(--radius-sm);
    border: 1px solid var(--rte-chrome-border);
    box-shadow: 0 1px 2px rgba(22, 21, 19, 0.04);
    overflow: hidden;
    background: var(--surface);
}

.premium-editor-shell .tox .tox-editor-header {
    padding: 0;
    box-shadow: none;
}

.premium-editor-shell .tox .tox-toolbar-overlord {
    background: var(--rte-chrome);
    border-bottom: 1px solid var(--rte-chrome-border);
}

.premium-editor-shell .tox .tox-toolbar,
.premium-editor-shell .tox .tox-toolbar__overflow,
.premium-editor-shell .tox .tox-toolbar__primary {
    background: var(--rte-chrome) !important;
}

.premium-editor-shell .tox .tox-toolbar-overlord .tox-toolbar + .tox-toolbar {
    border-top: 1px solid var(--rte-chrome-border);
}

.premium-editor-shell .tox .tox-toolbar__group {
    padding: 3px 0;
}

.premium-editor-shell .tox .tox-tbtn,
.premium-editor-shell .tox .tox-split-button__chevron {
    color: var(--rte-icon);
}

.premium-editor-shell .tox .tox-tbtn:hover,
.premium-editor-shell .tox .tox-split-button:hover .tox-tbtn {
    background: rgba(17, 24, 39, 0.06) !important;
    color: var(--text);
}

.premium-editor-shell .tox .tox-tbtn--enabled,
.premium-editor-shell .tox .tox-tbtn--enabled:hover {
    background: rgba(13, 148, 136, 0.1) !important;
    color: var(--mc-teal);
}

.premium-editor-shell .tox .tox-menu-button__select-label {
    font-weight: 500;
    font-size: 12px;
}

.premium-editor-shell .tox .tox-edit-area::before {
    border-color: var(--rte-chrome-border);
}

.premium-editor-shell .tox .tox-statusbar {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    background: var(--rte-chrome);
    border-top: 1px solid var(--rte-chrome-border);
    padding: 5px 10px;
    letter-spacing: 0.01em;
}

.premium-editor-shell .tox .tox-statusbar__wordcount {
    color: #6b7280;
}

.premium-editor-shell .tox .tox-statusbar__path-item {
    color: #374151;
}

.premium-editor-shell .tox .tox-edit-area__iframe {
    background-color: #fff;
}

.premium-editor-shell .tox:not(.tox-tinymce-inline) .tox-editor-header {
    border-bottom: none;
}

/* ----- Dashboard (premium) ----- */
.main-content:has(.dashboard-page) {
    max-width: 1240px;
    background-color: var(--dash-canvas);
    border-radius: 0;
}

.dashboard-page {
    position: relative;
    isolation: isolate;
    padding-bottom: 2rem;
}

.dash-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem 1.5rem;
    margin-bottom: 1.75rem;
    padding: 1.55rem 1.75rem 1.65rem;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff 0%, var(--surface-muted) 100%);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: dash-fade-up 0.55s ease both;
}

.dash-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--mc-teal);
    opacity: 0.9;
}

.dash-headline {
    margin: 0 0 0.5rem;
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.2;
    color: var(--text);
}

.dash-lede {
    margin: 0;
    max-width: 36rem;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--muted);
}

.dash-date {
    margin: 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(36, 28, 21, 0.06);
    border-radius: 999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding: 0.25rem 0 0.5rem;
    animation: dash-fade-up 0.55s ease 0.08s both;
}

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

@media (max-width: 480px) {
    .dash-stats {
        grid-template-columns: 1fr;
    }
}

.dash-stat {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.2rem 1.15rem 1.15rem;
    border-radius: 15px;
    text-decoration: none;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--dash-stat-card-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.dash-stat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
    opacity: 0.95;
}

.dash-stat--campaigns::before { background: linear-gradient(180deg, #0d9488, #2dd4bf); }
.dash-stat--lists::before { background: linear-gradient(180deg, #5c4dbe, #7c6ae0); }
.dash-stat--contacts::before { background: linear-gradient(180deg, #c45c26, #e0783a); }
.dash-stat--smtp::before { background: linear-gradient(180deg, #3d5a80, #5a7aad); }

.dash-stat:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    text-decoration: none;
}

.dash-stat:focus-visible {
    outline: 2px solid var(--mc-teal);
    outline-offset: 3px;
}

.dash-stat-icon {
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--mc-teal-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
    position: relative;
}

.dash-stat-icon::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 22px;
    height: 22px;
    background: var(--mc-teal);
    opacity: 0.88;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

.dash-stat--campaigns .dash-stat-icon::after {
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M22 2L11 13'/%3E%3Cpath d='M22 2l-7 20-4-9-9-4 20-7z'/%3E%3C/svg%3E");
}

.dash-stat--lists .dash-stat-icon::after {
    background: #5c4dbe;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E");
}

.dash-stat--contacts .dash-stat-icon::after {
    background: #c45c26;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}

.dash-stat--smtp .dash-stat-icon::after {
    background: #3d5a80;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Crect x='2' y='2' width='20' height='8' rx='2'/%3E%3Crect x='2' y='14' width='20' height='8' rx='2'/%3E%3Cline x1='6' y1='6' x2='6.01' y2='6'/%3E%3Cline x1='6' y1='18' x2='6.01' y2='18'/%3E%3C/svg%3E");
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='black' stroke-width='2'%3E%3Crect x='2' y='2' width='20' height='8' rx='2'/%3E%3Crect x='2' y='14' width='20' height='8' rx='2'/%3E%3Cline x1='6' y1='6' x2='6.01' y2='6'/%3E%3Cline x1='6' y1='18' x2='6.01' y2='18'/%3E%3C/svg%3E");
}

.dash-stat--campaigns .dash-stat-icon {
    background: linear-gradient(145deg, rgba(13, 148, 136, 0.14), rgba(45, 212, 191, 0.08));
}
.dash-stat--lists .dash-stat-icon {
    background: linear-gradient(145deg, rgba(92, 77, 190, 0.14), rgba(124, 106, 224, 0.08));
}
.dash-stat--contacts .dash-stat-icon {
    background: linear-gradient(145deg, rgba(196, 92, 38, 0.14), rgba(224, 120, 58, 0.08));
}
.dash-stat--smtp .dash-stat-icon {
    background: linear-gradient(145deg, rgba(61, 90, 128, 0.14), rgba(90, 122, 173, 0.08));
}

.dash-stat-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dash-stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.dash-stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.dash-stat-cta {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--dash-stat-cta);
    opacity: 0.9;
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.dash-stat:hover .dash-stat-cta {
    opacity: 1;
    color: var(--mc-teal);
    transform: translateX(2px);
}

.dash-panel {
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.dash-panel-header {
    align-items: flex-start;
    padding: 1.15rem 1.35rem;
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-muted) 100%);
}

.dash-panel-header h2 {
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.dash-panel-sub {
    margin: 0.35rem 0 0;
    font-size: 0.86rem;
    color: var(--muted);
    font-weight: 500;
    line-height: 1.4;
}

.dash-table-wrap {
    padding: 0;
}

.dash-table th {
    background: var(--surface-muted);
    font-weight: 600;
    border-bottom-color: var(--border);
}

.dash-table td {
    border-bottom-color: var(--border);
    vertical-align: middle;
}

.dash-table tbody tr {
    transition: background 0.15s ease;
}

.dash-table tbody tr:hover {
    background: rgba(13, 148, 136, 0.03);
}

.dash-cell-strong {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.dash-cell-muted {
    color: var(--muted);
    font-size: 0.9rem;
    max-width: 280px;
}

.dash-empty {
    padding: 2.75rem 1.5rem 3rem;
}

.dash-empty-visual {
    width: 88px;
    height: 88px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: conic-gradient(from 210deg, rgba(13, 148, 136, 0.2), rgba(92, 77, 190, 0.15), rgba(13, 148, 136, 0.2));
    box-shadow: 0 12px 32px -12px rgba(13, 148, 136, 0.35);
}

.dash-empty-actions {
    margin: 1.25rem 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}

.dash-panel--steps .panel-body {
    padding: 1.35rem 1.35rem 1.5rem;
}

.dash-steps-body {
    background: linear-gradient(180deg, #fafbfc 0%, #fff 40%);
}

.dash-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

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

.dash-step {
    display: flex;
    gap: 1rem;
    padding: 1.15rem 1.2rem;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid rgba(36, 28, 21, 0.06);
    box-shadow: 0 1px 3px rgba(36, 28, 21, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dash-step:hover {
    border-color: rgba(13, 148, 136, 0.12);
    box-shadow: 0 8px 24px -12px rgba(13, 148, 136, 0.12);
}

.dash-step-badge {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(145deg, var(--mc-teal), #14b8a6);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.32);
}

.dash-step:nth-child(2) .dash-step-badge {
    background: linear-gradient(145deg, #5c4dbe, #7b6ae8);
    box-shadow: 0 4px 12px rgba(92, 77, 190, 0.3);
}

.dash-step:nth-child(3) .dash-step-badge {
    background: linear-gradient(145deg, #c45c26, #e07a45);
    box-shadow: 0 4px 12px rgba(196, 92, 38, 0.28);
}

.dash-step-body {
    min-width: 0;
}

.dash-step-title {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.dash-step-desc {
    margin: 0 0 0.65rem;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--muted);
}

.dash-step-link {
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
}

.dash-step-link:hover {
    text-decoration: underline;
}

.dash-step-amp {
    margin: 0 0.25rem;
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 500;
}

.dashboard-page section.dash-panel {
    animation: dash-fade-up 0.55s ease both;
}

.dashboard-page section.dash-panel:not(.dash-panel--steps) {
    animation-delay: 0.14s;
}

.dashboard-page section.dash-panel--steps {
    animation-delay: 0.22s;
}

@keyframes dash-fade-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dashboard-page > .dash-hero,
    .dashboard-page > .dash-stats,
    .dashboard-page section.dash-panel {
        animation: none;
    }
    .dash-stat:hover {
        transform: none;
    }
}

/* Stat cards: two columns on mid-width phones / small tablets */
@media (max-width: 900px) and (min-width: 521px) {
    .grid-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ----- Phones & small tablets (global) ----- */
@media (max-width: 768px) {
    .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .panel-header .btn {
        align-self: flex-start;
    }
    .dash-panel-header .btn {
        align-self: flex-start;
    }
    .panel-body {
        padding: 1rem;
    }
    .data-table th,
    .data-table td {
        padding: 0.55rem 0.65rem;
        font-size: 0.86rem;
    }
    .table-wrap .data-table {
        min-width: 520px;
    }
    .row-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
    }
    .row-actions .btn {
        width: 100%;
        justify-content: center;
    }
    .grid-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .template-grid {
        grid-template-columns: 1fr;
    }
    .template-html-area,
    .template-live-preview {
        min-height: 260px !important;
    }
    .campaign-message-preview-frame {
        min-height: 220px !important;
    }
    .campaign-editor-split .template-html-area {
        min-height: 260px !important;
    }
    .campaign-body-preview-section .template-editor-layout {
        gap: 0.85rem;
    }
    .dash-hero {
        padding: 1.1rem 1rem;
    }
    .dash-date {
        white-space: normal;
        align-self: stretch;
        text-align: center;
    }
    .dash-cell-muted {
        max-width: none;
    }
    .auth-card {
        padding: 1.35rem 1.1rem;
    }
    .template-picker-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .template-picker-select {
        max-width: none;
    }
    .html-body-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .html-body-toolbar-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    .btn {
        padding: 0.5rem 0.95rem;
    }
}
