/* ============================================================
   VPN Shop · design system
   Aesthetic: editorial-technical dark, warm amber accent,
   IBM Plex typography, sharp corners, subtle grid texture.
   ============================================================ */

:root {
  /* Surfaces — light gray base */
  --bg:           #eef0f4;
  --bg-elevated:  #f6f7f9;
  --surface:      #ffffff;
  --surface-2:    #f0f2f5;
  --border:       #d4d8e0;
  --border-soft:  rgba(0, 0, 0, 0.06);

  /* Text — near-black */
  --text:         #0f1419;
  --text-muted:   #4a5567;
  --text-faint:   #8590a3;

  /* Accent (blue) */
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft:  rgba(37, 99, 235, 0.10);
  --accent-line:  rgba(37, 99, 235, 0.35);

  /* Semantic */
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;

  /* Type */
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", "SF Mono", Consolas, monospace;

  /* Shadow — softer for light theme */
  --shadow-sm:  0 1px 2px rgba(15, 20, 25, 0.06);
  --shadow-md:  0 4px 12px rgba(15, 20, 25, 0.08);
  --shadow-lg:  0 12px 36px rgba(15, 20, 25, 0.10);
}

/* ------------------------------------------------------------
   Reset & base
   ------------------------------------------------------------ */

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease;
}
a:hover { border-bottom-color: var(--accent-line); }

button { font-family: inherit; }

::selection { background: var(--accent); color: var(--bg); }

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }
.accent { color: var(--accent); }

/* ------------------------------------------------------------
   Background grid
   ------------------------------------------------------------ */

.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* ------------------------------------------------------------
   Section labels — uppercase, tracked, very small
   ------------------------------------------------------------ */

.section-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, border-color 120ms ease;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.btn:hover { transform: translateY(-1px); border-bottom: 1px solid transparent; }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--surface); border-color: var(--accent-line); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-arrow { font-size: 16px; transition: transform 120ms ease; }
.btn:hover .btn-arrow { transform: translateX(2px); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  transition: color 120ms ease, border-color 120ms ease;
}
.btn-icon:hover { color: var(--accent); border-color: var(--accent-line); }

/* ------------------------------------------------------------
   Inputs
   ------------------------------------------------------------ */

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  transition: border-color 120ms ease, background 120ms ease;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.input::placeholder { color: var(--text-faint); font-family: var(--font-mono); letter-spacing: 0.15em; }
.input-mono { font-family: var(--font-mono); font-size: 18px; letter-spacing: 0.2em; }

/* ------------------------------------------------------------
   Alerts
   ------------------------------------------------------------ */

.alert {
  padding: 12px 16px;
  border-radius: 2px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid;
}
.alert-danger {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.3);
  color: #b91c1c;
}

/* ============================================================
   AUTH PAGES (login / register / admin login)
   ============================================================ */

.auth-page { position: relative; }

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 24px;
  max-width: 480px;
  margin: 0 auto;
}

.auth-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.05em;
}
.brand-mark {
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}
.brand-text { color: var(--text); }
.brand-accent { color: var(--accent); margin-left: 0; }

.auth-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px rgba(22, 163, 74, 0.5);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
.status-dot-warning { background: var(--warning); box-shadow: 0 0 4px rgba(217, 119, 6, 0.5); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.auth-card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  align-self: center;
  width: 100%;
  animation: fade-up 400ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 32px;
  height: 1px;
  background: var(--accent);
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-card-head { margin-bottom: 28px; }

.auth-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  line-height: 1.2;
}

.auth-sub {
  color: var(--text-muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.auth-form { margin-bottom: 20px; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: var(--font-mono);
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-fineprint {
  margin: 20px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.5;
}

.auth-footer {
  text-align: center;
  padding-top: 32px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.back-link {
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}
.back-link:hover { color: var(--accent); }

.error-card { text-align: center; }
.error-card .auth-title { font-size: 64px; }

/* ============================================================
   APP SHELL (logged-in pages)
   ============================================================ */

.app-page { position: relative; }

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
}

.nav-item {
  padding: 8px 14px;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: 2px;
  border-bottom: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 120ms ease, background 120ms ease;
}
.nav-item:hover {
  color: var(--text);
  background: var(--surface);
  border-bottom: none;
}
.nav-item-active {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav-item-disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.badge-soon {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--border);
  color: var(--text-faint);
  padding: 2px 6px;
  border-radius: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  font-size: 12px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-muted);
}

.app-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 32px;
}

.hero-block {
  margin-bottom: 48px;
  max-width: 720px;
}

.hero-title {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 12px;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.55;
  margin: 0;
}

/* ------------------------------------------------------------
   Info cards (user dashboard)
   ------------------------------------------------------------ */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  transition: border-color 120ms ease, transform 120ms ease;
}
.info-card:hover { border-color: var(--accent-line); }

