*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0d1117;
  --surface:  #161b22;
  --surface2: #21262d;
  --border:   rgba(255,255,255,0.08);
  --text:     #e6edf3;
  --text2:    #8b949e;
  --blue:     #58a6ff;
  --green:    #3fb950;
  --red:      #f85149;
  --yellow:   #d29922;
}

body { background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; min-height: 100vh; }

.hidden { display: none !important; }
.page { min-height: 100vh; }

/* ── LOGIN / SETUP ─────────────────────────────────────────────────────────── */
#page-login, #page-setup {
  display: flex; align-items: center; justify-content: center; padding: 24px;
}

.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 40px 36px; width: 100%; max-width: 380px;
}

.login-logo { font-size: 36px; text-align: center; margin-bottom: 12px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; }
.login-sub { color: var(--text2); text-align: center; margin-bottom: 28px; font-size: 13px; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; color: var(--text2); font-weight: 500; }
.field input, .field select {
  width: 100%; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px; outline: none; transition: border-color .2s;
}
.field input:focus, .field select:focus { border-color: var(--blue); }
.field select { cursor: pointer; }

.otp-hint, .hint { font-size: 11px; color: var(--text2); font-weight: 400; }

.error-msg { background: rgba(248,81,73,.1); border: 1px solid rgba(248,81,73,.3); color: var(--red); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }

/* ── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; transition: opacity .15s, background .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .85; }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { background: transparent; color: var(--text2); padding: 4px 8px; font-size: 13px; border: 1px solid var(--border); border-radius: 5px; }
.btn-icon:hover { color: var(--text); background: var(--surface2); }
.w-full { width: 100%; }
.mt-16 { margin-top: 16px; }

/* ── QR SECTION ─────────────────────────────────────────────────────────────── */
.qr-section { text-align: center; margin-top: 20px; }
.qr-label { color: var(--text2); font-size: 13px; margin-bottom: 12px; }
.qr-img { width: 180px; height: 180px; border-radius: 8px; border: 4px solid #fff; display: block; margin: 0 auto 12px; }
.qr-secret-label { font-size: 12px; color: var(--text2); margin-bottom: 6px; }
.qr-secret { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; font-size: 12px; color: var(--green); letter-spacing: 1px; word-break: break-all; }

/* ── DASHBOARD ──────────────────────────────────────────────────────────────── */
#page-dashboard { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 220px; min-width: 220px; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 0;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.brand-icon { font-size: 20px; }
.brand-name { font-weight: 700; font-size: 15px; }

.sidebar-nav { flex: 1; padding: 0 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 6px; color: var(--text2); cursor: pointer; font-size: 13px;
  font-weight: 500; transition: background .15s, color .15s; text-decoration: none;
  margin-bottom: 2px; user-select: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(88,166,255,.12); color: var(--blue); }

.sidebar-footer { padding: 16px 20px 0; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-username { font-size: 12px; color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-content { flex: 1; overflow-y: auto; padding: 28px 32px; }

.tab-content { display: block; }
.tab-content.hidden { display: none; }

.tab-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.tab-title { font-size: 18px; font-weight: 700; }

/* ── TABLE ──────────────────────────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th { background: var(--surface2); padding: 11px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }
tbody td { padding: 12px 16px; font-size: 13px; vertical-align: middle; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-blue { background: rgba(88,166,255,.15); color: var(--blue); }
.badge-green { background: rgba(63,185,80,.15); color: var(--green); }
.badge-yellow { background: rgba(210,153,34,.15); color: var(--yellow); }

.actions { display: flex; gap: 6px; }
.loading { padding: 32px; text-align: center; color: var(--text2); }
.empty { padding: 32px; text-align: center; color: var(--text2); font-size: 13px; }

.account-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.account-tag { background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 7px; font-size: 11px; color: var(--text2); }

/* ── MODALS ─────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 24px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
}
.modal-box--sm { max-width: 340px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 16px; cursor: pointer; padding: 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.checkbox-list { display: flex; flex-direction: column; gap: 8px; max-height: 160px; overflow-y: auto; padding: 4px; }
.checkbox-item { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.checkbox-item input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--blue); }

.confirm-msg { color: var(--text2); font-size: 14px; margin-bottom: 4px; line-height: 1.6; }

/* ── TOAST ──────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500; z-index: 9999; animation: slideIn .25s ease;
  max-width: 320px;
}
.toast.success { background: rgba(63,185,80,.15); border: 1px solid rgba(63,185,80,.4); color: var(--green); }
.toast.error   { background: rgba(248,81,73,.15);  border: 1px solid rgba(248,81,73,.4);  color: var(--red); }

@keyframes slideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ── VOUCHER ─────────────────────────────────────────────────────────────────── */
.voucher-code {
  display: inline-block; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 12px; font-size: 14px; font-weight: 700;
  color: var(--yellow); letter-spacing: 1px; user-select: all;
}
