/* =========================================================
   Tick11FX - dashboard (/app) + super admin (/admin)
   Landing page (frontend/src/styles.css) jaisa hi look:
   wahi colors, fonts, gradient, pill buttons, glass cards.
   ========================================================= */

:root {
  --bg: #070b16;
  --bg-2: #0b1121;
  --surface: #0e1528;
  --surface-2: #131c35;
  --border: #1d2845;
  --border-strong: #2a3860;

  --text: #e8ecf6;
  --text-2: #a1abc6;
  --muted: #66728f;

  --violet: #7c5cff;
  --cyan: #22d3ee;
  --green: #22c55e;
  --red: #f43f5e;
  --amber: #fbbf24;

  --grad: linear-gradient(135deg, var(--violet), var(--cyan));

  /* Page ki chaudai: poori screen use karo (koi cap nahi), sirf side padding.
     Topbar aur page dono yahi lete hain - logo aur content ek line me rehte hain. */
  --page-max: none;
  --page-pad: clamp(16px, 3vw, 48px);

  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --shadow: 0 10px 40px rgba(0, 0, 0, .35);
  --glow: 0 0 0 1px rgba(124, 92, 255, .25), 0 20px 60px -20px rgba(124, 92, 255, .45);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(124, 92, 255, .4); }

.hidden { display: none !important; }
.muted  { color: var(--muted); }
.small  { font-size: 13px; }
.center { text-align: center; }

