/* ============ Theme variables ============ */
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dbe1ea;
  --input-bg: #ffffff;
  --primary: #4f7cff;
  --primary-dark: #3b63d9;
  --ring: rgba(79, 124, 255, .18);
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --shadow: 0 10px 40px rgba(15, 23, 42, .08);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0a0f1c;
  --card: #111827;
  --text: #e5e9f2;
  --muted: #94a3b8;
  --border: #243044;
  --input-bg: #0d1424;
  --primary: #5b86ff;
  --primary-dark: #7a9dff;
  --ring: rgba(91, 134, 255, .25);
  --danger: #fca5a5;
  --danger-bg: rgba(220, 38, 38, .12);
  --danger-border: rgba(248, 113, 113, .35);
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

/* ============ Theme toggle button ============ */
.theme-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s, background .25s;
}
.theme-btn:hover { transform: scale(1.06); }
.theme-btn:focus-visible { outline: 3px solid var(--ring); }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ============ Layout ============ */
.auth-wrap { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ---- Brand panel ---- */
.auth-brand {
  flex: 1.1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 64px;
  color: #fff;
  background: linear-gradient(135deg, #0a1020 0%, #14245a 55%, #2347a8 100%);
}
.auth-brand::before,
.auth-brand::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .5;
}
.auth-brand::before { width: 380px; height: 380px; background: #3b63d9; top: -120px; right: -100px; }
.auth-brand::after  { width: 300px; height: 300px; background: #7c3aed; bottom: -110px; left: -80px; opacity: .35; }

.brand-inner { position: relative; z-index: 1; max-width: 480px; }

.brand-logo, .mobile-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 700;
}
.brand-logo { margin-bottom: 56px; }

.logo-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff;
}

.auth-brand h1 { font-size: 36px; line-height: 1.25; font-weight: 700; letter-spacing: -.3px; }
.brand-sub { color: #b9c6e6; margin-top: 16px; line-height: 1.65; font-size: 16px; }

.features { list-style: none; margin-top: 36px; display: grid; gap: 14px; }
.features li { display: flex; align-items: center; gap: 12px; color: #dbe4fa; font-size: 15px; }
.tick {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
  font-size: 12px;
}

/* ---- Form side ---- */
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--bg);
  transition: background .25s;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
  transition: background .25s, border-color .25s;
}
.auth-card h2 { font-size: 26px; letter-spacing: -.3px; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }

.mobile-logo { display: none; color: var(--text); margin-bottom: 28px; }
.mobile-logo .logo-badge { background: var(--primary); border-color: transparent; }

.auth-card label { display: block; font-size: 13px; font-weight: 600; margin: 18px 0 8px; }

/* ---- Inputs ---- */
.field { position: relative; }
.field-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.field input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 44px;
  font-size: 16px; /* 16px = iPhone par zoom nahi hota */
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .25s;
}
.field input::placeholder { color: var(--muted); opacity: .7; }
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }

/* Browser autofill dark mode me safed na ho */
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  box-shadow: 0 0 0 1000px var(--input-bg) inset;
  caret-color: var(--text);
}

.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: none; border: none; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.eye:hover { color: var(--text); }
.eye:focus-visible { outline: 3px solid var(--ring); }
.eye-closed { display: none; }
.eye.is-visible .eye-open { display: none; }
.eye.is-visible .eye-closed { display: block; }

/* ---- Button ---- */
.btn-primary {
  width: 100%;
  height: 50px;
  margin-top: 26px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.985); }
.btn-primary:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
.btn-primary:disabled { opacity: .75; cursor: not-allowed; }

