/* ORav-VPN — deep navy glass (iOS-inspired) */
:root {
  --bg: #060b14;
  --bg-elevated: #0a1220;
  --khaki-950: #040810;
  --khaki-900: #0a1220;
  --khaki-800: #122033;
  --khaki-700: #1a2e48;
  --khaki-500: #4a6f96;
  --khaki-400: #6a8fb8;
  --khaki-300: #8aafd0;
  --khaki-200: #b0cce4;
  --khaki-100: #d8e6f4;

  --glass: rgba(56, 96, 148, 0.07);
  --glass-strong: rgba(56, 96, 148, 0.12);
  --glass-hover: rgba(56, 96, 148, 0.18);
  --glass-border: rgba(120, 160, 210, 0.14);
  --glass-highlight: rgba(200, 224, 255, 0.22);
  --glass-sheen: linear-gradient(
    155deg,
    rgba(180, 210, 255, 0.12) 0%,
    rgba(180, 210, 255, 0.04) 28%,
    transparent 52%,
    rgba(20, 40, 70, 0.14) 100%
  );
  --glass-blur: blur(28px) saturate(130%);

  --text: #d8e6f4;
  --muted: rgba(150, 180, 210, 0.52);
  --accent: #5a8ec4;
  --accent-strong: #7aabd8;
  --neon: #6a9fd0;
  --neon-dim: rgba(90, 150, 210, 0.3);
  --ok: #6aaa7a;
  --warn: #c4a55a;
  --err: #c07070;

  --radius: 22px;
  --radius-sm: 14px;
  --sidebar-w: 248px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --touch: 44px;

  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

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

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

body {
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
}

#fireflies {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 12% -8%, rgba(40, 90, 160, 0.18), transparent 58%),
    radial-gradient(ellipse 55% 40% at 95% 8%, rgba(16, 36, 64, 0.55), transparent 52%),
    radial-gradient(ellipse 70% 45% at 48% 110%, rgba(8, 18, 36, 0.75), transparent 55%),
    linear-gradient(180deg, #0a1424 0%, #060b14 45%, #040810 100%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* —— Glass —— */
.glass-panel {
  position: relative;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 1px 0 rgba(180, 210, 255, 0.08) inset,
    0 -14px 32px rgba(0, 0, 0, 0.35) inset,
    0 20px 56px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.glass-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--glass-sheen);
  pointer-events: none;
  z-index: 0;
}

.glass-panel::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(180, 210, 255, 0.28),
    transparent
  );
  pointer-events: none;
  z-index: 1;
}

.glass-panel > * {
  position: relative;
  z-index: 2;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 24px 14px calc(16px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(224, 214, 188, 0.1);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.sidebar.glass-panel::after {
  display: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
}

.sidebar-brand img {
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
  background: var(--khaki-800);
}

.sidebar-brand strong {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--khaki-100);
}

.sidebar-brand span {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: var(--touch);
  padding: 10px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  text-align: left;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  opacity: 0.8;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--glass-hover);
  color: var(--text);
}

.nav-item.active {
  color: var(--khaki-100);
  background: var(--glass-strong);
  box-shadow:
    inset 0 0 0 1px rgba(100, 150, 210, 0.32),
    inset 0 1px 0 rgba(180, 210, 255, 0.12);
}

.nav-item.active svg {
  opacity: 1;
  color: var(--neon);
}

.sidebar-foot {
  padding: 0 8px;
}

.pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 650;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(156, 186, 122, 0.14);
  color: var(--ok);
  border: 1px solid rgba(156, 186, 122, 0.32);
}

.pill.off {
  background: rgba(201, 122, 106, 0.12);
  color: var(--err);
  border-color: rgba(201, 122, 106, 0.32);
}

.workspace {
  padding: 28px 28px calc(88px + var(--safe-b));
  max-width: 1100px;
  width: 100%;
}

