/* ==========================================================================
   01. ROOT VARIABLES & THEME TOKENS (asimkhalid.com Design System)
   ========================================================================== */

:root {
  /* Brand */
  --accent: #FFD600;
  --accent-2: #fbd500;
  --accent-soft: rgba(255, 214, 0, 0.14);
  --accent-line: rgba(255, 214, 0, 0.28);

  /* Dark surface (Default) */
  --bg: #0a0f0d;
  --bg-2: #0e1513;
  --surface: #11181555;
  --surface-solid: #121a17;
  --surface-2: #161f1c;
  --hairline: rgba(255, 255, 255, 0.07);
  --hairline-2: rgba(255, 255, 255, 0.12);

  /* Text */
  --fg: #e8efeb;
  --fg-dim: rgba(232, 239, 235, 0.72);
  --fg-muted: rgba(232, 239, 235, 0.52);
  --fg-faint: rgba(232, 239, 235, 0.32);

  /* Type */
  --f-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* Layout */
  --max-w: 760px;
  --gutter: clamp(16px, 3.5vw, 32px);

  /* Grid overlay */
  --grid-line: rgba(255, 255, 255, 0.04);

  /* Inset surface & shadow tokens */
  --bg-inset: #090e0c;
  --shadow-sm: 0 4px 16px -2px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 20px 50px -12px rgba(0, 0, 0, 0.55);

  /* Alert / Auxiliary colors */
  --color-amber: #f7a83b;
  --color-red: #ea4335;
}

[data-theme="light"] {
  --bg: #f8faf8;
  --bg-2: #eff2ef;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-solid: #ffffff;
  --surface-2: #f0f4f1;
  --hairline: rgba(10, 25, 18, 0.08);
  --hairline-2: rgba(10, 25, 18, 0.15);
  --fg: #0c1411;
  --fg-dim: rgba(12, 20, 17, 0.78);
  --fg-muted: rgba(12, 20, 17, 0.58);
  --fg-faint: rgba(12, 20, 17, 0.35);
  --accent: #059669;
  --accent-2: #10b981;
  --accent-soft: rgba(5, 150, 105, 0.1);
  --accent-line: rgba(5, 150, 105, 0.28);

  /* Grid overlay lighter for light mode */
  --grid-line: rgba(0, 0, 0, 0.05);

  /* Inset surface & shadow tokens */
  --bg-inset: #e6eae7;
  --shadow-sm: 0 4px 16px -2px rgba(10, 25, 18, 0.08);
  --shadow-card: 0 20px 48px -12px rgba(10, 25, 18, 0.09);
}

/* ==========================================================================
   02. RESET & BASE STYLES
   ========================================================================== */

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-weight: 400;
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px var(--gutter);
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

::selection {
  background: var(--accent);
  color: #04130c;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--hairline-2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-line);
}

/* ==========================================================================
   03. BRANDING / BACKGROUND EFFECTS
   ========================================================================== */

.bg-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(
      800px 500px at 85% -10%,
      var(--accent-soft),
      transparent 60%
    ),
    radial-gradient(600px 400px at 5% 30%, var(--accent-soft), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  transition: background 0.3s ease;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(
    ellipse 80% 60% at 50% 30%,
    #000 30%,
    transparent 80%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 80% 60% at 50% 30%,
    #000 30%,
    transparent 80%
  );
}

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.28;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .08 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ==========================================================================
   04. APP CONTAINER
   ========================================================================== */

.app-container {
  width: 100%;
  max-width: var(--max-w);
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0 auto;
}

/* ==========================================================================
   05. HEADER
   ========================================================================== */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--surface-solid);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #04130c;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px var(--accent-soft);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.logo-icon:hover {
  transform: scale(1.05) rotate(-2deg);
}

.logo-text h1 {
  font-family: var(--f-display);
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  line-height: 1.15;
}

.version-tag {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Theme Toggle Button ── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  color: var(--fg-dim);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.06);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
  position: absolute;
  top: 50%;
  left: 50%;
  margin-top: -8.5px;
  margin-left: -8.5px;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}
[data-theme="dark"] .theme-toggle .moon-icon {
  opacity: 0;
  transform: scale(0.3) rotate(-90deg);
}

[data-theme="light"] .theme-toggle .sun-icon {
  opacity: 0;
  transform: scale(0.3) rotate(90deg);
}
[data-theme="light"] .theme-toggle .moon-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

