/* ─────────────────────────────────────────────────────────────────────────────
   RESET + ROOT
───────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* CRITICAL: prevent ALL horizontal overflow at the root */
html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  max-width: 100vw;
}

:root {
  /* Palette */
  --bg:          #09090b;
  --bg2:         #0f0f12;
  --surface:     #18181b;
  --surface2:    #1f1f24;
  --surface3:    #27272d;
  --border:      #2a2a33;
  --border2:     #38383f;

  --accent:      #3b82f6;
  --accent-h:    #2563eb;
  --accent-dim:  rgba(59,130,246,.1);
  --accent-glow: rgba(59,130,246,.2);

  --green:       #22c55e;
  --green-dim:   rgba(34,197,94,.1);
  --red:         #ef4444;
  --red-dim:     rgba(239,68,68,.1);
  --yellow:      #eab308;
  --yellow-dim:  rgba(234,179,8,.1);

  --text:        #f4f4f5;
  --text2:       #a1a1aa;
  --text3:       #52525b;

  --radius:      6px;
  --radius-lg:   10px;
  --font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:        'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────────────────────────────────────
   UTILITIES
───────────────────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.w-full   { width: 100%; }
.code-ta  { font-family: var(--mono); font-size: 0.82rem; }
.form-error   { color: var(--red);   font-size: 0.78rem; min-height: 1rem; }
.form-success { color: var(--green); font-size: 0.78rem; min-height: 1rem; }

/* ── Env var rows ─────────────────────────────────────────────────────────── */
.env-rows { display: flex; flex-direction: column; gap: 8px; }
.env-row  { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.env-row input {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 7px 10px; font-size: 13px; font-family: var(--mono);
  outline: none; width: 100%;
}
.env-row input:focus { border-color: var(--accent); }
.env-row input::placeholder { color: var(--text2); opacity: .5; }
.env-row-del {
  background: none; border: 1px solid transparent; border-radius: 6px;
  color: var(--text2); cursor: pointer; padding: 6px 9px; font-size: 16px; line-height: 1;
  transition: color .15s, border-color .15s;
}
.env-row-del:hover { color: var(--red); border-color: rgba(239,68,68,.3); }

/* Scrollbars */
::-webkit-scrollbar          { width: 4px; height: 4px; }
::-webkit-scrollbar-track    { background: transparent; }
::-webkit-scrollbar-thumb    { background: var(--border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* ─────────────────────────────────────────────────────────────────────────────
   FORMS + INPUTS
───────────────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.8rem; font-weight: 500; color: var(--text2); }
.field small  { font-size: 0.74rem; color: var(--text3); font-weight: 400; }

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="number"], textarea, select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  padding: 0.55rem 0.8rem;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
textarea { resize: vertical; }

/* ─────────────────────────────────────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────────────────────────────────────── */
.btn {
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  gap: 0.4rem;
  justify-content: center;
  line-height: 1.4;
  padding: 0.5rem 1rem;
  transition: background .12s, border-color .12s, transform .08s, opacity .12s;
  white-space: nowrap;
  user-select: none;
}
.btn:hover         { background: var(--surface3); border-color: var(--border2); }
.btn:active        { transform: scale(0.97); }
.btn-primary       { background: var(--accent);   border-color: var(--accent);  color: #fff; }
.btn-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.btn-danger        { background: var(--red);       border-color: var(--red);     color: #fff; }
.btn-danger:hover  { filter: brightness(1.1); }
.btn-ghost         { background: transparent; border-color: transparent; color: var(--text2); }
.btn-ghost:hover   { background: var(--surface2); border-color: var(--border); color: var(--text); }
.btn-sm            { font-size: 0.8rem;  padding: 0.38rem 0.75rem; }
.btn-xs            { font-size: 0.75rem; padding: 0.25rem 0.55rem; }
.btn:disabled      { opacity: 0.38; cursor: not-allowed; transform: none !important; }

/* ─────────────────────────────────────────────────────────────────────────────
   VIEWS (each view = 100vh, overflow hidden)
───────────────────────────────────────────────────────────────────────────── */
.view {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* ═════════════════════════════════════════════════════════════════════════════
   AUTH
═════════════════════════════════════════════════════════════════════════════ */
.auth-scene {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(59,130,246,.15), transparent);
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.auth-orb1 {
  width: 500px; height: 400px;
  background: rgba(59,130,246,.12);
  top: -100px; left: -100px;
}
.auth-orb2 {
  width: 400px; height: 350px;
  background: rgba(59,130,246,.08);
  bottom: -80px; right: -80px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px rgba(255,255,255,.03), 0 40px 80px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 2rem;
  position: relative;
  width: 100%;
  max-width: 380px;
  z-index: 1;
}

.ac-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.25rem;
}

.ac-logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 20px var(--accent-glow);
  color: #fff;
}

.ac-logo-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ac-brand {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
}

.ac-tagline {
  font-size: 0.72rem;
  color: var(--text3);
  letter-spacing: 0.02em;
}

.auth-tabs {
  display: flex;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}

.auth-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text2);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.83rem;
  font-weight: 500;
  padding: 0.45rem;
  transition: background .15s, color .15s;
}
.auth-tab.active { background: var(--surface3); color: var(--text); }
.auth-tab:hover:not(.active) { color: var(--text); }

.auth-form { display: flex; flex-direction: column; gap: 0.85rem; }

/* ═════════════════════════════════════════════════════════════════════════════
   APP SHELL (dashboard)
═════════════════════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: row;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 210px;
  flex-shrink: 0;
  height: 100%;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sb-logo-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.1rem 1rem 0.9rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sb-logomark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.sb-brand {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
}

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.55rem;
  overflow-y: auto;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .1s, color .1s;
  user-select: none;
}
.sb-item svg { flex-shrink: 0; }
.sb-item:hover  { background: var(--surface2); color: var(--text); }
.sb-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.sb-item.active svg { color: var(--accent); }

/* ─── Sidebar footer (user info) ─────────────────────────────────────────── */
.sb-footer {
  padding: 0.75rem 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex-shrink: 0;
}

.sbf-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.tn-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.76rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.sbf-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.1rem;
}

