:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242836;
    --border: #2e3347;
    --text: #e2e4ed;
    --text-dim: #8b8fa3;
    --accent: #6c5ce7;
    --accent-hover: #7c6df7;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #2ecc71;
    --warning: #f39c12;
    --temp-color: #00cec9;
    --trash-color: #fdcb6e;
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* ── Layout ─────────────────────────────────── */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

header h1 span { color: var(--accent); }

nav { display: flex; gap: 8px; }

nav a {
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-dim);
    transition: all 0.15s;
}

nav a:hover, nav a.active {
    background: var(--surface2);
    color: var(--text);
}

nav a.nav-logout {
    color: var(--danger);
    margin-left: 8px;
}

nav a.nav-logout:hover {
    background: #e74c3c15;
    color: var(--danger);
}

main { padding: 32px 0; }

/* ── Flash messages ─────────────────────────── */

.flash {
    padding: 10px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
    border-left: 3px solid;
}

.flash.success { background: #2ecc7115; border-color: var(--success); color: var(--success); }
.flash.error   { background: #e74c3c15; border-color: var(--danger);  color: var(--danger); }

/* ── Sections ───────────────────────────────── */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 800px) {
    .grid-2 { grid-template-columns: 1fr; }
}

.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-temp  { background: #00cec920; color: var(--temp-color); }
.badge-trash { background: #fdcb6e20; color: var(--trash-color); }
.badge-count { background: var(--surface2); color: var(--text-dim); }

/* ── Quick Action (one-click) ───────────────── */

.quick-action {
    background: linear-gradient(135deg, #6c5ce720, #00cec910);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
}

.quick-action p {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

.quick-result {
    margin-top: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--temp-color);
    word-break: break-all;
    display: none;
}

/* ── Buttons ────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    color: #fff;
}

.btn-primary   { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger    { background: var(--danger); }
.btn-danger:hover  { background: var(--danger-hover); }
.btn-sm        { padding: 4px 10px; font-size: 0.8rem; }
.btn-ghost     { background: transparent; color: var(--text-dim); border: 1px solid var(--border); }
.btn-ghost:hover   { background: var(--surface2); color: var(--text); }
.btn-big       { padding: 14px 32px; font-size: 1rem; font-weight: 600; }
.btn-copy      { background: var(--surface2); color: var(--text); }
.btn-copy:hover    { background: var(--border); }

/* ── Forms ──────────────────────────────────── */

.form-row {
    display: flex;
    gap: 8px;
    align-items: end;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 140px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
}

input, select {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus {
    border-color: var(--accent);
}

input::placeholder { color: var(--text-dim); opacity: 0.5; }

/* ── Table ──────────────────────────────────── */

.alias-list { width: 100%; }

.alias-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.alias-item:last-child { border-bottom: none; }

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

.alias-address {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-all;
}

.alias-meta {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.alias-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* ── Expiry indicator ───────────────────────── */

.expiry-bar {
    width: 60px;
    height: 4px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    margin-left: 6px;
}

.expiry-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.expiry-ok   .expiry-bar-fill { background: var(--success); }
.expiry-warn .expiry-bar-fill { background: var(--warning); }
.expiry-crit .expiry-bar-fill { background: var(--danger); }

/* ── Inbox / Messages ───────────────────────── */

.msg-item {
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 4px;
}

.msg-from {
    font-weight: 600;
    font-size: 0.9rem;
}

.msg-date {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.msg-subject {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.msg-body {
    font-size: 0.85rem;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg);
    padding: 10px;
    border-radius: 4px;
}

.msg-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-dim);
}

/* ── Collectors page ────────────────────────── */

.collector-card {
    background: var(--surface2);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.collector-card h3 {
    font-size: 1rem;
    margin-bottom: 8px;
}

.collector-card .form-row { margin-bottom: 8px; }

/* ── Utilities ──────────────────────────────── */

.text-dim { color: var(--text-dim); }
.text-sm  { font-size: 0.85rem; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none; }

/* ── Copy tooltip ───────────────────────────── */

.copied-tooltip {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 1000;
}

.copied-tooltip.show { opacity: 1; }