/* ── Status Pill ── */
.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  transition: all 0.25s ease;
  user-select: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-loading {
  background: rgba(247, 168, 59, 0.12);
  color: var(--color-amber);
  border-color: rgba(247, 168, 59, 0.3);
}
.status-loading .status-dot {
  background: var(--color-amber);
  box-shadow: 0 0 6px var(--color-amber);
  animation: pulse 1.6s ease-in-out infinite;
}

.status-online {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}
.status-online .status-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.status-offline {
  background: rgba(234, 67, 53, 0.12);
  color: var(--color-red);
  border-color: rgba(234, 67, 53, 0.3);
}
.status-offline .status-dot {
  background: var(--color-red);
}

.btn-icon-logout {
  background: rgba(234, 67, 53, 0.1);
  color: #ff6b6b;
  border: 1px solid rgba(234, 67, 53, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.btn-icon-logout:hover {
  background: rgba(234, 67, 53, 0.22);
  border-color: var(--color-red);
  color: #fff;
  transform: translateY(-1px);
}

/* ==========================================================================
   06. MULTI-ACCOUNT BAR
   ========================================================================== */

.accounts-strip {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface-solid);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
}

.accounts-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.accounts-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.accounts-label svg {
  color: var(--accent);
}

.accounts-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.accounts-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 6px 12px 6px 14px;
  font-family: var(--f-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-dim);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
  user-select: none;
}

.account-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--fg);
  transform: translateY(-1px);
}

.account-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--fg);
  box-shadow: 0 0 16px var(--accent-soft), 0 0 0 1px var(--accent-line) inset;
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-dot.online {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.pill-dot.pairing,
.pill-dot.qr,
.pill-dot.starting {
  background: var(--color-amber);
  animation: pulse 1.5s infinite;
}

.pill-dot.offline {
  background: var(--fg-faint);
}

.pill-name {
  font-weight: 600;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-delete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--hairline);
  border: none;
  color: var(--fg-muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  margin-left: 2px;
  transition: all 0.15s ease;
}

.pill-delete-btn:hover {
  background: rgba(234, 67, 53, 0.25);
  color: var(--color-red);
  transform: scale(1.15);
}

.btn-add-account {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
  white-space: nowrap;
}

.btn-add-account:hover {
  background: var(--accent);
  color: #04130c;
  box-shadow: 0 4px 16px var(--accent-soft);
  transform: translateY(-1px);
}

.btn-clean-inactive {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(234, 67, 53, 0.08);
  border: 1px solid rgba(234, 67, 53, 0.2);
  color: #ff6b6b;
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-clean-inactive:hover {
  background: rgba(234, 67, 53, 0.2);
  border-color: var(--color-red);
  transform: translateY(-1px);
}

/* ==========================================================================
   07. MAIN CARD & HERO
   ========================================================================== */

.main-card {
  background: var(--surface-solid);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-xl);
  padding: 38px 32px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.view-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  width: 100%;
}

.hidden {
  display: none !important;
}

.card-hero {
  text-align: center;
  max-width: 520px;
}

.card-hero h2 {
  font-family: var(--f-display);
  font-size: clamp(24px, 3.4vw, 30px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
  margin-bottom: 8px;
}

.card-hero p {
  color: var(--fg-dim);
  font-size: 15px;
  line-height: 1.6;
}

/* ==========================================================================
   08. BUTTONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition:
    transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1),
    background 0.25s,
    box-shadow 0.25s,
    border-color 0.25s,
    color 0.25s;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: #04130c;
  font-weight: 700;
  box-shadow:
    0 6px 24px -8px rgba(74, 222, 154, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:hover {
  box-shadow:
    0 12px 36px -10px rgba(74, 222, 154, 0.8),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--hairline-2);
}

.btn-secondary:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--fg);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--hairline);
  padding: 9px 18px;
  font-size: 13.5px;
}

.btn-ghost:hover {
  color: var(--fg);
  border-color: var(--hairline-2);
  background: var(--surface-2);
}

.btn-danger {
  background: linear-gradient(135deg, #ea4335, #c5221f);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(234, 67, 53, 0.35);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #f05244, #d32f2f);
  box-shadow: 0 8px 24px rgba(234, 67, 53, 0.5);
}

.btn-copy {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  padding: 8px 18px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.btn-copy:hover {
  background: var(--accent);
  color: #04130c;
  box-shadow: 0 4px 16px var(--accent-soft);
}

/* ==========================================================================
   09. FORM & INPUTS (PHONE LOGIN)
   ========================================================================== */

.phone-form {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
}

.phone-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}

.phone-input-wrapper:focus-within {
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.phone-prefix {
  padding: 14px 12px 14px 16px;
  color: var(--accent);
  font-family: var(--f-mono);
  font-weight: 700;
  font-size: 1.15rem;
  user-select: none;
}

.phone-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--fg);
  font-size: 1.05rem;
  padding: 14px 16px 14px 0;
  outline: none;
  font-family: var(--f-mono);
  letter-spacing: 0.05em;
}