.spinner {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-primary.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Alert ---- */
.alert {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 4px;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 24px; }

/* ============ Dashboard placeholder ============ */
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar strong { font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar-right button {
  background: none; color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px; border-radius: 8px;
  cursor: pointer; font-size: 14px;
}
.topbar .theme-btn { position: static; width: 38px; height: 38px; box-shadow: none; }
.content { padding: 32px 28px; }
.content h1 { margin-bottom: 8px; }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .auth-brand { display: none; }
  .mobile-logo { display: flex; }
  .auth-form-side { padding: 72px 20px 32px; align-items: flex-start; }
  .auth-card { margin: auto 0; }
}

@media (max-width: 480px) {
  .auth-form-side { padding: 68px 16px 24px; }
  .auth-card { padding: 30px 22px; border-radius: 14px; }
  .auth-card h2 { font-size: 23px; }
  .topbar { padding: 12px 16px; }
  .topbar-right span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* ============ App shell (sidebar + header) ============ */
.app-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* ---- Sidebar ---- */
.sidebar {
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 76px;
  width: var(--sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-right: 1px solid var(--border);
  transition: width .2s ease;
  position: relative;
  z-index: 30;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 68px;
}
.sidebar-top .logo-badge {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
}
.sidebar-title { font-weight: 700; font-size: 16px; white-space: nowrap; }

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--ring); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { display: flex; flex: none; }
.nav-text { overflow: hidden; text-overflow: ellipsis; }

.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 12px 14px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: transform .2s, background .15s, color .15s;
}
.sidebar-collapse-btn:hover { color: var(--text); background: var(--ring); }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.sidebar-footer-mini { display: none; text-align: center; }

/* ---- Collapsed state (desktop) ---- */
.sidebar-collapsed .sidebar {
  width: var(--sidebar-w-collapsed);
}
.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .sidebar-footer-full {
  display: none;
}
.sidebar-collapsed .sidebar-top { justify-content: center; padding: 20px 0; }
.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px;
  width: 44px;
  margin: 0 auto;
  border-radius: 10px; /* square-ish highlight */
}
.sidebar-collapsed .sidebar-collapse-btn { transform: rotate(180deg); }
.sidebar-collapsed .sidebar-footer { display: flex; justify-content: center; padding: 14px 0; }
.sidebar-collapsed .sidebar-footer-mini { display: block; }

.sidebar-backdrop { display: none; }

/* ---- Header ---- */
.main-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.app-header {
  height: 68px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left, .header-right { display: flex; align-items: center; gap: 14px; }
.page-title { font-size: 17px; font-weight: 600; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.icon-btn:hover { background: var(--ring); }
.icon-btn:focus-visible { outline: 3px solid var(--ring); }
.icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: block; }
[data-theme="dark"] .icon-btn .icon-moon { display: none; }

.profile-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  background: var(--input-bg);
  transition: background .15s;
  max-width: 220px;
}
.profile-btn:hover { background: var(--ring); }
.avatar {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.profile-email {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-btn svg { flex: none; color: var(--muted); }

.content { padding: 28px 24px; }
.content h1 { font-size: 22px; margin-bottom: 6px; }

/* ============ Responsive: mobile sidebar drawer ============ */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 0 rgba(0,0,0,0);
  }
  .sidebar-collapsed .sidebar { width: 260px; } /* collapse button hidden on mobile anyway */
  .sidebar-collapse-btn { display: none; }

  .sidebar-open .sidebar {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0,0,0,.25);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 25;
  }
  .sidebar-open .sidebar-backdrop { display: block; }

  .app-header { padding: 0 16px; }
  .page-title { display: none; }
  .profile-email { display: none; }
  .profile-btn { padding: 6px; }
  .content { padding: 20px 16px; }
}