.sbf-username {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sbf-tokens {
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--accent);
}

.sbf-signout {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text3);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.32rem 0.7rem;
  width: 100%;
  transition: color .15s, border-color .15s, background .15s;
}
.sbf-signout:hover { color: var(--red); border-color: rgba(239,68,68,.35); background: var(--red-dim); }

/* ─── Main area ──────────────────────────────────────────────────────────── */
.main-area {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.main-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.5px; }
.main-desc  { font-size: 0.8rem; color: var(--text2); margin-top: 0.25rem; }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}

.main-area > div { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.main-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 1.75rem 2rem;
}

/* ─── Bot grid ───────────────────────────────────────────────────────────── */
#bot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.bot-row {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.bot-row:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(0,0,0,.35);
}
.bot-row:active { transform: translateY(0); }

/* Coloured left accent strip based on status */
.bot-row::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--border);
  border-radius: 12px 0 0 12px;
  transition: background .2s;
}
.bot-row.running::before   { background: var(--green); }
.bot-row.error::before     { background: var(--red); }
.bot-row.suspended::before { background: #f59e0b; }

.bot-row-top {
  display: flex; align-items: center;
  padding: 1.1rem 1.1rem 0.75rem 1.3rem;
  gap: 0.85rem;
}

.bot-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.bot-indicator {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.bot-indicator.running { background: var(--green); box-shadow: 0 0 8px var(--green); }
.bot-indicator.stopped { background: var(--text3); }
.bot-indicator.error   { background: var(--red); box-shadow: 0 0 8px var(--red); }

.bot-info { flex: 1; min-width: 0; }
.bot-name { font-size: 0.93rem; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-meta { font-size: 0.74rem; color: var(--text2); margin-top: 0.2rem; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.bot-badges { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }

/* ─── Bot card resource bars ─────────────────────────────────────────────── */
.bot-row-bars {
  padding: 0.75rem 1.25rem 0.95rem 1.4rem;
  border-top: 1px solid var(--border);
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
}

.bot-res-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.bot-res-label {
  font-size: 0.67rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  width: 50px;
  flex-shrink: 0;
}

.mini-bar-track {
  flex: 1;
  height: 4px;
  background: var(--surface3);
  border-radius: 9999px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9999px;
  transition: width 0.4s ease;
}
.mini-bar-fill--warn   { background: #f59e0b; }
.mini-bar-fill--danger { background: var(--red); }

.bot-res-val {
  font-size: 0.68rem;
  color: var(--text2);
  font-family: var(--mono);
  width: 110px;
  text-align: right;
  flex-shrink: 0;
  white-space: nowrap;
}

.badge {
  font-size: 0.7rem; font-weight: 600;
  padding: 0.18rem 0.52rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.badge-mono { background: var(--surface3); color: var(--text2); font-family: var(--mono); }

.status-badge {
  font-size: 0.67rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 0.2rem 0.55rem; border-radius: 4px;
}
.status-badge.running { background: var(--green-dim); color: var(--green); }
.status-badge.stopped { background: var(--surface3);  color: var(--text3); }
.status-badge.error   { background: var(--red-dim);   color: var(--red);   }

/* Also keep status-dot for the bot panel header */
.status-dot {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.status-dot::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text3);
}
.status-dot.running::before { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.stopped::before { background: var(--text3); }
.status-dot.error::before   { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-dot.running { color: var(--green); }
.status-dot.stopped { color: var(--text3); }
.status-dot.error   { color: var(--red); }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; padding: 5rem 1.5rem;
  color: var(--text2); text-align: center;
  grid-column: 1 / -1;
}
.empty-state svg  { opacity: 0.25; }
.empty-state p    { font-size: 0.875rem; }

/* ═════════════════════════════════════════════════════════════════════════════
   PLAN PAGE
═════════════════════════════════════════════════════════════════════════════ */

/* ── Current plan card ───────────────────────────────────────────────────── */
.cpc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin: 0 auto 2rem;
  overflow: hidden;
  max-width: 960px;
}

.cpc--active {
  border-color: rgba(59,130,246,.4);
  background: linear-gradient(135deg, rgba(59,130,246,.07) 0%, var(--surface) 60%);
  box-shadow: 0 0 0 1px rgba(59,130,246,.08), 0 8px 32px rgba(0,0,0,.25);
}

.cpc-body {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 1.5rem 1.75rem;
}

.cpc-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text3);
  margin-bottom: 0.4rem;
}

.cpc-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.cpc-expiry-row { margin-top: 0.5rem; }

.cpc-countdown {
  font-size: 0.82rem;
  color: var(--text2);
}

.cpc-expiry-badge {
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  letter-spacing: 0.03em;
}

.cpc-right { text-align: right; }

.cpc-tokens {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 0.6rem;
}

.cpc-renew { margin-top: 0.25rem; }

/* ── Section label ───────────────────────────────────────────────────────── */
.plan-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text3);
  margin-bottom: 0.85rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Plan grid ───────────────────────────────────────────────────────────── */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
  max-width: 960px;
  margin: 0 auto;
}

.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}