.phone-input-wrapper input::placeholder {
  color: var(--fg-faint);
}

.input-hint {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.45;
}

.input-hint code {
  color: var(--accent);
  font-family: var(--f-mono);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.form-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--fg-faint);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin: 4px 0;
}

.form-divider::before,
.form-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px dashed var(--hairline-2);
}

.form-divider span {
  padding: 0 14px;
}

.alert-box {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13px;
  line-height: 1.45;
}

.alert-error {
  background: rgba(234, 67, 53, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(234, 67, 53, 0.3);
}

/* ==========================================================================
   10. PAIRING CODE SECTION
   ========================================================================== */

.pairing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 440px;
}

.pairing-code-card {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-lg);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 30px var(--accent-soft);
}

.pairing-code-text {
  font-family: var(--f-mono);
  font-size: clamp(2.1rem, 5.2vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-shadow: 0 0 16px var(--accent-soft);
  text-align: center;
}

.timeout-timer-card {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timer-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.timer-label strong {
  color: var(--color-amber);
  font-family: var(--f-mono);
  font-size: 13px;
}

.progress-bar-track {
  width: 100%;
  height: 5px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--color-amber));
  border-radius: 999px;
  transition: width 1s linear;
}

.timer-sub {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-muted);
  text-align: center;
}

.instructions-card {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 20px 22px;
}

.instructions-card h3 {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 14px;
}

.steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.steps-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--fg-dim);
}

.steps-list strong {
  color: var(--fg);
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ==========================================================================
   11. QR CODE SECTION
   ========================================================================== */

.qr-container-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.qr-box {
  width: 100%;
  max-width: 275px;
  aspect-ratio: 1 / 1;
  height: auto;
  background: #ffffff;
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 30px var(--accent-soft);
  border: 3px solid var(--accent);
}

.qr-scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px var(--accent);
  animation: scan 2.5s ease-in-out infinite alternate;
  z-index: 2;
  pointer-events: none;
}

@keyframes scan {
  0% { top: 6%; }
  100% { top: 92%; }
}

.qr-display {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-display img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--r-sm);
}

.qr-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(74, 222, 154, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 12px;
}

.qr-loading-text {
  font-family: var(--f-mono);
  font-size: 12px;
  color: #444;
  font-weight: 600;
}

/* ==========================================================================
   12. CONNECTED DASHBOARD SECTION (User Screenshot Screen)
   ========================================================================== */

.connected-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.success-ring {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 32px var(--accent-soft);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-ring svg {
  stroke-width: 3;
}

.connected-hero h2 {
  font-family: var(--f-display);
  font-size: clamp(24px, 3.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--fg);
}

.connected-hero p {
  color: var(--fg-dim);
  font-size: 15px;
}

/* ── Stats Grid (2 cards) ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
  position: relative;
}

.stat-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
  box-shadow:
    0 12px 30px -8px rgba(0, 0, 0, 0.4),
    0 0 0 1px var(--accent-line) inset;
}

.stat-label {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-muted);
}

.stat-value {
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-sub {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--fg-muted);
}

/* ── Quick Commands Card ── */
.quick-commands-card {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 20px 22px;
}

.quick-commands-card h3 {
  font-family: var(--f-display);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin-bottom: 14px;
}

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

.chip {
  background: var(--surface-solid);
  padding: 7px 14px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--fg-dim);
  border: 1px solid var(--hairline-2);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--fg);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-soft);
}

.chip:active {
  transform: translateY(0);
}

.chip code {
  color: var(--accent);
  font-weight: 700;
}

/* ── Account Actions (Disconnect) ── */
.account-actions-card {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-actions-info h4 {
  font-family: var(--f-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 4px;
}

.account-actions-info p {
  font-size: 13px;
  color: var(--fg-muted);
}

/* ==========================================================================
   13. DISCONNECTED SECTION
   ========================================================================== */

.warn-ring {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(234, 67, 53, 0.14);
  border: 2px solid var(--color-red);
  color: var(--color-red);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 0 24px rgba(234, 67, 53, 0.3);
}

/* ==========================================================================
   14. INTERACTIVE WEB CMD / TERMINAL
   ========================================================================== */

.terminal-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: var(--surface-solid);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  margin-top: 26px;
}

.terminal-header {
  background: var(--surface-2);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline-2);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  gap: 8px;
}