.info-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.info-card-head .section-label { margin-bottom: 0; }

.info-card-body {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.info-label {
  font-size: 13px;
  color: var(--text-muted);
}
.info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.info-card-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
}
.info-card-empty p { margin: 0 0 12px; }

.dot-active {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px rgba(22, 163, 74, 0.4);
}

/* ------------------------------------------------------------
   Stat grid (admin dashboard)
   ------------------------------------------------------------ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 56px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 24px; height: 1px;
  background: var(--accent);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.stat-value {
  font-size: 32px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.02em;
}

/* ------------------------------------------------------------
   Phase tracker (admin dashboard)
   ------------------------------------------------------------ */

.phase-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 28px;
  max-width: 720px;
}

.phase-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.phase-list li {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.phase-list li:last-child { border-bottom: none; }

.phase-num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  min-width: 28px;
}
.phase-done { color: var(--text); }
.phase-done .phase-num { color: var(--success); }
.phase-done::after {
  content: "✓";
  margin-left: auto;
  color: var(--success);
  font-size: 14px;
}
.phase-pending { color: var(--text-muted); }

/* ============================================================
   MODAL (welcome code)
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 25, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade-in 200ms ease both;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 36px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: scale-in 240ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.modal::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 48px; height: 1px;
  background: var(--accent);
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-title {
  font-size: 22px;
  font-weight: 600;
  margin: 4px 0 12px;
  letter-spacing: -0.015em;
}

.modal-text {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 24px;
}
.modal-text strong { color: var(--accent); font-weight: 600; }

.code-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--bg);
  border: 1px solid var(--accent-line);
  border-radius: 2px;
  padding: 20px;
  margin-bottom: 24px;
}
.code-display code {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--accent);
  background: transparent;
}
.copy-btn {
  flex-shrink: 0;
  border-color: var(--accent-line);
  color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-actions .btn { flex: 1; }

/* ============================================================
   ADMIN CONTEXT TINT (cool blue accent overlay)
   Subtle visual differentiation between user and admin areas
   ============================================================ */

.admin-context .brand-accent,
.admin-context .accent,
.admin-context .nav-item-active {
  /* keep accent the same but add a slight blue undertone via shadow */
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 640px) {
  .app-header {
    padding: 14px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }
  .app-nav { order: 3; width: 100%; }
  .app-main { padding: 32px 16px; }
  .hero-title { font-size: 28px; }
  .auth-card { padding: 28px 22px; }
  .auth-title { font-size: 22px; }
  .input-mono { font-size: 16px; }
  .code-display code { font-size: 22px; letter-spacing: 0.12em; }
}

/* ============================================================
   PHASE 2 ADDITIONS
   ============================================================ */

/* --- page heading row -------------------------------------- */

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.page-head .hero-title { margin-bottom: 8px; }
.page-head .hero-sub { max-width: 560px; }

.hero-count {
  font-size: 0.5em;
  color: var(--text-muted);
  margin-left: 8px;
  vertical-align: 0.3em;
  font-weight: 500;
}