.plan-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}

.plan-card--current {
  border-color: rgba(59,130,246,.45);
  background: linear-gradient(160deg, rgba(59,130,246,.07) 0%, var(--surface) 55%);
  box-shadow: 0 0 0 1px rgba(59,130,246,.08);
}

.plan-card--free {
  opacity: 0.75;
}

/* Plan card head */
.pc-head { display: flex; flex-direction: column; gap: 0.3rem; }

.pc-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pc-name {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
}

.pc-badge {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(59,130,246,.25);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
}

.pc-desc {
  font-size: 0.77rem;
  color: var(--text2);
  line-height: 1.4;
}

/* Pricing */
.pc-pricing {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pc-price {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--accent);
  line-height: 1.1;
}

.pc-price small {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0;
}

.pc-period {
  font-size: 0.74rem;
  color: var(--text3);
}

/* Feature list */
.pc-features {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex: 1;
}

.pc-feature {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.8rem;
}

.pc-feat-icon {
  font-size: 0.72rem;
  width: 16px;
  flex-shrink: 0;
  text-align: center;
}

.pc-feat-label {
  color: var(--text2);
  flex: 1;
}

.pc-feat-val {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--text);
  font-weight: 600;
}

/* CTA */
.pc-cta { width: 100%; margin-top: auto; }

