/* ==========================================================================
   Panel chrome — shared by the subscriber account and the admin console
   --------------------------------------------------------------------------
   Layered on theme.css. Both panels are working tools rather than pitches:
   dense, quiet, and identical in behaviour so muscle memory carries between
   them. Anything only one of them needs lives in account.css / admin.css.
   ========================================================================== */

.icon { width: 18px; height: 18px; flex-shrink: 0; }

.admin-body { min-height: 100vh; }

/* ==========================================================================
   Header
   ========================================================================== */

header {
  position: sticky; top: 0;
  z-index: var(--z-header);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 13px 24px;
  background: rgba(5, 7, 13, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.tagline {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
}
.header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.link-pill { cursor: pointer; transition: border-color var(--t), color var(--t); }
.link-pill:hover { border-color: var(--gold); color: var(--gold-bright); }

/* ==========================================================================
   Shell
   ========================================================================== */

.tabs {
  position: relative; z-index: var(--z-base);
  max-width: 1200px;
  width: calc(100% - 48px);
  margin: 18px auto 0;
}

.admin-main {
  position: relative; z-index: var(--z-base);
  max-width: 1200px;
  margin-inline: auto;
  padding: 16px 24px 8px;
}
.view { display: flex; flex-direction: column; gap: 16px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.wide { grid-column: 1 / -1; }

.admin-sub {
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
  margin: 22px 0 12px;
}

/* ==========================================================================
   Sign-in / register / verify
   ========================================================================== */

.login-screen {
  display: grid; place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
  position: relative; z-index: var(--z-base);
}
.login-card {
  width: 100%; max-width: 400px;
  display: flex; flex-direction: column; gap: 15px;
  padding: 32px 28px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.login-card .brand-mark {
  width: 46px; height: 46px;
  font-size: 17px;
  border-radius: 13px;
  margin-bottom: 2px;
}
.login-card h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.login-card .tagline { margin-top: -10px; }
.login-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-3);
}
.login-card label small {
  font-size: 11px; font-weight: 400;
  letter-spacing: 0; text-transform: none;
  color: var(--text-3);
}
.login-card .btn { width: 100%; margin-top: 4px; }
.login-card .hint { font-size: 13px; }
.login-card a { color: var(--gold); font-weight: 600; }
.login-card a:hover { color: var(--gold-bright); text-decoration: underline; }

.verify-step {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.verify-step.done { border-color: rgba(34, 197, 94, 0.3); background: var(--buy-wash); }
.verify-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.verify-label {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text);
}
.verify-label .icon { color: var(--gold); }
.verify-step .inline-form { display: flex; gap: 8px; }
.verify-step .inline-form input {
  font-family: var(--mono);
  letter-spacing: 0.28em;
  text-align: center;
}

.link-btn {
  align-self: flex-start;
  padding: 4px 0;
  font-size: 12.5px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  background: none;
  transition: color var(--t);
}
.link-btn:hover { color: var(--gold); text-decoration: underline; }

/* ==========================================================================
   Feedback
   ========================================================================== */

.admin-error {
  padding: 10px 13px;
  border-radius: var(--r-sm);
  background: var(--sell-wash);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-size: 13px;
  line-height: 1.5;
}
.result-box {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
.result-box.ok { background: var(--buy-wash); border-color: rgba(34, 197, 94, 0.28); color: #86efac; }
.result-box.error { background: var(--sell-wash); border-color: rgba(239, 68, 68, 0.28); color: #fca5a5; }
.result-box.warn { background: var(--warn-wash); border-color: rgba(245, 158, 11, 0.28); color: #fcd34d; }
.warn-box {
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--warn-wash);
  border: 1px solid rgba(245, 158, 11, 0.28);
  color: #fcd34d;
  font-size: 12.5px;
  line-height: 1.55;
}
.error { color: var(--sell); }
.ok { color: var(--buy); }
.warn { color: var(--warn); }

/* A transient confirmation. Fixed to the corner so it never displaces the
   control the user just operated. */
.toast {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: var(--z-toast);
  max-width: 340px;
  padding: 12px 16px;
  border-radius: var(--r);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: toast-in var(--t-slow) both;
}
.toast.ok { border-color: rgba(34, 197, 94, 0.4); }
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--border);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2);
  white-space: nowrap;
}
.badge.ok, .badge.done { background: var(--buy-wash); border-color: rgba(34, 197, 94, 0.3); color: var(--buy); }
.badge.open, .badge.warn { background: var(--warn-wash); border-color: rgba(245, 158, 11, 0.3); color: var(--warn); }
.badge.error, .badge.expired { background: var(--sell-wash); border-color: rgba(239, 68, 68, 0.3); color: var(--sell); }
.badge-count {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--gold);
  color: var(--text-on-gold);
  font-family: var(--mono);
  font-size: 10px; font-weight: 700;
}

/* ==========================================================================
   Stats
   ========================================================================== */

/* ==========================================================================
   Forms
   ========================================================================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
  gap: 14px;
}
.form-grid label, .settings-grid label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-3);
}
.form-grid label.check, .settings-grid label.check {
  flex-direction: row; align-items: center;
  text-transform: none; letter-spacing: 0; font-size: 13px;
  color: var(--text-2);
}
.inline-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.method-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.method-switch button {
  padding: 8px 14px;
  min-height: 38px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.method-switch button:hover { color: var(--text); border-color: var(--border-strong); }
.method-switch button.active { background: var(--gold-wash); border-color: var(--border-gold); color: var(--gold-bright); }

/* --- settings -------------------------------------------------------------
   A settings row that has been edited but not saved is marked, because a form
   this long makes it very easy to lose track of what is still pending. */
.settings-group { margin-bottom: 26px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.setting {
  display: flex; flex-direction: column; gap: 7px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color var(--t), background var(--t);
}
.setting.changed { border-color: var(--border-gold); background: var(--gold-wash); }
.setting-help { font-size: 11.5px; line-height: 1.5; color: var(--text-3); }

/* ==========================================================================
   Plans
   ========================================================================== */

.plans-grid, .plan-tile {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}
.plan-card {
  display: flex; flex-direction: column;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color var(--t), background var(--t);
}
.plan-card:hover { border-color: var(--border-strong); }
.plan-card.active, .plan-card.ok { border-color: var(--border-gold); background: var(--gold-wash); }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.plan-head h3, .plan-head strong { font-size: 15px; font-weight: 700; }
.plan-price {
  font-family: var(--mono);
  font-size: 25px; font-weight: 600;
  letter-spacing: -0.03em;
  margin: 10px 0 3px;
}
.plan-body { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.plan-features { list-style: none; display: grid; gap: 8px; margin: 14px 0 18px; }
.plan-features li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; line-height: 1.5;
  color: var(--text-2);
}
.plan-features .icon { width: 14px; height: 14px; margin-top: 2px; color: var(--gold); }
.plan-card .btn { margin-top: auto; width: 100%; }

/* ==========================================================================
   Payments
   ========================================================================== */

.payment-card {
  padding: 15px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.payment-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.payment-body { font-size: 13px; line-height: 1.6; color: var(--text-2); }
.payment-body .mono { color: var(--text); }

/* ==========================================================================
   Rows, logs, paging
   ========================================================================== */

.admin-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 13px 15px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.event-log {
  max-height: 240px;
  overflow-y: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-sunken);
}
.event {
  display: flex; align-items: baseline; gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-2);
}
.event:last-child { border-bottom: none; }
.event.error { color: #fca5a5; }
.event.warn { color: #fcd34d; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.pager .mono { font-size: 12px; color: var(--text-3); }

/* ==========================================================================
   WhatsApp pairing
   ========================================================================== */

.qr-box {
  display: grid; place-items: center;
  gap: 12px;
  padding: 20px;
  min-height: 240px;
  border-radius: var(--r);
  background: var(--bg-sunken);
  border: 1px dashed var(--border-strong);
  text-align: center;
}
/* The QR must be read by a phone camera pointed at the screen, so it keeps a
   white quiet zone regardless of the surrounding dark theme. */
.qr-box img {
  width: 210px; height: 210px;
  border-radius: var(--r-sm);
  background: #fff;
  padding: 9px;
}
.pairing-code {
  font-family: var(--mono);
  font-size: 27px; font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--gold-bright);
  padding: 13px 20px;
  border-radius: var(--r);
  background: var(--gold-wash);
  border: 1px solid var(--border-gold);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  header { padding: 11px 16px; gap: 12px; }
  header .tagline { display: none; }
  .tabs { width: calc(100% - 32px); margin-top: 14px; }
  .admin-main { padding: 14px 16px 8px; }
  .login-card { padding: 26px 20px; }
  .two-col { grid-template-columns: 1fr; }
  .settings-grid, .form-grid { grid-template-columns: 1fr; }
  .toast { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}
