@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #ffffff;
    --surface: #f6f8fa;
    --surface-2: #eef1f4;
    --border: #d0d7de;
    --gold: #C9A227;
    --gold-soft: #9a7c1c;
    --accent: #0969da;
    --accent-soft: #218bff;
    --text: #1f2328;
    --text-muted: #656d76;
    --success: #1a7f37;
    --success-bg: #dafbe1;
    --danger: #cf222e;
    --danger-bg: #ffebe9;
    --radius: 6px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

h1, h2, h3 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    margin: 0 0 8px;
    letter-spacing: -0.01em;
    color: var(--text);
}

h1 { font-size: 24px; }
h2 { font-size: 18px; }

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

.mono { font-family: 'JetBrains Mono', monospace; }

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

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar .brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.sidebar a {
    color: var(--text-muted);
    padding: 7px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
}

.sidebar a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.sidebar a.active { background: #ddf4ff; color: var(--accent); }

.sidebar .user-row {
    margin-top: auto;
    padding: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.content-col { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

.topbar {
    height: 56px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-search input {
    width: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 6px 14px;
    color: var(--text);
    font-size: 13px;
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    margin: 0;
    cursor: pointer;
    display: flex;
    border-radius: var(--radius);
}

.icon-btn:hover { color: var(--text); background: var(--surface-2); }

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold);
    color: #14120F;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 12px;
}

.sidebar-section {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 14px 10px 4px;
}

.ad-slot {
    margin: 20px 0;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    text-align: center;
    min-height: 90px;
    overflow: hidden;
}

/* ===== Mobile hamburger menu ===== */
.menu-trigger { display: none; }

.sidebar-close { display: none; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 18, 22, 0.45);
    z-index: 19;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-overlay.open { display: block; opacity: 1; }

body.no-scroll { overflow: hidden; }

.main { flex: 1; padding: 28px 40px 48px; max-width: 1100px; }

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--surface);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 8px 24px rgba(140, 149, 159, 0.15);
}

.auth-card .brand { font-family: 'Fraunces', serif; font-size: 20px; color: var(--text); margin-bottom: 4px; }
.auth-card p.sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }

label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin: 16px 0 6px; }
label:first-of-type { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=file], textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 12px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.15);
}

textarea { resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: 13px; }

button, .btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 8px 18px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    margin-top: 20px;
}

button:hover, .btn:hover { background: var(--accent-soft); text-decoration: none; }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); }

.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 20px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); border-color: #aceebb; color: #1a7f37; }
.alert-error { background: var(--danger-bg); border-color: #ffc1bc; color: #cf222e; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 20px 0 28px; }

.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 18px; }
.stat-card .value { font-family: 'JetBrains Mono', monospace; font-size: 26px; color: var(--text); font-weight: 500; }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 100px; font-size: 12px; font-weight: 500; }
.badge-draft { background: var(--surface-2); color: var(--text-muted); }
.badge-queued { background: #fff8c5; color: #9a6700; }
.badge-completed { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

.badge-sending { background: #fff8c5; color: #9a6700; }
.badge-sending .dot { width: 6px; height: 6px; border-radius: 50%; background: #9a6700; animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }

.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); background: var(--surface); border: 1px dashed var(--border); border-radius: 8px; }
.empty-state h3 { color: var(--text); margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) { .badge-sending .dot { animation: none; } }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 20px; }

.tool-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 18px; display: block; color: var(--text); }
.tool-card:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(140,149,159,0.15); text-decoration: none; }

.tool-card .icon {
    width: 32px; height: 32px; border-radius: 6px;
    background: var(--surface); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); margin-bottom: 12px;
}

.tool-card h3 { font-size: 14px; margin-bottom: 4px; }
.tool-card p { font-size: 12px; color: var(--text-muted); margin: 0; }
.tool-card.disabled { opacity: 0.55; cursor: default; }
.tool-card.disabled:hover { border-color: var(--border); box-shadow: none; }

.soon-tag {
    display: inline-block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
    background: var(--surface-2); color: var(--text-muted); padding: 2px 8px; border-radius: 100px; margin-top: 8px;
}