/* ── Auto renew ──────────────────────────────────────────────────────────── */
.auto-renew-wrap {
  margin: 0 1.75rem 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.auto-renew-copy {
  min-width: 0;
}

.auto-renew-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.auto-renew-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text2);
}

.auto-renew-msg {
  min-height: 18px;
  margin: 0 1.75rem 1rem;
  font-size: 12px;
  color: var(--text2);
}

.auto-renew-msg.success { color: var(--green); }
.auto-renew-msg.error { color: var(--red); }

.trial-redeem-box {
  max-width: 960px;
  margin: 0 auto 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.trial-redeem-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.trial-redeem-left { flex: 1; min-width: 160px; }
.trial-redeem-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.trial-redeem-sub {
  font-size: 12px;
  color: var(--text2);
  margin-top: 2px;
}
.trial-redeem-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}
.trial-code-input {
  width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 13px;
  color: var(--text);
  font-family: var(--mono, monospace);
  letter-spacing: 0.06em;
}
.trial-code-input:focus { outline: none; border-color: var(--accent); }
.trial-redeem-msg {
  margin-top: 0.5rem;
  font-size: 12px;
  color: var(--text2);
}
.trial-redeem-msg.success { color: var(--green); }
.trial-redeem-msg.error   { color: var(--red); }

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface3);
  border: 1px solid var(--border2);
  transition: .2s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  top: 2px;
  background-color: var(--text2);
  transition: .2s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: rgba(139, 92, 246, 0.3);
  border-color: var(--accent);
}

.switch input:checked + .slider:before {
  transform: translateX(20px);
  background-color: var(--accent);
}

.switch input:disabled + .slider {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ═════════════════════════════════════════════════════════════════════════════
   PANEL SHELL (bot panel)
═════════════════════════════════════════════════════════════════════════════ */
.panel-shell {
  display: flex; flex-direction: column; height: 100%; width: 100%; overflow: hidden;
}

/* ─── Top bar ────────────────────────────────────────────────────────────── */
.panel-topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 50px; flex-shrink: 0;
  padding: 0 1rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.ptb-left {
  display: flex; align-items: center; gap: 0.65rem;
  flex-shrink: 0; min-width: 0;
}

.ptb-back {
  display: flex; align-items: center; gap: 0.3rem;
  background: none; border: none;
  color: var(--text3); cursor: pointer;
  font-family: var(--font); font-size: 0.78rem; font-weight: 500;
  padding: 0.3rem 0.5rem; border-radius: var(--radius);
  transition: color .12s, background .12s; white-space: nowrap; flex-shrink: 0;
}
.ptb-back:hover { color: var(--text); background: var(--surface); }

.ptb-sep {
  width: 1px; height: 18px; background: var(--border); flex-shrink: 0;
}

.ptb-name {
  font-size: 0.88rem; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 180px;
}

/* ─── Tab nav ────────────────────────────────────────────────────────────── */
.ptb-tabs {
  display: flex; align-items: stretch; gap: 0;
  height: 100%; flex-shrink: 0;
}

.ph-tab {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0 0.9rem;
  background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text2); cursor: pointer;
  font-family: var(--font); font-size: 0.82rem; font-weight: 500;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
}
.ph-tab:hover          { color: var(--text); }
.ph-tab.active         { color: var(--accent); border-bottom-color: var(--accent); }
.ph-tab svg            { opacity: 0.6; flex-shrink: 0; }
.ph-tab.active svg     { opacity: 1; }

/* ─── Power controls ─────────────────────────────────────────────────────── */
.ptb-controls {
  display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0;
}

.ctrl-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface2);
  cursor: pointer; font-family: var(--font); font-size: 0.78rem; font-weight: 600;
  transition: all .12s; white-space: nowrap;
}
.ctrl-btn:active   { transform: scale(0.96); }
.ctrl-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none !important; }

.ctrl-start { color: var(--green); }
.ctrl-start:hover:not(:disabled) { background: var(--green-dim); border-color: rgba(34,197,94,.35); }

.ctrl-restart { color: var(--yellow); }
.ctrl-restart:hover:not(:disabled) { background: var(--yellow-dim); border-color: rgba(234,179,8,.35); }

