@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ══════════════════════════════════════════════════════════════════════════
   PeerPin API Console — Dark Theme
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────────────────── */
:root {
    --primary: #6c7cff;
    --primary-dark: #5a68e0;
    --primary-light: rgba(108, 124, 255, 0.12);
    --primary-glow: rgba(108, 124, 255, 0.25);

    --bg: #0f1117;
    --bg-elevated: #161822;
    --surface: #1a1d2e;
    --surface-alt: #212436;
    --surface-hover: #262a3e;

    --border: #2a2e42;
    --border-light: #333750;

    --text: #e2e4ec;
    --text-secondary: #8b90a5;
    --text-muted: #5c6078;

    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --info: #60a5fa;
    --info-bg: rgba(96, 165, 250, 0.12);

    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.35);
    --shadow-lg: 0 8px 28px rgba(0,0,0,0.45);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'SF Mono', 'Menlo', 'Monaco', 'Courier New', monospace;
}

/* ── Global Reset ──────────────────────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1480px;
    margin: 0 auto;
}

/* ── Scrollbars ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3f56; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #4e5470; }

/* ── Header ────────────────────────────────────────────────────────────── */
header {
    color: white;
    margin-bottom: 16px;
    padding: 22px 26px;
    background: linear-gradient(135deg, #3d4abe 0%, var(--primary) 60%, #8b96ff 100%);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(108, 124, 255, 0.2);
}

header h1 {
    font-size: 1.55em;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.subtitle {
    font-size: 0.9em;
    opacity: 0.78;
    font-weight: 400;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.header-main { flex: 1; }

/* Auth state indicator in header */
.auth-state-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.82em;
    color: var(--text-secondary);
    margin-right: 12px;
    white-space: nowrap;
}
.auth-state-indicator.logged-in {
    border-color: var(--success);
    background: var(--success-bg);
    color: var(--success);
}

/* Loading spinner on buttons */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}
.btn-loading::after {
    content: '';
    position: absolute;
    right: 8px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btnSpin 0.6s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* ── Tab Navigation ────────────────────────────────────────────────────── */
.tab-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--surface);
    padding: 6px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1 1 auto;
    min-width: 105px;
    padding: 9px 13px;
    font-size: 0.84em;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.tab-btn:hover {
    background: var(--surface-alt);
    color: var(--text);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 10px var(--primary-glow);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* Tab responsive */
@media (max-width: 1200px) {
    .tab-btn { flex: 1 1 calc(25% - 6px); min-width: 95px; font-size: 0.82em; }
}
@media (max-width: 768px) {
    .tab-navigation { gap: 4px; padding: 8px; }
    .tab-btn { flex: 1 1 calc(50% - 4px); min-width: 75px; padding: 9px 6px; font-size: 0.78em; }
}
@media (max-width: 480px) {
    .tab-btn { flex: 1 1 calc(50% - 4px); min-width: 65px; padding: 7px 5px; font-size: 0.74em; }
}

/* ── WebSocket Status Bar ──────────────────────────────────────────────── */
.ws-status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 18px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.88em;
    transition: all 0.2s ease;
}

.ws-status-bar.connected {
    background: var(--success-bg);
    border: 1.5px solid var(--success);
    color: var(--success);
}

.ws-status-bar.disconnected {
    background: var(--danger-bg);
    border: 1.5px solid var(--danger);
    color: var(--danger);
}

.ws-status-bar.connecting {
    background: var(--warning-bg);
    border: 1.5px solid var(--warning);
    color: var(--warning);
    animation: pulse 1.5s infinite;
}

.ws-status-indicator { display: flex; align-items: center; gap: 10px; font-size: 1.05em; }
.ws-status-actions { display: flex; gap: 8px; }

/* ── Sections / Cards ──────────────────────────────────────────────────── */
.section {
    background: var(--surface);
    padding: 22px;
    margin-bottom: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.section:hover { box-shadow: var(--shadow-md); }

.section h2 {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.subsection {
    background: var(--surface-alt);
    padding: 18px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    border-left: 3px solid var(--primary);
}

.subsection h3 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.02em;
    font-weight: 600;
}

/* ── Quick Guide ───────────────────────────────────────────────────────── */
.guide-section {
    background: var(--surface);
    padding: 22px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
    border: 1px solid var(--border);
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.guide-card {
    background: var(--surface-alt);
    padding: 16px 12px;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
}

.guide-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.guide-icon { font-size: 2em; margin-bottom: 6px; }

.guide-card h3 {
    color: var(--primary);
    margin-bottom: 5px;
    font-size: 0.95em;
    font-weight: 600;
}

.guide-card p {
    color: var(--text-secondary);
    font-size: 0.82em;
    line-height: 1.4;
}

/* ── Two-Column Layout ─────────────────────────────────────────────────── */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 20px;
}

@media (max-width: 1200px) {
    .two-column-layout { grid-template-columns: 1fr; }
}

.column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
button {
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    font-size: 0.88em;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s ease;
}

button:hover { filter: brightness(1.1); box-shadow: var(--shadow-sm); }
button:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-light); }

