/* ============================================================
   Jokoproxies Dashboard — app.css
   Clean dark theme inspired by Proxidize
   ============================================================ */

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

:root {
  --primary:       #00A76F;
  --primary-dark:  #007B55;
  --primary-light: #C8FAD6;

  --bg-body:       #161C24;
  --bg-surface:    #212B36;
  --bg-soft:       #293544;
  --bg-elevated:   #2F3D4E;
  --bg-hover:      #364557;

  --border:        rgba(145, 158, 171, 0.16);

  --text-main:     #FFFFFF;
  --text-secondary:#919EAB;
  --text-tertiary: #637381;

  --success:       #22C55E;
  --success-bg:    rgba(34, 197, 94, 0.12);
  --danger:        #FF5630;
  --danger-bg:     rgba(255, 86, 48, 0.12);
  --warning:       #FFAB00;
  --warning-bg:    rgba(255, 171, 0, 0.12);
  --info:          #00B8D9;
  --info-bg:       rgba(0, 184, 217, 0.12);

  --bg:            var(--bg-body);
  --surface:       var(--bg-surface);
  --surface2:      var(--bg-soft);
  --accent:        var(--primary);
  --accent2:       var(--primary-dark);
  --green:         var(--success);
  --red:           var(--danger);
  --orange:        var(--warning);
  --purple:        #7635DC;
  --text:          var(--text-main);
  --muted:         var(--text-secondary);

  --shadow-card:   0 0 2px 0 rgba(0,0,0,0.2), 0 12px 24px -4px rgba(0,0,0,0.12);
  --shadow-sm:     none;

  --radius:        16px;
  --radius-sm:     8px;
  --radius-lg:     16px;
  --sidebar-w:     240px;
}

