*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface2: #273549;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --ok: #22c55e;
    --error: #ef4444;
    --warn: #f59e0b;
    --info: #38bdf8;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 760px;
}

/* ── Nav ── */
.nav-menu { display: flex; flex-direction: column; height: 100%; padding: 1.5rem 1rem; }

.nav-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 1.5rem; }
.brand-name { font-size: 1.1rem; font-weight: 700; color: var(--accent); }

.nav-links { list-style: none; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.nav-links a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem .75rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .9rem;
    transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--surface2); color: var(--text); }
.nav-links a.active { background: var(--accent); color: #fff; }

.nav-footer { font-size: .75rem; color: var(--text-muted); padding-top: 1rem; border-top: 1px solid var(--border); }

/* ── Page header ── */
.page-header { margin-bottom: 2rem; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; }
.page-header p { color: var(--text-muted); margin-top: .25rem; }

/* ── Stats bar ── */
.stats-bar { display: flex; gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}
.stat-number { display: block; font-size: 2.5rem; font-weight: 800; color: var(--accent); }
.stat-label { font-size: .8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Cards ── */
.send-card, .history-card, .status-card, .action-card, .info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.send-card h2, .history-card h2, .status-card h2, .info-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* ── Form ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: .4rem; }
.input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .65rem .9rem;
    color: var(--text);
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--accent); }
.textarea { resize: vertical; min-height: 80px; }

/* ── Buttons ── */
.btn-send, .btn-subscribe {
    width: 100%;
    padding: .8rem;
    border: none;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-send:hover, .btn-subscribe:hover { background: var(--accent-hover); }
.btn-send:disabled, .btn-subscribe:disabled { opacity: .5; cursor: not-allowed; }

.btn-unsubscribe {
    width: 100%;
    padding: .8rem;
    border: 1px solid var(--error);
    border-radius: 8px;
    background: transparent;
    color: var(--error);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-unsubscribe:hover { background: rgba(239,68,68,.1); }
.btn-unsubscribe:disabled { opacity: .5; cursor: not-allowed; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: .25rem .65rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
}
.badge-ok    { background: rgba(34,197,94,.15);  color: var(--ok); }
.badge-error { background: rgba(239,68,68,.15);  color: var(--error); }
.badge-off   { background: rgba(148,163,184,.15); color: var(--text-muted); }
.badge-info  { background: rgba(56,189,248,.15);  color: var(--info); }

/* ── Status rows ── */
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}
.status-row:last-child { border-bottom: none; }
.status-label { font-size: .9rem; }

/* ── Feedback ── */
.feedback { margin-top: .75rem; font-size: .9rem; padding: .6rem .9rem; border-radius: 8px; }
.feedback-ok    { background: rgba(34,197,94,.1);  color: var(--ok); }
.feedback-error { background: rgba(239,68,68,.1);  color: var(--error); }

.hint { font-size: .85rem; color: var(--text-muted); margin-top: .75rem; }
.hint a { color: var(--accent); }
.hint-success { font-size: .9rem; color: var(--ok); margin-top: 1rem; line-height: 1.6; }
.hint-success a { color: var(--accent); }

.error-msg { color: var(--error); font-size: .9rem; margin-top: .75rem; }

/* ── History ── */
.history-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.history-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .9rem 1rem;
}
.history-meta { display: flex; justify-content: space-between; margin-bottom: .3rem; }
.history-time { font-size: .8rem; color: var(--text-muted); }
.history-sent { font-size: .8rem; color: var(--ok); }
.history-title { font-weight: 600; font-size: .95rem; }
.history-body { font-size: .85rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Info steps ── */
.steps { padding-left: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.steps li { font-size: .9rem; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 640px) {
    .sidebar { display: none; }
    .main-content { padding: 1rem; }
    .stats-bar { flex-direction: column; }
}