.panel {
  display: none;
  animation: panelIn 0.22s ease;
}
.panel.active {
  display: block;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.panel-head {
  margin-bottom: 20px;
}

.panel-head h2 {
  font-size: clamp(1.35rem, 3.5vw, 1.7rem);
  font-weight: 720;
  letter-spacing: -0.035em;
  color: var(--khaki-100);
}

.panel-sub {
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.content-panel {
  padding: 20px 22px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dash-hero {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dash-ring-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.dash-ring {
  position: relative;
  width: 88px;
  height: 88px;
  min-width: 88px;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.dash-ring-glow {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(100, 150, 210, 0.32);
  animation: ringPulse 2.8s ease-in-out infinite;
}

.dash-ring.on .dash-ring-glow {
  border-color: var(--neon);
  box-shadow: 0 0 24px var(--neon-dim), inset 0 0 12px rgba(100, 150, 210, 0.2);
}

.dash-ring-core {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: linear-gradient(
    145deg,
    rgba(212, 196, 160, 0.35),
    rgba(90, 82, 58, 0.45)
  );
  border: 1px solid rgba(180, 210, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.dash-ring.on .dash-ring-core {
  background: linear-gradient(
    145deg,
    rgba(224, 214, 188, 0.55),
    rgba(138, 129, 104, 0.4)
  );
}

@keyframes ringPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

.dash-ring-meta strong {
  display: block;
  font-size: 1.1rem;
}
.dash-ring-meta span {
  font-size: 0.78rem;
  color: var(--muted);
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.dash-stats em {
  display: block;
  font-style: normal;
  font-size: 1.35rem;
  font-weight: 720;
  color: var(--neon);
}

.dash-stats span {
  font-size: 0.68rem;
  color: var(--muted);
}

.dash-chart-card {
  padding: 20px 22px;
}

#dash_chart {
  width: 100%;
  display: block;
  margin-top: 8px;
}

.dash-rates {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.dash-rates strong {
  color: var(--text);
}

.server-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  margin-top: 16px;
}

.server-card {
  padding: 18px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.server-card.sync-flash {
  animation: syncFlash 0.9s ease;
}

@keyframes syncFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(90, 150, 210, 0.45);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(90, 150, 210, 0);
  }
  100% {
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  }
}

.settings-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-h3 {
  font-size: 0.95rem;
  font-weight: 650;
  margin-bottom: 16px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--touch);
  padding: 12px 0;
  border-bottom: 1px solid rgba(224, 214, 188, 0.1);
}

.toggle-row div strong {
  display: block;
  font-size: 0.88rem;
}
.toggle-row div span {
  font-size: 0.72rem;
  color: var(--muted);
}

.ios-toggle {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.ios-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ios-toggle i {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(224, 214, 188, 0.16);
  transition: background 0.25s;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}

.ios-toggle i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: linear-gradient(180deg, #d8e6f4, #a8c4e0);
  transition: transform 0.25s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.ios-toggle input:checked + i {
  background: linear-gradient(180deg, #6a9fd0, #3a6a9a);
  box-shadow: 0 0 12px var(--neon-dim), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.ios-toggle input:checked + i::after {
  transform: translateX(20px);
}

.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.team-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  transition: background 0.25s, transform 0.2s;
  min-height: var(--touch);
}

.team-card:hover {
  background: var(--glass-hover);
  transform: translateY(-2px);
}

.team-handle {
  font-weight: 700;
  color: var(--neon);
  font-size: 0.95rem;
}
.team-role {
  font-size: 0.72rem;
  color: var(--muted);
}

.settings-foot {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--muted);
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.user-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}
.user-row .hint {
  color: var(--muted);
  font-size: 0.72rem;
}

.log-stream {
  margin-top: 12px;
  padding: 16px;
  max-height: min(60vh, 520px);
  overflow: auto;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--khaki-200);
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  white-space: pre-wrap;
  -webkit-overflow-scrolling: touch;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin: 10px 0;
}

.field {
  flex: 1 1 140px;
  min-width: 120px;
  margin-bottom: 8px;
}

.field label {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 550;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--touch);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(14, 13, 11, 0.55);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* prevent iOS zoom */
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--khaki-400) 50%),
    linear-gradient(135deg, var(--khaki-400) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(100, 160, 220, 0.55);
  box-shadow: 0 0 0 3px rgba(90, 150, 210, 0.18);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  min-height: var(--touch);
  padding: 10px 16px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s, filter 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(180deg, #6a9fd0 0%, #4a7ab0 48%, #2e5688 100%);
  color: #f0f6fc;
  box-shadow:
    0 1px 0 rgba(180, 210, 255, 0.2) inset,
    0 6px 18px rgba(0, 0, 0, 0.45);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-ghost {
  background: var(--glass-hover);
  color: var(--text);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(180, 210, 255, 0.1);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(196, 184, 150, 0.22);
  border-color: rgba(224, 214, 188, 0.28);
}

.btn-danger {
  background: rgba(201, 122, 106, 0.14);
  color: var(--err);
  border: 1px solid rgba(201, 122, 106, 0.32);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(201, 122, 106, 0.24);
}

.btn-accent {
  background: rgba(90, 150, 210, 0.16);
  color: var(--neon);
  border: 1px solid rgba(100, 160, 220, 0.36);
  box-shadow: inset 0 1px 0 rgba(180, 210, 255, 0.08);
}

.btn-accent:hover:not(:disabled) {
  background: rgba(90, 150, 210, 0.28);
  box-shadow: 0 0 14px rgba(90, 150, 210, 0.18);
}

.btn-dl {
  background: rgba(168, 155, 122, 0.12);
  color: var(--khaki-200);
  border: 1px solid rgba(168, 155, 122, 0.28);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: -0.02em;
}

.btn-dl:hover:not(:disabled) {
  background: rgba(168, 155, 122, 0.2);
  color: var(--khaki-100);
}

.btn-sm {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.8rem;
}

.hint {
  font-size: 0.72rem;
  color: var(--muted);
}

.msg {
  font-size: 0.78rem;
  margin-top: 10px;
  min-height: 1.1em;
  color: var(--muted);
}
.msg.ok {
  color: var(--ok);
}
.msg.err {
  color: var(--err);
}
.msg.busy {
  color: var(--warn);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.item {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(14, 13, 11, 0.4);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(180, 210, 255, 0.06);
}

.item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.item-title {
  font-weight: 650;
  font-size: 0.92rem;
}

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  color: var(--khaki-300);
  word-break: break-all;
}

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 650;
  background: var(--glass-hover);
  color: var(--muted);
}

.tag.ok {
  color: var(--ok);
  background: rgba(156, 186, 122, 0.14);
}
.tag.wait {
  color: var(--warn);
  background: rgba(212, 181, 106, 0.14);
}
.tag.err {
  color: var(--err);
  background: rgba(201, 122, 106, 0.14);
}

.item-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.item-traffic {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--neon);
  margin: 8px 0 4px;
  letter-spacing: -0.02em;
}

.item-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

.empty-hint {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.online-hints {
  color: rgba(140, 185, 230, 0.9);
}

.online-traffic {
  font-variant-numeric: tabular-nums;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.router-actions,
.server-actions,
.config-actions {
  padding-top: 12px;
  border-top: 1px solid rgba(224, 214, 188, 0.1);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.action-group-main {
  flex: 1 1 auto;
}

.action-group-dl {
  flex: 1 1 100%;
  padding: 10px 0 2px;
  gap: 8px;
}

.action-group-dl .btn {
  min-width: 7.5rem;
}

.action-group-danger {
  margin-left: auto;
}

.action-label {
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}

.router-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-top: 10px;
}

.router-fields .field-wide {
  grid-column: 1 / -1;
}

.router-actions-min {
  margin-top: 12px;
}
.toolbar-min {
  justify-content: flex-end;
  min-height: 0;
}
.dash-ring:disabled {
  cursor: default;
  opacity: 0.95;
}

.net-ind {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 0.72rem;
  font-weight: 700;
}

.net-ind-vpn {
  color: var(--khaki-200);
  background: rgba(138, 129, 104, 0.28);
}
.net-ind-direct {
  color: var(--ok);
  background: rgba(156, 186, 122, 0.18);
}
.net-ind-offline {
  color: #e8b4a8;
  background: rgba(201, 122, 106, 0.2);
}
.net-ind-err {
  color: #f0c4bc;
  background: rgba(160, 70, 55, 0.35);
}
.net-ind-muted {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}
.net-ind-stale {
  opacity: 0.82;
  border: 1px dashed rgba(224, 214, 188, 0.2);
}

.guide-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.progress-wrap {
  display: none;
  margin-top: 12px;
}
.progress-wrap.active {
  display: block;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.progress-head strong {
  color: var(--neon);
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(224, 214, 188, 0.1);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--khaki-400), var(--khaki-300));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.log-box {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  max-height: 220px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  color: var(--khaki-200);
  white-space: pre-wrap;
}

.log-box.show {
  display: block;
}

details.fold {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}
details.fold summary {
  cursor: pointer;
  color: var(--neon);
  font-weight: 550;
  list-style: none;
  min-height: var(--touch);
  display: flex;
  align-items: center;
}
details.fold summary::-webkit-details-marker {
  display: none;
}

.blocked-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 0;
  max-height: min(52vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 2px 4px 0;
}
.blocked-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  position: relative;
  z-index: 0;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  background: rgba(8, 14, 26, 0.55);
  border: 1px solid rgba(180, 210, 255, 0.12);
  border-radius: var(--radius-sm);
  box-shadow: none;
}
.blocked-row-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.blocked-row-main .mono {
  width: 100%;
  line-height: 1.35;
}
.blocked-row-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
}
.access-layout {
  display: grid;
  gap: 14px;
}
.access-chain {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}
.access-chain li {
  margin-bottom: 6px;
}
.field-wide {
  flex: 1 1 220px;
}

.adv-fold {
  margin-top: 12px;
  padding-top: 4px;
}
.adv-warn {
  color: var(--warn);
  margin: 6px 0 10px;
}
.adv-quick {
  margin-bottom: 8px;
}
.adv-textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: rgba(6, 11, 20, 0.65);
  color: var(--text);
  box-sizing: border-box;
}

@media (max-width: 720px) {
  .blocked-row {
    flex-direction: row;
    align-items: center;
  }
  .blocked-row-btn {
    flex: 0 0 auto !important;
    width: auto !important;
    min-width: 0 !important;
  }
}

/* —— Mobile bottom nav —— */
.mobile-nav {
  display: none;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(10px + var(--safe-b));
  z-index: 100;
  flex-direction: row;
  align-items: stretch;
  gap: 2px;
  padding: 6px;
  border-radius: 24px;
  width: min(520px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
}

.mobile-nav .nav-item {
  flex: 1 1 0;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 8px 4px;
  font-size: 0.58rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  border-radius: 16px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-nav .nav-item svg {
  display: block;
  width: 20px;
  height: 20px;
  opacity: 0.85;
}

.mobile-nav .nav-item.active svg {
  opacity: 1;
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .workspace {
    padding: 16px 14px calc(96px + var(--safe-b));
  }
  .mobile-nav {
    display: flex;
  }
  .dash-grid,
  .settings-layout,
  .team-grid {
    grid-template-columns: 1fr;
  }
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .content-panel {
    padding: 16px;
  }
  .card-row .btn {
    width: 100%;
  }
  .card-row .field {
    flex: 1 1 100%;
  }
  .actions {
    gap: 8px;
  }
  .action-group {
    width: 100%;
  }
  .action-group .btn,
  .actions > .btn {
    flex: 1 1 calc(50% - 8px);
    min-width: calc(50% - 8px);
  }
  .action-group-dl .btn {
    flex: 1 1 100%;
    min-width: 0;
  }
  .action-group-danger {
    margin-left: 0;
    width: 100%;
  }
  .action-group-danger .btn {
    flex: 1 1 100%;
  }
  .item-head {
    flex-direction: column;
    align-items: stretch;
  }
  .item-head-right {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 640px) {
  .router-fields {
    grid-template-columns: 1fr;
  }
  .dash-ring-wrap {
    gap: 14px;
  }
  .dash-ring {
    width: 76px;
    height: 76px;
    min-width: 76px;
  }
  .panel-head h2 {
    font-size: 1.35rem;
  }
}

@media (min-width: 901px) {
  .mobile-nav {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Login helpers (also used by login.html) */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
}

.login-card {
  width: min(420px, 100%);
  padding: 28px 24px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.login-card > p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.92rem;
}

.login-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.login-actions .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

.login-msg {
  margin-top: 12px;
  min-height: 1.2em;
  font-size: 0.9rem;
  color: var(--err);
}

.login-lang {
  margin-bottom: 16px;
}


/* —— Analytics —— */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.analytics-stat {
  padding: 14px 16px;
}
.analytics-stat em {
  display: block;
  font-style: normal;
  font-size: 1.25rem;
  font-weight: 720;
  color: var(--neon);
}
.analytics-stat span {
  font-size: 0.68rem;
  color: var(--muted);
}
.analytics-chart {
  width: 100%;
  display: block;
  margin-top: 8px;
  min-height: 100px;
}
.online-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 14px;
  font-size: 0.78rem;
  color: var(--muted);
}
.online-summary strong {
  color: var(--text);
  font-weight: 650;
}
.data-fresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--muted);
}
.data-fresh::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.data-fresh.stale::before {
  background: var(--warn);
  box-shadow: none;
}
.data-fresh.offline::before {
  background: var(--err);
}