/* ── Base ───────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Public Sans', 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--primary);
  color: #fff;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(145, 158, 171, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(145, 158, 171, 0.35); }

/* ── Layout ─────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px dashed var(--border);
  margin-bottom: 16px;
}
.logo-icon {
  font-size: 22px;
  color: var(--primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-section {
  border-radius: 10px;
  padding: 8px;
}
.nav-section-admin {
  background: rgba(255, 171, 0, 0.04);
}

.nav-section-title {
  margin: 0 6px 8px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.nav-section-admin .nav-section-title { color: var(--orange); }

.nav-section-list { list-style: none; }
.nav-section-list li { margin-bottom: 2px; }
.nav-section-list li:last-child { margin-bottom: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background .15s, color .15s;
  font-size: 13px;
  font-weight: 500;
}
.nav-link:hover {
  background: rgba(145, 158, 171, 0.08);
  color: var(--text-main);
}
.nav-link.active {
  background: rgba(0, 167, 111, 0.08);
  color: var(--primary);
}

.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 16px 20px 0;
  color: var(--text-tertiary);
  font-size: 11px;
  border-top: 1px dashed var(--border);
}

/* ── Main content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 40px;
}

/* ── Page header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
}
.page-header h1 {
  font-size: 24px;
  font-weight: 700;
}

/* ── Status badge ───────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}
.badge-online {
  background: rgba(0, 167, 111, 0.12);
  color: var(--primary);
}
.badge-offline {
  background: var(--danger-bg);
  color: var(--red);
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-error {
  background: var(--danger-bg);
  color: var(--red);
}
.alert-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.alert-info {
  background: var(--info-bg);
  color: var(--info);
}

/* ── KPI Grid ───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-blue   { background: rgba(0, 184, 217, 0.12); color: var(--info); }
.kpi-green  { background: rgba(0, 167, 111, 0.12); color: var(--primary); }
.kpi-purple { background: rgba(118, 53, 220, 0.12); color: var(--purple); }
.kpi-orange { background: var(--warning-bg); color: var(--orange); }
.kpi-value  { font-size: 32px; font-weight: 700; line-height: 1; }
.kpi-label  { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ── Section cards ──────────────────────────────────────── */
.section-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
  margin-bottom: 24px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.count-badge {
  background: rgba(145, 158, 171, 0.12);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

/* ── Info grid ──────────────────────────────────────────── */
.info-grid { display: flex; flex-direction: column; gap: 4px; }
.info-item {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.info-item:nth-child(odd) { background: rgba(145, 158, 171, 0.04); }
.info-key { color: var(--text-secondary); min-width: 180px; }
.info-val { font-weight: 600; color: var(--text-main); }

/* ── Table ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.proxy-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.proxy-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 13px;
  background: rgba(145, 158, 171, 0.04);
  border-bottom: 1px dashed var(--border);
  white-space: nowrap;
}
.proxy-table td {
  padding: 14px 16px;
  border-bottom: 1px dashed var(--border);
  vertical-align: middle;
}
.proxy-table tbody tr:hover { background: rgba(145, 158, 171, 0.04); }
.proxy-table tbody tr:last-child td { border-bottom: none; }
.td-name   { font-weight: 600; }
.td-mono   { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 12px; color: var(--text-secondary); }
.td-time   { color: var(--text-tertiary); font-size: 12px; }

/* ── Pills & badges ─────────────────────────────────────── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}
.pill-green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
}
.pill-red {
  background: var(--danger-bg);
  color: var(--red);
}

.type-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Empty state ────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-tertiary);
  font-size: 14px;
}
.empty-state-icon {
  margin-bottom: 12px;
  opacity: 0.3;
}

/* ── Code block ─────────────────────────────────────────── */
.code-block {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 2;
  color: var(--text-secondary);
}
code {
  background: rgba(145, 158, 171, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Update bar ─────────────────────────────────────────── */
.update-bar {
  margin-top: 8px;
  color: var(--text-tertiary);
  font-size: 11px;
  text-align: right;
}

.text-muted { color: var(--text-secondary); margin-bottom: 12px; }

/* ── Proxy cards ───────────────────────────────────────── */
.proxy-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  overflow: hidden;
}

.proxy-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px dashed var(--border);
}
.proxy-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.proxy-name { font-weight: 600; font-size: 14px; }
.proxy-card-actions { display: flex; gap: 8px; }

.proxy-card-body { padding: 16px 20px; }

.proxy-info-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.proxy-info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.proxy-info-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
}
.proxy-info-value {
  font-size: 14px;
  font-weight: 600;
}

.proxy-connection-string {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(145, 158, 171, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.proxy-connection-string code {
  flex: 1;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  word-break: break-all;
  background: transparent;
  padding: 0;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(145, 158, 171, 0.24);
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover {
  background: rgba(145, 158, 171, 0.08);
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.btn-test {
  color: var(--primary);
  border-color: rgba(0, 167, 111, 0.32);
}
.btn-test:hover {
  background: rgba(0, 167, 111, 0.08);
}

.btn-danger {
  color: var(--red);
  border-color: rgba(255, 86, 48, 0.32);
}
.btn-danger:hover {
  background: var(--danger-bg);
}
.btn-loading { animation: pulse 1s infinite; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text-secondary);
  transition: background .15s, color .15s;
}
.btn-icon:hover {
  background: rgba(145, 158, 171, 0.08);
  color: var(--text-main);
}

/* ── Type badge variants ───────────────────────────────── */
.type-http   { background: rgba(0, 184, 217, 0.12); color: var(--info); }
.type-socks5 { background: rgba(118, 53, 220, 0.12); color: var(--purple); }
.type-tcp    { background: var(--warning-bg); color: var(--orange); }

/* ── Test results ──────────────────────────────────────── */
.test-result {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.test-success {
  background: var(--success-bg);
  color: var(--green);
}
.test-error {
  background: var(--danger-bg);
  color: var(--red);
}

/* ── Settings form ─────────────────────────────────────── */
.settings-form { max-width: 480px; }
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(145, 158, 171, 0.08);
  border: 1px solid rgba(145, 158, 171, 0.24);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.form-input:focus {
  border-color: var(--primary);
}
.form-input::placeholder {
  color: var(--text-tertiary);
}
.form-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-input-group .form-input { flex: 1; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.btn-save {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  padding: 9px 24px;
  font-weight: 700;
}
.btn-save:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}
.save-confirm {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

/* ── Fleet dashboard ───────────────────────────────────── */
.fleet-toolbar {
  padding-bottom: 16px;
}
.fleet-toolbar-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(200px, 220px) repeat(3, auto);
  gap: 10px;
  align-items: center;
}
.fleet-toolbar-meta {
  margin-top: 10px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 12px;
}
.fleet-qr-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.fleet-qr-card img {
  width: 180px;
  height: 180px;
  image-rendering: pixelated;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.fleet-qr-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fleet-inline-error {
  color: var(--red);
  font-size: 13px;
}
.fleet-assign {
  display: flex;
  gap: 8px;
  align-items: center;
}
.fleet-assign .form-input {
  min-width: 220px;
}

/* ── Sidebar toggle ────────────────────────────────────── */
.sidebar-toggle {
  position: absolute;
  top: 32px;
  right: -12px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 101;
  transition: background .15s, color .15s;
}
.sidebar-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}
.sidebar { transition: width .2s ease; }
.sidebar-logo-text,
.nav-label,
.nav-section-title { transition: opacity .2s ease; }

/* ── Sidebar collapsed ─────────────────────────────────── */
.sidebar-collapsed .sidebar {
  width: 72px;
}
.sidebar-collapsed .sidebar-logo {
  justify-content: center;
  padding: 0 0 24px;
}
.sidebar-collapsed .sidebar-logo-text {
  display: none;
}
.sidebar-collapsed .sidebar-nav {
  padding: 0 8px;
}
.sidebar-collapsed .nav-section-title {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}
.sidebar-collapsed .nav-link {
  justify-content: center;
  padding: 10px;
}
.sidebar-collapsed .nav-label {
  display: none;
}
.sidebar-collapsed .sidebar-footer {
  padding: 12px 8px 0;
  text-align: center;
}
.sidebar-collapsed .sidebar-user {
  display: none;
}
.sidebar-collapsed .sidebar-version {
  font-size: 10px;
}
.sidebar-collapsed .main-content,
.sidebar-collapsed ~ .main-content {
  margin-left: 72px;
}
.sidebar-collapsed .sidebar-toggle {
  right: -12px;
}

/* ── Sidebar user ──────────────────────────────────────── */
.sidebar-user {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 12px;
}
.sidebar-user span {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-link {
  color: var(--red);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
}
.logout-link:hover { text-decoration: underline; }

/* ── Select input ─────────────────────────────────────── */
select.form-input {
  appearance: auto;
  cursor: pointer;
}

/* ── Checkbox ─────────────────────────────────────────── */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}


/* ── Blazor error UI ──────────────────────────────────── */
#blazor-error-ui {
  background: var(--bg-surface);
  border-top: 2px solid var(--danger);
  color: var(--text-main);
  padding: 12px 24px;
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 1000;
  display: none;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.2);
}
#blazor-error-ui .reload {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  margin-left: 8px;
}
#blazor-error-ui .reload:hover { text-decoration: underline; }
#blazor-error-ui .dismiss {
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  margin-left: 16px;
  cursor: pointer;
}
#blazor-error-ui .dismiss:hover { color: var(--text-main); }

/* ── Platform public layout ───────────────────────────── */
.public-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.public-topbar {
  height: 64px;
  border-bottom: 1px solid rgba(145, 158, 171, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: rgba(22, 28, 36, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 200;
}
.public-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.public-brand:hover { color: var(--primary); }
.public-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.public-nav-link {
  padding: 8px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}
.public-nav-link:hover {
  color: var(--text-main);
  background: rgba(145, 158, 171, 0.08);
}
.public-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.public-login-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color .15s;
}
.public-login-link:hover { color: var(--text-main); }
.public-signup-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background .15s;
}
.public-signup-btn:hover { background: var(--primary-dark); color: #fff; }
.public-main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 24px 56px;
}

/* ── Platform home ────────────────────────────────────── */
.home-hero {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  margin-bottom: 24px;
}
.home-eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 10px;
}
.home-title {
  font-size: 36px;
  line-height: 1.15;
  margin-bottom: 14px;
  max-width: 760px;
  font-weight: 700;
}
.home-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 680px;
  margin-bottom: 20px;
  line-height: 1.7;
}
.home-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.home-metrics {
  display: grid;
  gap: 12px;
}
.home-metric-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.home-metric-key {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
}
.home-metric-val {
  font-size: 18px;
  font-weight: 700;
}
.home-metric-desc {
  color: var(--text-secondary);
  font-size: 12px;
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ── Dashboard welcome banner ─────────────────────────── */
.dash-welcome {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.dash-welcome-text h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.dash-welcome-text p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.dash-welcome-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Quick navigation grid ───────────────────────────── */
.quick-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.quick-nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid rgba(145, 158, 171, 0.24);
  border-radius: var(--radius);
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.quick-nav-btn:hover {
  background: rgba(145, 158, 171, 0.08);
}
.quick-nav-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.quick-nav-btn:disabled:hover {
  background: var(--bg-surface);
}
.quick-nav-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Dashboard grid layout ───────────────────────────── */
.dash-grid-2col {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  margin-bottom: 24px;
}

/* ── Server info bar ─────────────────────────────────── */
.server-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.server-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.server-bar-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

/* ── Module tabs ─────────────────────────────────────── */
.module-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  margin-bottom: 28px;
  box-shadow: var(--shadow-card);
}
.module-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.module-tab:hover {
  background: rgba(145, 158, 171, 0.08);
  color: var(--text-main);
}
.module-tab.active {
  background: rgba(0, 167, 111, 0.12);
  color: var(--primary);
}
.module-tab-badge {
  background: rgba(145, 158, 171, 0.16);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  line-height: 1.5;
}
.module-tab.active .module-tab-badge {
  background: rgba(0, 167, 111, 0.16);
  color: var(--primary);
}

/* ── Module summary mini-stats ──────────────────────── */
.module-summary-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.module-summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.module-summary-val {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}
.module-summary-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Modal overlay ───────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.4);
  max-width: 520px;
  width: 90%;
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.modal-close:hover {
  background: rgba(145, 158, 171, 0.08);
  color: var(--text-main);
}

