/* Focry App Portal */
:root {
  --bg: #030712;
  --bg2: #0f172a;
  --card: rgba(15, 23, 42, 0.72);
  --border: rgba(148, 163, 184, 0.14);
  --text: #f8fafc;
  --muted: #94a3b8;
  --brand: #10b981;
  --brand2: #34d399;
  --accent: #38bdf8;
  --danger: #f87171;
  --sidebar: #0b1220;
  --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
  --radius: 18px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
}

body.auth-page { overflow-x: hidden; }

a { color: var(--brand2); text-decoration: none; }
a:hover { text-decoration: underline; }

.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 10%, rgba(16, 185, 129, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 20%, rgba(56, 189, 248, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(16, 185, 129, 0.08), transparent 50%),
    linear-gradient(160deg, #020617 0%, #0f172a 45%, #020617 100%);
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 0;
  animation: float 12s ease-in-out infinite;
}
.orb-1 { width: 280px; height: 280px; background: rgba(16, 185, 129, 0.22); top: 8%; left: -4%; }
.orb-2 { width: 220px; height: 220px; background: rgba(56, 189, 248, 0.16); bottom: 10%; right: -2%; animation-delay: -4s; }

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-18px) scale(1.04); }
}

.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: min(100%, 440px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 32px 28px;
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.brand img { width: 42px; height: 42px; border-radius: 12px; }
.brand h1 { margin: 0; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 0.85rem; }

.auth-subtitle { margin: 0 0 24px; color: var(--muted); font-size: 0.95rem; line-height: 1.5; }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 8px; font-size: 0.82rem; font-weight: 600; color: #cbd5e1; }
.field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(2, 6, 23, 0.65);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.btn:disabled { opacity: 0.65; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), #059669);
  color: #fff;
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.28);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: auto;
  padding: 10px 16px;
}

.auth-links { margin-top: 18px; text-align: center; font-size: 0.9rem; color: var(--muted); }

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  animation: rise 0.4s ease;
}
.alert-error { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35); color: #fecaca; }
.alert-success { background: rgba(16, 185, 129, 0.12); border: 1px solid rgba(16, 185, 129, 0.35); color: #a7f3d0; }
.alert-info { background: rgba(56, 189, 248, 0.1); border: 1px solid rgba(56, 189, 248, 0.28); color: #bae6fd; }

.hidden { display: none !important; }

.app-shell { display: flex; min-height: 100vh; background: var(--bg); }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 20;
  transition: transform 0.3s ease;
}

.sidebar-brand { padding: 22px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.sidebar-brand img { width: 36px; height: 36px; border-radius: 10px; }
.sidebar-brand strong { font-size: 1.05rem; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { margin-bottom: 18px; }
.nav-label { padding: 0 10px 8px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px;
  color: #cbd5e1; font-size: 0.92rem; font-weight: 500;
  margin-bottom: 4px; transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: rgba(148, 163, 184, 0.08); text-decoration: none; color: #fff; }
.nav-link.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.08));
  color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.22);
}
.nav-link.disabled { opacity: 0.45; pointer-events: none; }
.nav-link .badge-soon { margin-left: auto; font-size: 0.65rem; padding: 2px 6px; border-radius: 999px; background: rgba(148, 163, 184, 0.12); color: #94a3b8; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.main { flex: 1; margin-left: 260px; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar h2 { margin: 0; font-size: 1.2rem; }
.menu-toggle {
  display: none; background: transparent; border: 1px solid var(--border);
  color: var(--text); border-radius: 10px; padding: 8px 10px; cursor: pointer;
}

.content { padding: 24px; animation: rise 0.5s ease; }

.hero-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}
.hero-card h3 { margin: 0 0 8px; font-size: 1.5rem; }
.hero-card p { margin: 0; color: var(--muted); line-height: 1.55; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: #64748b; margin-bottom: 8px; }
.stat-card .value { font-size: 1.15rem; font-weight: 700; }
.stat-card .value.ok { color: #6ee7b7; }
.stat-card .value.warn { color: #fbbf24; }
.stat-card .value.danger { color: #f87171; }

.subnav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.subnav-link {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.subnav-link:hover { color: #fff; background: rgba(148, 163, 184, 0.08); text-decoration: none; }
.subnav-link.active {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.panel-head h3 { margin: 0; font-size: 1.15rem; }
.panel-desc { margin: 0 0 18px; color: var(--muted); line-height: 1.55; }
.muted { color: var(--muted); }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--border);
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.08);
}
.status-badge.ok { color: #6ee7b7; border-color: rgba(16, 185, 129, 0.35); background: rgba(16, 185, 129, 0.1); }
.status-badge.warn { color: #fbbf24; border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.1); }
.status-badge.danger { color: #f87171; border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.1); }
.status-badge.muted { color: #94a3b8; }

.wa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.btn-inline {
  width: auto;
  min-width: 160px;
}
.wa-qr-wrap {
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  text-align: center;
}
.wa-qr-image {
  width: min(100%, 280px);
  height: auto;
  margin-top: 12px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.wa-connected-info {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.22);
}
.placeholder-box {
  padding: 16px;
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  color: var(--muted);
  line-height: 1.55;
}

.content .field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(2, 6, 23, 0.65);
  color: var(--text);
  font-size: 1rem;
}
.content .field input:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
}

.profile-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 720px; }
.profile-row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.08); }
.profile-row:last-child { border-bottom: none; }
.profile-row span:first-child { color: var(--muted); }
.profile-row span:last-child { font-weight: 600; text-align: right; }

.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 15; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
}

@media (max-width: 480px) {
  .auth-card { padding: 24px 18px; }
  .profile-row { flex-direction: column; gap: 4px; }
  .profile-row span:last-child { text-align: left; }
}