@media (max-width: 720px) {
    .app-shell { flex-direction: column; }

    .menu-trigger { display: flex; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 260px;
        max-width: 82vw;
        flex-direction: column;
        overflow-y: auto;
        border-right: 1px solid var(--border);
        border-bottom: none;
        box-shadow: 0 0 0 rgba(0,0,0,0);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 20;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 24px rgba(0,0,0,0.18); }

    .sidebar .brand-mark { display: flex; }
    .sidebar .user-row, .sidebar-section { display: block; }

    .sidebar-close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 30px;
        height: 30px;
        background: none;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        border-radius: var(--radius);
    }
    .sidebar-close:hover { background: var(--surface-2); color: var(--text); }

    .topbar { padding: 0 16px; gap: 8px; justify-content: flex-start; }
    .topbar-search { flex: 1; min-width: 0; }
    .topbar-search input { width: 100%; }
    .topbar-actions { margin-left: auto; }
    .main { padding: 20px; }
}

/* ===== Landing page ===== */
body.landing { overflow-x: hidden; background: var(--bg); }

.landing-nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 48px; max-width: 1200px; margin: 0 auto; border-bottom: 1px solid var(--border);
}

.landing-logo { display: flex; }
.landing-nav-links { display: flex; gap: 28px; }
.landing-nav-links a { color: var(--text-muted); font-size: 14px; }
.landing-nav-links a:hover { color: var(--text); text-decoration: none; }
.landing-nav-actions { display: flex; gap: 10px; align-items: center; }
.landing-nav-actions .btn { margin-top: 0; }

.landing-hero { position: relative; text-align: center; padding: 64px 24px 40px; max-width: 860px; margin: 0 auto; }

.hero-grid-bg {
    position: absolute; inset: -40px 50% auto 50%; width: 1400px; height: 460px; transform: translateX(-50%);
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse 60% 100% at 50% 0%, #000 30%, transparent 70%);
    mask-image: radial-gradient(ellipse 60% 100% at 50% 0%, #000 30%, transparent 70%);
    opacity: 0.5; z-index: 0;
}

.landing-hero h1 { position: relative; font-size: 48px; line-height: 1.1; letter-spacing: -0.02em; z-index: 1; color: var(--text); }
.gold-text { color: var(--accent); }
.hero-sub { position: relative; color: var(--text-muted); font-size: 16px; max-width: 520px; margin: 20px auto 0; z-index: 1; }
.hero-actions { position: relative; display: flex; gap: 12px; justify-content: center; margin-top: 28px; z-index: 1; }
.hero-actions .btn { margin-top: 0; }

.hero-mock {
    position: relative; text-align: left; max-width: 560px; margin: 20px auto 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 18px 22px; font-size: 13px;
    z-index: 1; box-shadow: 0 12px 32px rgba(140,149,159,0.2);
}

.hero-mock-row { padding: 4px 0; color: var(--text); }
.hero-mock-dim { color: var(--text-muted); margin-right: 8px; }
.dot-inline { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--success); margin-left: 6px; }

.landing-section { max-width: 1080px; margin: 0 auto; padding: 32px 24px; }
.section-heading { font-size: 24px; text-align: center; max-width: 560px; margin: 0 auto 28px; color: var(--text); }
.landing-section + .landing-section { border-top: 1px solid var(--border); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.feature-card { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 20px; }
.feature-card h3 { font-size: 14px; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.6; }

.landing-footer {
    display: flex; justify-content: space-between; max-width: 1200px; margin: 0 auto;
    padding: 24px 48px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted);
}

@media (max-width: 720px) {
    .landing-nav { padding: 16px 20px; }
    .landing-nav-links { display: none; }
    .landing-hero { padding: 60px 20px 36px; }
    .landing-hero h1 { font-size: 32px; }
    .landing-footer { flex-direction: column; gap: 8px; padding: 20px; }
}

/* ===== Tools dropdown (landing nav) ===== */
.nav-dropdown { position: relative; }

.nav-dropdown-trigger {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.nav-dropdown-trigger:hover { color: var(--text); }
.nav-dropdown-trigger svg { transition: transform 0.15s ease; }
.nav-dropdown.open .nav-dropdown-trigger svg { transform: rotate(180deg); }

.nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: 300px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(140,149,159,0.25);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 30;
}

.nav-dropdown.open .nav-dropdown-panel,
.nav-dropdown:hover .nav-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 6px;
    color: var(--text);
}

.nav-dropdown-item:hover { background: var(--surface); text-decoration: none; }
.nav-dropdown-item.disabled { opacity: 0.5; cursor: default; }
.nav-dropdown-item.disabled:hover { background: none; }