.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- flash messages ---------------------------------------- */

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
}
.flash {
  padding: 12px 16px;
  border-radius: 2px;
  border: 1px solid;
  font-size: 14px;
  animation: fade-up 240ms ease both;
}
.flash-info    { background: rgba(96, 165, 250, 0.08); border-color: rgba(96, 165, 250, 0.3); color: #1d4ed8; }
.flash-success { background: rgba(74, 222, 128, 0.08); border-color: rgba(74, 222, 128, 0.3); color: #15803d; }
.flash-warning { background: rgba(251, 191, 36, 0.08); border-color: rgba(251, 191, 36, 0.3); color: #b45309; }
.flash-danger  { background: rgba(248, 113, 113, 0.08); border-color: rgba(248, 113, 113, 0.3); color: #b91c1c; }

/* --- tags / pills ------------------------------------------ */

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  border: 1px solid;
  margin-right: 4px;
  vertical-align: middle;
}
.tag-success { background: rgba(74, 222, 128, 0.1);  border-color: rgba(74, 222, 128, 0.3);  color: #15803d; }
.tag-danger  { background: rgba(248, 113, 113, 0.1); border-color: rgba(248, 113, 113, 0.3); color: #b91c1c; }
.tag-warning { background: rgba(251, 191, 36, 0.1);  border-color: rgba(251, 191, 36, 0.3);  color: #b45309; }
.tag-info    { background: rgba(96, 165, 250, 0.1);  border-color: rgba(96, 165, 250, 0.3);  color: #1d4ed8; }
.tag-muted   { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }

/* --- data tables ------------------------------------------- */

.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  text-align: left;
  padding: 14px 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.data-table tbody td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(37, 99, 235, 0.04); }

.data-table.compact thead th { padding: 10px 14px; }
.data-table.compact tbody td { padding: 10px 14px; font-size: 13px; }

.row-title { font-weight: 500; color: var(--text); border-bottom: none; }
.row-title:hover { color: var(--accent); border-bottom: none; }
.row-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.row-actions { text-align: right; white-space: nowrap; }
.dim { color: var(--text-faint); }

/* --- search bar -------------------------------------------- */

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}
.search-bar .input { flex: 1; min-width: 220px; }
.search-bar select.input { flex: 0 0 220px; }

.btn-link {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: none;
}
.btn-link:hover { color: var(--accent); border-bottom: none; }

/* --- empty state ------------------------------------------- */

.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 2px;
}
.empty-state p { color: var(--text-muted); margin: 12px 0 20px; }
.empty-inline { color: var(--text-muted); font-size: 14px; padding: 8px 0; }

/* --- forms ------------------------------------------------- */

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 32px;
  max-width: 720px;
}

.form-grid { display: flex; flex-direction: column; gap: 18px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  padding: 10px 0;
  flex-direction: row;
  flex-wrap: wrap;
}
.check-inline { padding: 0; align-items: center; }
.check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  margin-top: 2px;
}
.check .field-hint { flex: 1 0 100%; padding-left: 26px; margin-top: -4px; }
.check-inline .field-hint { display: none; }

.textarea {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
}

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

.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.input-narrow { width: 72px; flex: 0 0 72px; }

/* --- danger button styling --------------------------------- */

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger-ghost {
  color: #b91c1c;
  border-color: var(--border);
}
.btn-danger-ghost:hover { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.06); }

/* --- panels (carded sections) ------------------------------ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.panel-head .section-label { margin-bottom: 0; }

/* --- two-column layout (user detail) ----------------------- */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 20px;
  align-items: start;
}
.col-main { min-width: 0; }
.col-side { min-width: 0; }

@media (max-width: 960px) {
  .two-col { grid-template-columns: 1fr; }
}

/* --- key list rows inside user detail ---------------------- */

.key-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.key-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  flex-wrap: wrap;
}
.key-row-main { flex: 1; min-width: 200px; }
.key-row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  margin-bottom: 2px;
}
.key-row-sub { font-size: 12px; }
.key-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* --- collapsible "issue key" ------------------------------- */

.issue-key { margin-top: 12px; }
.issue-key summary {
  list-style: none;
  display: inline-flex;
  cursor: pointer;
}
.issue-key summary::-webkit-details-marker { display: none; }
.issue-key[open] summary { margin-bottom: 12px; }

.issue-form {
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 2px;
}
.issue-form .field-row { margin-bottom: 12px; }

.hint-warning {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-size: 12px;
  color: #b45309;
  background: rgba(251, 191, 36, 0.06);
  border-left: 2px solid rgba(251, 191, 36, 0.4);
}
.hint-warning a { color: var(--accent); }

/* --- message history list ---------------------------------- */

.message-history { list-style: none; padding: 0; margin: 0; }
.message-history li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.message-history li:last-child { border-bottom: none; }
.msg-meta { font-size: 11px; margin-bottom: 4px; }
.msg-title { color: var(--text); }

