/* ClienteLab panel — aesthetic pro v5
   Classes preserved: topbar brand top-actions counter wrap grid card
   card-title dot name icon-btn meta actions btn btn-primary btn-disabled
   btn-ghost empty toast login-page login-card error
   No HTML/JS changes required. */

:root {
  --bg0: #070b14;
  --bg1: #0b1220;
  --bg2: #0f172a;
  --surface: #111c30;
  --surface-2: #152238;
  --border: #243554;
  --border-soft: #1e293b;
  --text: #e8eef7;
  --text-dim: #94a3b8;
  --text-mute: #64748b;
  --brand: #7dd3fc;
  --brand-2: #38bdf8;
  --accent: #0ea5e9;
  --accent-2: #6366f1;
  --ok: #22c55e;
  --ok-glow: rgba(34, 197, 94, 0.35);
  --danger: #ef4444;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg0);
  background-image:
    radial-gradient(1100px 560px at 88% -8%, rgba(56, 189, 248, 0.12) 0%, transparent 58%),
    radial-gradient(900px 520px at -12% 108%, rgba(99, 102, 241, 0.10) 0%, transparent 55%),
    radial-gradient(700px 400px at 50% 50%, rgba(14, 165, 233, 0.04) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 100%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

/* ── Top bar ── */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid rgba(36, 53, 84, 0.85);
  background: rgba(11, 18, 32, 0.78);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 8px 28px rgba(0, 0, 0, 0.18);
}

.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-2), var(--accent-2));
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
  flex: none;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.counter {
  font-size: 12.5px;
  color: var(--text-dim);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 5px 12px;
  letter-spacing: 0.01em;
}

/* ── Layout ── */
.wrap {
  max-width: 1200px;
  margin: 28px auto 48px;
  padding: 0 22px;
}

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

/* ── Cards ── */
.card {
  background: linear-gradient(165deg, rgba(21, 34, 56, 0.95) 0%, rgba(17, 28, 48, 0.98) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.18s ease,
              box-shadow 0.18s ease;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.18), transparent);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #3a5a8a;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(56, 189, 248, 0.06);
}

.card.on {
  border-left: 3px solid var(--ok);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18), -2px 0 16px var(--ok-glow);
}

.card.off {
  border-left: 3px solid #475569;
  opacity: 0.78;
}

.card.off:hover { opacity: 0.92; }

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  min-width: 0;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
  flex: none;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.15);
}

.card.on .dot {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok-glow), 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.name {
  font-weight: 650;
  font-size: 14.5px;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f1f5f9;
  min-width: 0;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 7px;
  border-radius: 8px;
  margin-left: auto;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  flex: none;
}

.icon-btn:hover {
  color: var(--brand);
  background: rgba(30, 41, 59, 0.85);
  border-color: var(--border-soft);
}

.meta {
  font-size: 12.5px;
  color: var(--text-dim);
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 8px 10px;
  background: rgba(7, 11, 20, 0.35);
  border: 1px solid rgba(30, 41, 59, 0.7);
  border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums;
}

.meta span,
.meta div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 16px;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: filter 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, color 0.14s ease, background 0.14s ease;
  font-family: inherit;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  width: 100%;
  box-shadow: 0 2px 12px rgba(14, 165, 233, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transform: translateY(-1px);
}

.btn-disabled {
  background: #1a2438;
  color: #475569;
  width: 100%;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid #334155;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--brand);
  background: rgba(125, 211, 252, 0.06);
}

/* ── Empty state ── */
.empty {
  text-align: center;
  color: var(--text-mute);
  padding: 80px 24px;
  font-size: 14px;
  line-height: 1.75;
  background: rgba(17, 28, 48, 0.4);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  max-width: 520px;
  margin: 40px auto;
}