.nav-dropdown-item .ddi-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 6px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.nav-dropdown-item strong { display: block; font-size: 13px; font-weight: 600; }
.nav-dropdown-item small { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ===== 3D animated hero scene ===== */
.hero-scene {
    position: relative;
    height: 380px;
    margin-top: 28px;
    perspective: 1100px;
    z-index: 1;
}

.scene-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 380px;
    height: 380px;
    margin: -190px 0 0 -190px;
    border: 1px dashed var(--border);
    border-radius: 50%;
    animation: scene-rotate-ring 14s linear infinite;
}

.scene-ring-2 {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    margin: -150px 0 0 -150px;
    border: 1px dashed var(--border);
    border-radius: 50%;
    opacity: 0.6;
    animation: scene-rotate-ring 10s linear infinite reverse;
}

.scene-envelope {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140px;
    height: 102px;
    margin: -51px 0 0 -70px;
    transform-style: preserve-3d;
    animation: scene-envelope-in 1.3s cubic-bezier(0.34, 1.56, 0.64, 1) both,
               scene-envelope-idle 3.2s ease-in-out 1.3s infinite;
    filter: drop-shadow(0 16px 28px rgba(9,105,218,0.22));
}

.scene-envelope svg { width: 100%; height: 100%; }

.scene-particle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 48px;
    height: 48px;
    margin: -24px 0 0 -24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    box-shadow: 0 6px 16px rgba(140,149,159,0.25);
}

.scene-particle.p1 { animation: scene-fly-1 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.5s both, scene-bob 2.6s ease-in-out 1.6s infinite; }
.scene-particle.p2 { animation: scene-fly-2 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.65s both, scene-bob 2.9s ease-in-out 1.75s infinite; }
.scene-particle.p3 { animation: scene-fly-3 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.8s both, scene-bob 2.4s ease-in-out 1.9s infinite; }
.scene-particle.p4 { animation: scene-fly-4 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.95s both, scene-bob 2.8s ease-in-out 2.05s infinite; }
.scene-particle.p5 { animation: scene-fly-5 1.1s cubic-bezier(0.22, 1, 0.36, 1) 1.1s both, scene-bob 3.1s ease-in-out 2.2s infinite; }
.scene-particle.p6 { animation: scene-fly-6 1.1s cubic-bezier(0.22, 1, 0.36, 1) 1.25s both, scene-bob 2.7s ease-in-out 2.35s infinite; }

@keyframes scene-envelope-in {
    0% { transform: translateZ(-220px) rotateY(-60deg) rotateX(18deg) scale(0.5); opacity: 0; }
    55% { opacity: 1; }
    100% { transform: translateZ(0) rotateY(0deg) rotateX(0deg) scale(1); opacity: 1; }
}

@keyframes scene-envelope-idle {
    0%, 100% { transform: translateZ(0) rotateY(-10deg) translateY(0); }
    50% { transform: translateZ(34px) rotateY(10deg) translateY(-10px); }
}

@keyframes scene-rotate-ring {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes scene-bob {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-12px) scale(1.06); }
}

@keyframes scene-fly-1 { 0% { transform: translate(0,0) scale(0.3); opacity: 0; } 100% { transform: translate(-190px,-110px) scale(1); opacity: 1; } }
@keyframes scene-fly-2 { 0% { transform: translate(0,0) scale(0.3); opacity: 0; } 100% { transform: translate(190px,-118px) scale(1); opacity: 1; } }
@keyframes scene-fly-3 { 0% { transform: translate(0,0) scale(0.3); opacity: 0; } 100% { transform: translate(-235px,32px) scale(1); opacity: 1; } }
@keyframes scene-fly-4 { 0% { transform: translate(0,0) scale(0.3); opacity: 0; } 100% { transform: translate(235px,38px) scale(1); opacity: 1; } }
@keyframes scene-fly-5 { 0% { transform: translate(0,0) scale(0.3); opacity: 0; } 100% { transform: translate(-125px,128px) scale(1); opacity: 1; } }
@keyframes scene-fly-6 { 0% { transform: translate(0,0) scale(0.3); opacity: 0; } 100% { transform: translate(125px,128px) scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .scene-envelope, .scene-particle, .scene-ring, .scene-ring-2 { animation: none !important; opacity: 1 !important; }
    .scene-particle.p1 { transform: translate(-190px,-110px); }
    .scene-particle.p2 { transform: translate(190px,-118px); }
    .scene-particle.p3 { transform: translate(-235px,32px); }
    .scene-particle.p4 { transform: translate(235px,38px); }
    .scene-particle.p5 { transform: translate(-125px,128px); }
    .scene-particle.p6 { transform: translate(125px,128px); }
}

/* ===== Split-screen auth pages ===== */
.auth-split {
    min-height: 100vh;
    display: flex;
}

.auth-visual {
    flex: 1.1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b3a73 0%, #0969da 55%, #2f9e6f 100%);
    color: #fff;
    padding: 40px;
}

.auth-visual-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    opacity: 0.5;
}