/* --- dashboard stat-card clickable ------------------------- */

.stat-card-link {
  text-decoration: none;
  color: inherit;
  transition: border-color 120ms ease, transform 120ms ease;
  border-bottom: none;
}
.stat-card-link:hover {
  border-color: var(--accent-line);
  transform: translateY(-1px);
  border-bottom: none;
}
.stat-footnote {
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- responsive table behavior ----------------------------- */

@media (max-width: 640px) {
  .data-table thead { display: none; }
  .data-table tbody td { display: block; padding: 8px 14px; border-bottom: none; }
  .data-table tbody tr {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
  }
  .data-table tbody td.row-actions { text-align: left; padding-top: 12px; }
  .row-sub { font-size: 11px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .form-card { padding: 20px; }
}

/* --- sync banner (dashboard) ------------------------------- */

.sync-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.06), rgba(251, 191, 36, 0.02));
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-left: 2px solid var(--warning);
  border-radius: 2px;
  flex-wrap: wrap;
}
.sync-banner-body { flex: 1; min-width: 280px; }
.sync-banner-title {
  font-size: 18px;
  font-weight: 600;
  margin: 4px 0 6px;
  color: #b45309;
}
.sync-banner-text {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

code.mono {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 0.9em;
  color: var(--accent);
}
.field-hint code.mono { background: transparent; border: none; padding: 0; color: var(--text); }

/* ============================================================
   PHASE 4 ADDITIONS — user cabinet
   ============================================================ */

/* nav badge for unread messages */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  border-radius: 2px;
}

.user-hero { margin-bottom: 32px; }

/* --- trial CTA -------------------------------------------- */

.trial-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 24px 28px;
  margin-bottom: 32px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.02) 100%);
  border: 1px solid var(--accent-line);
  border-left: 2px solid var(--accent);
  border-radius: 2px;
  flex-wrap: wrap;
}
.trial-card-head { flex: 1; min-width: 260px; }
.trial-title {
  font-size: 22px;
  font-weight: 600;
  margin: 6px 0 8px;
}
.trial-title .mono.accent { font-size: 0.85em; }
.trial-sub { margin: 0; color: var(--text-muted); font-size: 13px; }
.trial-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.trial-form .input { min-width: 200px; }

/* --- section heads ---------------------------------------- */

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.section-head .section-label { margin-bottom: 0; }

.keys-section { margin-bottom: 48px; }
.messages-section { margin-bottom: 48px; }

/* --- key cards (dashboard grid) --------------------------- */

.keys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.key-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  text-decoration: none;
  border-bottom: none;
  transition: border-color 120ms ease, transform 120ms ease;
  position: relative;
  overflow: hidden;
}
.key-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 1px;
  background: var(--accent);
}
.key-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  border-bottom: none;
}

.key-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.key-card-country {
  display: flex;
  align-items: center;
  gap: 10px;
}
.country-code {
  display: inline-block;
  padding: 3px 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.country-name { font-size: 14px; font-weight: 500; }

.key-card-label {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-muted);
}

.key-card-remaining {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
}
.remaining-value {
  font-size: 22px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: -0.01em;
}
.remaining-sub { font-size: 11px; }

.key-card-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}
.key-card-cta {
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: lowercase;
}
.key-card:hover .key-card-cta { color: var(--accent); }

.key-card-empty {
  background: transparent;
  border: 1px dashed var(--border);
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: default;
}
.key-card-empty:hover { transform: none; border-color: var(--border); }
.key-card-empty::before { display: none; }
.empty-text {
  font-size: 13px;
  color: var(--text-faint);
  margin: 8px 0 4px;
}

/* --- key detail page -------------------------------------- */

.back-row { margin-bottom: 20px; }
.back-row .back-link {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: none;
}
.back-row .back-link:hover { color: var(--accent); border-bottom: none; }

.key-detail-head {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.key-detail-head .hero-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 28px;
}
.key-detail-head .hero-title .country-code { font-size: 14px; }

.alert-warning {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.3);
  color: #b45309;
}

.key-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 20px;
  align-items: start;
  margin-bottom: 48px;
}

