/* =========================================================================
   HeroSMS — Dovetail design system
   Refined technical dashboard. Dark-first, calm, usability-focused.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+JP:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Surface */
    --bg-0: #0a0d14;
    --bg-1: #0f131c;
    --bg-2: #141926;
    --bg-3: #1a2030;
    --bg-4: #232a3d;

    /* Lines */
    --line: rgba(255, 255, 255, 0.06);
    --line-strong: rgba(255, 255, 255, 0.12);

    /* Text */
    --text: #e6e8ed;
    --text-muted: #8e94a3;
    --text-faint: #5c6371;

    /* Signature */
    --accent: #5eead4;
    --accent-soft: rgba(94, 234, 212, 0.12);
    --accent-ring: rgba(94, 234, 212, 0.28);
    --accent-dim: #2dd4bf;

    /* Status */
    --success: #86efac;
    --success-soft: rgba(134, 239, 172, 0.12);
    --warning: #fcd34d;
    --warning-soft: rgba(252, 211, 77, 0.12);
    --danger:  #fb7185;
    --danger-soft: rgba(251, 113, 133, 0.12);
    --info:    #93c5fd;
    --info-soft: rgba(147, 197, 253, 0.12);

    /* Radii */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-pill: 999px;

    /* Spacing (8px grid) */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 24px;
    --s-6: 32px;
    --s-7: 48px;
    --s-8: 64px;

    /* Typography */
    --font-body: 'IBM Plex Sans JP', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

    /* Transitions */
    --t-fast: 120ms cubic-bezier(.4, 0, .2, 1);
    --t-med:  200ms cubic-bezier(.4, 0, .2, 1);

    /* Shadows (dark-mode appropriate — subtle, single-layer) */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-3: 0 16px 40px rgba(0, 0, 0, 0.55);
}

/* -------- Reset -------- */

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 70% -10%, rgba(94, 234, 212, 0.04), transparent 60%),
        radial-gradient(800px 400px at 10% 110%, rgba(147, 197, 253, 0.03), transparent 60%),
        var(--bg-0);
    min-height: 100vh;
    padding: var(--s-5);
}

/* Subtle noise atmosphere */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.025;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    z-index: 100;
}

/* -------- Typography -------- */

h1, h2, h3, h4 {
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--text);
}

h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 18px; line-height: 1.3; margin-bottom: var(--s-4); }
h3 { font-size: 15px; line-height: 1.4; }
h4 { font-size: 13px; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

p { color: var(--text-muted); }

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: #99f6e4; }

code, kbd, pre, samp {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

code {
    background: var(--bg-2);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
}

small { color: var(--text-faint); font-size: 12px; }

strong { color: var(--text); font-weight: 600; }

/* -------- Container / Layout -------- */

.container {
    max-width: 1180px;
    margin: 0 auto;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-3);
    overflow: hidden;
}

/* -------- Header (top bar) -------- */

.header {
    position: relative;
    padding: var(--s-6) var(--s-6) var(--s-5);
    background:
        linear-gradient(180deg, rgba(94, 234, 212, 0.04) 0%, transparent 100%),
        var(--bg-2);
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: var(--s-1);
}

.header h1::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: var(--s-3);
    transform: translateY(-4px) rotate(45deg);
    box-shadow: 0 0 20px var(--accent-ring);
}

.header p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 620px;
}

/* -------- Navigation -------- */

.nav-links {
    position: absolute;
    top: var(--s-5);
    right: var(--s-6);
    display: flex;
    gap: var(--s-2);
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: calc(100% - 2 * var(--s-6));
}

/* logout-btn repurposed as "nav-chip" */
.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--s-2);
    padding: var(--s-2) var(--s-4);
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
    text-decoration: none;
    white-space: nowrap;
}

.logout-btn:hover {
    color: var(--text);
    border-color: var(--line-strong);
    background: var(--bg-3);
    transform: none;
}

.logout-btn:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

/* -------- Tabs -------- */

.tabs {
    display: flex;
    background: var(--bg-1);
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab {
    flex: 1 0 auto;
    padding: var(--s-4) var(--s-5);
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
    white-space: nowrap;
    user-select: none;
    letter-spacing: 0.01em;
}

.tab:hover {
    color: var(--text);
    background: var(--bg-2);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: transparent;
}

.tab:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent-ring);
}

