@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;700&family=Orbitron:wght@400;500;700;900&display=swap');

:root {
    --bg: #f8fafc;
    --bg-warm: #eef2ff;
    --card: #ffffff;
    --navy: #0f172a;
    --navy-soft: #1e1b4b;
    --coral: #2563eb;
    --coral-dark: #1d4ed8;
    --coral-soft: rgba(37, 99, 235, .09);
    --blue: #8b5cf6;
    --blue-soft: rgba(139, 92, 246, .09);
    --text: #475569;
    --muted: #64748b;
    --line: rgba(15, 23, 42, .08);
    --line-strong: rgba(15, 23, 42, .15);
    --green: #059669;
    --shadow: 0 20px 45px rgba(15, 23, 42, .06), 0 3px 10px rgba(15, 23, 42, .03);
    --radius: 24px;
    --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --heading: 'Space Grotesk', sans-serif;
    --logo: 'Orbitron', sans-serif;
    --mono: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; font-size: 16px; -webkit-font-smoothing: antialiased; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.app-container { width: min(1440px, calc(100% - 48px)); margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--navy); text-decoration: none; white-space: nowrap; }
.brand small { margin-left: 4px; color: var(--muted); font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.brand-wordmark { font-family: var(--logo); font-size: 17px; font-weight: 500; letter-spacing: -.055em; text-transform: uppercase; }
.brand-wordmark b { font-weight: 700; }
.brand-wordmark em { background: linear-gradient(135deg,#2563eb,#8b5cf6); -webkit-background-clip:text; background-clip:text; color:transparent; font-style: normal; font-weight: 700; }
.brand-on-dark { color: var(--navy); }

.eyebrow { margin-bottom: 14px; color: var(--coral); font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow::before { content: ''; display: inline-block; width: 22px; height: 2px; margin-right: 9px; vertical-align: 3px; border-radius: 9px; background: currentColor; }
.eyebrow-light { color: #4f46e5; }
.muted { color: var(--muted); }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 46px; padding: 0 20px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; text-decoration: none; font-weight: 700; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .58; cursor: wait; transform: none; }
.button-primary { color: #fff; background: linear-gradient(135deg, #2563eb, #8b5cf6); box-shadow: 0 10px 24px rgba(37, 99, 235, .22); border-radius: 999px; }
.button-primary:hover { background: linear-gradient(135deg, #1d4ed8, #7c3aed); box-shadow: 0 14px 30px rgba(37,99,235,.28); }
.button-secondary { color: var(--navy); background: #fff; border-color: var(--line-strong); box-shadow: 0 2px 8px rgba(26, 26, 46, .03); }
.button-secondary:hover { border-color: var(--navy); }
.button-link { color: var(--muted); background: transparent; }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > span:first-child, .field-label-row > span { color: var(--navy); font-size: 13px; font-weight: 700; }
.field-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.field-label-row small { color: var(--muted); }
.field input, .field select, .login-form input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 11px; outline: none; color: var(--navy); background: #fff; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .login-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.field input::placeholder, .login-form input::placeholder { color: #aaaab5; }
.select-wrap { position: relative; display: block; }
.select-wrap::after { content: '⌄'; position: absolute; right: 14px; top: 50%; color: var(--navy); pointer-events: none; transform: translateY(-58%); font-size: 18px; }
.field .select-wrap select { appearance: none; padding-right: 38px; cursor: pointer; }
.field-grid { display: grid; gap: 16px; }
.field-grid-3 { grid-template-columns: minmax(0, 1fr) 120px 120px; }
.field-wide { min-width: 0; }

/* Login */
.login-page { min-height: 100vh; background: var(--bg) url('hero_bg_wide.webp') center right / cover no-repeat fixed; }
.login-page::before, .login-page::after { content: ''; position: fixed; pointer-events: none; border-radius: 50%; filter: blur(2px); }
.login-page::before { inset: 0; width: auto; height: auto; border-radius: 0; background: linear-gradient(90deg, rgba(255,255,255,.98) 0%, rgba(255,255,255,.92) 47%, rgba(255,255,255,.45) 100%); }
.login-page::after { width: 520px; height: 520px; right: -110px; bottom: -210px; background: radial-gradient(circle, rgba(139,92,246,.16), transparent 68%); }
.login-shell { min-height: 100vh; width: min(1120px, calc(100% - 40px)); margin: auto; display: grid; grid-template-columns: 1.1fr .78fr; align-items: center; gap: 90px; position: relative; z-index: 1; }
.login-copy .brand { margin-bottom: 90px; }
.login-copy h1 { max-width: 650px; margin: 0; color: var(--navy); font-family: var(--heading); font-size: clamp(46px, 6vw, 76px); line-height: .98; letter-spacing: -.055em; }
.login-copy h1 span { background: linear-gradient(135deg,#2563eb,#8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-copy > p { max-width: 560px; margin: 28px 0 0; color: var(--text); font-size: 18px; line-height: 1.7; }
.login-card { padding: 42px; border: 1px solid rgba(15,23,42,.1); border-radius: 24px; background: rgba(255,255,255,.9); backdrop-filter: blur(20px); box-shadow: 0 25px 70px rgba(15,23,42,.12); }
.login-card h2 { margin: 0 0 6px; color: var(--navy); font-size: 32px; letter-spacing: -.03em; }
.login-card > p { margin: 0 0 28px; }
.login-form { display: grid; gap: 12px; }
.login-form label { color: var(--navy); font-size: 13px; font-weight: 700; }
.login-form input { height: 52px; margin-bottom: 8px; }
.login-form input[autofocus] { margin-bottom: 4px; }
.alert { margin: 0 0 22px; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.alert-error { color: #9b2f1b; background: #fff0ec; border: 1px solid #f5c4b7; }

/* App shell */
.topbar { position: sticky; top: 0; z-index: 50; height: 76px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.9); backdrop-filter: blur(20px); }
.topbar-inner { height: 100%; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.tabs { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.72); }
.tab { min-height: 37px; padding: 0 17px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; font-weight: 700; }
.tab:hover { color: var(--navy); }
.tab.is-active { color: #fff; background: var(--navy); box-shadow: 0 4px 12px rgba(26,26,46,.16); }
.tab-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 7px; padding: 0 6px; border-radius: 999px; color: var(--navy); background: #d9ff57; font-size: 10px; font-weight: 800; }
.logout-form { justify-self: end; }
.logout-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600; }
.logout-button:hover { color: var(--coral); }
.app-main { padding-top: 52px; padding-bottom: 72px; }
.page-heading { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .7fr); align-items: end; gap: 48px; margin-bottom: 34px; }
.page-heading h1 { margin: 0; color: var(--navy); font-family: var(--heading); font-size: clamp(42px, 5.1vw, 72px); line-height: .98; letter-spacing: -.055em; }
.page-heading h1 span { background: linear-gradient(135deg,#2563eb,#8b5cf6); -webkit-background-clip:text; background-clip:text; color:transparent; }
.page-heading > p { margin: 0 0 4px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: rgba(255,255,255,.55); }
.metric { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 20px 24px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric > span { color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.metric strong { grid-row: span 2; color: var(--navy); font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.metric small { color: var(--muted); font-size: 12px; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: panel-in .2s ease both; }
@keyframes panel-in { from { opacity: 0; transform: translateY(5px); } }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(430px, .98fr); gap: 22px; align-items: stretch; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.compose-panel, .preview-panel, .data-panel { padding: 26px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 24px; }
.panel-heading > div { display: flex; align-items: center; gap: 11px; }
.panel-heading h2 { margin: 0; color: var(--navy); font-family: var(--heading); font-size: 21px; letter-spacing: -.02em; }
.step { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--navy); font-family: var(--mono); font-size: 9px; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.status-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }
.status-live::before { background: #25a478; box-shadow: 0 0 0 4px rgba(37,164,120,.12); }
#mailer-form { display: grid; gap: 18px; }
.edit-notice { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: -4px 0 2px; padding: 15px 17px; border: 1px solid rgba(37,99,235,.2); border-radius: 13px; background: linear-gradient(135deg,rgba(37,99,235,.08),rgba(139,92,246,.08)); }
.edit-notice > div { display: grid; gap: 3px; min-width: 0; }
.edit-notice strong { color: var(--navy); font-size: 13px; }
.edit-notice span { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.inline-button { padding: 5px 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; white-space: nowrap; }
.delivery-strip { display: flex; flex-wrap: wrap; gap: 7px; margin: -8px 0 20px; }
.delivery-strip span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; color: var(--green); background: rgba(22,122,89,.08); font-size: 10px; font-weight: 700; }
.delivery-strip span::before { content: '✓'; font-size: 10px; }
.editor-shell { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 11px; background: #fff; }
.editor-toolbar { display: flex; align-items: center; gap: 3px; min-height: 42px; padding: 5px 9px; border-bottom: 1px solid var(--line-strong); background: #fbfaf8; }
.editor-toolbar button { display: grid; place-items: center; width: 32px; height: 30px; border: 0; border-radius: 7px; color: #555568; background: transparent; cursor: pointer; font-family: var(--font); font-size: 14px; }
.editor-toolbar button:hover, .editor-toolbar button:focus-visible { color: var(--blue); background: var(--blue-soft); outline: none; }
.editor-toolbar button:disabled { opacity: .55; cursor: wait; }
.editor-toolbar-separator { width: 1px; height: 20px; margin: 0 4px; background: var(--line-strong); }
.editor-toolbar .image-tool { width: auto; padding: 0 9px; font-size: 12px; font-weight: 700; }
#editor { min-height: 255px; padding: 18px; color: var(--navy); background: #fff; font-size: 16px; line-height: 1.65; outline: none; }
#editor:empty::before { content: attr(data-placeholder); color: #9ca3af; pointer-events: none; }
#editor p { margin: 0 0 12px; }
#editor img { display: block; width: 100%; max-width: 554px; height: auto; margin: 18px 0; border: 1px solid var(--line); border-radius: 10px; }
.upload { position: relative; min-height: 98px; display: grid; place-items: center; padding: 16px; border: 1px dashed var(--line-strong); border-radius: 13px; background: #fbfaf8; text-align: center; transition: border-color .15s, background .15s; }
.upload.is-dragging { border-color: var(--coral); background: var(--coral-soft); }
.upload input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload div { display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.upload strong { color: var(--navy); }
.upload span { color: var(--muted); font-size: 13px; }
.upload small { color: #aaaab5; font-size: 11px; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { display: inline-flex; gap: 8px; align-items: center; max-width: 100%; padding: 7px 10px; border-radius: 8px; color: var(--blue); background: var(--blue-soft); font-size: 12px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.existing-file-list { display: grid; gap: 8px; }
.existing-file-list::before { content: 'Varem lisatud manused'; color: var(--muted); font-size: 11px; font-weight: 700; }
.existing-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; transition: opacity .15s, background .15s; }
.existing-file > div { display: grid; flex: 1; gap: 1px; min-width: 0; }
.existing-file strong { overflow: hidden; color: var(--navy); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.existing-file small { color: var(--muted); font-size: 10px; }
.existing-file button { padding: 5px 0; border: 0; color: #9b2f1b; background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }
.existing-file.is-removed { opacity: .55; background: #f8fafc; }
.existing-file.is-removed strong { text-decoration: line-through; }
.existing-file.is-removed button { color: var(--blue); }
.send-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding-top: 4px; }
.send-actions { display: flex; align-items: center; gap: 10px; }
.schedule-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .55fr); align-items: end; gap: 24px; padding: 17px 18px; border: 1px solid #cbd5e1; border-radius: 14px; background: linear-gradient(135deg,#f8fafc,#f5f3ff); }
.schedule-card > div { display: grid; gap: 5px; }
.schedule-card strong { color: var(--navy); font-size: 14px; }
.schedule-card small { max-width: 500px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.schedule-card .field { margin: 0; }
.sender-note { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sender-avatar { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 11px; color: #fff; background: var(--navy); font-size: 11px; font-weight: 800; }
.sender-note > span:last-child { display: flex; min-width: 0; flex-direction: column; }
.sender-note strong { color: var(--navy); font-size: 13px; }
.sender-note small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; }
.form-note, .privacy-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.quality-card { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fbfaf8; }
.quality-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 11px; }
.quality-heading strong { color: var(--navy); font-size: 13px; }
.quality-heading span { color: var(--coral); font-size: 11px; font-weight: 700; }
.quality-heading span.is-ready { color: var(--green); }
.quality-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.quality-grid span { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; }
.quality-grid span::before { content: '!'; display: grid; place-items: center; flex: 0 0 17px; width: 17px; height: 17px; border-radius: 50%; color: #9b6a23; background: #fff0cf; font-size: 9px; font-weight: 800; }
.quality-grid span.is-good { color: var(--green); }
.quality-grid span.is-good::before { content: '✓'; color: var(--green); background: rgba(22,122,89,.1); }
.quality-card > small { display: block; color: #9999a5; font-size: 10px; line-height: 1.45; }
.preview-panel { display: flex; flex-direction: column; background: linear-gradient(145deg,#0f172a 0%,#1e1b4b 100%); border-color: rgba(139,92,246,.28); }
.preview-panel .panel-heading h2 { color: #fff; }
.preview-panel .step { color: #fff; border-color: rgba(255,255,255,.28); }
.preview-panel .status-dot { color: #bfbfd0; }
.preview-browser { min-height: 680px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 15px; background: #fff; box-shadow: 0 18px 45px rgba(0,0,0,.28); }
.browser-bar { flex: 0 0 40px; display: flex; align-items: center; gap: 6px; padding: 0 14px; color: #9797a6; background: #f1eee9; font-size: 11px; }
.browser-bar i { width: 8px; height: 8px; border-radius: 50%; background: #d6d0c8; }
.browser-bar i:first-child { background: #e85d35; }
.browser-bar span { margin-left: 8px; }
.preview-browser iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* Data views */
.data-panel { min-height: 420px; }
.schedule-workspace { padding: 30px; }
.schedule-heading { align-items: flex-start; }
.schedule-heading h2 { margin-bottom: 3px; }
.schedule-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.panel-actions { display: flex; align-items: center; gap: 9px; }
.panel-actions .button { min-height: 42px; }
.queue-summary { display: grid; grid-template-columns: repeat(4,1fr); margin-bottom: 18px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: #fbfaf8; }
.queue-summary > div { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 17px 19px; border-right: 1px solid var(--line); }
.queue-summary > div:last-child { border-right: 0; }
.queue-summary span { color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.queue-summary strong { grid-row: span 2; color: var(--navy); font-size: 26px; line-height: 1; }
.queue-summary small { color: var(--muted); font-size: 10px; }
.schedule-toolbar { display: grid; grid-template-columns: minmax(260px,1fr) 210px; gap: 13px; margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf8; }
.scheduled-list { display: grid; gap: 10px; }
.scheduled-item { display: grid; grid-template-columns: 76px minmax(0,1fr) auto; align-items: center; gap: 20px; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; transition: border-color .15s, box-shadow .15s, transform .15s; }
.scheduled-item:hover { border-color: rgba(37,99,235,.22); box-shadow: 0 12px 30px rgba(15,23,42,.055); transform: translateY(-1px); }
.scheduled-date { display: grid; place-items: center; align-content: center; min-height: 72px; padding: 8px; border-radius: 13px; color: #fff; background: linear-gradient(145deg,#0f172a,#1e1b4b); text-align: center; }
.scheduled-date strong { font-size: 18px; line-height: 1; }
.scheduled-date span { margin-top: 5px; color: #d9ff57; font-size: 13px; font-weight: 700; }
.scheduled-date small { margin-top: 2px; color: #94a3b8; font-size: 9px; }
.scheduled-main { display: grid; gap: 9px; min-width: 0; }
.scheduled-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.scheduled-title-row > div { display: grid; gap: 3px; min-width: 0; }
.scheduled-title-row strong { overflow: hidden; color: var(--navy); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.scheduled-title-row a { overflow: hidden; color: var(--blue); font-size: 12px; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.scheduled-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.scheduled-meta span { padding: 4px 7px; border-radius: 7px; color: var(--muted); background: #f1f5f9; font-size: 9px; font-weight: 650; }
.scheduled-error { display: grid; gap: 2px; max-width: 680px; padding: 9px 11px; border-radius: 9px; color: #9b2f1b; background: #fff0ec; }
.scheduled-error strong { font-size: 11px; }
.scheduled-error span { font-size: 10px; line-height: 1.45; }
.scheduled-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; max-width: 270px; }
.action-button { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--muted); background: #fff; cursor: pointer; font-size: 11px; font-weight: 700; text-decoration: none; }
.action-button:hover { color: var(--navy); border-color: var(--navy); }
.action-button:disabled { opacity: .5; cursor: wait; }
.action-primary { color: #fff; border-color: var(--navy); background: var(--navy); }
.action-primary:hover { color: #fff; background: #25253d; }
.action-danger { color: #9b2f1b; border-color: transparent; background: transparent; }
.action-danger:hover { color: #7f1d1d; border-color: #fecaca; background: #fff7f7; }
.schedule-empty { display: grid; justify-items: center; padding: 58px 20px; border: 1px dashed var(--line-strong); border-radius: 16px; text-align: center; }
.schedule-empty > span { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 14px; border-radius: 15px; color: #fff; background: linear-gradient(135deg,#2563eb,#8b5cf6); font-size: 22px; }
.schedule-empty strong { color: var(--navy); font-size: 18px; }
.schedule-empty p { margin: 5px 0 18px; color: var(--muted); font-size: 13px; }
.schedule-no-results { padding: 38px 16px; color: var(--muted); text-align: center; }
.filter-row { display: grid; grid-template-columns: minmax(240px, 1fr) 220px auto; align-items: end; gap: 14px; margin-bottom: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfaf8; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 13px 16px; color: var(--muted); background: #fbfaf8; font-family: var(--mono); font-size: 9px; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
td { padding: 15px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
td strong { color: var(--navy); font-weight: 650; }
tbody tr:hover { background: rgba(248,245,240,.55); }
.table-link, .url-cell a { color: var(--blue); font-weight: 600; text-decoration: none; }
.url-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 60px 20px; color: var(--muted); text-align: center; }
.event-badge { display: inline-flex; padding: 5px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.event-open { color: var(--green); background: rgba(22,122,89,.1); }
.event-click { color: var(--blue); background: var(--blue-soft); }
.event-unsubscribe { color: #a03f28; background: var(--coral-soft); }
.event-waiting { color: var(--muted); background: rgba(26,26,46,.06); }
.queue-pending { color: #805b12; background: #fff4d6; }
.queue-sending { color: var(--blue); background: var(--blue-soft); }
.queue-sent { color: var(--green); background: rgba(22,122,89,.1); }
.queue-failed { color: #9b2f1b; background: #fff0ec; }
.queue-cancelled { color: var(--muted); background: rgba(26,26,46,.06); }
.queue-note { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 18px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 13px; background: #f8fafc; }
.queue-note strong { color: var(--navy); font-size: 13px; }
.queue-note span { max-width: 680px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.queue-error { display: block; max-width: 320px; margin-top: 6px; color: #9b2f1b; line-height: 1.4; }
.table-button { padding: 0; border: 0; color: #9b2f1b; background: transparent; cursor: pointer; font: inherit; font-weight: 650; }
.engagement-cell { white-space: nowrap; }
.event-time { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.tracking-explanation { margin: -8px 0 16px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.privacy-note { margin-top: 15px; }
.settings-panel { padding: 32px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(340px, 1fr); gap: 70px; align-items: start; max-width: 980px; }
.settings-grid h3 { margin: 0 0 12px; color: var(--navy); font-family: var(--heading); font-size: 30px; letter-spacing: -.03em; }
.settings-grid p { margin: 0; color: var(--muted); line-height: 1.7; }
#password-form { display: grid; gap: 16px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: #f8fafc; }
#password-form small { color: var(--muted); line-height: 1.5; }

/* Feedback */
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); padding: 14px 18px; border-radius: 12px; color: #fff; background: var(--navy); box-shadow: 0 14px 40px rgba(26,26,46,.22); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #9b2f1b; }
.send-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(26,26,46,.72); backdrop-filter: blur(8px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.send-overlay.is-visible { opacity: 1; pointer-events: auto; }
.send-result { width: min(440px, 100%); padding: 44px; border-radius: 24px; background: #fff; box-shadow: 0 30px 100px rgba(0,0,0,.25); text-align: center; }
.result-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 20px; border-radius: 18px; color: #fff; background: var(--green); font-size: 28px; font-weight: 700; }
.send-result h2 { margin: 0 0 8px; color: var(--navy); font-size: 28px; }
.send-result p { margin: 0 0 24px; color: var(--muted); }

/* Unsubscribe */
.unsubscribe-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: var(--bg-warm); }
.unsubscribe-card { width: min(570px, 100%); padding: 44px; border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.unsubscribe-card .brand { margin-bottom: 56px; }
.unsubscribe-card h1 { margin: 0 0 16px; color: var(--navy); font-size: 38px; line-height: 1.08; letter-spacing: -.04em; }
.unsubscribe-card p { margin: 0 auto 28px; max-width: 460px; line-height: 1.7; }
.unsubscribe-card form { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }

@media (max-width: 1120px) {
    .workspace-grid { grid-template-columns: 1fr; }
    .preview-browser { min-height: 720px; }
    .topbar-inner { grid-template-columns: auto 1fr auto; }
    .tabs { justify-self: center; }
    .brand small { display: none; }
}

@media (max-width: 820px) {
    .app-container { width: min(100% - 28px, 720px); }
    .topbar { height: auto; }
    .topbar-inner { grid-template-columns: 1fr auto; padding: 12px 0; }
    .topbar .brand { font-size: 0; }
    .topbar .brand-mark { width: 36px; height: 36px; font-size: 18px; }
    .tabs { grid-row: 2; grid-column: 1 / -1; width: 100%; }
    .tab { flex: 1; padding: 0 9px; font-size: 13px; }
    .logout-form { grid-column: 2; grid-row: 1; }
    .app-main { padding-top: 34px; }
    .page-heading { grid-template-columns: 1fr; gap: 20px; }
    .page-heading h1 { font-size: clamp(40px, 11vw, 58px); }
    .page-heading > p { max-width: 560px; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .metric:nth-child(2) { border-right: 0; }
    .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .field-grid-3 { grid-template-columns: 1fr 1fr; }
    .field-wide { grid-column: 1 / -1; }
    .filter-row { grid-template-columns: 1fr 1fr; }
    .filter-row .button { grid-column: 1 / -1; }
    .login-shell { grid-template-columns: 1fr; gap: 40px; padding: 50px 0; }
    .login-copy .brand { margin-bottom: 55px; }
    .login-copy h1 { font-size: clamp(44px, 11vw, 68px); }
    .settings-grid { grid-template-columns: 1fr; gap: 28px; }
    .schedule-card { grid-template-columns: 1fr; gap: 14px; }
    .queue-summary { grid-template-columns: repeat(2,1fr); }
    .queue-summary > div:nth-child(2) { border-right: 0; }
    .queue-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
    .scheduled-item { grid-template-columns: 68px minmax(0,1fr); }
    .scheduled-actions { grid-column: 2; justify-content: flex-start; max-width: none; }
}

@media (max-width: 600px) {
    .app-container { width: calc(100% - 20px); }
    .tabs { gap: 1px; }
    .tab { min-width: 0; padding: 0 5px; font-size: 11.5px; }
    .tab-count { min-width: 17px; height: 17px; margin-left: 3px; padding: 0 4px; font-size: 9px; }
    .app-main { padding-bottom: 40px; }
    .page-heading { margin-bottom: 26px; }
    .page-heading h1 { font-size: 43px; }
    .metric { padding: 16px; }
    .metric strong { font-size: 26px; }
    .compose-panel, .preview-panel, .data-panel { padding: 17px; border-radius: 16px; }
    .panel-heading { margin-bottom: 20px; }
    .panel-heading .status-dot { display: none; }
    .field-grid-3 { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .send-row { align-items: stretch; flex-direction: column; }
    .send-row .button { width: 100%; }
    .send-actions { width: 100%; flex-direction: column-reverse; }
    .queue-note { align-items: flex-start; flex-direction: column; gap: 5px; }
    .preview-browser { min-height: 640px; }
    .quality-grid { grid-template-columns: 1fr; }
    .filter-row { grid-template-columns: 1fr; padding: 14px; }
    .filter-row .button { grid-column: auto; }
    .table-wrap { border: 0; overflow: visible; }
    table, thead, tbody, tr, th, td { display: block; }
    thead { display: none; }
    tbody { display: grid; gap: 10px; }
    tbody tr { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
    tbody tr.empty-row { padding: 0; }
    td { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 7px 0; border: 0; overflow-wrap: anywhere; }
    td::before { content: attr(data-label); color: var(--muted); font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
    td.empty-state { display: block; padding: 38px 12px; }
    td.empty-state::before { display: none; }
    .url-cell { max-width: none; white-space: normal; }
    .login-shell { width: calc(100% - 24px); padding: 26px 0; }
    .login-copy .brand { margin-bottom: 46px; }
    .login-copy h1 { font-size: 43px; }
    .login-copy > p { font-size: 16px; }
    .login-card { padding: 26px 22px; border-radius: 21px; }
    .unsubscribe-card { padding: 30px 20px; }
    .unsubscribe-card .brand { margin-bottom: 40px; }
    .unsubscribe-card h1 { font-size: 32px; }
    .send-result { padding: 34px 22px; }
    .settings-panel { padding: 20px; }
    .settings-grid h3 { font-size: 26px; }
    #password-form { padding: 18px; }
    .edit-notice { align-items: flex-start; flex-direction: column; gap: 9px; }
    .edit-notice span { white-space: normal; }
    .schedule-workspace { padding: 17px; }
    .schedule-heading { align-items: stretch; flex-direction: column; }
    .schedule-heading > div { align-items: flex-start; }
    .panel-actions { width: 100%; }
    .panel-actions .button { flex: 1; padding: 0 12px; }
    .queue-summary > div { padding: 14px; }
    .queue-summary strong { font-size: 23px; }
    .queue-summary small { display: none; }
    .schedule-toolbar { grid-template-columns: 1fr; padding: 12px; }
    .scheduled-item { grid-template-columns: 58px minmax(0,1fr); align-items: start; gap: 13px; padding: 14px; }
    .scheduled-date { min-height: 64px; }
    .scheduled-title-row { align-items: flex-start; flex-direction: column-reverse; gap: 7px; }
    .scheduled-title-row strong { white-space: normal; }
    .scheduled-actions { grid-column: 1 / -1; width: 100%; }
    .action-button { flex: 1; min-width: 76px; }
}