@media (max-width: 880px) {
  .key-layout { grid-template-columns: 1fr; }
}

.key-share {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px;
}
@media (max-width: 720px) {
  .key-share { grid-template-columns: 1fr; }
}

.key-url-card { display: flex; flex-direction: column; gap: 12px; }
.key-url-box {
  background: var(--bg);
  border: 1px solid var(--accent-line);
  padding: 14px 16px;
  border-radius: 2px;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}
.key-url-text {
  font-size: 12px;
  color: var(--accent);
  user-select: all;
}

.key-qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.key-qr-img {
  width: 200px;
  height: 200px;
  display: block;
  background: white;
  padding: 8px;
  border-radius: 2px;
  border: 1px solid var(--border);
}
.qr-hint {
  font-size: 11px;
  color: var(--text-faint);
  text-align: center;
  margin: 0;
  font-family: var(--font-mono);
  line-height: 1.4;
}

/* --- key actions sidebar ---------------------------------- */

.key-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.action-block summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: 14px;
  transition: background 120ms ease;
}
.action-block summary::-webkit-details-marker { display: none; }
.action-block summary:hover { background: var(--surface-2); }
.action-block[open] summary {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.action-summary-static {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--text-muted);
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--accent);
  font-size: 16px;
}
.action-title { flex: 1; }

.action-block-disabled .action-summary-static .action-title { color: var(--text-muted); }
.action-block-disabled .action-icon { color: var(--text-faint); }
.action-block-disabled { opacity: 0.7; }

.action-form {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-form .input { font-size: 13px; padding: 10px 12px; }
.action-hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  line-height: 1.5;
}

/* --- instructions / platform tabs ------------------------- */

.instructions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 28px;
  margin-bottom: 32px;
}
.instructions-head { margin-bottom: 20px; }
.instructions-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin: 8px 0 0;
}

.platform-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.platform-tabs .tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}
.platform-tabs .tab:hover { color: var(--text); }
.platform-tabs .tab.tab-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.tab-content-active { display: block; }

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 0;
}
.steps li {
  position: relative;
  padding: 10px 0 10px 40px;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  line-height: 1.6;
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 12px;
  width: 24px;
  height: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- message feed ----------------------------------------- */

.message-feed {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.message-feed-full { gap: 12px; }

.msg-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--border);
  border-radius: 2px;
  padding: 16px 20px;
}
.msg-info    { border-left-color: rgba(96, 165, 250, 0.5); }
.msg-success { border-left-color: var(--success); }
.msg-warning { border-left-color: var(--warning); }
.msg-danger  { border-left-color: var(--danger); }

.msg-unread { background: linear-gradient(180deg, rgba(37, 99, 235, 0.05), transparent); }

.msg-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.msg-title-text {
  flex: 1;
  font-weight: 500;
  font-size: 14px;
}
.msg-kind-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}
.msg-unread .msg-kind-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.msg-date { font-size: 11px; }

.msg-body {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.msg-actions { margin-top: 8px; }

/* --- responsive tweaks ----------------------------------- */

@media (max-width: 640px) {
  .trial-card { padding: 20px; }
  .trial-form { width: 100%; }
  .trial-form .input { flex: 1; min-width: 0; }
  .key-share { padding: 16px; }
  .key-qr-img { width: 160px; height: 160px; }
  .instructions { padding: 20px; }
  .key-detail-head .hero-title { font-size: 22px; }
}

/* ============================================================
   PHASE 4 — USER CABINET
   ============================================================ */

/* --- trial / empty-state block ----------------------------- */

.trial-block {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.06), transparent);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  padding: 32px;
  margin-bottom: 32px;
  border-radius: 2px;
}
.trial-block .hero-title { margin-bottom: 8px; }
.trial-block .hero-sub { margin-bottom: 24px; }
.trial-block .btn-primary { margin-top: 8px; }

/* --- country picker ---------------------------------------- */

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.country-form { margin: 0; }
.country-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, transform 80ms ease;
  font-family: var(--font-sans);
  text-align: left;
}
.country-btn:hover:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--bg-elevated);
  transform: translateY(-1px);
}
.country-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.country-name { font-size: 15px; font-weight: 500; }
.country-sub {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.flag { font-size: 20px; line-height: 1; }
.flag-large { font-size: 32px; }

/* --- keys section ------------------------------------------ */

.keys-section { margin-bottom: 40px; }

.keys-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
  flex-wrap: wrap;
}