.ctrl-stop { color: var(--red); }
.ctrl-stop:hover:not(:disabled) { background: var(--red-dim); border-color: rgba(239,68,68,.35); }

/* ─── Panel content ──────────────────────────────────────────────────────── */
.panel-content {
  flex: 1; min-height: 0; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

.tab-pane {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ─── Console footer (status + resource monitor) ─────────────────────────── */
.console-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.45rem 0.85rem;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  flex-shrink: 0; gap: 1rem;
}

.cf-left {
  display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0;
}

.cf-res {
  display: flex; align-items: center; gap: 0.55rem; flex-shrink: 0;
}

/* Resource chips */
.res-chip {
  display: flex; align-items: center; gap: 0.55rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 0.28rem 0.65rem;
}

.rc-lbl {
  font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text3); width: 24px; flex-shrink: 0;
}

.rc-track {
  width: 72px; height: 4px;
  background: var(--surface3); border-radius: 2px; overflow: hidden;
  flex-shrink: 0;
}

.rc-fill {
  height: 100%; border-radius: 2px; width: 0%;
  transition: width 0.6s ease, background 0.4s;
}
.cpu-fill { background: var(--accent); }
.ram-fill { background: var(--green); }

.rc-val {
  font-size: 0.7rem; font-family: var(--mono); color: var(--text2);
  min-width: 52px; text-align: right; flex-shrink: 0;
}

/* WS status pill */
.ws-pill {
  font-size: 0.67rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding: 0.18rem 0.52rem; border-radius: 4px;
}
.ws-pill.connected    { background: var(--green-dim); color: var(--green); }
.ws-pill.disconnected { background: var(--surface3); color: var(--text3); }
.ws-pill.connecting   { background: var(--yellow-dim); color: var(--yellow); }

/* ─── Pane bar (files / backups headers) ─────────────────────────────────── */
.pane-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; gap: 0.75rem;
}

.pane-title {
  font-size: 0.71rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em; color: var(--text3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.pane-bar-right {
  display: flex; align-items: center; gap: 0.3rem; flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   TERMINAL — aggressive overflow containment
───────────────────────────────────────────────────────────────────────────── */
#terminal-wrap {
  flex: 1; min-height: 0; min-width: 0;
  background: #05050a;
  overflow: hidden; /* CRITICAL — no scrollbars on the wrap itself */
  padding: 4px;
  position: relative;
}

/* Clip xterm at every layer */
#terminal-wrap .xterm              { height: 100%; overflow: hidden !important; }
#terminal-wrap .xterm-viewport     { overflow: hidden !important; width: 100% !important; max-width: 100% !important; }
#terminal-wrap .xterm-screen       { overflow: hidden !important; max-width: 100% !important; }
#terminal-wrap canvas              { max-width: 100%; }

/* ─────────────────────────────────────────────────────────────────────────────
   FILE MANAGER
───────────────────────────────────────────────────────────────────────────── */
.files-layout {
  flex: 1; min-height: 0;
  display: flex; overflow: hidden;
}

.ftree-col {
  width: 240px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  background: var(--bg2); overflow: hidden;
}

.file-tree {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0.3rem 0;
}

/* ── Storage bar (file explorer sidebar) ─────────────────────────────────── */
.storage-bar-wrap {
  padding: 0.55rem 0.8rem 0.6rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.storage-bar-track {
  height: 4px;
  background: var(--surface);
  border-radius: 9999px;
  overflow: hidden;
}
.storage-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 9999px;
  transition: width 0.3s ease, background 0.3s ease;
}
.storage-bar-fill--warn   { background: #f59e0b; }
.storage-bar-fill--danger { background: var(--red); }
.storage-bar-label {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.68rem;
  color: var(--text3);
  text-align: right;
}

.file-item {
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.28rem 0.8rem;
  font-size: 0.825rem; cursor: pointer;
  transition: background .08s; user-select: none;
  overflow: hidden;
}
.file-item:hover    { background: var(--surface); }
.file-item.selected { background: var(--accent-dim); color: var(--accent); }
.file-icon { flex-shrink: 0; font-size: 0.82rem; }
.file-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.82rem;
}
.file-size { font-size: 0.7rem; color: var(--text3); flex-shrink: 0; }

.feditor-col {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  overflow: hidden; background: var(--bg);
}

.editor-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; gap: 0.6rem; color: var(--text3); font-size: 0.82rem;
}

.editor-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.85rem;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.editor-filename { font-family: var(--mono); font-size: 0.78rem; color: var(--text2); }
.editor-actions  { display: flex; gap: 0.3rem; }

.editor-wrap     { flex: 1; overflow: hidden; min-height: 0; }
.editor-wrap .CodeMirror {
  height: 100%;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
}

/* ─── Toast notifications ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  min-width: 260px;
  max-width: 380px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  animation: toast-in .2s cubic-bezier(.22,1,.36,1) forwards;
}
.toast.toast-out {
  animation: toast-out .2s ease-in forwards;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0)   scale(1); }
  to   { opacity: 0; transform: translateY(8px)  scale(.97); }
}

.toast-body {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
}
.toast-icon {
  font-size: 1rem;
  line-height: 1.4;
  flex-shrink: 0;
}
.toast-text {
  font-size: 0.83rem;
  color: var(--text1);
  line-height: 1.45;
}

.toast-bar {
  height: 3px;
  width: 100%;
  transform-origin: left;
  transition: transform linear;
}
.toast--error   .toast-bar { background: var(--red); }
.toast--success .toast-bar { background: var(--green); }
.toast--info    .toast-bar { background: #7c8cff; }
.toast--warn    .toast-bar { background: var(--yellow); }

/* ─────────────────────────────────────────────────────────────────────────────
   SETTINGS
───────────────────────────────────────────────────────────────────────────── */
.settings-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: 0.85rem;
}