.btn-success { background: var(--success); color: #05201a; }
.btn-success:hover { background: #2bc48d; }

.btn-warning { background: var(--warning); color: #1a1d26; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #ef5350; }

.btn-location {
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 14px;
    font-size: 0.86em;
}
.btn-location:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-block { width: 100%; margin-top: 8px; }
.btn-small { padding: 6px 12px; font-size: 0.84em; border-radius: 6px; }
.btn-small:disabled { opacity: 0.4; cursor: not-allowed; }

.button-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── Form Elements ─────────────────────────────────────────────────────── */
.form-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.88em;
}

label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 115px;
    font-size: 0.86em;
    letter-spacing: 0.01em;
}

input[type="text"],
input[type="number"] {
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9em;
    font-family: var(--font);
    background: var(--bg-elevated);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder { color: var(--text-muted); }

.input-large { width: 100%; max-width: 400px; }
.input-medium { width: 100%; }
.input-small { width: 150px; }

.input-full {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9em;
    font-family: var(--font);
    background: var(--bg-elevated);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-full:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea.input-full {
    resize: vertical;
    min-height: 60px;
}

.input-readonly {
    width: 100%;
    padding: 9px 13px;
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.86em;
    color: var(--text-secondary);
    font-family: var(--mono);
}

.file-input { padding: 8px; cursor: pointer; }
.file-info { margin-top: 6px; color: var(--success); font-size: 0.84em; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ── Info & Hint Boxes ─────────────────────────────────────────────────── */
.info-box {
    background: var(--surface-alt);
    border-left: 3px solid var(--primary);
    padding: 14px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.9em;
}

.info-box p { margin-bottom: 6px; }
.info-box p:last-child { margin-bottom: 0; }

.info-box code {
    background: var(--primary-light);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: var(--mono);
    color: var(--primary);
    font-weight: 600;
}

.hint {
    background: var(--warning-bg);
    border-left: 3px solid var(--warning);
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 6px;
    font-size: 0.88em;
    color: var(--warning);
}

.user-generator {
    margin-bottom: 14px;
    padding: 12px 14px;
    background: var(--success-bg);
    border: 1px solid rgba(52, 211, 153, 0.25);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-text {
    color: var(--success);
    font-size: 0.88em;
    font-weight: 500;
}

/* ── Instructions Panel ────────────────────────────────────────────────── */
.instructions-panel {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.instructions-panel h2 {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 1.4em;
    font-weight: 700;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.instruction-card {
    background: var(--surface-alt);
    padding: 18px;
    border-radius: var(--radius);
    position: relative;
    padding-left: 65px;
    min-height: 100px;
    border: 1px solid var(--border);
}

.step-number {
    position: absolute;
    left: 14px;
    top: 14px;
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    font-weight: 700;
}

.instruction-card h3 {
    color: var(--text);
    margin-bottom: 6px;
    font-size: 1.05em;
}

.instruction-card p {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.45;
}

.tips-section {
    background: var(--surface-alt);
    padding: 18px;
    border-radius: var(--radius);
    border-left: 3px solid var(--primary);
}

.tips-section h3 { color: var(--primary); margin-bottom: 12px; }
.tips-section ul { list-style: none; padding-left: 0; }
.tips-section li { padding: 6px 0 6px 22px; position: relative; line-height: 1.55; }
.tips-section li:before { content: "✓"; position: absolute; left: 0; color: var(--primary); font-weight: bold; }
.tips-section strong { color: var(--text); }

/* ── Log / Console ─────────────────────────────────────────────────────── */
.log-controls {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-controls label { font-weight: normal; min-width: auto; }

.log {
    background: #0d0e14;
    color: #c9cdd6;
    padding: 14px;
    height: 420px;
    overflow-y: auto;
    font-family: var(--mono);
    font-size: 12.5px;
    border-radius: var(--radius);
    line-height: 1.6;
    border: 1px solid var(--border);
}

.log-entry { margin-bottom: 6px; padding: 4px; border-radius: 3px; }
.log-entry.info { color: #60a5fa; }
.log-entry.success { color: var(--success); }
.log-entry.error { color: var(--danger); }
.log-entry.warning { color: var(--warning); }

.log-timestamp { color: var(--text-muted); font-size: 0.88em; }

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.log-count { color: var(--text-muted); font-size: 0.88em; font-style: italic; }

.sticky-section {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.api-log {
    flex: 1;
    overflow-y: auto;
    min-height: 400px;
    max-height: calc(100vh - 200px);
}

/* ── Unified API Log (Postman-like) ────────────────────────────────────── */
.api-log-entry {
    background: var(--surface-alt);
    border-radius: 8px;
    padding: 11px;
    margin-bottom: 10px;
    border-left: 4px solid var(--text-muted);
    transition: background 0.15s;
}

.api-log-entry:hover { background: var(--surface-hover); }
.api-log-entry.success { border-left-color: var(--success); }
.api-log-entry.error { border-left-color: var(--danger); }
.api-log-entry.info { border-left-color: var(--info); }

.api-log-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.api-log-timestamp { color: var(--text-muted); font-size: 0.83em; font-family: monospace; }

.api-log-method {
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 0.78em;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-log-status { font-weight: 600; font-size: 0.88em; }
.api-log-status.success { color: var(--success); }
.api-log-status.error   { color: var(--danger); }
.api-log-status.info    { color: var(--info); }

.api-log-time { color: var(--text-muted); font-size: 0.83em; margin-left: auto; }

.api-log-url {
    color: #93c5fd;
    font-family: var(--mono);
    font-size: 0.88em;
    word-break: break-all;
    padding: 5px 7px;
    background: rgba(0,0,0,0.25);
    border-radius: 4px;
    margin-bottom: 6px;
}

.api-log-section { margin-top: 6px; }
.api-log-section-header {
    color: var(--text-muted);
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
}

.api-log-body {
    background: #0d0e14;
    color: #c9cdd6;
    padding: 9px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 0.83em;
    line-height: 1.5;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.api-log-body .string  { color: #98c379; }
.api-log-body .number  { color: #d19a66; }
.api-log-body .boolean { color: #56b6c2; }
.api-log-body .null    { color: #c678dd; }
.api-log-body .key     { color: #e06c75; }

/* ── Billing Log (bll-*) ──────────────────────────────────────────────── */
.bll-entry {
    background: var(--surface-alt);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid var(--text-muted);
    overflow: hidden;
    transition: background 0.15s;
}
.bll-entry:hover { background: var(--surface-hover); }
.bll-entry.success { border-left-color: var(--success); }
.bll-entry.error   { border-left-color: var(--danger); }
.bll-entry.info    { border-left-color: var(--info); }

.bll-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    cursor: pointer;
    user-select: none;
    flex-wrap: wrap;
}

.bll-method {
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 0.74em;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.bll-status { font-weight: 600; font-size: 0.84em; flex-shrink: 0; }
.bll-status.success { color: var(--success); }
.bll-status.error   { color: var(--danger); }
.bll-status.info    { color: var(--info); }

.bll-path {
    color: #93c5fd;
    font-family: var(--mono);
    font-size: 0.83em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
}

.bll-meta { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-shrink: 0; }

.bll-duration {
    background: rgba(255,255,255,0.06);
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 0.76em;
    color: var(--text-secondary);
    font-weight: 600;
    font-family: monospace;
}

.bll-time { color: var(--text-muted); font-size: 0.76em; font-family: monospace; }

.bll-chevron { color: var(--text-muted); font-size: 0.88em; transition: transform 0.2s; flex-shrink: 0; }
.bll-entry.collapsed .bll-chevron { transform: rotate(-90deg); }

.bll-detail { padding: 0 11px 11px; display: block; }
.bll-entry.collapsed .bll-detail { display: none; }

.bll-panel { margin-top: 6px; }
.bll-panel-label {
    color: var(--text-muted);
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 3px;
}

.bll-json {
    background: #0d0e14;
    color: #c9cdd6;
    padding: 9px 11px;
    border-radius: 6px;
    font-family: var(--mono);
    font-size: 0.81em;
    line-height: 1.55;
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.bll-req-line { color: var(--text-muted); font-size: 0.79em; }
.bll-json .jk { color: #e06c75; }
.bll-json .js { color: #98c379; }
.bll-json .jn { color: #d19a66; }
.bll-json .jb { color: #56b6c2; }
.bll-json .jl { color: #c678dd; }

.billing-result-box {
    background: var(--bg-elevated);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 11px 13px;
    margin-top: 8px;
    font-size: 0.88em;
    line-height: 1.55;
}

.bll-log-count {
    background: rgba(255,255,255,0.06);
    color: var(--text-muted);
    padding: 2px 9px;
    border-radius: 12px;
    font-size: 0.8em;
    font-family: monospace;
}

/* Log action buttons (copy / cURL) */
.bll-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.bll-action-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.72em;
    cursor: pointer;
    font-family: var(--mono);
    transition: all 0.15s;
}
.bll-action-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.bll-action-btn.copied { background: var(--success); color: #fff; border-color: var(--success); }

/* Log filter bar */
.log-filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
    align-items: center;
}
.log-filter-bar input {
    flex: 1;
    padding: 5px 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82em;
    font-family: var(--mono);
}
.log-filter-bar input::placeholder { color: var(--text-muted); }
.log-filter-bar select {
    padding: 5px 8px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.82em;
    cursor: pointer;
}

/* ── Status indicators ─────────────────────────────────────────────────── */
.status { padding: 6px 14px; border-radius: 20px; font-weight: 600; font-size: 0.88em; }
.connected { color: var(--success); background: var(--success-bg); }
.disconnected { color: var(--danger); background: var(--danger-bg); }

/* ── User Cards ────────────────────────────────────────────────────────── */
.active-users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 12px;
    min-height: 70px;
}

.no-users {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    font-style: italic;
}

.user-card {
    background: var(--surface-alt);
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    transition: box-shadow 0.2s;
}

.user-card:hover { box-shadow: var(--shadow-md); }
.user-card.current-user { border-left-color: var(--success); background: rgba(52, 211, 153, 0.08); }

.user-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.05em;
}

.user-card.current-user .user-avatar { background: var(--success); }
.user-card-info h3 { margin: 0; color: var(--text); font-size: 1.05em; }
.user-card-info .user-id { font-size: 0.78em; color: var(--text-muted); font-family: monospace; }
.user-card-details { display: flex; flex-direction: column; gap: 4px; font-size: 0.88em; color: var(--text-secondary); }
.user-card-details div { display: flex; align-items: center; gap: 4px; }
.user-timestamp { font-size: 0.83em; color: var(--text-muted); margin-top: 4px; }

/* ── Quick Locations ───────────────────────────────────────────────────── */
.quick-locations {
    margin-top: 16px;
    padding: 14px;
    background: var(--surface-alt);
    border-radius: 8px;
}

.quick-locations strong { display: block; margin-bottom: 8px; color: var(--text-secondary); }
.quick-locations button { margin: 4px; }

.quick-locations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    gap: 8px;
}

.quick-locations-grid .btn-location { width: 100%; margin: 0; }

/* ── Session Info ──────────────────────────────────────────────────────── */
.session-info {
    background: rgba(52, 211, 153, 0.08);
    border-left-color: var(--success);
}

.session-display { display: flex; flex-direction: column; gap: 10px; }
.session-item { display: flex; flex-direction: column; gap: 4px; }
.session-item strong { color: var(--success); font-size: 0.88em; }

/* ── Profile & Subscription Cards ──────────────────────────────────────── */
.profile-display { margin-top: 16px; }

.profile-card {
    background: var(--surface);
    padding: 18px;
    border-radius: var(--radius);
    border: 1.5px solid var(--primary);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-card h4 {
    color: var(--primary);
    margin-bottom: 12px;
    font-size: 1.15em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.profile-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    align-items: center;
}

.profile-row:last-child { border-bottom: none; }
.profile-row strong { color: var(--text-secondary); font-size: 0.92em; }

.subscription-display { margin-top: 16px; }

.subscription-card {
    background: linear-gradient(135deg, var(--primary) 0%, #8b96ff 100%);
    color: white;
    padding: 22px;
    border-radius: var(--radius-lg);
    box-shadow: 0 6px 20px var(--primary-glow);
    animation: fadeIn 0.3s ease;
}

.subscription-card h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 1.4em;
    border-bottom: 2px solid rgba(255,255,255,0.25);
    padding-bottom: 10px;
}

.subscription-row {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 12px;
    align-items: center;
    font-size: 1.02em;
}

.subscription-row:last-child { border-bottom: none; }
.subscription-row strong { font-weight: 600; opacity: 0.85; }

/* ── Health Check ──────────────────────────────────────────────────────── */
.health-status-display { margin-top: 12px; }

.status-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--border);
    transition: all 0.3s ease;
}

.status-card.status-up {
    border-color: var(--success);
    background: linear-gradient(135deg, rgba(52,211,153,0.08) 0%, rgba(52,211,153,0.04) 100%);
}

.status-card.status-down {
    border-color: var(--danger);
    background: linear-gradient(135deg, rgba(248,113,113,0.08) 0%, rgba(248,113,113,0.04) 100%);
}

.status-card.status-error {
    border-color: var(--warning);
    background: linear-gradient(135deg, rgba(251,191,36,0.08) 0%, rgba(251,191,36,0.04) 100%);
}

.status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.status-icon-large { font-size: 2.8em; }
.status-title { font-size: 1.4em; font-weight: bold; color: var(--text); }

.status-details { margin-bottom: 12px; }
.status-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.status-row:last-child { border-bottom: none; }
.status-label { font-weight: 600; color: var(--text-secondary); }
.status-value { color: var(--text); font-family: var(--mono); }

.status-timestamp {
    text-align: right;
    font-size: 0.83em;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.components-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.components-section h4 { font-size: 1.05em; margin-bottom: 8px; color: var(--primary); }

.component-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 8px;
    background: var(--surface-alt);
    border-radius: 5px;
    margin-bottom: 4px;
    font-size: 0.92em;
}

/* ── Compass ───────────────────────────────────────────────────────────── */
.compass-container {
    display: flex;
    justify-content: center;
    padding: 36px 18px;
    background: var(--surface-alt);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.compass-circle {
    position: relative;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    overflow: visible;
    background: radial-gradient(circle, var(--surface) 0%, var(--surface-alt) 100%);
    box-shadow:
        0 0 0 2px var(--primary),
        0 0 0 4px var(--primary-glow),
        inset 0 0 40px rgba(108, 124, 255, 0.06),
        0 8px 28px rgba(0,0,0,0.4);
    border: 3px solid var(--primary);
}

.compass-direction {
    position: absolute;
    font-weight: bold;
    font-size: 22px;
    color: var(--primary);
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.compass-direction.north { top: 8px; left: 50%; transform: translateX(-50%); }
.compass-direction.east  { right: 8px; top: 50%; transform: translateY(-50%); }
.compass-direction.south { bottom: 8px; left: 50%; transform: translateX(-50%); }
.compass-direction.west  { left: 8px; top: 50%; transform: translateY(-50%); }

.compass-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 4; }

.you-marker {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 13px;
    box-shadow:
        0 3px 12px var(--primary-glow),
        0 0 0 3px var(--surface),
        0 0 0 5px var(--primary);
    animation: youPulse 2s infinite;
}

@keyframes youPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.compass-user {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.compass-user-marker {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(238, 90, 111, 0.4), 0 0 0 2px var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.compass-user-marker:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 16px rgba(238, 90, 111, 0.6), 0 0 0 2px var(--surface);
}

.compass-user-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 8px;
    pointer-events: none;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    line-height: 1.3;
}

.compass-user-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
}

.compass-user-detail {
    font-size: 10px;
    font-weight: 500;
    color: var(--primary);
}

/* Compass empty state overlay */
.compass-empty-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    margin-top: 60px;
    text-align: center;
    pointer-events: none;
}

.compass-empty-overlay span {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

/* ── Notification Toast System ─────────────────────────────────────────── */
.notification-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
    pointer-events: none;
}

.notification-toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px 18px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
    pointer-events: auto;
    min-width: 280px;
    max-width: 380px;
    border: 1px solid var(--border);
}

.notification-toast.hiding { animation: slideOutRight 0.3s ease-in forwards; }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.notification-icon {
    font-size: 1.4em;
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.notification-content { flex: 1; min-width: 0; }
.notification-title { font-weight: 600; font-size: 0.92em; color: var(--text); margin-bottom: 3px; }
.notification-message { font-size: 0.83em; color: var(--text-secondary); line-height: 1.4; word-wrap: break-word; }

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.15em;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    flex-shrink: 0;
}

.notification-close:hover { color: var(--text); }

.notification-toast.success { border-left: 4px solid var(--success); }
.notification-toast.success .notification-icon { background: var(--success-bg); color: var(--success); }
.notification-toast.info { border-left: 4px solid var(--info); }
.notification-toast.info .notification-icon { background: var(--info-bg); color: var(--info); }
.notification-toast.warning { border-left: 4px solid var(--warning); }
.notification-toast.warning .notification-icon { background: var(--warning-bg); color: var(--warning); }
.notification-toast.error { border-left: 4px solid var(--danger); }
.notification-toast.error .notification-icon { background: var(--danger-bg); color: var(--danger); }

/* ── Notification Bell & Panel ─────────────────────────────────────────── */
.notification-bell-container { position: relative; }

.notification-bell-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.25);
    cursor: pointer;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.notification-bell-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.05); }

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65em;
    font-weight: bold;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.notification-panel {
    position: absolute;
    top: 110px;
    right: 18px;
    width: 380px;
    max-height: 560px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.notification-panel-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-panel-header h3 { margin: 0; font-size: 1.15em; color: var(--text); }
.notification-actions { display: flex; gap: 8px; }

.notification-panel-list { flex: 1; overflow-y: auto; max-height: 420px; }

.notification-item {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s ease;
}

.notification-item:hover { background: var(--surface-alt); }
.notification-item.unread { background: var(--primary-light); }

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background: var(--primary);
    border-radius: 50%;
}

.notification-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.notification-time { font-size: 0.78em; color: var(--text-muted); }

.notification-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.notification-delete-btn:hover { background: var(--danger-bg); color: var(--danger); }
.notification-body { color: var(--text-secondary); font-size: 0.88em; line-height: 1.4; }
.notification-empty { padding: 36px 18px; text-align: center; color: var(--text-muted); }

.notification-panel-footer {
    padding: 8px 18px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

/* ── SOS Alerts ────────────────────────────────────────────────────────── */
.sos-button {
    position: relative;
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.08em;
    font-weight: bold;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
    user-select: none;
}

.sos-button:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5); }
.sos-button:active { transform: translateY(0); }
.sos-button.pressing { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); transform: scale(0.98); }
.sos-icon { width: 22px; height: 22px; }

.sos-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255,255,255,0.5);
    transform-origin: left;
    transform: scaleX(0);
}

@keyframes sos-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.sos-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 18px;
    animation: sos-overlay-fade-in 0.3s ease;
}

@keyframes sos-overlay-fade-in { from { opacity: 0; } to { opacity: 1; } }

.sos-alert-card {
    background: var(--surface);
    border-radius: 18px;
    max-width: 480px;
    width: 100%;
    overflow: hidden;
    animation: sos-alert-slide-up 0.4s ease;
    box-shadow: 0 16px 50px rgba(239, 68, 68, 0.4);
}

@keyframes sos-alert-slide-up {
    from { transform: translateY(40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.sos-alert-header {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 26px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.sos-alert-icon { width: 58px; height: 58px; animation: sos-pulse 1.5s ease-in-out infinite; }

@keyframes sos-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.sos-alert-header h2 { font-size: 1.9em; margin: 0; letter-spacing: 2px; }
.sos-alert-body { padding: 26px; }
.sos-alert-group { font-size: 1.05em; color: var(--text-secondary); margin-bottom: 8px; }
.sos-alert-user { font-size: 1.4em; font-weight: bold; color: var(--danger); margin-bottom: 12px; }
.sos-alert-location { font-size: 0.92em; color: var(--text-secondary); margin-bottom: 6px; font-family: var(--mono); }
.sos-alert-time { font-size: 0.88em; color: var(--text-muted); margin-bottom: 12px; }

.sos-alert-message {
    font-size: 1.02em;
    color: var(--text);
    font-style: italic;
    padding: 12px;
    background: var(--surface-alt);
    border-radius: 8px;
    border-left: 4px solid var(--danger);
}

.sos-alert-actions {
    padding: 18px 26px;
    background: var(--bg-elevated);
    display: flex;
    gap: 12px;
}

.btn-view-map, .btn-resolve {
    flex: 1;
    padding: 13px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.96em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view-map { background: var(--info); color: white; }
.btn-view-map:hover { background: #3b82f6; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(59,130,246,0.3); }
.btn-resolve { background: var(--success); color: #05201a; }
.btn-resolve:hover { background: #2bc48d; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(52,211,153,0.3); }

.sos-confirmation {
    margin-top: 12px;
    padding: 12px;
    background: var(--success-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.sos-check-icon { width: 22px; height: 22px; color: var(--success); }
.sos-confirmation span { color: var(--success); font-weight: 600; font-size: 1.02em; }

/* ── Presence Tab ──────────────────────────────────────────────────────── */
.presence-indicator {
    padding: 14px 22px;
    border-radius: 44px;
    font-size: 1.25em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.presence-indicator.status-online { background: var(--success-bg); color: var(--success); box-shadow: 0 0 12px rgba(52,211,153,0.2); }
.presence-indicator.status-away { background: var(--warning-bg); color: var(--warning); box-shadow: 0 0 12px rgba(251,191,36,0.2); }
.presence-indicator.status-idle { background: var(--surface-alt); color: var(--text-secondary); }
.presence-indicator.status-dnd { background: var(--danger-bg); color: var(--danger); box-shadow: 0 0 12px rgba(248,113,113,0.2); }
.presence-indicator.status-offline { background: var(--surface-alt); color: var(--text-muted); }

.presence-status-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.btn-status {
    padding: 11px 18px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-status:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.btn-online { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.btn-online:hover { background: var(--success); color: #05201a; }

.btn-away { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.btn-away:hover { background: var(--warning); color: #1a1d26; }

.btn-idle { background: var(--surface-alt); color: var(--text-secondary); border-color: var(--text-muted); }
.btn-idle:hover { background: var(--text-muted); color: white; }

.btn-dnd { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-dnd:hover { background: var(--danger); color: white; }

.ws-events-log {
    background: var(--surface-alt);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--mono);
    font-size: 0.83em;
    border: 1px solid var(--border);
}

.ws-events-log .event-item {
    padding: 7px 10px;
    margin-bottom: 6px;
    border-radius: 5px;
    border-left: 4px solid var(--warning);
    background: var(--surface);
}

.ws-events-log .event-item.presence { border-left-color: var(--success); }
.ws-events-log .event-item.typing { border-left-color: var(--info); }
.ws-events-log .event-item.error { border-left-color: var(--danger); background: var(--danger-bg); }
.ws-events-log .no-events { text-align: center; color: var(--text-muted); padding: 24px; font-style: italic; }

/* ── Admin Tab ─────────────────────────────────────────────────────────── */

/* Admin access banner */
.admin-access-banner {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--warning);
    font-size: 0.9em;
}

/* Admin sub-tab navigation — underline style (distinct from main tabs) */
.admin-subtab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
    padding: 0;
    background: transparent;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
}

.admin-subtab-btn {
    flex: 0 0 auto;
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    color: var(--text-secondary);
    font-size: 0.88em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.admin-subtab-btn:hover {
    color: var(--text);
    border-bottom-color: var(--text-muted);
}

.admin-subtab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* Admin panels */
.admin-panel {
    display: none;
}

.admin-panel.active {
    display: block;
}

/* Tier config collapsible sections */
details + details {
    margin-top: 4px;
}

details summary.tier-section-heading {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 0.95em;
    font-weight: 600;
    padding: 10px 12px;
    border-top: 1px dashed var(--border-light);
    cursor: pointer;
    list-style: none;
    user-select: none;
    border-radius: 6px;
    transition: background 0.15s;
}

details summary.tier-section-heading:hover {
    background: var(--bg-hover, rgba(0,0,0,0.04));
}

details summary.tier-section-heading::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    font-size: 0.7em;
    transition: transform 0.2s;
    vertical-align: middle;
}

details[open] summary.tier-section-heading::before {
    transform: rotate(90deg);
}

/* Hide default marker in webkit */
details summary.tier-section-heading::-webkit-details-marker {
    display: none;
}

/* Clickable guide cards */
#adminTab .guide-card {
    cursor: pointer;
}

.admin-role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
}

.admin-role-badge.user { background: var(--surface-alt); color: var(--text-secondary); }
.admin-role-badge.business { background: var(--success-bg); color: var(--success); }
.admin-role-badge.support { background: var(--info-bg); color: var(--info); }
.admin-role-badge.moderator { background: var(--warning-bg); color: var(--warning); }
.admin-role-badge.admin { background: var(--danger-bg); color: var(--danger); }
.admin-role-badge.super_admin { background: linear-gradient(135deg, var(--primary), #8b96ff); color: white; }

.tier-config-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.tier-config-card h4 { color: var(--primary); margin-bottom: 8px; }

.tier-config-card .config-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed var(--border);
}

.tier-config-card .config-row:last-child { border-bottom: none; }

/* ── Chat ──────────────────────────────────────────────────────────────── */
.chat-message {
    background: var(--surface-alt);
    padding: 11px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.message-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.88em; color: var(--text-secondary); }
.message-time { font-size: 0.83em; color: var(--text-muted); }
.message-content { color: var(--text); line-height: 1.4; word-wrap: break-word; }

/* ── Billing Tab ───────────────────────────────────────────────────────── */
.billing-display { margin-top: 10px; }
.billing-empty { text-align: center; color: var(--text-muted); padding: 18px; font-style: italic; }

.billing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.billing-card:hover { box-shadow: var(--shadow-md); }
.billing-card-inactive { opacity: 0.55; }

.billing-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 13px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
}

.billing-plan-name { font-weight: 600; font-size: 0.93em; color: var(--text); }

.billing-plan-tier {
    font-size: 0.73em;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.billing-tier-free { background: var(--success-bg); color: var(--success); }
.billing-tier-plus { background: var(--info-bg); color: var(--info); }
.billing-tier-pro { background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(251,146,36,0.15)); color: #fbbf24; }

.billing-card-body { padding: 10px 13px; }
.billing-price { font-size: 1.35em; font-weight: 700; color: var(--text); }
.billing-interval { color: var(--text-muted); font-size: 0.83em; margin-bottom: 3px; }
.billing-monthly-eq { color: var(--primary); font-size: 0.78em; font-weight: 500; margin-bottom: 5px; }
.billing-description { color: var(--text-secondary); font-size: 0.83em; margin: 5px 0; }
.billing-plan-id { font-size: 0.76em; color: var(--text-muted); }

.billing-plan-id code {
    background: var(--surface-alt);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.74em;
}

.billing-inactive-badge { color: var(--warning); font-weight: 600; font-size: 0.8em; margin-top: 5px; }
.billing-row { padding: 2px 0; font-size: 0.86em; color: var(--text-secondary); }
.billing-status { font-weight: 700; font-size: 0.8em; }
.billing-history-info { text-align: center; font-size: 0.8em; color: var(--text-muted); padding: 5px 0; }

.billing-history-card .billing-card-body code {
    background: var(--surface-alt);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.74em;
    word-break: break-all;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    header h1 { font-size: 1.5em; }
    .instructions-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; align-items: stretch; }
    label { min-width: auto; }
    .input-large { max-width: 100%; }
    .compass-circle { width: 330px; height: 330px; }
    .you-marker { width: 42px; height: 42px; font-size: 10px; }
    .compass-user-marker { width: 36px; height: 36px; font-size: 14px; }
    .sos-alert-card { max-width: 100%; margin: 0 18px; }
    .sos-alert-actions { flex-direction: column; }
    .btn-view-map, .btn-resolve { width: 100%; }
    .header-content { flex-direction: column; gap: 12px; }
    .header-main { text-align: center; }
    .notification-panel { width: 90vw; right: 5vw; }
}

@media (max-width: 480px) {
    .notification-container { left: 8px; right: 8px; max-width: none; }
    .notification-toast { min-width: auto; max-width: none; }
}

/* ── Accent Subsections (replace inline styles) ────────────────────────── */
.subsection-green {
    background: rgba(52, 211, 153, 0.08) !important;
    border-left: 4px solid var(--success) !important;
    padding: 15px;
}
.subsection-green h3 { color: var(--success); }
.subsection-green .hint { color: var(--success) !important; }
.subsection-green .separator-dashed { border-top-color: rgba(52, 211, 153, 0.25); }

.subsection-blue {
    background: rgba(96, 165, 250, 0.08) !important;
    border-left: 4px solid var(--info) !important;
    padding: 15px;
}
.subsection-blue h3 { color: var(--info); }
.subsection-blue .hint { color: var(--info) !important; }
.subsection-blue .separator-dashed { border-top-color: rgba(96, 165, 250, 0.25); }

.subsection-orange {
    background: rgba(251, 191, 36, 0.08) !important;
    border-left: 4px solid var(--warning) !important;
    padding: 15px;
}
.subsection-orange h3 { color: var(--warning); }
.subsection-orange .hint { color: var(--warning) !important; }

.section-ws-monitor {
    background: rgba(96, 165, 250, 0.08) !important;
    border: 2px solid var(--info) !important;
}
.section-ws-monitor h2 { color: var(--info) !important; }

/* Utility text */
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-primary { color: var(--primary) !important; }

/* Dark-safe panels/containers */
.info-panel {
    padding: 10px;
    background: var(--surface-alt);
    border-radius: 6px;
    border: 1px solid var(--border);
}

.separator-dashed {
    border-top: 1px dashed var(--border-light);
    margin-top: 15px;
    padding-top: 15px;
}

.chat-messages-box {
    height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    background: var(--bg-elevated);
    margin-bottom: 15px;
}

.tips-box {
    margin-top: 15px;
    padding: 10px;
    background: var(--success-bg);
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: var(--success);
}
.tips-box strong { color: var(--success); }
.tips-box ul { margin: 10px 0 0 20px; }
.tips-box li { color: var(--text-secondary); }

.banner-warning {
    background: var(--warning-bg) !important;
    border: 2px solid var(--warning) !important;
    margin-bottom: 20px;
}
.banner-warning h3 { color: var(--warning) !important; }
.banner-warning p { color: var(--text-secondary) !important; }

.ws-events-box {
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px;
}

/* Select dropdowns dark mode */
select {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 9px 13px;
    font-family: var(--font);
    font-size: 0.9em;
    transition: border-color 0.15s;
}
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Password inputs */
input[type="password"],
input[type="email"],
textarea {
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.9em;
    font-family: var(--font);
    background: var(--bg-elevated);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="password"]:focus,
input[type="email"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Small / help text */
small { color: var(--text-muted); }

/* OAuth buttons */
.btn-oauth-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    cursor: pointer;
    background: var(--primary);
    color: white;
    border: none;
    width: 100%;
    margin-top: 15px;
}

.btn-oauth-apple {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    cursor: pointer;
    background: #fff;
    color: #000;
    border: 1px solid var(--border);
    width: 100%;
    margin-top: 15px;
}

.terms-text {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 10px;
}

/* ── Animations ────────────────────────────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ── Admin Dashboard ──────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.stat-card {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
}
.stat-icon { font-size: 1.3em; margin-bottom: 4px; }
.stat-value { font-size: 1.4em; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.75em; color: var(--text-tertiary); margin-top: 2px; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}
.admin-table th {
    text-align: left;
    padding: 8px 6px;
    border-bottom: 2px solid var(--border);
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.admin-table td {
    padding: 7px 6px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}
.admin-table tr:hover td {
    background: var(--surface-alt);
}

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}
.role-user { background: var(--surface-alt); color: var(--text-secondary); }
.role-business { background: var(--success-bg); color: var(--success); }
.role-support { background: var(--info-bg); color: var(--info); }
.role-moderator { background: var(--warning-bg); color: var(--warning); }
.role-admin { background: var(--danger-bg); color: var(--danger); }
.role-super_admin { background: linear-gradient(135deg, var(--primary), #8b96ff); color: white; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