.blob-1 { width: 320px; height: 320px; background: #ffd166; top: -60px; left: -60px; animation: blob-float-1 12s ease-in-out infinite; }
.blob-2 { width: 260px; height: 260px; background: #1a7f37; bottom: -60px; right: -40px; animation: blob-float-2 14s ease-in-out infinite; }

@keyframes blob-float-1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(30px,20px) scale(1.1); } }
@keyframes blob-float-2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-25px,-15px) scale(1.08); } }

.auth-visual-content {
    position: relative;
    z-index: 1;
    max-width: 380px;
    text-align: center;
}

.auth-visual-content .brand-mark-lg {
    display: inline-flex;
    margin-bottom: 24px;
}

.auth-visual-content h2 {
    font-size: 26px;
    color: #fff;
    line-height: 1.25;
}

.auth-visual-content p {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    margin-top: 10px;
}

.floaty-icons {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 32px;
}

.floaty-icons span {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: floaty-bob 3s ease-in-out infinite;
}

.floaty-icons span:nth-child(2) { animation-delay: 0.4s; }
.floaty-icons span:nth-child(3) { animation-delay: 0.8s; }

@keyframes floaty-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.auth-form-col {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--surface);
}

@media (max-width: 860px) {
    .auth-split { flex-direction: column; }
    .auth-visual { flex: none; padding: 32px 20px; min-height: 200px; }
    .auth-visual-content h2 { font-size: 20px; }
    .auth-visual-content p { display: none; }
    .floaty-icons { margin-top: 20px; }
    .auth-form-col { flex: none; padding: 24px 16px 48px; }
}

/* ===== Global responsive touch-ups ===== */
@media (max-width: 900px) {
    .hero-scene { height: 300px; transform: scale(0.78); margin-top: 12px; }
}

@media (max-width: 480px) {
    h1 { font-size: 22px; }
    .main { padding: 16px; }
    .stat-grid, .tool-grid, .feature-grid { grid-template-columns: 1fr; }
    .topbar-search { display: none; }
    table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ===== Account dropdown (app topbar avatar) ===== */
.account-dropdown { position: relative; }

.account-dropdown .topbar-avatar { cursor: pointer; border: none; }

.account-dropdown-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(140,149,159,0.28);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 40;
}

.account-dropdown.open .account-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.account-dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 12px;
}

.account-dropdown-header strong { font-size: 13px; color: var(--text); }

.account-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

.account-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
}

.account-dropdown-item:hover { background: var(--surface); text-decoration: none; }
.account-dropdown-item svg { flex-shrink: 0; color: var(--text-muted); }

.account-dropdown-danger { color: var(--danger); }
.account-dropdown-danger svg { color: var(--danger); }
.account-dropdown-danger:hover { background: var(--danger-bg); }

/* ===== Mega dropdown (nested category -> flyout) ===== */
.mega-dropdown { position: relative; }

.mega-dropdown-panel {
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    width: 640px;
    max-width: 90vw;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 16px 40px rgba(140,149,159,0.28);
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    z-index: 30;
}

.mega-dropdown.open .mega-dropdown-panel {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.mega-category { position: relative; border-radius: 8px; }

.mega-category-label {
    display: block;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-radius: 6px;
    cursor: default;
}

.mega-category:hover .mega-category-label,
.mega-category:hover .mega-flyout { background: var(--surface); }
.mega-category:hover .mega-flyout { display: flex; }

.mega-flyout {
    display: none;
    flex-direction: column;
    padding: 2px 6px 8px;
    border-radius: 0 0 8px 8px;
}

.mega-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 8px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
}

.mega-item:hover { background: var(--surface-2); text-decoration: none; }
.mega-item.disabled { color: var(--text-muted); cursor: default; }
.mega-item.disabled:hover { background: none; }
.mega-item em { font-style: normal; font-size: 10px; text-transform: uppercase; color: var(--text-muted); background: var(--surface-2); padding: 1px 6px; border-radius: 100px; }