.sg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 580px;
}

.sg-hd {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.sg-hd h3 { font-size: 0.87rem; font-weight: 700; }
.sg-hd p  { font-size: 0.77rem; color: var(--text2); margin-top: 0.2rem; }

.sg-bd {
  padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: 0.85rem;
}

.sg-danger { border-color: rgba(239,68,68,.25); }
.sg-danger .sg-hd h3 { color: var(--red); }

/* ─── Profile page ───────────────────────────────────────────────────────── */
.profile-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 580px;
}

.da-warning {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

/* Narrow modal variant for single-action confirms */
.modal-box--sm { max-width: 440px; }

/* ═════════════════════════════════════════════════════════════════════════════
   MODAL
═════════════════════════════════════════════════════════════════════════════ */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.8);
  backdrop-filter: blur(6px);
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px rgba(255,255,255,.04), 0 40px 80px rgba(0,0,0,.7);
  display: flex; flex-direction: column; gap: 1.1rem;
  max-height: 90vh; overflow-y: auto;
  padding: 1.4rem;
  position: relative; z-index: 1;
  width: 100%; max-width: 450px;
}

.modal-hd {
  display: flex; align-items: flex-start; justify-content: space-between;
}
.modal-title { font-size: 0.95rem; font-weight: 700; }
.modal-sub   { font-size: 0.78rem; color: var(--text2); margin-top: 0.2rem; }

.modal-close {
  background: none; border: none; color: var(--text3);
  cursor: pointer; padding: 0.1rem; margin-left: 0.5rem;
  flex-shrink: 0; transition: color .15s;
  display: flex; align-items: center;
}
.modal-close:hover { color: var(--text); }

.modal-form {
  display: flex; flex-direction: column; gap: 0.9rem;
}

.modal-ft {
  display: flex; justify-content: flex-end; gap: 0.45rem;
  margin-top: 0.25rem;
}

/* Source tabs */
/* ── Runtime picker ──────────────────────────────────────────────────────── */
.runtime-picker { display: flex; gap: 0.5rem; }

.runtime-opt {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
  padding: 0.7rem 0.5rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
}
.runtime-opt input[type=radio] { display: none; }
.runtime-opt:hover { border-color: var(--border2); background: var(--surface3); }
.runtime-opt.active { border-color: rgba(59,130,246,.5); background: var(--accent-dim); }

.rt-icon { font-size: 1.4rem; line-height: 1; }
.rt-name { font-size: 0.83rem; font-weight: 700; color: var(--text); }
.rt-sub  { font-size: 0.72rem; color: var(--text3); }