/* -------- Content area -------- */

.content {
    padding: var(--s-6);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 280ms cubic-bezier(.4, 0, .2, 1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* -------- Forms -------- */

.form-group {
    margin-bottom: var(--s-5);
}

.form-group label {
    display: block;
    margin-bottom: var(--s-2);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.form-group input,
.form-group select,
.form-group textarea,
input[type=text],
input[type=password],
input[type=number],
input[type=email],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}

.form-group input::placeholder,
.form-group textarea::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-2);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-group input[readonly],
input[readonly] {
    background: var(--bg-1);
    color: var(--text-muted);
    cursor: default;
}

.form-group small {
    display: block;
    margin-top: var(--s-2);
    font-size: 12px;
    color: var(--text-faint);
}

/* -------- Buttons -------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: 10px 20px;
    background: var(--bg-3);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-sm);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
    user-select: none;
    letter-spacing: 0.01em;
}

.btn:hover {
    background: var(--bg-4);
    border-color: var(--line-strong);
    transform: none;
}

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #052e2c;
    font-weight: 600;
    box-shadow: 0 0 0 0 transparent;
}

.btn-primary:hover {
    background: #99f6e4;
    border-color: #99f6e4;
    color: #052e2c;
    box-shadow: 0 4px 16px rgba(94, 234, 212, 0.2);
}

.btn-success {
    background: var(--success-soft);
    border-color: transparent;
    color: var(--success);
}
.btn-success:hover { background: rgba(134, 239, 172, 0.22); color: #bbf7d0; }

.btn-danger {
    background: var(--danger-soft);
    border-color: transparent;
    color: var(--danger);
}
.btn-danger:hover { background: rgba(251, 113, 133, 0.22); color: #fda4af; }

.btn-info {
    background: var(--info-soft);
    border-color: transparent;
    color: var(--info);
}
.btn-info:hover { background: rgba(147, 197, 253, 0.22); color: #bfdbfe; }

.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--line);
}
.btn-secondary:hover {
    color: var(--text);
    background: var(--bg-3);
    border-color: var(--line-strong);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 4px 8px;
    font-size: 14px;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-3); }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-group {
    display: flex;
    gap: var(--s-3);
    margin-top: var(--s-4);
    flex-wrap: wrap;
}

/* -------- Alerts -------- */

.alert {
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-5);
    border-radius: var(--r-sm);
    border-left: 3px solid transparent;
    font-size: 13px;
    display: none;
}

.alert.show {
    display: block;
    animation: fadeIn 200ms ease;
}

.alert-success {
    background: var(--success-soft);
    color: var(--success);
    border-left-color: var(--success);
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-left-color: var(--danger);
}

.alert-info {
    background: var(--info-soft);
    color: var(--info);
    border-left-color: var(--info);
}

/* -------- Info box -------- */

.info-box {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    padding: var(--s-4) var(--s-5);
    margin-bottom: var(--s-5);
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--text-muted);
}

.info-box strong {
    color: var(--text);
}

.info-box a {
    color: var(--accent) !important;
    font-weight: 600 !important;
}

/* -------- Cards (activation) -------- */

.activation-card {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
    box-shadow: var(--shadow-1);
    transition: border-color var(--t-fast), transform var(--t-fast);
}

.activation-card:hover {
    border-color: var(--line-strong);
}

.activation-card h3 {
    color: var(--accent);
    margin-bottom: var(--s-3);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0;
}

.activation-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--s-3);
    margin-top: var(--s-4);
}

.info-item {
    padding: var(--s-3) var(--s-4);
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}

.info-item strong {
    display: block;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--s-1);
}

.info-item span {
    display: block;
    font-size: 15px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    word-break: break-all;
}

/* -------- Status badges -------- */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--r-pill);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid transparent;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-waiting {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: rgba(252, 211, 77, 0.2);
}

.status-ok {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(134, 239, 172, 0.2);
}

.status-cancelled {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(251, 113, 133, 0.2);
}

/* -------- Tables -------- */

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--s-4);
    font-size: 13px;
}