.key-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
}
.key-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 1px;
  background: var(--accent);
}

.key-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
}

.key-card-titles { min-width: 0; }
.key-card-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.key-card-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.key-date {
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* --- rename inline input ----------------------------------- */

.rename-form { margin: 0; }
.rename-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px dashed transparent;
  padding: 2px 0;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: border-color 120ms ease, color 120ms ease;
}
.rename-input:hover { border-bottom-color: var(--border); }
.rename-input:focus {
  outline: none;
  border-bottom-color: var(--accent);
  color: var(--text);
}
.rename-input::placeholder { color: var(--text-faint); }

/* --- vless url box ----------------------------------------- */

.key-url-box {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}
.key-url {
  flex: 1;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  background: transparent;
  border: none;
  user-select: all;
}
.copy-btn-large {
  width: auto;
  height: auto;
  padding: 0 16px;
  border-radius: 0;
  border: none;
  border-left: 1px solid var(--border);
  font-size: 18px;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}
.copy-btn-large:hover { background: var(--accent-soft); color: var(--accent); }
.copy-btn-large.copied { color: var(--success); background: rgba(74, 222, 128, 0.08); }

/* --- key actions (details) --------------------------------- */

.key-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.key-action summary {
  list-style: none;
  cursor: pointer;
  width: fit-content;
  display: inline-flex;
}
.key-action summary::-webkit-details-marker { display: none; }
.key-action[open] summary { margin-bottom: 12px; }

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 2px;
}
.qr-img {
  width: 240px;
  height: 240px;
  background: white;
  padding: 12px;
  border-radius: 2px;
}
.qr-hint {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.5;
}

.switch-wrap {
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 2px;
}
.switch-wrap .qr-hint { text-align: left; max-width: none; margin-bottom: 12px; }

/* --- setup instructions (CSS-only tabs) -------------------- */

.setup-section { margin-bottom: 40px; }
.setup-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.015em;
}
.setup-intro {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 20px;
}

.setup-tabs > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.setup-tabs-nav {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.setup-tabs-nav::-webkit-scrollbar { display: none; }
.setup-tabs-nav label {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 120ms ease, border-color 120ms ease;
  margin-bottom: -1px;
}
.setup-tabs-nav label:hover { color: var(--text); }

#setup-ios:checked    ~ .setup-tabs-nav label[for="setup-ios"],
#setup-android:checked ~ .setup-tabs-nav label[for="setup-android"],
#setup-win:checked    ~ .setup-tabs-nav label[for="setup-win"],
#setup-mac:checked    ~ .setup-tabs-nav label[for="setup-mac"],
#setup-linux:checked  ~ .setup-tabs-nav label[for="setup-linux"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.setup-panel { display: none; padding-top: 8px; }
#setup-ios:checked    ~ .setup-panel[data-tab="ios"],
#setup-android:checked ~ .setup-panel[data-tab="android"],
#setup-win:checked    ~ .setup-panel[data-tab="win"],
#setup-mac:checked    ~ .setup-panel[data-tab="mac"],
#setup-linux:checked  ~ .setup-panel[data-tab="linux"] { display: block; }

.setup-steps {
  padding-left: 0;
  list-style: none;
  counter-reset: step;
}
.setup-steps li {
  position: relative;
  padding: 8px 0 12px 36px;
  counter-increment: step;
  line-height: 1.55;
  font-size: 14px;
  border-bottom: 1px dashed var(--border);
}
.setup-steps li:last-child { border-bottom: none; }
.setup-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 2px;
}

.kbd {
  display: inline-block;
  padding: 1px 7px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--accent);
}

.setup-alt {
  margin-top: 16px;
  padding-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
}

/* --- messages ---------------------------------------------- */

.messages-section { margin-bottom: 40px; scroll-margin-top: 80px; }
.message-list { display: flex; flex-direction: column; gap: 10px; }