.terminal-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.control-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--fg-muted);
  letter-spacing: 0.04em;
}

.terminal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.term-tab {
  background: transparent;
  border: 1px solid var(--hairline-2);
  color: var(--fg-muted);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}

.term-tab:hover {
  color: var(--fg);
  border-color: var(--accent-line);
}

.term-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-line);
}

.term-btn-icon {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  padding: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.term-btn-icon:hover {
  color: var(--color-red);
  background: rgba(234, 67, 53, 0.1);
}

.term-collapse-btn:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.term-collapse-btn svg {
  transition: transform 0.25s ease;
}

.terminal-card.collapsed .term-collapse-btn svg {
  transform: rotate(180deg);
}

.terminal-card.collapsed .terminal-body,
.terminal-card.collapsed .terminal-input-bar {
  display: none !important;
}

.terminal-body {
  height: 240px;
  overflow-y: auto;
  padding: 16px 18px;
  font-family: var(--f-mono);
  font-size: 12.5px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-inset);
  color: var(--fg-dim);
}

.term-line {
  word-break: break-word;
  white-space: pre-wrap;
}

.term-system { color: #58a6ff; font-weight: 600; }
.term-user-cmd { color: var(--accent); }
.term-output { color: var(--fg); }
.term-dim { color: var(--fg-muted); }
.term-green { color: var(--accent); }
.term-cyan { color: #79c0ff; font-weight: 600; }
.term-warn { color: var(--color-amber); }
.term-error { color: #ff6b6b; }

.terminal-input-bar {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-top: 1px solid var(--hairline-2);
  padding: 8px 12px;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.term-prompt {
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 700;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.terminal-input {
  flex: 1 1 0%;
  min-width: 0;
  width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: var(--f-mono);
  font-size: 12.5px;
}

.terminal-input::placeholder {
  color: var(--fg-faint);
  font-family: var(--f-sans);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-run-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-line);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--f-mono);
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.term-run-btn:hover {
  background: var(--accent);
  color: #04130c;
}

/* ==========================================================================
   15. MODAL & FOOTER
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  background: var(--surface-solid);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  animation: popIn 0.25s ease-out;
}

.modal-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(234, 67, 53, 0.14);
  color: var(--color-red);
  border: 1px solid rgba(234, 67, 53, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
}

.modal-card h3 {
  font-family: var(--f-display);
  font-size: 1.25rem;
  color: var(--fg);
  margin-bottom: 8px;
}

.modal-card p {
  font-size: 14px;
  color: var(--fg-dim);
  line-height: 1.55;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.app-footer code {
  color: var(--accent);
}

/* ==========================================================================
   16. ANIMATIONS & RESPONSIVENESS
   ========================================================================== */

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.92); }
}

/* ==========================================================================
   16. RESPONSIVE BREAKPOINTS (Mobile & Tablet Optimization)
   ========================================================================== */

@media (max-width: 640px) {
  body {
    padding: 12px 10px;
  }

  .app-container {
    gap: 14px;
    width: 100%;
    overflow-x: hidden;
  }

  /* ── Header: Two-row balanced layout on mobile ── */
  .app-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .logo-area {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .logo-icon {
    width: 38px;
    height: 38px;
  }

  .logo-icon svg {
    width: 22px;
    height: 22px;
  }

  .logo-text h1 {
    font-size: 1.1rem;
  }

  .version-tag {
    font-size: 9.5px;
  }

  .header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
    border-top: 1px solid var(--hairline);
    padding-top: 10px;
  }

  .status-pill {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 6px 10px;
    font-size: 11px;
  }

  .status-pill span#statusText {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .theme-toggle {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  .btn-dash-logout,
  .btn-icon-logout {
    flex-shrink: 0;
    height: 36px;
    padding: 0 12px;
    font-size: 11px;
    gap: 6px;
  }

  /* ── Accounts Strip ── */
  .accounts-strip {
    padding: 12px 14px;
    gap: 10px;
  }

  .accounts-strip-header {
    gap: 8px;
  }

  .accounts-label {
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .btn-add-account,
  .btn-clean-inactive {
    padding: 5px 11px;
    font-size: 11px;
  }

  .accounts-pills {
    gap: 6px;
  }

  .account-pill {
    font-size: 12px;
    padding: 5px 12px;
  }

  /* ── Main Card & Content ── */
  .main-card {
    padding: 22px 16px;
  }

  .card-hero h2 {
    font-size: 1.35rem;
  }

  .card-hero p {
    font-size: 13.5px;
  }

  .btn {
    width: 100%;
    padding: 12px 18px;
    font-size: 14px;
  }

  .phone-input-wrapper input {
    font-size: 1rem;
    padding: 12px 12px 12px 0;
  }

  .phone-prefix {
    font-size: 1.05rem;
    padding: 12px 10px 12px 12px;
  }

  /* ── Pairing Code Screen ── */
  .pairing-code-card {
    padding: 22px 16px;
  }

  .pairing-code-text {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
    letter-spacing: 0.12em;
    word-break: break-all;
  }

  /* ── Connected Screen Stats ── */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .account-actions-card {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .account-actions-card .btn {
    width: 100%;
  }

  /* ── Terminal Responsive ── */
  .terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .terminal-title {
    display: none; /* Hide redundant full hostname on mobile so tabs fit cleanly */
  }

  .tab-long {
    display: none; /* "Interactive CMD" -> "CMD", "Live Logs" -> "Logs" */
  }

  .terminal-actions {
    gap: 5px;
  }

  .term-tab {
    font-size: 11px;
    padding: 4px 9px;
    white-space: nowrap;
  }

  .terminal-body {
    height: 180px;
    padding: 12px 14px;
    font-size: 11.5px;
  }

  .terminal-input-bar {
    padding: 8px 10px;
    gap: 6px;
  }

  .prompt-long {
    display: none; /* "bot@whatsapp:~$" -> "~$" on mobile */
  }

  .term-prompt {
    font-size: 11.5px;
    white-space: nowrap;
  }

  .terminal-input {
    font-size: 12px;
    min-width: 0;
  }

  .terminal-input::placeholder {
    font-size: 11.5px;
  }

  .term-run-btn {
    padding: 5px 9px;
    font-size: 11px;
    white-space: nowrap;
  }

  /* ── Footer ── */
  .app-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    font-size: 11px;
  }

  /* ── Auth Gate Card on Mobile ── */
  .auth-gate-container {
    padding: 12px;
    min-height: calc(100vh - 30px);
  }

  .auth-card {
    padding: 26px 18px;
    gap: 16px;
  }
}

/* Extra small devices (phones <= 400px) */
@media (max-width: 400px) {
  .btn-dash-logout span,
  .btn-icon-logout span {
    display: none;
  }

  .btn-dash-logout,
  .btn-icon-logout {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .accounts-strip-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .accounts-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ==========================================================================
   17. DASHBOARD LOGIN GATE (AUTH)
   ========================================================================== */

.auth-gate-container {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  position: relative;
  z-index: 3;
}

.auth-card {
  background: var(--surface-solid);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-xl);
  padding: 34px 28px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.auth-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

.auth-brand-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.auth-brand-info h2 {
  font-family: var(--f-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.15;
}

.auth-badge {
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-hero h3 {
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.auth-hero p {
  font-size: 13.5px;
  color: var(--fg-dim);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-md);
  padding: 0 14px;
  transition: all 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.auth-input-wrapper:focus-within {
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-input-wrapper svg {
  color: var(--fg-muted);
  flex-shrink: 0;
  transition: color 0.2s;
}

.auth-input-wrapper:focus-within svg {
  color: var(--accent);
}

.auth-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 13px 0;
  font-family: var(--f-mono);
  font-size: 13.5px;
  color: var(--fg);
}

.auth-input-wrapper input::placeholder {
  color: var(--fg-faint);
  font-family: var(--f-sans);
}

.toggle-password-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  transition: color 0.2s;
}

.toggle-password-btn:hover,
.toggle-password-btn:focus {
  color: var(--fg);
  outline: none;
}

.toggle-password-btn svg {
  color: inherit !important;
}

.auth-hint {
  text-align: center;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-muted);
}

.auth-hint code {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 5px;
  border-radius: 4px;
}

.auth-hint a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.auth-hint a:hover {
  color: var(--accent-2);
  opacity: 0.9;
}

.btn-dash-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline-2);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-dim);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.btn-dash-logout:hover {
  background: rgba(234, 67, 53, 0.14);
  border-color: var(--color-red);
  color: #ff6b6b;
  transform: translateY(-1px);
}
