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

:root {
  --bg: #0f1117;
  --bg2: #1a1d27;
  --bg3: #242736;
  --accent: #25d366;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3b82f6;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --border: #2d3148;
  --radius: 8px;
}

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

/* ── Auth ── */
.auth-page { align-items: center; justify-content: center; }
.auth-card { background: var(--bg2); padding: 2.5rem; border-radius: 16px; width: 100%; max-width: 420px; border: 1px solid var(--border); }
.logo { font-size: 2rem; text-align: center; margin-bottom: .75rem; }

/* ── Auth tabs ── */
.auth-tabs { display: flex; background: var(--bg3); border-radius: var(--radius); padding: 4px; margin-bottom: 1.5rem; gap: 4px; }
.auth-tab { flex: 1; padding: .5rem; border: none; border-radius: 6px; background: transparent; color: var(--text2); cursor: pointer; font-size: .9rem; font-weight: 500; transition: all .15s; }
.auth-tab.active { background: var(--accent); color: #000; }

/* ── Password toggle ── */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.5rem; }
.pw-toggle { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 1rem; user-select: none; }

/* ── Messages ── */
.err-msg { color: #f87171; font-size: .85rem; margin-bottom: .75rem; padding: .6rem .9rem; background: #7f1d1d33; border-radius: var(--radius); }
.ok-msg { color: #4ade80; font-size: .85rem; margin-bottom: .75rem; padding: .6rem .9rem; background: #16532433; border-radius: var(--radius); }

/* ── Sidebar ── */
.sidebar { width: 230px; min-height: 100vh; background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 1.5rem 0; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; }
.sidebar-logo { font-size: 1.3rem; font-weight: 700; color: var(--accent); padding: 0 1.25rem .75rem; }
.member-info { text-align: center; padding: 1rem; border-bottom: 1px solid var(--border); margin-bottom: .5rem; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: #000; font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto .5rem; }
.member-name { font-weight: 600; font-size: .95rem; margin-bottom: .35rem; }
.nav-item { display: block; padding: .7rem 1.25rem; color: var(--text2); text-decoration: none; border-radius: var(--radius); margin: 0 .5rem .2rem; transition: all .15s; font-size: .9rem; }
.nav-item:hover, .nav-item.active { background: var(--bg3); color: var(--accent); }
.sidebar-footer { margin-top: auto; padding: 1rem; }

/* ── Content ── */
.content { margin-left: 230px; padding: 2rem; flex: 1; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
h2 { font-size: .85rem; margin: 1.5rem 0 .75rem; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; text-align: center; }
.stat-val { font-size: 1.75rem; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--text2); font-size: .8rem; margin-top: .25rem; }

/* ── Usage bar ── */
.usage-section { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; }
.usage-header { display: flex; justify-content: space-between; margin-bottom: .75rem; font-size: .9rem; }
.usage-bar-bg { background: var(--bg3); border-radius: 100px; height: 10px; }
.usage-bar-fill { height: 10px; border-radius: 100px; background: var(--accent); transition: width .5s ease; }
.usage-bar-fill.warn { background: var(--warning); }
.usage-bar-fill.danger { background: var(--danger); }

/* ── Session cards ── */
.session-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.session-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.session-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .75rem; }
.session-name { font-weight: 700; font-size: 1rem; }
.session-phone { color: var(--text2); font-size: .8rem; margin-top: .2rem; }
.session-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }

/* ── Sessions quick on overview ── */
.sessions-quick { display: flex; flex-wrap: wrap; gap: .75rem; }
.sq-item { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem 1rem; font-size: .875rem; display: flex; align-items: center; gap: .5rem; }

/* ── Quick start ── */
.quickstart { display: flex; flex-direction: column; gap: .75rem; }
.qs-step { display: flex; align-items: center; gap: 1rem; background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.qs-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #000; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ── Key cards ── */
.key-cards { display: flex; flex-direction: column; gap: .75rem; }
.key-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.key-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.key-label { font-weight: 600; }
.key-value { font-family: monospace; font-size: .85rem; color: var(--accent); background: var(--bg3); padding: .5rem .75rem; border-radius: var(--radius); word-break: break-all; margin-bottom: .75rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.key-meta { font-size: .8rem; color: var(--text2); }

/* ── Docs ── */
.docs-header { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.5rem; font-size: .9rem; }
.doc-section { margin-bottom: 2rem; }
.endpoint-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: .75rem; }
.ep-method { display: inline-block; padding: .25rem .6rem; border-radius: 4px; font-size: .75rem; font-weight: 700; margin-bottom: .5rem; }
.get { background: #1e3a5f; color: #60a5fa; }
.post { background: #14532d; color: #4ade80; }
.delete { background: #7f1d1d; color: #f87171; }
.ep-path { font-family: monospace; font-size: .95rem; font-weight: 600; margin-bottom: .35rem; }
.ep-desc { font-size: .85rem; color: var(--text2); margin-bottom: .5rem; }

/* ── Table ── */
.table { width: 100%; border-collapse: collapse; background: var(--bg2); border-radius: var(--radius); overflow: hidden; font-size: .875rem; }
.table th { background: var(--bg3); color: var(--text2); padding: .7rem 1rem; text-align: left; font-weight: 600; }
.table td { padding: .65rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--bg3); }

/* ── Forms ── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .8rem; color: var(--text2); margin-bottom: .35rem; }
input, select, textarea { width: 100%; padding: .6rem .9rem; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: .9rem; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.checkbox-group { display: flex; gap: 1rem; }
.checkbox-group label { display: flex; align-items: center; gap: .4rem; font-size: .9rem; color: var(--text); cursor: pointer; width: auto; }
.checkbox-group input[type=checkbox] { width: auto; }

/* ── Buttons ── */
.btn { padding: .5rem 1.1rem; border: none; border-radius: var(--radius); cursor: pointer; font-size: .875rem; font-weight: 500; transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-primary { background: var(--accent); color: #000; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.w-full { width: 100%; }

/* ── Badges ── */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 100px; font-size: .75rem; font-weight: 600; }
.badge-green { background: #16532433; color: #4ade80; }
.badge-red { background: #7f1d1d33; color: #f87171; }
.badge-yellow { background: #78350f33; color: #fbbf24; }
.badge-blue { background: #1e3a5f33; color: #60a5fa; }

/* ── Info box ── */
.info-box { background: #1e3a5f22; border: 1px solid #3b82f633; border-radius: var(--radius); padding: 1rem 1.25rem; font-size: .875rem; color: #93c5fd; margin-bottom: 1.25rem; }

/* ── Card ── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }

/* ── Code ── */
pre.code-block { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; font-size: .82rem; overflow-x: auto; margin-top: .5rem; line-height: 1.6; color: #a5f3fc; }
code { background: var(--bg3); padding: .1rem .4rem; border-radius: 4px; font-size: .85rem; color: var(--accent); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--bg2); border-radius: 12px; padding: 2rem; width: 100%; max-width: 440px; border: 1px solid var(--border); }
.modal h3 { margin-bottom: 1.25rem; font-size: 1.1rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }
.hidden { display: none !important; }

/* ── Pagination ── */
.pagination { display: flex; gap: .5rem; margin-top: 1rem; }
.pagination button { padding: .4rem .8rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg2); color: var(--text); cursor: pointer; }
.pagination button.active { background: var(--accent); color: #000; border-color: var(--accent); }

/* ── Spinner ── */
.spinner { width: 48px; height: 48px; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 2rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── QR ── */
#qrContainer img { max-width: 240px; border-radius: var(--radius); border: 4px solid var(--accent); }

/* ── Profile section ── */
.profile-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: #000; font-size: 2rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.profile-meta { font-size: .85rem; color: var(--text2); margin-top: .25rem; }