.message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 2px solid var(--text-faint);
  border-radius: 2px;
  padding: 16px 20px;
  transition: border-color 120ms ease;
}
.message-info    { border-left-color: #60a5fa; }
.message-success { border-left-color: var(--success); }
.message-warning { border-left-color: var(--warning); }
.message-danger  { border-left-color: var(--danger); }
.message-unread {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 30%);
}

.message-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  gap: 12px;
}
.message-title { font-weight: 600; font-size: 15px; }
.message-date { font-size: 11px; flex-shrink: 0; }
.message-body {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.message-foot { margin-top: 10px; }

/* --- account ----------------------------------------------- */

.account-section { margin-bottom: 40px; }
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.account-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: 2px;
}
.account-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.account-value {
  font-size: 16px;
  color: var(--text);
}
code.account-value {
  font-family: var(--font-mono);
  background: transparent;
  border: none;
  padding: 0;
  letter-spacing: 0.15em;
  color: var(--accent);
}

/* --- plans grid -------------------------------------------- */

.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.plan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 28px 24px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: border-color 120ms ease, transform 120ms ease;
}
.plan-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.plan-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 32px; height: 1px;
  background: var(--accent);
}
.plan-days {
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.plan-days-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.plan-name { font-size: 16px; font-weight: 500; margin: 4px 0; }
.plan-price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 0;
}
.plan-price { font-size: 28px; font-weight: 600; }
.plan-currency { font-size: 16px; color: var(--text-muted); }
.plan-per-day {
  font-size: 12px;
  margin-bottom: 16px;
  letter-spacing: 0.05em;
}

/* --- responsive -------------------------------------------- */

@media (max-width: 640px) {
  .key-card-head { grid-template-columns: auto 1fr; }
  .key-card-status { grid-column: 1 / -1; align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .key-card { padding: 20px 16px; }
  .key-url { font-size: 11px; padding: 12px 14px; }
  .qr-img { width: 200px; height: 200px; }
  .country-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .trial-block { padding: 24px 20px; }
}

/* ============================================================
   PHASE 5 — CHECKOUT & PAYMENT RETURN
   ============================================================ */

.checkout-main { max-width: 960px; }

.checkout-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: flex-start;
}

@media (max-width: 760px) {
  .checkout-grid { grid-template-columns: 1fr; }
}

/* --- summary aside ----------------------------------------- */

.checkout-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 2px;
  position: sticky;
  top: 90px;
}
.checkout-summary::before {
  content: "";
  display: block;
  width: 32px; height: 1px;
  background: var(--accent);
  margin-bottom: 16px;
  margin-top: -8px;
}

.plan-name-large {
  font-size: 24px;
  font-weight: 600;
  margin: 8px 0 20px;
  letter-spacing: -0.015em;
}

.checkout-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 16px;
}
.checkout-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 14px;
}

.checkout-total {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checkout-total-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
}

/* --- checkout form ----------------------------------------- */

.checkout-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.checkout-section { display: flex; flex-direction: column; }

.checkout-section-title {
  font-size: 18px;
  font-weight: 500;
  margin: 4px 0 14px;
  letter-spacing: -0.005em;
}

.btn-large {
  padding: 16px 24px;
  font-size: 15px;
}

.checkout-disclaimer {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  line-height: 1.5;
}

/* --- country radio cards ----------------------------------- */

.country-radio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.country-radio { position: relative; cursor: pointer; }
.country-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.country-radio-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  transition: border-color 120ms ease, background 120ms ease;
}
.country-radio:hover .country-radio-content {
  border-color: var(--accent-line);
}
.country-radio input:checked + .country-radio-content {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.country-radio input:checked + .country-radio-content .country-name {
  color: var(--accent);
}

/* --- return page ------------------------------------------- */

.return-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 40px;
  position: relative;
  margin-bottom: 32px;
  max-width: 720px;
}
.return-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 48px; height: 1px;
  background: var(--accent);
}
.return-card-succeeded { border-left: 2px solid var(--success); }
.return-card-pending   { border-left: 2px solid var(--warning); }
.return-card-canceled  { border-left: 2px solid var(--danger); }

.pending-spinner {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--warning);
  font-size: 13px;
  letter-spacing: 0.06em;
}
.pending-spinner::before {
  content: "";
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--warning);
  border-top-color: transparent;
  border-radius: 50%;
  margin-right: 10px;
  animation: spin 1s linear infinite;
  vertical-align: -2px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   PHASE 6 — POLISH
   ============================================================ */