/* ── Panel toast (native; maint toast is separate in terminal.js) ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(14, 165, 233, 0.55);
  color: var(--text);
  padding: 11px 22px;
  border-radius: 12px;
  font-size: 13px;
  z-index: 50;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* ── Login ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
}

.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px 360px at 50% 28%, rgba(14, 165, 233, 0.10) 0%, transparent 60%),
    radial-gradient(500px 300px at 70% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  background: linear-gradient(165deg, rgba(21, 34, 56, 0.98) 0%, rgba(15, 23, 42, 0.98) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 28px 24px;
  width: min(360px, 100%);
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: linear-gradient(90deg, transparent, var(--brand-2), var(--accent-2), transparent);
  opacity: 0.85;
}

.login-card h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--brand);
  text-align: center;
  letter-spacing: 0.02em;
  margin-top: 4px;
}

.login-card .sub {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 0;
  margin-bottom: 2px;
}

.login-card input {
  background: rgba(7, 11, 20, 0.65);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-card input::placeholder { color: #52607a; }

.login-card input:hover { border-color: #33507f; }

.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
  background: rgba(7, 11, 20, 0.85);
}

.login-card .btn-primary {
  margin-top: 4px;
  min-height: 42px;
  font-size: 14px;
}

.error {
  background: rgba(127, 29, 29, 0.28);
  border: 1px solid rgba(239, 68, 68, 0.55);
  color: #fca5a5;
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  text-align: center;
}

/* ── Scrollbar (panel only) ── */
body::-webkit-scrollbar { width: 8px; height: 8px; }
body::-webkit-scrollbar-track { background: var(--bg0); }
body::-webkit-scrollbar-thumb {
  background: #243554;
  border-radius: 4px;
}
body::-webkit-scrollbar-thumb:hover { background: #33507f; }
* { scrollbar-width: thin; scrollbar-color: #243554 var(--bg0); }

/* ── Selection ── */
::selection {
  background: rgba(14, 165, 233, 0.35);
  color: #f8fafc;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .brand { font-size: 15px; }
  .wrap { margin-top: 18px; padding: 0 14px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .login-card { padding: 28px 22px 24px; }
}

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




/* chips always readable */
.cl-bank-chip,
.cl-bank-chip.brand,
.cl-bank-chip.cl-chip-brand,
.cl-bank-chip.site,
span.cl-bank-chip {
  font-size: 9.5px !important;
  line-height: 1 !important;
  color: var(--cl-chip-fg, #f8fafc) !important;
  visibility: visible !important;
  opacity: 1 !important;
  min-height: 16px !important;
  height: 16px !important;
  padding: 0 6px !important;
  white-space: nowrap !important;
}

/* CLIENTLAB_BRAND_SIMPLE_V4 — one text brand, no flag, hide natives */
body:not(.login-page) .sidebar .brand:not(#cl-brand-once),
body:not(.login-page) .sidebar .nav-foot:not(#cl-foot-once),
body:not(.login-page) .sidebar #cl-side-brand,
body:not(.login-page) .sidebar #cl-side-foot,
body:not(.login-page) .sidebar [data-cl-brand],
body:not(.login-page) .sidebar [data-cl-foot],
body:not(.login-page) .sidebar .cl-flag {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -99999px !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  font-size: 0 !important;
}
body:not(.login-page) .sidebar .brand:not(#cl-brand-once)::before,
body:not(.login-page) .sidebar .brand:not(#cl-brand-once)::after,
body:not(.login-page) .sidebar .nav-foot:not(#cl-foot-once)::before,
body:not(.login-page) .sidebar .nav-foot:not(#cl-foot-once)::after {
  content: none !important;
  display: none !important;
}
body:not(.login-page) #cl-brand-once {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 3px !important;
  padding: 18px 16px 14px !important;
  margin: 0 0 10px 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border-bottom: 1px solid rgba(36, 48, 65, 0.9) !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  font-size: 0 !important;
  color: transparent !important;
}
body:not(.login-page) #cl-brand-once .cl-b1 {
  display: block !important;
  font: 800 16px/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif !important;
  color: #60a5fa !important;
  letter-spacing: 0.02em !important;
  white-space: nowrap !important;
  visibility: visible !important;
  opacity: 1 !important;
}
body:not(.login-page) #cl-brand-once .cl-b2 {
  display: block !important;
  font: 600 11px/1.25 system-ui, -apple-system, Segoe UI, Roboto, sans-serif !important;
  color: #94a3b8 !important;
  letter-spacing: 0.04em !important;
  visibility: visible !important;
  opacity: 1 !important;
}
body:not(.login-page) #cl-brand-once::before,
body:not(.login-page) #cl-brand-once::after {
  content: none !important;
  display: none !important;
}
body:not(.login-page) #cl-foot-once {
  display: block !important;
  margin-top: auto !important;
  padding: 14px 12px 12px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border-top: 1px solid rgba(36, 48, 65, 0.75) !important;
  font: 600 13px/1.3 system-ui, -apple-system, Segoe UI, Roboto, sans-serif !important;
  color: #94a3b8 !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
}
body:not(.login-page) #cl-foot-once::before,
body:not(.login-page) #cl-foot-once::after {
  content: none !important;
  display: none !important;
}