.src-tabs { display: flex; gap: 0.3rem; }

.src-tab {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text2); cursor: pointer;
  font-family: var(--font); font-size: 0.79rem; font-weight: 500;
  padding: 0.33rem 0.75rem; transition: all .12s;
}
.src-tab:hover:not(.active) { background: var(--surface3); color: var(--text); }
.src-tab.active { background: var(--accent-dim); border-color: rgba(59,130,246,.4); color: var(--accent); }

.src-panel { display: flex; flex-direction: column; gap: 0.75rem; }

.src-info {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 0.81rem;
  color: var(--text2); line-height: 1.5; padding: 0.7rem 0.85rem;
}
.src-info svg { flex-shrink: 0; margin-top: 0.1rem; opacity: 0.5; }

.file-drop {
  border: 1px dashed var(--border2); border-radius: var(--radius);
  color: var(--text2); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 0.82rem; padding: 1.5rem 1rem;
  text-align: center; transition: border-color .15s, color .15s;
  gap: 0.25rem;
}
.file-drop:hover { border-color: var(--accent); color: var(--text); }
.file-drop input { display: none; }

/* ═════════════════════════════════════════════════════════════════════════════
   STORE
═════════════════════════════════════════════════════════════════════════════ */

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
  max-width: 960px;
  margin: 0 auto;
}

.store-pkg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.35rem 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  overflow: hidden;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.store-pkg:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}

/* Deal highlight */
.store-pkg--deal {
  border-color: rgba(59,130,246,.4);
  background: linear-gradient(160deg, rgba(59,130,246,.07) 0%, var(--surface) 55%);
}
.store-deal-banner {
  position: absolute;
  top: 0; right: 0;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 0.25rem 0.65rem;
  border-bottom-left-radius: 8px;
}

.store-pkg-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.store-pkg-tokens {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  line-height: 1;
}
.store-pkg-base {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text);
}
.store-pkg-bonus {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}
.store-pkg-unit {
  font-size: 0.8rem;
  color: var(--text2);
  font-weight: 500;
}

.store-pkg-total {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.store-pkg-price {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 0.5rem;
}
.store-pkg-per {
  font-size: 0.71rem;
  color: var(--text3);
  margin-bottom: 0.75rem;
}

.store-pkg-btn { width: 100%; margin-top: auto; }

/* Purchase history */
.store-history-wrap {
  max-width: 960px;
  margin: 0 auto;
}
.purchase-history {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ph-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
}
.ph-name   { color: var(--text); font-weight: 500; }
.ph-tokens { color: var(--green); font-weight: 700; font-family: var(--mono); }
.ph-price  { color: var(--text2); font-family: var(--mono); }
.ph-date   { color: var(--text3); }

/* ═════════════════════════════════════════════════════════════════════════════
   TICKETS
═════════════════════════════════════════════════════════════════════════════ */

/* ── Ticket list rows ─────────────────────────────────────────────────────── */
#ticket-list { display: flex; flex-direction: column; gap: 0.5rem; }

.ticket-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.15rem;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .1s;
  position: relative;
  overflow: hidden;
}
.ticket-row::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--surface3);
}
.ticket-row.open::before  { background: var(--green); }
.ticket-row.closed::before { background: var(--text3); }
.ticket-row:hover {
  border-color: var(--border2);
  background: var(--surface2);
  transform: translateY(-1px);
}
.ticket-row-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.45rem;
}
.ticket-subject {
  font-size: 0.9rem; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ticket-row-foot {
  display: flex; align-items: center; gap: 0.5rem;
}
.ticket-row-date {
  font-size: 0.73rem; color: var(--text3); margin-left: auto;
}

/* ── Ticket detail modal — wider box ─────────────────────────────────────── */
.modal-box--wide { max-width: 680px; }

/* ── Conversation thread ──────────────────────────────────────────────────── */
.ticket-thread {
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.ticket-msg { display: flex; flex-direction: column; gap: 0.3rem; max-width: 82%; }
.ticket-msg--user  { align-self: flex-start; }
.ticket-msg--staff { align-self: flex-end; }

.ticket-msg-meta {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.74rem; color: var(--text2);
}
.ticket-msg-author { font-weight: 600; color: var(--text); }
.ticket-staff-tag {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  background: var(--accent-dim); color: var(--accent);
  border: 1px solid rgba(59,130,246,.25); border-radius: 4px;
  padding: 0.1rem 0.4rem;
}
.ticket-msg-time { margin-left: auto; font-size: 0.7rem; color: var(--text3); }

.ticket-msg-body {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.85rem;
  font-size: 0.875rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}
.ticket-msg--staff .ticket-msg-body {
  background: var(--accent-dim);
  border-color: rgba(59,130,246,.2);
}

/* Closed notice */
.ticket-closed-notice {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text2);
  padding: 0.75rem 0 0.25rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

/* ═════════════════════════════════════════════════════════════════════════════
   CHECKOUT MODAL
═════════════════════════════════════════════════════════════════════════════ */

.checkout-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; padding: 24px;
}
.checkout-modal.hidden { display: none; }

.checkout-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%; max-width: 440px;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  overflow: hidden;
}