table th,
table td {
    padding: var(--s-3) var(--s-4);
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

table th {
    background: var(--bg-2);
    font-weight: 500;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--line-strong);
}

table tr:hover td {
    background: var(--bg-2);
}

table tr:last-child td {
    border-bottom: none;
}

/* -------- SMS code display -------- */

.code-display {
    background:
        linear-gradient(180deg, rgba(94, 234, 212, 0.08) 0%, transparent 100%),
        var(--bg-2);
    padding: var(--s-6);
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 32px;
    text-align: center;
    margin-top: var(--s-5);
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.3em;
    text-shadow: 0 0 30px var(--accent-ring);
}

/* -------- Scrollbars -------- */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--bg-4);
    border-radius: var(--r-sm);
}
::-webkit-scrollbar-thumb:hover { background: #2f3849; }

/* Selection */
::selection {
    background: var(--accent-ring);
    color: var(--text);
}

/* Focus visible — fallback */
:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: 2px;
    border-radius: var(--r-sm);
}

/* -------- Login (single-page variant) -------- */

.login-shell {
    min-height: 100vh;
    margin: calc(var(--s-5) * -1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-5);
    position: relative;
}

.login-container {
    width: 100%;
    max-width: 420px;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-7) var(--s-6);
    box-shadow: var(--shadow-3);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.6;
}

.login-header {
    text-align: center;
    margin-bottom: var(--s-6);
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--s-2);
    letter-spacing: -0.01em;
}

.login-header h1::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 2px;
    margin-right: var(--s-2);
    transform: translateY(-4px) rotate(45deg);
    box-shadow: 0 0 16px var(--accent-ring);
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: #052e2c;
    border: 1px solid var(--accent);
    border-radius: var(--r-sm);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
    letter-spacing: 0.02em;
}

.btn-login:hover {
    background: #99f6e4;
    box-shadow: 0 4px 16px rgba(94, 234, 212, 0.2);
}

.btn-login:active {
    transform: translateY(1px);
}

.error-message {
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-4);
    background: var(--danger-soft);
    color: var(--danger);
    border-left: 3px solid var(--danger);
    border-radius: var(--r-sm);
    font-size: 13px;
}

/* -------- Manual countries page -------- */

.page-hint {
    font-size: 12px;
    color: var(--text-faint);
    margin-top: var(--s-2);
    margin-bottom: var(--s-5);
}

.page-hint code { font-size: 11px; }

.toolbar {
    display: flex;
    gap: var(--s-2);
    margin-bottom: var(--s-4);
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-spacer { flex: 1; }

.status-bar {
    padding: var(--s-3) var(--s-4);
    margin-bottom: var(--s-4);
    border-radius: var(--r-sm);
    font-size: 13px;
    display: none;
    border-left: 3px solid transparent;
}

.status-bar.show { display: block; }
.status-bar.ok {
    background: var(--success-soft);
    color: var(--success);
    border-left-color: var(--success);
}
.status-bar.err {
    background: var(--danger-soft);
    color: var(--danger);
    border-left-color: var(--danger);
}

.mc-table { width: 100%; border-collapse: collapse; margin-bottom: var(--s-4); }
.mc-table th,
.mc-table td {
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.mc-table tr:hover td { background: transparent; }
.mc-table input[type=text] {
    padding: 6px 10px;
    background: var(--bg-1);
    font-size: 13px;
}
.mc-table input[type=text]:focus {
    background: var(--bg-2);
}
.col-order { width: 72px; text-align: center; white-space: nowrap; }
.col-code { width: 140px; }
.col-name { width: 280px; }
.col-note { width: auto; }
.col-actions { width: 100px; text-align: right; }

.preview {
    background: var(--bg-0);
    border: 1px solid var(--line);
    color: var(--accent);
    padding: var(--s-4);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 220px;
    overflow-y: auto;
}

.preview-label {
    font-size: 11px;
    color: var(--text-muted);
    margin: var(--s-5) 0 var(--s-2);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* -------- API docs page -------- */

.doc-intro {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-4) var(--s-5);
    margin-bottom: var(--s-6);
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-muted);
}

.doc-intro strong {
    color: var(--text);
    font-weight: 600;
}

.toc {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-4) var(--s-5);
    margin-bottom: var(--s-6);
}