/* ---------- Background (landing jaisa grid + orbs) ---------- */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .35; }
.orb-1 { width: 520px; height: 520px; background: #5b3df5; top: -200px; left: -160px; }
.orb-2 { width: 460px; height: 460px; background: #0ea5c6; top: 80px; right: -200px; opacity: .22; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-tag {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: #c9bfff; padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(124, 92, 255, .35); background: rgba(124, 92, 255, .1);
}

/* ---------- Top bar (landing nav jaisa) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(7, 11, 22, .72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad);
  height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav-link { font-size: 14.5px; font-weight: 500; color: var(--text-2); }
.nav-link:hover { color: var(--text); text-decoration: none; }

/* ---------- Page ---------- */
.wrap {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px var(--page-pad) 80px;
  display: grid;
  /* minmax(0,1fr): wide table column ko bahar na dhakele - table-wrap khud scroll kare */
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.page-head { margin-bottom: 4px; }
.page-head h1 { margin: 0; font-size: clamp(26px, 3.4vw, 34px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.page-head p { margin: 8px 0 0; color: var(--text-2); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(19, 28, 53, .75), rgba(11, 17, 33, .85));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.card-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Auth (login / sign up) ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  position: relative;
  width: 100%; max-width: 420px;
  background: linear-gradient(180deg, rgba(19, 28, 53, .92), rgba(11, 17, 33, .96));
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 32px 30px;
  box-shadow: var(--shadow), var(--glow);
}
.auth-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(140deg, rgba(124, 92, 255, .6), transparent 40%, transparent 60%, rgba(34, 211, 238, .5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.auth-card .brand { margin-bottom: 22px; }
.auth-card h1 { margin: 0 0 6px; font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.auth-card > p { margin: 0 0 22px; }

.plan-box {
  display: flex; justify-content: space-between; align-items: center;
  background: rgba(124, 92, 255, .08);
  border: 1px solid rgba(124, 92, 255, .3);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin: 4px 0 18px;
}
.plan-box span { display: block; font-size: 13px; }
.price { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.price span { font-size: 13px; font-weight: 500; }

.switch { text-align: center; margin: 20px 0 0; font-size: 14px; color: var(--text-2); }
.switch a { margin-left: 6px; font-weight: 600; }

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  margin-bottom: 14px;
}
input, select {
  display: block; width: 100%;
  margin-top: 6px;
  padding: 11px 13px;
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
input::placeholder { color: var(--muted); }
input:focus, select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, .2);
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; align-items: end; }
.span2 { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ---------- Buttons (landing jaisa pill) ---------- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .02);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s, border-color .25s;
}
button:hover:not(:disabled) { border-color: var(--violet); background: rgba(124, 92, 255, .08); transform: translateY(-1px); }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.primary {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px -8px rgba(124, 92, 255, .7);
}
.primary:hover:not(:disabled) {
  background: var(--grad); border-color: transparent;
  box-shadow: 0 14px 34px -10px rgba(124, 92, 255, .85); transform: translateY(-2px);
}
.ghost { background: rgba(255, 255, 255, .02); }
.danger { background: var(--red); border-color: var(--red); color: #fff; }
.danger:hover:not(:disabled) { background: #e11d48; border-color: #e11d48; }
.danger.ghost { background: transparent; color: var(--red); border-color: rgba(244, 63, 94, .4); }
.danger.ghost:hover:not(:disabled) { background: rgba(244, 63, 94, .1); border-color: var(--red); }
.auth-card .primary, form .primary.span2 { width: 100%; padding: 12px 20px; font-size: 15px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.actions.right { justify-content: flex-end; }

button.tiny { padding: 5px 12px; font-size: 12.5px; }

/* ---------- Pills, tags, badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  background: rgba(255, 255, 255, .02);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.ok   { color: #86efac; border-color: rgba(34, 197, 94, .4); background: rgba(34, 197, 94, .08); }
.pill.ok::before { background: var(--green); box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.pill.bad  { color: #fda4af; border-color: rgba(244, 63, 94, .4); background: rgba(244, 63, 94, .08); }
.pill.bad::before { background: var(--red); }

/* Server / Local switch */
.seg {
  display: inline-flex; padding: 3px; gap: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, .02);
}
.seg button { border: 0; border-radius: 999px; background: transparent; color: var(--text-2); padding: 6px 16px; font-size: 13px; }
.seg button:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .04); transform: none; }
.seg button.on { background: var(--grad); color: #fff; }
.seg button.on[data-target="local"] { background: var(--amber); color: #111; }

.opt-row[hidden] { display: none; }
.opt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }

.target-tag {
  display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, .4); color: var(--cyan); background: rgba(34, 211, 238, .08);
}
.target-tag.local { border-color: rgba(251, 191, 36, .45); color: var(--amber); background: rgba(251, 191, 36, .08); }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; letter-spacing: .05em;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, .03);
  color: var(--text-2);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.READY        { color: #86efac; border-color: rgba(34, 197, 94, .4);  background: rgba(34, 197, 94, .08); }
.badge.FAILED       { color: #fda4af; border-color: rgba(244, 63, 94, .4);  background: rgba(244, 63, 94, .08); }
.badge.DEGRADED,
.badge.UPDATING,
.badge.PROVISIONING,
.badge.PENDING      { color: #fcd34d; border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .08); }
.badge.DISCONNECTED { color: var(--muted); }

/* ---------- Key / endpoint boxes ---------- */
.keyrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgba(0, 0, 0, .28);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 10px 10px 14px;
  margin-top: 8px;
  overflow-x: auto;
}
.keyrow code { white-space: nowrap; color: var(--text); font-size: 13px; }

.reveal {
  margin-top: 16px;
  padding: 16px 18px;
  border: 1px solid rgba(251, 191, 36, .4);
  border-radius: var(--r-md);
  background: rgba(251, 191, 36, .06);
  font-size: 13.5px;
}
.reveal.live {
  border-color: rgba(34, 197, 94, .35);
  background: linear-gradient(160deg, rgba(34, 197, 94, .08), rgba(34, 211, 238, .04));
}

.note {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  border: 1px solid rgba(244, 63, 94, .4);
  background: rgba(244, 63, 94, .08);
  color: #fda4af;
}
.note.warn { border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .07); color: #fcd34d; }
.verify-banner { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 18px; }
.verify-banner button { flex: none; }

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .015);
}
.kv span { display: block; font-size: 12px; margin-bottom: 2px; }
.kv b { font-weight: 600; font-size: 14.5px; word-break: break-all; }
/* Health: hara = theek, peela = ruko / pata nahi, laal = kaam nahi karega */
.kv b.st-ok   { color: #86efac; }
.kv b.st-warn { color: #fcd34d; }
.kv b.st-bad  { color: #fda4af; }

.progress { margin-top: 16px; font-size: 13px; color: var(--text-2); }
.bar { height: 4px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.bar i { display: block; height: 100%; width: 35%; background: var(--grad); border-radius: 4px; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--r-md); }
/* Scroll karne wale table / key box ka scrollbar dark theme jaisa (default safed patti nahi) */
.table-wrap, .keyrow code { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left;
  font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
  padding: 11px 14px;
  background: rgba(255, 255, 255, .02);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
tbody tr { transition: background .2s; }
tbody tr:hover { background: rgba(124, 92, 255, .05); }
tbody tr:last-child td { border-bottom: none; }
td code { color: var(--text); }
.pos { color: #86efac; }
.neg { color: #fda4af; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 16px;
  background: rgba(3, 6, 14, .7);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal-card {
  width: 100%; max-width: 460px;
  background: linear-gradient(180deg, rgba(19, 28, 53, .96), rgba(11, 17, 33, .98));
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow), var(--glow);
}
.modal-card h3 { margin: 0 0 10px; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.modal-card p  { margin: 0; font-size: 14px; color: var(--text-2); }
.modal-card form { margin-top: 14px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100;
  max-width: min(560px, 90vw);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px; font-weight: 500;
  background: rgba(19, 28, 53, .95);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.toast.err { border-color: rgba(244, 63, 94, .5); color: #fda4af; }
.toast.ok  { border-color: rgba(34, 197, 94, .5); color: #86efac; }

/* ---------- Admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat {
  background: linear-gradient(180deg, rgba(19, 28, 53, .75), rgba(11, 17, 33, .85));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
}
.stat span { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.stat b { display: block; margin-top: 4px; font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat:first-child b, .stat:nth-child(3) b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.row-actions { display: flex; gap: 6px; }

/* Accounts list: row click = woh account chuno */
.acc-table tbody tr { cursor: pointer; }
.acc-table tbody tr.sel td { background: rgba(124, 92, 255, .08); }
.acc-table tbody tr:hover td { background: rgba(255, 255, 255, .03); }

/* Overview: chhote stat tiles, section headings */
.ov-stats .stat b { font-size: 19px; }
.ov-h { margin: 22px 0 4px; font-size: 14.5px; font-weight: 700; }
.wrap-text { white-space: normal; max-width: 280px; }
code.pw {
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px 8px;
}
details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "\25B8"; color: var(--muted); transition: transform .2s; }
details[open] > summary::before { transform: rotate(90deg); }
details[open] > summary { margin-bottom: 12px; }

@media (max-width: 640px) {
  .topbar-inner { padding: 0 16px; height: auto; min-height: 64px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .wrap { padding: 24px 16px 60px; }
  .card { padding: 18px; }
}

/* ---------- Billing (billing.js) ---------- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.plan-tile {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .02);
}
.plan-tile.current { border-color: rgba(124, 92, 255, .55); background: rgba(124, 92, 255, .07); }
.plan-tile h3 { margin: 0; font-size: 15px; font-weight: 700; }
.plan-tile ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--text-2); }
.plan-tile label { margin: 0; font-size: 13px; }
.plan-tile input { margin-top: 4px; }
.plan-tile button { margin-top: auto; }

/* Accounts ki ginti: [ − | n | + ] ek hi dabba */
.plan-tile .qty { display: flex; flex-direction: column; gap: 6px; }
.stepper {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px;
  border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden;
  background: rgba(255, 255, 255, .03);
  transition: border-color .2s, box-shadow .2s;
}
.stepper:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 92, 255, .2); }
.plan-tile .stepper button {
  margin: 0; padding: 0; height: 42px;
  border: 0; border-radius: 0; background: transparent;
  font-size: 18px; line-height: 1;
}
.plan-tile .stepper button:first-child { border-right: 1px solid var(--border); }
.plan-tile .stepper button:last-child { border-left: 1px solid var(--border); }
.plan-tile .stepper button:hover:not(:disabled) { background: rgba(124, 92, 255, .14); transform: none; }
.plan-tile .stepper button:focus-visible { outline-offset: -3px; }
.plan-tile .stepper input {
  margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none;
  text-align: center; font-weight: 700;
  appearance: textfield; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* "/ account / mo" ek saath agli line par jaye, beech se na toote */
.plan-tile .price .muted { white-space: nowrap; }
.badge.PAID    { color: #86efac; border-color: rgba(34, 197, 94, .4);  background: rgba(34, 197, 94, .08); }
.badge.TRIAL   { color: #93c5fd; border-color: rgba(59, 130, 246, .4); background: rgba(59, 130, 246, .08); }
.badge.EXPIRED { color: #fcd34d; border-color: rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .08); }
.st-paid { color: #86efac; }
.st-failed, .st-expired { color: #fda4af; }

/* API requests: "Errors only" checkbox (upar wala input style yahan nahi chahiye), galti ki chhoti line */
.inline-check { display: inline-flex; align-items: center; gap: 7px; margin: 0 8px 0 0; cursor: pointer; color: var(--muted); }
.inline-check input { display: inline-block; width: auto; margin: 0; padding: 0; accent-color: var(--violet); }
.rq-sub { display: block; max-width: 340px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; color: var(--muted); }
.tag { margin-left: 6px; padding: 1px 7px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: 11px; color: var(--text-2); }
#rq-more-row { align-items: center; }
