:root {
    --bg: #f5f7f6;
    --surface: #ffffff;
    --surface-2: #f0f3f2;
    --border: #e2e7e5;
    --text: #1c2421;
    --muted: #66736e;
    --accent: #128c4a;
    --accent-hover: #0e7440;
    --accent-soft: #e3f4ea;
    --sidebar: #0f2a1f;
    --sidebar-text: #c9d8d1;
    --sidebar-muted: #7f988c;
    --sidebar-active: #1d4535;
    --ok-bg: #dcf5e5; --ok-fg: #13663a;
    --bad-bg: #fde4e4; --bad-fg: #9f1d1d;
    --warn-bg: #fff1d6; --warn-fg: #8a5300;
    --info-bg: #e1ecfd; --info-fg: #1f4f99;
    --muted-bg: #eceff0; --muted-fg: #56615c;
    --terminal-bg: #0d1512;
    --terminal-fg: #cfe3d8;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 32, 24, .06);
    color-scheme: light;
}

/* Dark theme: follows the OS unless the toggle picked one (data-theme on <html>).
   The two blocks below must stay identical. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #0f1412;
        --surface: #161d1a;
        --surface-2: #1c2521;
        --border: #27332e;
        --text: #e3ebe7;
        --muted: #8fa099;
        --accent: #25b364;
        --accent-hover: #2fc972;
        --accent-soft: #173826;
        --sidebar: #0b100e;
        --sidebar-active: #1a2e25;
        --ok-bg: #173826; --ok-fg: #7fe0a6;
        --bad-bg: #3d1a1a; --bad-fg: #ff9d9d;
        --warn-bg: #3a2c12; --warn-fg: #f5c46b;
        --info-bg: #182a45; --info-fg: #9cc0fb;
        --muted-bg: #222b28; --muted-fg: #9aa8a2;
        --shadow: none;
    }
    :root:not([data-theme="light"]) .theme-icon-dark { display: none; }
    :root:not([data-theme="light"]) .theme-icon-light { display: contents; }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1412;
    --surface: #161d1a;
    --surface-2: #1c2521;
    --border: #27332e;
    --text: #e3ebe7;
    --muted: #8fa099;
    --accent: #25b364;
    --accent-hover: #2fc972;
    --accent-soft: #173826;
    --sidebar: #0b100e;
    --sidebar-active: #1a2e25;
    --ok-bg: #173826; --ok-fg: #7fe0a6;
    --bad-bg: #3d1a1a; --bad-fg: #ff9d9d;
    --warn-bg: #3a2c12; --warn-fg: #f5c46b;
    --info-bg: #182a45; --info-fg: #9cc0fb;
    --muted-bg: #222b28; --muted-fg: #9aa8a2;
    --shadow: none;
}
:root[data-theme="dark"] .theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: contents; }

/* Toggle shows a moon in light mode and a sun in dark mode. */
.theme-icon-light { display: none; }
.theme-icon-dark { display: contents; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-reset { white-space: nowrap; }

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* beat component display rules (flex rows, block images) */
html, body { margin: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---- Shell ---- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: 248px;
    background: var(--sidebar);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    z-index: 30;
    transition: transform .2s ease;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 16px;
    font-weight: 700; font-size: 16px; color: #fff;
}
.brand-mark {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 9px;
    background: #25d366; color: #0b2a1a;
}
.sidebar nav { flex: 1; overflow-y: auto; padding: 4px 12px; }
.nav-group {
    font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    color: var(--sidebar-muted);
    padding: 16px 10px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px; margin-bottom: 2px;
    border-radius: 8px;
    color: var(--sidebar-text); text-decoration: none;
}
.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-link.active .icon { color: #25d366; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-footer .pill { width: 100%; justify-content: center; }
.sidebar-user { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.sidebar-user form { margin: 0; }
.sidebar-user-name {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
    color: var(--sidebar-text); text-decoration: none; font-weight: 600;
}
.sidebar-user-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-name:hover { color: #fff; }
.sidebar-logout {
    display: grid; place-items: center; width: 34px; height: 34px;
    background: transparent; color: var(--sidebar-text);
    border: 1px solid rgba(255, 255, 255, .15); border-radius: 8px; cursor: pointer;
}
.sidebar-logout:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ---- Login page ---- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 10px 30px rgba(16, 32, 24, .08); padding: 28px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 22px; }
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-sub { margin: 0 0 20px; }
.auth-submit { width: 100%; padding: 11px 16px; margin-top: 4px; }

.main { flex: 1; min-width: 0; margin-left: 248px; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 28px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; flex: 1; }
.topbar .menu-btn { display: none; }
.content { padding: 24px 28px 48px; max-width: 1200px; width: 100%; }
.backdrop { display: none; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .backdrop {
        display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .4);
    }
    .main { margin-left: 0; }
    .topbar .menu-btn { display: inline-grid; }
    .topbar { padding: 12px 16px; }
    .topbar-right .pill span:last-child { display: none; }
    .topbar-reset { padding-inline: 10px; font-size: 12px; }
    .content { padding: 16px 16px 40px; }
}

@media (max-width: 560px) {
    .topbar-reset { max-width: 112px; white-space: normal; line-height: 1.15; }
}

/* ---- Status pill & badges ---- */
.pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 12px; border-radius: 999px;
    font-size: 13px; font-weight: 600; text-decoration: none;
    white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill-ok, .badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-bad, .badge-bad { background: var(--bad-bg); color: var(--bad-fg); }
.pill-warn, .badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill-info, .badge-info { background: var(--info-bg); color: var(--info-fg); }
.pill-muted, .badge-muted { background: var(--muted-bg); color: var(--muted-fg); }
.pill-warn .dot, .pill-info .dot { animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600; text-transform: capitalize;
}

/* ---- Cards & grid ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 15px; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: 2fr 1fr; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1000px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.stat-accent { border-color: var(--accent); background: var(--accent-soft); }

/* WhatsApp-style ticks: grey = delivered, blue = read */
.tick { color: var(--muted); font-weight: 700; letter-spacing: -2px; margin-right: 4px; }
.tick-read { color: #34b7f1; }

/* Segmented filter buttons */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button {
    padding: 5px 11px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
    background: var(--surface); color: var(--muted); border: 0; border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--accent); color: #fff; }
.seg .seg-link {
    padding: 6px 12px; font-size: 13px; font-weight: 600; text-decoration: none;
    background: var(--surface); color: var(--muted); border-right: 1px solid var(--border);
}
.seg .seg-link:last-child { border-right: 0; }
.seg .seg-link.active { background: var(--accent); color: #fff; }

/* Open rate: small bar + number */
.rate { display: flex; align-items: center; gap: 10px; }
.rate .progress { flex: 1; height: 8px; min-width: 70px; }

/* ---- Forms & buttons ---- */
label { display: block; font-weight: 600; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 4px; }
input[type=text], input[type=search], input[type=tel], input[type=password], textarea, select {
    width: 100%; padding: 9px 12px;
    font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
    background: var(--accent); color: #fff;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: #c62828; }
.btn-danger:hover { background: #a91f1f; }
.btn-link { background: none; color: var(--bad-fg); padding: 4px 6px; font-weight: 500; }
.btn-link:hover { background: var(--bad-bg); }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn-danger { color: var(--bad-fg); border-color: var(--bad-bg); }
.icon-btn-danger:hover { color: #fff; background: #c62828; border-color: #c62828; }
.history-actions { width: 76px; text-align: center; white-space: nowrap; }
.history-actions .icon-btn { margin-inline: auto; }
.contact-link { color: var(--text); font-weight: 650; text-decoration: none; }
.contact-link:hover { color: var(--accent); text-decoration: underline; }
.profile-head { display: flex; align-items: center; gap: 18px; }
.profile-avatar {
    display: grid; place-items: center; width: 64px; height: 64px; flex: 0 0 64px;
    border-radius: 50%; background: var(--accent-soft); color: var(--accent);
}
.profile-avatar .icon { width: 30px; height: 30px; }
.profile-title h2 { font-size: 20px; margin-bottom: 4px; }
.profile-title p { margin: 0; color: var(--muted); }
.message-cell { min-width: 280px; max-width: 620px; white-space: pre-wrap; word-break: break-word; }
form.inline { display: inline; }
.section-divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 20px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { color: var(--muted); font-size: 12.5px; }
.truncate { max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

/* ---- Alerts ---- */
.alert { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: var(--ok-bg); color: var(--ok-fg); }
.alert-error { background: var(--bad-bg); color: var(--bad-fg); }
.alert-info { background: var(--info-bg); color: var(--info-fg); }
.flash { cursor: pointer; transition: opacity .4s ease, transform .4s ease; }
.flash.hiding { opacity: 0; transform: translateY(-6px); }

/* ---- Recipients picker ---- */
.picker { border: 1px solid var(--border); border-radius: 8px; }
.picker-head {
    display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
    padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
    border-radius: 8px 8px 0 0;
}
.picker-head input[type=search] { max-width: 240px; padding: 6px 10px; }
.picker-list { max-height: 320px; overflow-y: auto; }
.check-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; margin: 0; font-weight: 400; cursor: pointer;
    border-bottom: 1px solid var(--border);
}
.check-row:last-child { border-bottom: none; }
.check-row:hover { background: var(--surface-2); }
.check-row .sub { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---- Message editor ---- */
.editor { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.editor:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.editor textarea { border: 0; border-radius: 0 0 8px 8px; }
.editor textarea:focus { outline: none; }
.toolbar {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface-2);
    border-radius: 8px 8px 0 0;
}
.toolbar button {
    display: inline-flex; align-items: center; gap: 6px;
    min-width: 32px; height: 30px; padding: 0 8px;
    font: inherit; font-size: 14px; color: var(--text);
    background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.toolbar button:hover { background: var(--surface); border-color: var(--border); }
.toolbar button code { font-size: 12px; }
.toolbar button .icon { width: 16px; height: 16px; }
.toolbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.toolbar-label { font-size: 12.5px; color: var(--muted); padding: 0 2px 0 4px; }
.toolbar .placeholder-btn { font-size: 13px; color: var(--accent); }
.toolbar .placeholder-btn .icon { width: 14px; height: 14px; }
.link-panel { padding: 12px; border-bottom: 1px solid var(--border); background: var(--accent-soft); }
.link-fields { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-bottom: 10px; }
.link-fields label { font-size: 13px; }
@media (max-width: 600px) { .link-fields { grid-template-columns: 1fr; } }

/* ---- Message templates ---- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.tpl-card {
    position: relative; display: flex; align-items: flex-start; gap: 10px;
    margin: 0; padding: 12px 34px 12px 12px; font-weight: 400; cursor: pointer;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
    transition: border-color .15s, background .15s;
}
.tpl-card:hover { border-color: var(--accent); }
.tpl-card:has(.tpl-check:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.tpl-check { margin-top: 2px; flex-shrink: 0; }
.tpl-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); flex-shrink: 0; }
.tpl-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tpl-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-snippet { color: var(--muted); font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.tpl-delete {
    position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
    display: grid; place-items: center; padding: 0;
    font-size: 17px; line-height: 1; color: var(--muted);
    background: transparent; border: 0; border-radius: 6px; cursor: pointer;
}
.tpl-delete:hover { background: var(--bad-bg); color: var(--bad-fg); }
.tpl-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.signature-field { margin: 16px 0 0; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.signature-field textarea { font-size: 13px; }
.signature-field.is-off textarea { opacity: .5; }

/* ---- Image picker ---- */
.image-drop {
    position: relative;
    border: 2px dashed var(--border); border-radius: 10px;
    transition: border-color .15s, background .15s;
}
.image-drop:hover, .image-drop.dragging { border-color: var(--accent); background: var(--accent-soft); }
.image-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.image-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px; text-align: center; color: var(--muted); }
.image-empty .icon { width: 28px; height: 28px; margin-bottom: 4px; }
.image-empty strong { color: var(--accent); }
.image-selected { display: none; align-items: center; gap: 14px; padding: 12px; }
.image-selected img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.image-selected #image-name { font-weight: 600; word-break: break-all; }
.image-drop.has-image { border-style: solid; }
.image-drop.has-image .image-empty { display: none; }
.image-drop.has-image .image-selected { display: flex; }
.image-drop.has-image input[type=file] { display: none; }

/* ---- WhatsApp-style preview ---- */
.wa-chat {
    background: #efe7de; border-radius: 10px; padding: 18px 16px;
    background-image: radial-gradient(rgba(0, 0, 0, .04) 1px, transparent 1px); background-size: 14px 14px;
}
.wa-bubble {
    position: relative; margin-left: auto; max-width: 340px; width: fit-content; min-width: 90px;
    background: #d9fdd3; color: #111b21; border-radius: 8px 0 8px 8px; padding: 6px 9px 8px;
    box-shadow: 0 1px .5px rgba(11, 20, 26, .13); font-size: 14.2px; line-height: 1.4;
}
.wa-bubble img { display: block; max-height: 280px; object-fit: cover; border-radius: 6px; margin: -2px -5px 6px; width: calc(100% + 10px); }
.wa-text { white-space: pre-wrap; word-wrap: break-word; }
.wa-text a { color: #027eb5; }
.wa-text code { font-family: Consolas, ui-monospace, monospace; font-size: 13px; }
.wa-text .wa-empty { color: #667781; font-style: italic; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .wa-chat { background-color: #0b141a; background-image: radial-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px); }
    :root:not([data-theme="light"]) .wa-bubble { background: #005c4b; color: #e9edef; }
    :root:not([data-theme="light"]) .wa-text a { color: #53bdeb; }
}
:root[data-theme="dark"] .wa-chat { background-color: #0b141a; background-image: radial-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px); }
:root[data-theme="dark"] .wa-bubble { background: #005c4b; color: #e9edef; }
:root[data-theme="dark"] .wa-text a { color: #53bdeb; }

/* ---- Progress ---- */
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .4s ease; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); flex-wrap: wrap; }

/* ---- Connection / QR ---- */
.qr-box {
    display: grid; place-items: center; text-align: center;
    min-height: 360px; padding: 20px;
}
.qr-box img {
    width: 300px; max-width: 100%; height: auto;
    background: #fff; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
}
.qr-box .big-icon { width: 56px; height: 56px; margin-bottom: 12px; color: var(--muted); }
.qr-box h3 { font-size: 17px; margin-bottom: 6px; }
.qr-box p { color: var(--muted); margin: 0 0 16px; max-width: 360px; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.spinner {
    width: 40px; height: 40px; margin-bottom: 14px;
    border: 4px solid var(--surface-2); border-top-color: var(--accent); border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Terminal ---- */
.terminal {
    background: var(--terminal-bg); color: var(--terminal-fg);
    font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: 13px; line-height: 1.55;
    height: 460px; overflow: auto; margin: 0; padding: 14px 18px;
    white-space: pre-wrap; word-break: break-word;
    border-radius: 0 0 var(--radius) var(--radius);
}
.terminal .t-err { color: #ff8a8a; }
.terminal .t-ok { color: #6ee7a0; }
.terminal .t-head { color: #f5c46b; }
.terminal-bar {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 10px 16px; background: #16211c; color: #9fb5aa; font-size: 13px;
}
.terminal-bar .dots { display: flex; gap: 6px; }
.terminal-bar .dots span { width: 11px; height: 11px; border-radius: 50%; background: #3b4a43; }
.terminal-bar label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; margin-left: auto; }
.terminal-card { overflow: hidden; }