/* ============ Overview page ============ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; margin-bottom: 4px; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--primary);
  color: var(--primary);
  background: transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.btn-outline:hover { background: var(--primary); color: #fff; }

/* ---- Stat cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  transition: background .25s, border-color .25s, transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }

.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }

.stat-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
}
.icon-green  { background: rgba(34,197,94,.15);  color: #22c55e; }
.icon-blue   { background: rgba(59,130,246,.15); color: #3b82f6; }
.icon-purple { background: rgba(168,85,247,.15); color: #a855f7; }
.icon-amber  { background: rgba(245,158,11,.15); color: #f59e0b; }
.icon-teal   { background: rgba(45,212,191,.15); color: #14b8a6; }

.stat-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.stat-badge.up      { color: #16a34a; background: rgba(34,197,94,.12); }
.stat-badge.down    { color: #dc2626; background: rgba(239,68,68,.12); }
.stat-badge.neutral { color: var(--muted); background: var(--ring); }

.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
.stat-value-sub { font-size: 15px; font-weight: 500; color: var(--muted); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---- Charts ---- */
.charts-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  transition: background .25s, border-color .25s;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-head h3 { font-size: 15px; font-weight: 600; }
.small { font-size: 12px; }
.link { color: var(--primary); font-size: 13px; font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

.chart-wrap { position: relative; height: 260px; }

/* ---- Server health table ---- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.data-table th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }
.flag { margin-right: 8px; }

.proto-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--ring);
  color: var(--primary);
}

.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}
.status-dot.online  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.status-dot.offline { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.18); }
.status-dot.warn    { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.18); }

.load-bar {
  width: 100%;
  max-width: 120px;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.load-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.load-bar.warn span { background: #f59e0b; }

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

/* ============ Providers page ============ */
.page-head-actions { display: flex; gap: 10px; }

.btn-primary-sm {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; background: var(--primary); color: #fff;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .1s;
}
.btn-primary-sm:hover { background: var(--primary-dark); }
.btn-primary-sm:active { transform: scale(.97); }
.btn-primary-sm:disabled { opacity: .7; cursor: not-allowed; }

.btn-ghost {
  padding: 10px 18px; background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s;
}
.btn-ghost:hover { background: var(--ring); }

.btn-danger {
  padding: 10px 18px; background: #ef4444; color: #fff;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, transform .1s;
}
.btn-danger:hover { background: #dc2626; }
.btn-danger:active { transform: scale(.97); }

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

.search-field {
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: 320px; padding: 0 14px; height: 42px;
  border: 1px solid var(--border); background: var(--input-bg);
  border-radius: 10px; color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.search-field input {
  border: none; outline: none; background: transparent;
  color: var(--text); font-size: 14px; width: 100%; height: 100%;
}
.search-field input::placeholder { color: var(--muted); }

.col-actions { text-align: right; width: 110px; }
.data-table td.col-actions { text-align: right; white-space: nowrap; }

.provider-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary); margin-right: 10px;
}

.url-link { color: var(--muted); text-decoration: none; font-size: 13px; }
.url-link:hover { color: var(--primary); text-decoration: underline; }

.row-btn {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 8px; cursor: pointer; margin-left: 6px;
  transition: background .15s, color .15s, transform .1s;
}
.row-btn:hover { background: var(--ring); }
.row-btn:active { transform: scale(.93); }
.row-btn.danger:hover { background: rgba(239,68,68,.12); color: #ef4444; border-color: rgba(239,68,68,.3); }

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.row-in { animation: rowIn .25s ease both; }

.empty-state {
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 56px 20px; color: var(--muted); text-align: center;
}
.empty-state svg { opacity: .5; margin-bottom: 4px; }
.empty-state p { font-size: 15px; font-weight: 600; color: var(--text); }

/* ---- Side modal (Add/Edit) ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10, 15, 28, .55);
  opacity: 0; visibility: hidden; transition: opacity .25s ease; z-index: 50;
}
.modal-backdrop.show { opacity: 1; visibility: visible; }

.side-modal {
  position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 420px;
  background: var(--card); border-left: 1px solid var(--border);
  box-shadow: -20px 0 60px rgba(0,0,0,.2);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.22,1,.36,1);
  z-index: 60; display: flex; flex-direction: column;
}
.side-modal.show { transform: translateX(0); }
.side-modal form { display: flex; flex-direction: column; height: 100%; }

.side-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.side-modal-head h3 { font-size: 17px; }

.side-modal-body { padding: 22px 24px; flex: 1; overflow-y: auto; }
.side-modal-body label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.side-modal-body label:not(:first-of-type) { margin-top: 18px; }
.side-modal-body input:not([type=checkbox]):not([type=file]),
.side-modal-body select,
.side-modal-body textarea {
  width: 100%; height: 46px; padding: 0 14px; font-size: 15px; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border);
  border-radius: 10px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.side-modal-body input:not([type=checkbox]):not([type=file]):focus,
.side-modal-body select:focus,
.side-modal-body textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }

.side-modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 18px 24px; border-top: 1px solid var(--border);
}

.form-alert {
  background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border);
  padding: 11px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 18px;
}

.spinner-sm {
  display: none; width: 15px; height: 15px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spinner-sm.show { display: inline-block; }

/* ---- Delete confirm ---- */
.confirm-box {
  position: fixed; top: 50%; left: 50%; width: 90%; max-width: 380px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow);
  transform: translate(-50%, -48%) scale(.95);
  opacity: 0; visibility: hidden;
  transition: transform .2s ease, opacity .2s ease, visibility .2s;
  z-index: 70;
}
.confirm-box.show { transform: translate(-50%, -50%) scale(1); opacity: 1; visibility: visible; }
.confirm-box h3 { font-size: 17px; margin-bottom: 8px; }
.confirm-box p { font-size: 14px; margin-bottom: 20px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 22px; border-radius: 10px; font-size: 14px; font-weight: 500;
  color: #fff; background: #16a34a;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, transform .25s, visibility .25s;
  z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.toast.error { background: #dc2626; }

@media (max-width: 480px) {
  .side-modal { max-width: 100%; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .search-field { max-width: none; }
}

/* ============ Applications page ============ */
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 14px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--muted);
  border-radius: 999px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.pkg {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px;
  color: var(--muted); background: var(--ring); padding: 3px 8px; border-radius: 6px;
}

.tag {
  display: inline-block; padding: 3px 10px; font-size: 12px; font-weight: 600;
  border-radius: 999px; white-space: nowrap;
}
.tag-android { color: #16a34a; background: rgba(34,197,94,.12); }
.tag-ios { color: #2563eb; background: rgba(59,130,246,.12); }
.tag-device { color: var(--muted); background: var(--ring); }

#appsTable .row-disabled td:not(.col-actions):not(:nth-child(5)) { opacity: .5; }

.seg { display: flex; gap: 6px; }
.seg-btn {
  flex: 1; height: 42px; padding: 0 10px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--muted);
  border-radius: 10px; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--ring); border-color: var(--primary); color: var(--primary); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--border);
  transition: background .2s; pointer-events: none;
}
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .switch-track { background: #22c55e; }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--ring); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .switch-track { opacity: .55; }

.switch-row { display: flex !important; align-items: center; gap: 12px; font-weight: 500 !important; cursor: pointer; }



/* ============ Servers page ============ */
.side-modal.side-modal-wide { max-width: 520px; }
.side-modal-body select { appearance: auto; cursor: pointer; }
.side-modal-body textarea {
  height: auto; padding: 12px 14px; resize: vertical; margin-top: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5;
}
.proto-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.proto-section > label:first-child, .proto-section > .section-title + label { margin-top: 0; }
.proto-section label:not(.file-pick):not(:first-child) { margin-top: 16px; }
.section-title { font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.sub-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 12px; }
.row-2 { display: grid; grid-template-columns: 1fr 120px; gap: 12px; align-items: start; margin-top: 18px; }
.row-2 > div > label { margin-top: 0 !important; }
.file-pick {
  display: flex !important; align-items: center; gap: 10px; cursor: pointer;
  padding: 11px 14px; border: 1px dashed var(--border); border-radius: 10px;
  color: var(--muted); font-weight: 500 !important; font-size: 13px !important;
  background: var(--input-bg); transition: border-color .15s, color .15s;
}
.file-pick:hover { border-color: var(--primary); color: var(--primary); }
.tag-proto { color: var(--primary); background: var(--ring); }
.tag-free { color: #16a34a; background: rgba(34,197,94,.12); }
.tag-paid { color: #d97706; background: rgba(245,158,11,.15); }
.flag { font-size: 18px; margin-right: 10px; vertical-align: middle; }
#serversTable .row-disabled td:not(.col-actions):not(:nth-child(8)) { opacity: .5; }

.filter-select {
  height: 34px; padding: 0 12px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border); background: var(--input-bg); color: var(--text);
  border-radius: 999px; cursor: pointer; max-width: 100%;
}
.filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }

/* Dropdowns: custom arrow with breathing room on the right */
.side-modal-body select,
.filter-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 42px;
}
.side-modal-body select { padding-left: 14px; text-overflow: ellipsis; }
.filter-select { padding-left: 14px; background-position: right 12px center; padding-right: 36px; }


/* ============ Server Protocol page ============ */
.proto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.proto-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 10px; transition: opacity .2s;
}
.proto-card.off h3, .proto-card.off > p { opacity: .55; }
.proto-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.proto-card h3 { font-size: 17px; }
.proto-card > p { font-size: 13px; line-height: 1.5; flex: 1; }
.proto-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }

.apps-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px;
}
.apps-toggle svg { transition: transform .2s; flex: none; }
.apps-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.apps-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.app-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 4px; }
.app-row + .app-row { border-top: 1px solid var(--border); }
.app-row-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.app-row-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-row-info .tag { padding: 2px 8px; font-size: 11px; }
.app-row-all .app-row-name { font-weight: 700; }
.app-row-overridden .app-row-info, .app-row-overridden .switch { opacity: .45; }
.proto-card > .apps-list { max-height: 320px; }

/* ============ Notifications page ============ */
.notice {
  background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border);
  padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 18px; line-height: 1.5;
}
.notice code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.col-actions.col-wide, .data-table td.col-actions.col-wide { width: 120px; }
.notif-cell { max-width: 360px; }
.notif-title { font-weight: 600; }
.notif-body { margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tag-failed { color: #dc2626; background: rgba(239,68,68,.12); }
.char-count { text-align: right; margin-top: 6px; }
.side-modal-body textarea#notifMessage { font-family: inherit; font-size: 15px; margin-top: 0; }

/* ============ Settings page ============ */
.panel-head { padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 16px; margin-bottom: 6px; }
.panel-head p { max-width: 720px; line-height: 1.5; }
.cell-wrap { word-break: break-all; max-width: 280px; }
.notice a { color: inherit; font-weight: 600; text-decoration: underline; }
.notif-title + .small { margin-top: 8px; }
.notif-title .tag { margin-left: 6px; vertical-align: middle; }

/* ============ Feedback page ============ */
.row-click { cursor: pointer; }
.row-click:hover td { background: var(--ring); }
.row-unread .notif-title { font-weight: 700; }
.img-flag { display: inline-flex; vertical-align: middle; color: var(--muted); margin-left: 6px; }
.foot-split { justify-content: space-between; }
.btn-danger-ghost {
  height: 42px; padding: 0 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  background: transparent; color: #ef4444; border: 1px solid rgba(239,68,68,.35); border-radius: 10px;
  transition: background .15s;
}
.btn-danger-ghost:hover { background: rgba(239,68,68,.12); }
.detail-title { font-size: 18px; line-height: 1.35; margin-bottom: 10px; word-break: break-word; }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.detail-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 22px 0 8px; }
.detail-text { white-space: pre-wrap; word-break: break-word; line-height: 1.55; font-size: 14px; }
.detail-img { display: block; max-width: 100%; max-height: 360px; border-radius: 10px; border: 1px solid var(--border); object-fit: contain; background: var(--input-bg); }
.status-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status-actions .btn-ghost { height: 38px; font-size: 13px; }
.detail-section { margin-top: 6px; padding-top: 2px; border-top: 1px solid var(--border); margin-top: 22px; }
.detail-section .detail-label:first-child { margin-top: 18px; }
.reply-box { white-space: pre-wrap; word-break: break-word; line-height: 1.55; font-size: 14px; padding: 12px 14px; border-radius: 10px; background: var(--ring); border: 1px solid var(--border); }
.reply-meta { margin-top: 8px; line-height: 1.5; }
.reply-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.side-modal-body textarea#replyText { margin-top: 0; font-family: inherit; font-size: 14px; }

/* ============ Settings: tabs, AdMob, VPN global ============ */
.field[hidden] { display: none; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  padding: 11px 16px; font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap;
  background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel[hidden] { display: none; }

.tag-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 260px; }
.tag-list .tag { padding: 2px 8px; font-size: 11px; }

.vpn-form { display: flex; flex-direction: column; gap: 22px; padding-top: 18px; max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.text-input, .select-input {
  width: 100%; height: 46px; padding: 0 14px; font-size: 15px; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.text-input:focus, .select-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.text-input.narrow { width: 96px; flex: none; text-align: center; }
.select-input { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px; }

.toggle-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; cursor: pointer; }
.toggle-row + .toggle-row { border-top: 1px solid var(--border); }
.toggle-text { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.toggle-row.sub-field { cursor: default; padding-left: 34px; background: var(--input-bg); }
.toggle-row.sub-field.off .toggle-text, .toggle-row.sub-field.off .text-input { opacity: .5; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ============ Settings: API tab ============ */
.copy-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.copy-value {
  flex: 1; min-width: 0; padding: 11px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere;
}
.btn-sm { height: 40px; }
.key-text { word-break: break-all; }
.data-table td.col-actions-4 { white-space: nowrap; width: 170px; }
.api-block { max-width: 760px; }
.panel-head code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--ring); padding: 1px 6px; border-radius: 5px; }

/* ============ VPN Global: bulk credentials ============ */
.bulk-section { max-width: 760px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 18px; }
.bulk-head h3 { font-size: 15px; margin-bottom: 6px; }
.bulk-head p { line-height: 1.5; }
.match-count { font-size: 13px; color: var(--muted); }
.match-count strong { color: var(--text); font-size: 15px; }

/* ============ Dashboard ============ */
.stat-card.pending { opacity: .6; }
.stat-card.pending .stat-value { color: var(--muted); }
a.stat-link { color: inherit; text-decoration: none; display: block; }
a.stat-link:hover { border-color: var(--primary); }

/* ============ Server health ============ */
.health-err { display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.row-btn.spinning svg { animation: spin .8s linear infinite; }
.row-btn:disabled { opacity: .45; cursor: not-allowed; }
.narrow-select { width: 160px; flex: none; }
.btn-outline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.btn-outline:disabled { opacity: .6; cursor: progress; }
#serversTable td.col-actions { width: 150px; }
.status-dot.pending { background: #94a3b8; box-shadow: 0 0 0 3px rgba(148,163,184,.2); }
.panel.attention { border-color: rgba(239,68,68,.35); }
.panel.attention[hidden] { display: none; }

/* ============ Branding logo + Admin tab ============ */
.logo-img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.logo-badge.has-logo,
.sidebar-top .logo-badge.has-logo,
.mobile-logo .logo-badge.has-logo { background: transparent; border-color: transparent; box-shadow: none; }

.admin-section { padding-top: 4px; }
.admin-section + .admin-section { padding-top: 22px; border-top: 1px solid var(--border); }
.admin-section h3 { font-size: 15px; margin-bottom: 14px; }
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview {
  width: 64px; height: 64px; flex: none; display: grid; place-items: center; overflow: hidden;
  border-radius: 14px; background: var(--primary); color: #fff; border: 1px solid var(--border);
}
.logo-preview.has-logo { background: var(--input-bg); }
.logo-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.logo-actions .btn-sm { height: 40px; }
.logo-actions [hidden] { display: none; }

.btn-link { display: inline-flex; align-items: center; text-decoration: none; padding: 0 14px; font-size: 14px; font-weight: 600; color: var(--text); border: 1px solid var(--border); border-radius: 10px; }
.btn-link:hover { background: var(--ring); }

/* Analytics tab */
button.btn-link { height: 34px; background: transparent; font-family: inherit; cursor: pointer; }
button.btn-link:disabled { opacity: .45; cursor: not-allowed; }
button.btn-link:disabled:hover { background: transparent; }
.analytics-steps { margin: 0 0 18px; padding-left: 20px; line-height: 1.7; }
#analyticsTable .text-input { min-width: 150px; }

/* ============ Admins, profile, roles ============ */
.tag-role-owner { color: #7c3aed; background: rgba(124,58,237,.12); }
.tag-role-admin { color: var(--primary); background: var(--ring); }
.tag-role-viewer { color: var(--muted); background: rgba(148,163,184,.18); }
.who { display: flex; align-items: center; gap: 12px; }
.who .notif-title + .small { margin-top: 2px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.role-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--card, transparent); }
.role-card p { margin: 8px 0 0; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row input { flex: 1; min-width: 0; }
.field-hint { margin: 6px 0 0; }
.check-row { display: flex !important; align-items: center; gap: 10px; font-weight: 500 !important; cursor: pointer; }
.data-table td.col-actions-3 { white-space: nowrap; width: 130px; }
.profile-grid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; }
.profile-forms { display: flex; flex-direction: column; gap: 20px; }
.profile-card { padding: 24px; }
.profile-hero { text-align: center; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.profile-hero h2 { margin: 12px 0 2px; font-size: 19px; word-break: break-word; }
.profile-hero p { margin: 0 0 10px; word-break: break-all; }
.avatar-lg { width: 72px; height: 72px; font-size: 28px; margin: 0 auto; }
.detail-list { margin: 16px 0 0; display: flex; flex-direction: column; gap: 12px; }
.detail-list div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; }
.role-can { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.role-can h4 { margin: 0 0 8px; font-size: 14px; }
.role-can ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; color: var(--muted); }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }

/* View-only accounts: write controls are hidden or disabled (the server refuses the changes anyway) */
.ro-banner { margin: 0 0 18px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; background: rgba(148,163,184,.16); color: var(--muted); border: 1px solid var(--border); }
html.role-viewer button[data-ro] { display: none !important; }
html.role-viewer [data-ro]:disabled { cursor: not-allowed; opacity: .7; }
html.role-viewer .page-head-actions { display: none; }

/* ============ License ============ */
.license-grid { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; }
.license-side { display: flex; flex-direction: column; gap: 20px; }
.license-card { padding: 24px; }
.license-status { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.license-status h2 { margin: 0; font-size: 19px; }
.license-note { padding: 0 20px 18px; margin: 0; }
.key-area { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; resize: vertical; word-break: break-all; }
#compare td.yes { color: #16a34a; font-weight: 700; }
#compare td.no { color: var(--muted); }
#compare th.ed-full, #compare th.ed-partial, #compare td.ed-full, #compare td.ed-partial { text-align: center; }
#compare .current { background: var(--ring); font-weight: 700; }
.license-open { max-width: 1100px; margin: 0 auto; padding: 16px; }
.license-open-head { display: flex; align-items: center; gap: 12px; padding: 12px 0 20px; }
.license-open-head .btn-link { margin-left: auto; height: 34px; }
@media (max-width: 900px) { .license-grid { grid-template-columns: 1fr; } }
.license-banner { margin: 0 0 18px; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; background: rgba(245,158,11,.15); color: #b45309; border: 1px solid rgba(245,158,11,.4); }
.license-banner a { color: inherit; font-weight: 700; }

/* ============ Import / Export ============ */
.transfer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; padding: 18px 20px 24px; }
.transfer-card { border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.transfer-card h3 { margin: 0; font-size: 16px; }
.transfer-warn { font-size: 13px; padding: 10px 12px; border-radius: 10px; background: rgba(245,158,11,.14); color: #b45309; border: 1px solid rgba(245,158,11,.35); }
.radio-col { display: flex; flex-direction: column; gap: 8px; }
.transfer-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.transfer-result { border-top: 1px solid var(--border); padding-top: 14px; }
.transfer-result .data-table .row-problem td:last-child { color: #dc2626; }
.transfer-result .data-table .row-skip td:last-child { color: var(--muted); }
.radio-col input[type="radio"], .radio-col input[type="checkbox"] {
  width: 18px; height: 18px; flex: none; margin: 0; padding: 0;
  border-radius: 50%; box-shadow: none; accent-color: var(--primary); cursor: pointer;
}
/* An element switched off with the hidden attribute stays hidden even if its class sets a display (buttons, flex rows) */
[hidden] { display: none !important; }
input[type="file"].text-input { height: auto; padding: 8px 10px; cursor: pointer; }
input[type="file"].text-input::file-selector-button {
  margin-right: 12px; padding: 7px 14px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--ring); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
input[type="file"].text-input:disabled { cursor: not-allowed; opacity: .7; }

/* ============ Installer ============ */
.installer { min-height: 100vh; background: var(--bg); }
.wiz { max-width: 760px; margin: 0 auto; padding: 36px 16px 64px; }
.wiz-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.wiz-head h1 { margin: 0 0 2px; font-size: 24px; }
.wiz-head p { margin: 0; }
.wiz-steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.wiz-steps li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); border: 1px solid var(--border); }
.wiz-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--ring); }
.wiz-steps li.active { color: var(--text); border-color: var(--primary); }
.wiz-steps li.active span { background: var(--primary); color: #fff; }
.wiz-steps li.done span { background: #16a34a; color: #fff; }
.wiz-card { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.wiz-card h2 { margin: 0; font-size: 19px; }
.wiz-card[hidden] { display: none; }
.wiz-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.wiz-actions a.btn-primary-sm { text-decoration: none; }
.req-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.req-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.req-list .mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 700; }
.req-list .ok .mark { background: rgba(34,197,94,.15); color: #16a34a; }
.req-list .bad .mark { background: rgba(239,68,68,.15); color: #dc2626; }
.req-list em { margin-left: auto; font-style: normal; color: var(--muted); font-size: 12.5px; }
.db-types { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.db-type { text-align: left; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 4px; font: inherit; }
.db-type span { font-size: 12.5px; color: var(--muted); }
.db-type:hover { background: var(--ring); }
.db-type.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
.form-grid .field.wide { grid-column: 1 / -1; }
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: 13px; padding: 0; text-align: left; width: fit-content; }
.wiz-note { padding: 12px 14px; border-radius: 10px; background: var(--ring); font-size: 14px; }
.wiz-note p { margin: 4px 0 0; }
.wiz-test { padding: 10px 14px; border-radius: 10px; font-size: 14px; border: 1px solid var(--border); }
.wiz-test.ok { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.35); }
.wiz-test.bad { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.35); color: #dc2626; }
.strength { height: 6px; border-radius: 99px; background: var(--ring); overflow: hidden; margin-top: 8px; }
.strength span { display: block; height: 100%; width: 0; background: #dc2626; transition: width .2s, background .2s; }
.strength.s1 span { width: 25%; } .strength.s2 span { width: 50%; background: #d97706; } .strength.s3 span { width: 75%; background: #65a30d; } .strength.s4 span { width: 100%; background: #16a34a; }
.wiz-progress { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 10px; background: var(--ring); }
.wiz-progress[hidden] { display: none; }
.wiz-progress span { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--primary); border-right-color: transparent; animation: wizspin .8s linear infinite; }
@keyframes wizspin { to { transform: rotate(360deg); } }
.done-badge { width: 56px; height: 56px; border-radius: 50%; background: rgba(34,197,94,.15); color: #16a34a; display: grid; place-items: center; font-size: 28px; font-weight: 700; }
.creds { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.creds div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.creds div span { color: var(--muted); }
.creds strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.creds .btn-ghost { align-self: flex-start; }
.maintenance { max-width: 560px; margin: 12vh auto; padding: 0 16px; }

/* Text boxes inside .field are for the sign-in form, which reserves room for an icon on the left; plain .text-input boxes do not */
.field input.text-input, .field textarea.text-input { padding: 0 14px; height: 46px; font-size: 15px; }
.field textarea.text-input { height: auto; padding: 12px 14px; }
.field input[type="file"].text-input { height: auto; padding: 8px 10px; }
#dbForm { display: flex; flex-direction: column; gap: 16px; }
#dbForm[hidden] { display: none; }
.wiz .check-row { margin: 0; }