@media (max-width: 720px) {
    .mega-dropdown-panel { grid-template-columns: 1fr; width: 280px; }
    .mega-flyout { display: flex; }
}

/* ===== Signup paywall modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(31,35,40,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
    z-index: 200;
    padding: 20px;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-box {
    background: var(--bg);
    border-radius: 12px;
    padding: 28px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}

.modal-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ddf4ff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.modal-box h3 { font-size: 17px; }
.modal-box p { color: var(--text-muted); font-size: 13px; margin-top: 6px; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }

/* ===== Public (anonymous) tool page layout ===== */
.public-tool-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 48px 24px 80px;
    min-height: calc(100vh - 200px);
}

/* ===== Attractive file upload dropzone (replaces plain <input type=file>) ===== */
.dropzone {
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 28px 24px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    margin-bottom: 16px;
}

.dropzone:hover { border-color: var(--accent); background: #f1f8ff; }
.dropzone.dropzone-active { border-color: var(--accent); background: #eaf4ff; }

.dropzone-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #0969da, #2f9e6f);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dropzone-text { display: flex; flex-direction: column; gap: 3px; }
.dropzone-text strong { font-size: 15px; color: var(--text); }
.dropzone-text span { font-size: 12px; color: var(--text-muted); }

/* Result panel shown after a tool successfully produces something */
.result-panel {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--success-bg);
    border: 1px solid #aceebb;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 20px;
}

.result-panel-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-panel-info { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: 2px; }
.result-panel-info strong { font-size: 14px; color: var(--text); }
.result-panel-info span { font-size: 12px; color: var(--text-muted); }

/* Generic card wrapper for simpler (non-file) tool forms */
.tool-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(140,149,159,0.12);
}

@media (max-width: 480px) {
    .dropzone { flex-direction: column; text-align: center; padding: 24px 16px; }
}

/* ===== Trust strip (fills the gap between hero and features) ===== */
.trust-strip {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px 32px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 28px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 32px;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.trust-item svg { color: var(--success); flex-shrink: 0; }

@media (max-width: 620px) {
    .trust-strip { gap: 14px 20px; }
}

/* ===== Tool page tab bar with share icons (ezyzip-style pattern, light theme) ===== */
.tool-tab-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    padding: 10px 16px;
    margin-bottom: -1px;
}

.tool-tab-active {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 6px 14px;
    border-radius: 8px 8px 0 0;
    position: relative;
    top: 1px;
}

.tool-share-icons { display: flex; gap: 6px; }

.share-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.share-icon:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.tool-tab-bar + h1 {
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 16px 16px 4px;
    margin-bottom: 0;
}

.tool-desc {
    background: var(--bg);
    border: 1px solid var(--border);
    border-top: none;
    padding: 0 16px 16px;
    margin-bottom: 20px;
}

/* ===== Campaign builder (professional multi-section layout) ===== */
.builder-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 20px;
    align-items: start;
}

.builder-main { display: flex; flex-direction: column; gap: 20px; }

.builder-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.builder-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.builder-card-header h2 { font-size: 15px; margin: 0; }
.builder-card-header p { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

.builder-step {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.builder-card-body { padding: 20px; }

/* Contact picker */
.contact-picker {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.contact-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.contact-picker-list { max-height: 240px; overflow-y: auto; }

.contact-picker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    margin: 0;
    font-weight: 400;
    cursor: pointer;
}

.contact-picker-row:last-child { border-bottom: none; }
.contact-picker-row:hover { background: var(--surface); }

.contact-picker-avatar {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Live preview */
.preview-frame {
    width: 100%;
    height: 320px;
    border: none;
    background: #fff;
}

/* Sticky sidebar summary */
.builder-sidebar { position: sticky; top: 76px; }

.builder-summary {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.builder-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}

.builder-summary-row:last-of-type { border-bottom: none; margin-bottom: 8px; }
.builder-summary-row strong { color: var(--text); font-weight: 600; }

@media (max-width: 860px) {
    .builder-grid { grid-template-columns: 1fr; }
    .builder-sidebar { position: static; }
}

/* ===== Sequence step cards ===== */
.sequence-step {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 14px;
    background: var(--surface);
}

.sequence-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sequence-step-header strong { font-size: 13px; color: var(--text); }

/* ===== Campaign detail: collapsible resend panel ===== */
.resend-panel { display: none; }
.resend-panel.open { display: block; }