/* ── Toolbar row ─────────────────────────────────────── */
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.toolbar-row .form-input {
  max-width: 360px;
}
.toolbar-spacer { flex: 1; }

/* ── License card ────────────────────────────────────── */
.license-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
}
.license-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.license-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.license-row:last-child { border-bottom: none; }
.license-key { color: var(--text-secondary); }
.license-val { font-weight: 700; }

/* ── Progress bar ────────────────────────────────────── */
.progress-bar-wrap {
  height: 6px;
  background: rgba(145, 158, 171, 0.16);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
}
.progress-bar-fill.warn { background: var(--warning); }
.progress-bar-fill.full { background: var(--danger); }

/* ── Proxy cards grid ────────────────────────────────── */
.proxy-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* ── Fleet manager ─────────────────────────────────────── */
.fleet-phone-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  overflow: hidden;
}
.fleet-phone-card.fleet-phone-obsolete {
  opacity: .6;
}
.fleet-unassigned-card {
  border: 1px dashed var(--border);
}
.fleet-phone-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background .15s;
}
.fleet-phone-header:hover {
  background: rgba(145, 158, 171, 0.04);
}
.fleet-phone-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.fleet-phone-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.fleet-expand-icon {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.fleet-phone-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fleet-phone-meta {
  color: var(--text-tertiary);
  font-size: 12px;
  white-space: nowrap;
}
.fleet-phone-body {
  border-top: 1px dashed var(--border);
  padding: 16px 20px;
  overflow-x: auto;
}
.fleet-proxy-empty {
  color: var(--text-tertiary);
  font-size: 13px;
  padding: 12px 0;
  text-align: center;
}
.fleet-proxy-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fleet-reassign-select {
  max-width: 200px;
  font-size: 12px;
  padding: 5px 8px;
}
.fleet-rename-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fleet-rename-input {
  max-width: 200px;
  padding: 5px 10px;
  font-size: 13px;
}

/* ── Landing page ──────────────────────────────────────── */
.landing-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  padding: 20px 0 48px;
}
.landing-hero-content { display: flex; flex-direction: column; gap: 20px; }
.landing-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 12px;
  background: rgba(0, 167, 111, 0.12);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.landing-title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.5px;
}
.landing-title-accent {
  color: var(--primary);
}
.landing-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 500px;
}
.landing-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.landing-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.landing-btn-primary:hover { background: var(--primary-dark); color: #fff; }
.landing-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text-main);
  border: 1px solid rgba(145, 158, 171, 0.24);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.landing-btn-outline:hover { background: rgba(145, 158, 171, 0.08); color: #fff; }

/* Terminal visual */
.landing-hero-visual { display: flex; align-items: center; justify-content: center; }
.landing-terminal {
  width: 100%;
  max-width: 480px;
  background: #0D1117;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 2px 0 rgba(0,0,0,0.3), 0 20px 40px -8px rgba(0,0,0,0.4);
  border: 1px solid rgba(145, 158, 171, 0.1);
}
.landing-terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: rgba(145, 158, 171, 0.06);
  border-bottom: 1px solid rgba(145, 158, 171, 0.08);
}
.landing-terminal-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.landing-terminal-title {
  margin-left: 8px;
  font-size: 12px;
  color: #637381;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.landing-terminal-body {
  padding: 20px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.9;
}
.landing-terminal-line { white-space: pre; }
.t-green { color: #22C55E; }
.t-white { color: #fff; font-weight: 600; }
.t-muted { color: #637381; }

/* Stats strip */
.landing-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 32px 0;
  margin-bottom: 48px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.landing-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 36px;
}
.landing-stat-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}
.landing-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}
.landing-stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.landing-apk-download {
  margin-bottom: 40px;
}
.landing-apk-card {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 24px;
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(145, 158, 171, 0.2);
  background: linear-gradient(135deg, rgba(0, 171, 85, 0.1), rgba(0, 167, 111, 0.03));
}
.landing-apk-text {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.landing-apk-hint {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}
.landing-apk-qr-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.landing-apk-qr {
  width: 210px;
  height: 210px;
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  image-rendering: pixelated;
}

/* Section header */
.landing-section-header {
  text-align: center;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.landing-section-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -.3px;
}

/* Features grid */
.landing-features { margin-bottom: 64px; }
.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.landing-feature-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.landing-feature-card h3 {
  font-size: 16px;
  font-weight: 700;
}
.landing-feature-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.landing-feature-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}