.toc strong {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--s-3);
}

.toc ul {
    list-style: none;
    padding: 0;
    columns: 3;
    column-gap: var(--s-5);
}
@media (max-width: 780px) { .toc ul { columns: 2; } }
@media (max-width: 480px) { .toc ul { columns: 1; } }

.toc li {
    padding: 3px 0;
    font-family: var(--font-mono);
    font-size: 12px;
    break-inside: avoid;
}

.toc a { color: var(--text-muted); }
.toc a:hover { color: var(--accent); }

.doc-section-title {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: var(--s-6) 0 var(--s-3);
    padding-bottom: var(--s-2);
    border-bottom: 1px solid var(--line);
}

.endpoint {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
    transition: border-color var(--t-fast);
    scroll-margin-top: var(--s-5);
}

.endpoint:hover { border-color: var(--line-strong); }
.endpoint:target {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.ep-head {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
    flex-wrap: wrap;
}

.method {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
}

.method-get  { background: var(--info-soft);   color: var(--info);    border-color: rgba(147, 197, 253, 0.2); }
.method-post { background: var(--warning-soft); color: var(--warning); border-color: rgba(252, 211, 77, 0.2); }

.path {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: var(--s-3);
    line-height: 1.7;
}

.endpoint h3 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: var(--s-4) 0 var(--s-2);
}

.endpoint table { margin: 0; font-size: 12px; }
.endpoint table th {
    background: transparent;
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--line);
}
.endpoint table td {
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--line);
}

.req { color: var(--danger); font-weight: 600; font-size: 10px; margin-left: 2px; }

pre {
    background: var(--bg-0);
    border: 1px solid var(--line);
    color: var(--text);
    padding: var(--s-4);
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

pre code { background: transparent; border: none; padding: 0; color: var(--accent); }

/* -------- Toasts (right-bottom stack) -------- */

.toast-stack {
    position: fixed;
    bottom: var(--s-5);
    right: var(--s-5);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    pointer-events: none;
    max-width: min(420px, calc(100vw - var(--s-6)));
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
    background: var(--bg-2);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-2);
    font-size: 13px;
    color: var(--text);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity var(--t-med), transform var(--t-med);
    min-width: 240px;
}

.toast.in { opacity: 1; transform: translateX(0); }
.toast.out { opacity: 0; transform: translateX(20px); }

.toast-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
    background: var(--text-muted);
    box-shadow: 0 0 12px currentColor;
}
.toast-ok   .toast-dot { background: var(--success); color: var(--success); }
.toast-err  .toast-dot { background: var(--danger);  color: var(--danger); }
.toast-warn .toast-dot { background: var(--warning); color: var(--warning); }
.toast-info .toast-dot { background: var(--info);    color: var(--info); }

.toast-msg { flex: 1; line-height: 1.5; word-break: break-word; }

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 var(--s-1);
    transition: color var(--t-fast);
}
.toast-close:hover { color: var(--text); }

/* -------- Copy button (inline with text/codes) -------- */

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    transition: all var(--t-fast);
    vertical-align: middle;
    margin-left: var(--s-2);
}
.copy-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.copy-btn.copied {
    color: var(--success);
    border-color: var(--success);
    background: var(--success-soft);
}
.copy-btn.copied::after {
    content: '✓';
    font-size: 12px;
}
.copy-btn svg { display: block; }

/* Copy button attached to <pre> */
.pre-wrap { position: relative; }
.pre-copy {
    position: absolute;
    top: var(--s-2);
    right: var(--s-2);
    opacity: 0;
    transition: opacity var(--t-fast);
    margin-left: 0;
    padding: 5px 8px;
}
.pre-wrap:hover .pre-copy,
.pre-copy:focus-visible { opacity: 1; }

/* -------- Spinner / loading button -------- */

.spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 720ms linear infinite;
    margin-right: 4px;
    vertical-align: -2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn.loading { cursor: wait; opacity: 0.8; }

/* -------- Filter bar (search above tables/lists) -------- */

.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    margin-bottom: var(--s-3);
    flex-wrap: wrap;
}