.checkout-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.checkout-hd h2 { font-size: 16px; font-weight: 700; }
.checkout-close {
  background: none; border: none; color: var(--text2);
  cursor: pointer; font-size: 20px; line-height: 1; padding: 2px 4px;
}
.checkout-close:hover { color: var(--text); }

.checkout-item {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.checkout-item-icon {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  background: var(--accent-dim, rgba(59,130,246,.1));
  border: 1px solid rgba(59,130,246,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.checkout-item-name { font-size: 15px; font-weight: 700; }
.checkout-item-sub  { font-size: 12.5px; color: var(--text2); margin-top: 2px; }

.checkout-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }

.checkout-code-row {
  display: flex; gap: 8px;
}
.checkout-code-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border2);
  border-radius: var(--radius); color: var(--text); padding: 9px 12px;
  font-size: 13.5px; font-family: inherit; outline: none;
  text-transform: uppercase; letter-spacing: .04em;
}
.checkout-code-input:focus { border-color: var(--accent); }
.checkout-code-input::placeholder { text-transform: none; letter-spacing: 0; }
.checkout-apply-btn {
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); border-radius: var(--radius);
  padding: 9px 16px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; white-space: nowrap;
  transition: border-color .15s;
}
.checkout-apply-btn:hover { border-color: var(--accent); color: var(--accent); }

.checkout-discount-badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.2);
  border-radius: var(--radius); padding: 8px 12px;
  font-size: 13px; color: var(--green);
}
.checkout-discount-badge .cd-check { font-size: 15px; }
.checkout-discount-badge.hidden { display: none; }

.checkout-summary {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.checkout-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 14px; font-size: 13px; color: var(--text2);
}
.checkout-summary-row + .checkout-summary-row {
  border-top: 1px solid var(--border);
}
.checkout-summary-row.total {
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px;
}
.checkout-summary-row .discount-val { color: var(--green); }
.checkout-summary-row .badge-recurring {
  font-size: 10px; font-weight: 700; background: rgba(59,130,246,.15);
  color: var(--accent); padding: 2px 7px; border-radius: 9999px;
  margin-left: 6px; vertical-align: middle;
}

.checkout-balance {
  font-size: 12.5px; color: var(--text2); text-align: right;
}
.checkout-balance.insufficient { color: #ef4444; }

.checkout-error {
  font-size: 12.5px; color: #ef4444;
  background: rgba(239,68,68,.08); border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius); padding: 8px 12px;
  display: none;
}

.checkout-ft {
  display: flex; gap: 10px; padding: 0 24px 20px;
}
.checkout-ft .btn-cancel {
  flex: 1; background: transparent; border: 1px solid var(--border2);
  color: var(--text2); border-radius: var(--radius);
  padding: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit;
}
.checkout-ft .btn-cancel:hover { border-color: var(--muted); color: var(--text); }
.checkout-ft .btn-confirm {
  flex: 2; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 10px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background .15s;
}
.checkout-ft .btn-confirm:hover { background: var(--accent-dk, #2563eb); }
.checkout-ft .btn-confirm:disabled { opacity: .5; cursor: not-allowed; }