/* Pricing */
.landing-pricing { margin-bottom: 64px; }
.landing-pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  max-width: 720px;
  margin: 0 auto;
}
.landing-price-card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}
.landing-price-featured {
  border: 2px solid var(--primary);
}
.landing-price-popular {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 14px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.landing-price-tier {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.landing-price-amount {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}
.landing-price-currency {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
}
.landing-price-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.landing-price-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}
.landing-price-features li svg { color: var(--primary); flex-shrink: 0; }

/* Footer */
.landing-footer {
  text-align: center;
  padding: 24px 0 32px;
  border-top: 1px dashed var(--border);
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1000px) {
  .layout { flex-direction: column; }
  .sidebar {
    position: static;
    width: 100% !important;
    height: auto;
    border-right: none;
    border-bottom: 1px dashed var(--border);
  }
  .sidebar-toggle { display: none; }
  .sidebar-collapsed .nav-label,
  .sidebar-collapsed .nav-section-title,
  .sidebar-collapsed .sidebar-logo-text,
  .sidebar-collapsed .sidebar-user { display: revert; opacity: 1; height: auto; margin: revert; }
  .sidebar-collapsed .nav-link { justify-content: flex-start; padding: 9px 12px; }
  .main-content {
    margin-left: 0 !important;
    padding: 20px;
  }
  .fleet-toolbar-grid { grid-template-columns: 1fr; }
  .fleet-assign { flex-direction: column; align-items: stretch; }
  .fleet-assign .form-input { min-width: 0; }
  .dash-grid-2col { grid-template-columns: 1fr; }
  .quick-nav-grid { grid-template-columns: 1fr 1fr; }
  .fleet-phone-header { flex-direction: column; align-items: flex-start; }
  .fleet-phone-header-right { flex-wrap: wrap; }
  .fleet-proxy-actions { flex-wrap: wrap; }
  .fleet-reassign-select { max-width: 100%; }

  /* Landing / topbar responsive */
  .public-topbar { padding: 0 16px; }
  .public-nav { display: none; }
  .landing-hero { grid-template-columns: 1fr; gap: 32px; }
  .landing-title { font-size: 30px; }
  .landing-apk-card { grid-template-columns: 1fr; padding: 20px; }
  .landing-apk-qr { width: 180px; height: 180px; }
  .landing-features-grid { grid-template-columns: 1fr; }
  .landing-pricing-grid { grid-template-columns: 1fr; }
  .landing-stats { gap: 20px; }
  .landing-stat { padding: 0 20px; }
  .landing-stat-divider { display: none; }
}

/* Download page */
.download-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 24px;
  margin-bottom: 28px;
}
.download-hero-content {
  padding: 30px;
  border-radius: var(--radius);
  border: 1px solid rgba(145, 158, 171, 0.22);
  background:
    radial-gradient(120% 120% at 0% 0%, rgba(0, 167, 111, 0.18) 0%, rgba(0, 167, 111, 0.03) 45%, transparent 80%),
    linear-gradient(145deg, rgba(33, 43, 54, 0.95), rgba(24, 31, 40, 0.95));
  box-shadow: var(--shadow-card);
}
.download-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
}
.download-hero-content h1 {
  font-size: 34px;
  line-height: 1.18;
  margin-bottom: 12px;
}
.download-hero-content p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 700px;
}
.download-hero-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.download-hero-aside {
  display: grid;
  gap: 12px;
}
.download-stat-card {
  border-radius: var(--radius);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(145, 158, 171, 0.14);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.download-stat-label {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.download-stat-value {
  font-size: 20px;
  font-weight: 700;
}
.download-platforms {
  margin-bottom: 24px;
}
.download-chip-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.download-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(145, 158, 171, 0.22);
  background: rgba(145, 158, 171, 0.08);
  color: var(--text-main);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: border-color .15s, background .15s;
}
.download-chip:hover {
  border-color: rgba(145, 158, 171, 0.4);
  background: rgba(145, 158, 171, 0.12);
}
.download-chip-dot {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.download-chip.is-live .download-chip-dot {
  color: var(--primary);
}
.download-chip.is-pending .download-chip-dot {
  color: var(--warning);
}
.download-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.download-card {
  border-radius: var(--radius);
  background: var(--bg-surface);
  border: 1px solid rgba(145, 158, 171, 0.2);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 350px;
}
.download-card.is-unavailable {
  border-style: dashed;
}
.download-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.download-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.download-card-icon.accent-windows {
  color: var(--info);
  background: rgba(0, 184, 217, 0.14);
}
.download-card-icon.accent-android {
  color: var(--primary);
  background: rgba(0, 167, 111, 0.14);
}
.download-card-icon.accent-linux {
  color: var(--warning);
  background: rgba(255, 171, 0, 0.16);
}
.download-card-head h2 {
  font-size: 18px;
  margin-bottom: 2px;
}
.download-card-head p {
  color: var(--text-secondary);
  font-size: 12px;
}
.download-card-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.download-card-info {
  display: grid;
  gap: 8px;
}
.download-card-info div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  border-bottom: 1px dashed rgba(145, 158, 171, 0.16);
  padding-bottom: 6px;
}
.download-card-info div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.download-label {
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.download-card-description {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
  flex: 1;
}
.download-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.download-guides {
  margin-top: 30px;
}
.download-guides-header {
  margin-bottom: 14px;
}
.download-guides-header h2 {
  font-size: 24px;
  line-height: 1.2;
}
.download-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.download-guide-card {
  border-radius: var(--radius);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(145, 158, 171, 0.16);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.download-guide-card h3 {
  font-size: 18px;
}
.download-guide-card ol {
  margin-left: 18px;
  color: var(--text-secondary);
  display: grid;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.download-guide-card li code {
  font-size: 11px;
}
.download-command {
  margin-top: auto;
  border-radius: var(--radius-sm);
  border: 1px dashed rgba(145, 158, 171, 0.24);
  background: rgba(145, 158, 171, 0.08);
  padding: 10px 12px;
  overflow-x: auto;
}
.download-command code {
  background: transparent;
  padding: 0;
  white-space: pre;
  line-height: 1.5;
}

@media (max-width: 1000px) {
  .download-hero { grid-template-columns: 1fr; }
  .download-card-grid { grid-template-columns: 1fr; }
  .download-guide-grid { grid-template-columns: 1fr; }
  .download-hero-content { padding: 22px; }
  .download-hero-content h1 { font-size: 28px; }
}