.filter-bar input[type=text],
.filter-bar input[type=search] {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px 8px 36px;
    background: var(--bg-2);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e94a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.35-4.35'/></svg>");
    background-repeat: no-repeat;
    background-position: 12px center;
    font-size: 13px;
}

.filter-count {
    font-size: 12px;
    color: var(--text-faint);
    white-space: nowrap;
}

/* -------- Section header (unified pattern) -------- */

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--s-4);
    margin-bottom: var(--s-4);
    padding-bottom: var(--s-3);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.section-header h2 { margin-bottom: 0; }
.section-header .section-meta {
    font-size: 12px;
    color: var(--text-faint);
}

/* -------- Empty state (unified) -------- */

.empty-state {
    padding: var(--s-7) var(--s-5);
    text-align: center;
    background: var(--bg-2);
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-md);
    color: var(--text-muted);
}
.empty-state-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: var(--s-2);
}
.empty-state-hint {
    font-size: 12px;
    color: var(--text-faint);
}

/* -------- Sticky action bar (bottom of manual-countries) -------- */

.sticky-actions {
    position: sticky;
    bottom: 0;
    margin: var(--s-4) calc(var(--s-6) * -1) calc(var(--s-6) * -1);
    padding: var(--s-4) var(--s-6);
    background: rgba(15, 19, 28, 0.92);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--line-strong);
    display: flex;
    align-items: center;
    gap: var(--s-3);
    z-index: 10;
}

.sticky-actions .spacer { flex: 1; }

.dirty-indicator {
    font-size: 12px;
    color: var(--warning);
    display: none;
}
.dirty-indicator.show { display: inline-flex; align-items: center; gap: 6px; }
.dirty-indicator::before {
    content: '';
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

/* -------- Drag & drop rows -------- */

.mc-table tr { cursor: grab; }
.mc-table tr.dragging { opacity: 0.4; cursor: grabbing; }
.mc-table tr.drag-over td { border-top: 2px solid var(--accent); }
.mc-table td input, .mc-table td button { cursor: auto; }
.drag-handle {
    color: var(--text-faint);
    font-size: 14px;
    padding: 0 var(--s-2);
    user-select: none;
}

/* -------- API docs: sticky TOC on wide screens -------- */

.docs-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-5);
}
@media (min-width: 1024px) {
    .docs-layout {
        grid-template-columns: 220px 1fr;
        align-items: start;
    }
    .toc-sticky {
        position: sticky;
        top: var(--s-4);
        max-height: calc(100vh - var(--s-7));
        overflow-y: auto;
    }
    .toc-sticky ul { columns: 1; }
}

/* -------- Tab panels: unified info display -------- */

.stat-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-3);
    margin-bottom: var(--s-4);
}
.stat-card {
    flex: 1 1 200px;
    padding: var(--s-3) var(--s-4);
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
}
.stat-label {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}
.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* -------- Inventory blocks -------- */

.inventory-country-block {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-5);
    margin-bottom: var(--s-4);
}

.inventory-country-block h3 {
    color: var(--accent);
    margin-bottom: var(--s-2);
}

.inv-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--s-2);
}

.inventory-history-item {
    padding: var(--s-3) 0;
    border-bottom: 1px solid var(--line);
}

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

.inv-hist-ts {
    color: var(--text);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 12px;
    margin-bottom: var(--s-1);
}

.inventory-history-item p { font-size: 13px; margin-bottom: var(--s-1); color: var(--text); }
.inventory-history-item .btn { margin-top: var(--s-2); }

/* -------- Responsive -------- */

@media (max-width: 720px) {
    body { padding: var(--s-3); }
    .header {
        padding: var(--s-7) var(--s-4) var(--s-4);
    }
    .nav-links {
        position: static;
        margin-bottom: var(--s-4);
        justify-content: flex-start;
    }
    .header h1 { font-size: 22px; }
    .content { padding: var(--s-4); }
    .tabs { padding: 0 var(--s-2); }
    .tab { padding: var(--s-3) var(--s-4); font-size: 12px; }
    .activation-info { grid-template-columns: 1fr; }
    .col-code, .col-name { width: auto; }
}