/* danger variant of the sync banner */
.sync-banner-danger {
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.06), rgba(248, 113, 113, 0.02));
  border-color: rgba(248, 113, 113, 0.3);
  border-left-color: var(--danger);
}
.sync-banner-danger .sync-banner-title { color: #b91c1c; }

.stat-card-warning { border-color: rgba(251, 191, 36, 0.4); }
.stat-card-warning .stat-value { color: var(--warning); }
.stat-value-sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-faint);
  margin-left: 6px;
}

/* secondary nav item (Audit) — slightly muted */
.nav-item-secondary { opacity: 0.7; }
.nav-item-secondary.nav-item-active { opacity: 1; }

/* recent activity list */
.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.activity-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}
.activity-list li:last-child { border-bottom: none; }
.activity-time { font-size: 11px; min-width: 84px; }
.activity-admin { color: var(--accent); }
.activity-action { font-size: 12px; }

/* background jobs panel */
.bg-jobs-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.bg-jobs-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.bg-jobs-list li:last-child { border-bottom: none; }
.job-name { color: var(--text); }
.job-period { font-size: 11px; color: var(--text-muted); letter-spacing: 0.08em; }

/* audit details column */
.audit-details {
  font-size: 11px;
  max-width: 360px;
  word-break: break-word;
}

/* pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 24px 0;
  flex-wrap: wrap;
}
.pagination .mono { font-size: 12px; letter-spacing: 0.06em; }

/* ============================================================
   POST-PHASE-6 UI REFINEMENTS
   subscription URL · messages with delete · support modal
   ============================================================ */

/* --- subscription section --------------------------------- */

.subscription-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-md);
}

.sub-meta-row {
  display: flex;
  gap: 32px;
  margin: 8px 0 20px;
  flex-wrap: wrap;
}
.sub-meta-item { display: flex; flex-direction: column; gap: 4px; }
.sub-meta-value {
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sub-meta-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 2px;
  text-transform: lowercase;
}
.sub-tag-success { background: rgba(22, 163, 74, 0.1);  color: #15803d; }
.sub-tag-warning { background: rgba(217, 119, 6, 0.1);  color: #b45309; }
.sub-tag-danger  { background: rgba(220, 38, 38, 0.1);  color: #b91c1c; }

.sub-url-box {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 16px;
  overflow: hidden;
}

.sub-url {
  flex: 1;
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  user-select: all;
}

.copy-sub-btn {
  flex-shrink: 0;
  border-radius: 0;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.copy-sub-btn.copied { background: var(--success); }

/* --- compact country pills -------------------------------- */

.country-pills, .country-list-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.country-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
}
.country-pill .flag { font-size: 14px; }

/* --- messages: cleaner styling + close button -------------- */

.message {
  position: relative;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-faint);
  border-radius: 2px;
  margin-bottom: 8px;
}
.message-info    { border-left-color: var(--accent); }
.message-success { border-left-color: var(--success); }
.message-warning { border-left-color: var(--warning); }
.message-danger  { border-left-color: var(--danger); }

.message-unread {
  background: rgba(37, 99, 235, 0.03);
}

.message-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.message-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.message-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.message-date { font-size: 11px; }

.message-close-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.message-close-btn:hover { background: rgba(220, 38, 38, 0.08); color: var(--danger); }

.message-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
}
.message-foot { margin-top: 8px; }

/* --- support modal ---------------------------------------- */

.support-link-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-line);
  border-radius: 2px;
  margin: 8px 0 24px;
  flex-wrap: wrap;
}
.support-link-box code {
  font-size: 18px;
  font-weight: 500;
  color: var(--accent);
}

@media (max-width: 640px) {
  .sub-url { font-size: 11px; padding: 12px 14px; }
  .copy-sub-btn { padding: 0 14px; font-size: 13px; }
  .sub-url-box { flex-direction: column; }
  .copy-sub-btn { border-top: 1px solid var(--border); padding: 12px; }
}

/* Direct APK download link — slightly emphasised */
.apk-link {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-soft);
  border-radius: 2px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}
.apk-link:hover { background: var(--accent); color: #fff; }
