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

    :root {
      --bg: #030712;
      --bg-glass: rgba(17, 24, 39, 0.7);
      --bg-card: rgba(31, 41, 55, 0.4);
      --bg-hover: rgba(99, 102, 241, 0.15);

      --accent: #6366f1;
      --accent-secondary: #ec4899;
      --accent-gradient: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
      --accent-glow: rgba(99, 102, 241, 0.5);

      --text: #f3f4f6;
      --text-dim: #9ca3af;
      --text-muted: #6b7280;

      --border: rgba(255, 255, 255, 0.05);
      --border-bright: rgba(255, 255, 255, 0.12);

      --success: #10b981;
      --danger: #ef4444;
      --warning: #f59e0b;
      --info: #0ea5e9;

      --radius-2xl: 24px;
      --radius-xl: 18px;
      --radius-lg: 12px;
      --radius-md: 8px;

      --shadow-neon: 0 0 30px -10px var(--accent-glow);
      --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
      --bg-panel: rgba(15, 23, 42, 0.9);
      --glass: backdrop-filter: blur(24px) saturate(180%);
      --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    body {
      font-family: 'Inter', system-ui, -apple-system, sans-serif;
      background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.15), transparent 40%),
        radial-gradient(circle at bottom left, rgba(219, 39, 119, 0.1), transparent 40%),
        var(--bg);
      color: var(--text);
      min-height: 100vh;
      line-height: 1.5;
      -webkit-font-smoothing: antialiased;
    }

    /* Scrollbar Customization */
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    ::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.1);
      border-radius: 10px;
    }

    ::-webkit-scrollbar-thumb:hover {
      background: var(--accent);
    }

    /* Login Screen */
    #login-screen {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      padding: 20px;
    }

    .login-card {
      background: var(--bg-glass);
      backdrop-filter: blur(32px);
      border: 1px solid var(--border-bright);
      border-radius: var(--radius-2xl);
      padding: 60px;
      width: 100%;
      max-width: 440px;
      text-align: center;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), var(--shadow-neon);
      animation: fadeIn 0.8s ease-out;
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: translateY(20px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .login-card h1 {
      font-size: 2.5rem;
      font-weight: 800;
      margin-bottom: 32px;
      background: var(--accent-gradient);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      letter-spacing: -1px;
    }

    /* Layout */
    .layout {
      display: flex;
      min-height: 100vh;
    }

    .sidebar {
      width: 280px;
      background: rgba(15, 23, 42, 0.8);
      backdrop-filter: blur(24px);
      border-right: 1px solid var(--border);
      height: 100vh;
      position: fixed;
      padding: 40px 16px;
      display: flex;
      flex-direction: column;
      z-index: 100;
    }

    .sidebar-title {
      font-weight: 800;
      font-size: 1.4rem;
      margin-bottom: 40px;
      padding: 0 12px;
      display: flex;
      align-items: center;
      gap: 12px;
      color: #fff;
    }

    .logo-icon {
      width: 36px;
      height: 36px;
      background: var(--accent-gradient);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      color: var(--text-dim);
      border-radius: var(--radius-lg);
      margin-bottom: 4px;
      font-weight: 500;
      transition: var(--transition);
      cursor: pointer;
    }

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

    .nav-item.active {
      background: var(--accent-gradient);
      color: #fff;
      box-shadow: 0 4px 15px -3px rgba(124, 58, 237, 0.4);
    }

    .content {
      margin-left: 280px;
      flex: 1;
      padding: 48px 64px;
      max-width: 1600px;
    }

    /* Common Components */
    .section {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      padding: 32px;
      margin-bottom: 32px;
      backdrop-filter: blur(16px);
    }

    .header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 40px;
    }

    .title {
      font-size: 2.2rem;
      font-weight: 800;
      letter-spacing: -1px;
    }

    .cards {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 24px;
      margin-bottom: 32px;
    }

    .card {
      background: var(--bg-glass);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      padding: 24px;
      transition: var(--transition);
    }

    .card:hover {
      border-color: var(--accent);
      transform: translateY(-4px);
      box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    }

    .card-val {
      font-size: 2.2rem;
      font-weight: 800;
      margin: 8px 0;
      letter-spacing: -1px;
    }

    .card-lbl {
      font-size: 0.75rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-dim);
    }

    /* Buttons & Inputs */
    .btn {
      padding: 10px 20px;
      border-radius: var(--radius-lg);
      font-weight: 600;
      cursor: pointer;
      border: 1px solid var(--border-bright);
      background: rgba(255, 255, 255, 0.05);
      color: #fff;
      transition: var(--transition);
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }

    .btn:hover {
      background: rgba(255, 255, 255, 0.1);
      border-color: var(--text-dim);
    }

    .btn-primary {
      background: var(--accent-gradient);
      border: none;
    }

    .btn-primary:hover {
      filter: brightness(1.1);
      box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
    }

    .btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: var(--radius-md); }
    .btn-danger { border-color: var(--danger); color: var(--danger); }
    .btn-danger:hover { background: rgba(239, 68, 68, 0.15); }
    .btn-success { border-color: var(--success); color: var(--success); }

    .badge {
      display: inline-block; padding: 3px 10px; border-radius: 20px;
      font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px;
    }

    .spinner {
      display: inline-block; width: 20px; height: 20px;
      border: 2px solid rgba(255,255,255,0.2); border-top-color: var(--accent);
      border-radius: 50%; animation: spin 0.6s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .fade-in { animation: fadeIn 0.4s ease-out; }

    .msg-deleted {
      border: 1px dashed var(--danger) !important;
      opacity: 0.7;
    }

    .input,
    .select,
    .textarea {
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      color: #fff;
      padding: 12px 16px;
      outline: none;
      transition: var(--transition);
    }

    .input:focus,
    .select:focus,
    .textarea:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 2px var(--accent-glow);
    }

    /* Table */
    table {
      width: 100%;
      border-collapse: collapse;
    }

    th {
      text-align: left;
      padding: 16px;
      color: var(--text-dim);
      font-size: 0.8rem;
      text-transform: uppercase;
      border-bottom: 1px solid var(--border);
    }

    td {
      padding: 16px;
      border-bottom: 1px solid var(--border);
    }

    tr:hover td {
      background: rgba(255, 255, 255, 0.02);
    }

    /* Spy Feature Professional Redesign */
    .spy-container {
      display: flex;
      height: 700px;
      background: var(--bg-glass);
      border: 1px solid var(--border);
      border-radius: var(--radius-2xl);
      overflow: hidden;
    }

    .spy-sidebar {
      width: 320px;
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      background: rgba(0, 0, 0, 0.2);
    }

    .spy-chat-list {
      flex: 1;
      overflow-y: auto;
      padding: 12px;
    }

    .spy-chat-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px;
      border-radius: var(--radius-lg);
      cursor: pointer;
      margin-bottom: 8px;
      transition: var(--transition);
      border: 1px solid transparent;
    }

    .spy-chat-item:hover {
      background: rgba(255, 255, 255, 0.05);
    }

    .spy-chat-item.active {
      background: var(--bg-hover);
      border-color: rgba(124, 58, 237, 0.3);
    }

    .spy-main {
      flex: 1;
      display: flex;
      flex-direction: column;
      position: relative;
    }

    .spy-header {
      padding: 20px 32px;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(0, 0, 0, 0.1);
    }

    .spy-messages {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 20px 16px;
      padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
      display: flex;
      flex-direction: column;
      gap: 0;
      -webkit-overflow-scrolling: touch;
    }

    .spy-msg {
      max-width: min(85%, 420px);
      min-width: 80px;
      display: flex;
      flex-direction: column;
    }

    .spy-msg-in { align-self: flex-start; }
    .spy-msg-out { align-self: flex-end; }

    .spy-sender {
      font-size: 0.72rem;
      font-weight: 700;
      margin: 0 4px 4px;
    }

    .spy-msg-body {
      padding: 10px 14px;
      border-radius: inherit;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
      white-space: pre-wrap;
      word-break: break-word;
      line-height: 1.5;
      overflow: hidden;
    }

    .spy-msg-out .spy-msg-body { border-bottom-right-radius: 4px; }
    .spy-msg-in .spy-msg-body { border-bottom-left-radius: 4px; }

    .spy-msg-meta {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 6px;
      margin-top: 4px;
      padding: 0 4px;
      font-size: 0.65rem;
      opacity: 0.6;
    }

    .spy-tag-deleted { color: var(--danger); }
    .spy-tag-edited { color: var(--warning); }

    .spy-text { margin-top: 8px; }

    .spy-media-block { max-width: 100%; }
    .spy-media-caption {
      margin-top: 8px;
      font-size: 0.9rem;
      opacity: 0.95;
    }

    .spy-photo {
      display: block;
      max-width: 100%;
      max-height: min(70vh, 480px);
      width: auto;
      height: auto;
      border-radius: 12px;
      cursor: zoom-in;
      object-fit: contain;
      -webkit-touch-callout: none;
      user-select: none;
      box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
    }

    .spy-video,
    .spy-video-note {
      max-width: 100%;
      border-radius: 12px;
      background: #000;
    }

    .spy-video { max-height: min(70vh, 480px); }
    .spy-video-note {
      width: 200px;
      height: 200px;
      border-radius: 50%;
      object-fit: cover;
      border: 3px solid var(--accent);
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    }

    .spy-audio {
      display: block;
      width: min(100%, 280px);
      min-width: 220px;
      height: 44px;
      max-height: none;
      border-radius: 22px;
      background: rgba(0, 0, 0, 0.25);
    }

    .spy-msg-out .spy-audio { filter: brightness(1.05); }

    .spy-media-placeholder {
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 14px;
      background: rgba(255, 255, 255, 0.04);
      border-radius: 14px;
      cursor: pointer;
      border: 1px solid rgba(255, 255, 255, 0.08);
      transition: var(--transition);
      min-width: 180px;
    }

    .spy-media-placeholder:active { transform: scale(0.98); }

    .spy-media-ph-icon {
      color: #fff;
      width: 40px;
      height: 40px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex: none;
    }

    .spy-media-ph-icon i { width: 18px; height: 18px; }

    .spy-media-ph-title { font-weight: 600; font-size: 0.9rem; }
    .spy-media-ph-hint { font-size: 0.7rem; opacity: 0.55; margin-top: 2px; }
    .spy-media-ph-dl { width: 16px; height: 16px; margin-left: auto; opacity: 0.35; flex: none; }

    .spy-doc-link {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 10px 14px;
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.06);
      color: inherit;
      text-decoration: none;
    }

    .spy-chat-avatar {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 1.1rem;
      flex: none;
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    .spy-chat-body { flex: 1; min-width: 0; }

    .spy-chat-top {
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      gap: 8px;
      margin-bottom: 4px;
    }

    .spy-chat-name {
      font-weight: 700;
      font-size: 0.92rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .spy-chat-time { font-size: 0.68rem; color: var(--text-dim); flex: none; }

    .spy-chat-preview {
      font-size: 0.8rem;
      color: var(--text-dim);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .spy-toolbar { padding: 16px 20px; margin-bottom: 16px; }
    .spy-toolbar-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
    .spy-toolbar-row:last-child { margin-bottom: 0; }
    .spy-uid-input { flex: 1; min-width: 140px; }

    .spy-live-toggle {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-dim);
      cursor: pointer;
      user-select: none;
    }

    .spy-controls-wrap {
      flex-wrap: wrap;
      gap: 8px;
      justify-content: flex-end;
    }

    .spy-lightbox {
      position: fixed;
      inset: 0;
      z-index: 2000;
      background: rgba(0, 0, 0, 0.92);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: env(safe-area-inset-top, 16px) 12px env(safe-area-inset-bottom, 16px);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.25s ease;
      -webkit-tap-highlight-color: transparent;
    }

    .spy-lightbox.open {
      opacity: 1;
      pointer-events: auto;
    }

    .spy-lightbox img {
      max-width: 100%;
      max-height: 100%;
      object-fit: contain;
      border-radius: 4px;
      user-select: none;
      -webkit-user-drag: none;
    }

    .spy-lightbox-close {
      position: absolute;
      top: calc(12px + env(safe-area-inset-top, 0px));
      right: 12px;
      width: 44px;
      height: 44px;
      border: none;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.12);
      color: #fff;
      font-size: 1.25rem;
      cursor: pointer;
      z-index: 1;
    }

    .msg-bubble {
      max-width: 75%;
      padding: 12px 18px;
      border-radius: 18px;
      font-size: 0.95rem;
      line-height: 1.5;
      position: relative;
    }

    .msg-in {
      align-self: flex-start;
      background: var(--bg-card);
      border-bottom-left-radius: 4px;
    }

    .msg-out {
      align-self: flex-end;
      background: var(--accent);
      color: #fff;
      border-bottom-right-radius: 4px;
      box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
    }

    .msg-meta {
      font-size: 0.7rem;
      margin-top: 4px;
      opacity: 0.6;
      display: flex;
      justify-content: flex-end;
      gap: 6px;
    }

    /* Modal & Toast */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      backdrop-filter: blur(8px);
      z-index: 1000;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.3s ease;
    }

    .modal-overlay.active {
      opacity: 1;
      pointer-events: auto;
    }

    .modal {
      background: var(--bg-glass);
      backdrop-filter: blur(32px);
      border: 1px solid var(--border-bright);
      border-radius: var(--radius-2xl);
      padding: 40px;
      width: 100%;
      max-width: 600px;
      transform: scale(0.9);
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .modal-overlay.active .modal {
      transform: scale(1);
    }

    .toast-container {
      position: fixed;
      top: 32px;
      right: 32px;
      z-index: 2000;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .toast {
      padding: 16px 24px;
      border-radius: var(--radius-lg);
      background: var(--bg-glass);
      backdrop-filter: blur(16px);
      border: 1px solid var(--border-bright);
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
      animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
      display: flex;
      align-items: center;
      gap: 12px;
      font-weight: 600;
    }

    @keyframes slideIn {
      from {
        transform: translateX(100%);
        opacity: 0;
      }

      to {
        transform: translateX(0);
        opacity: 1;
      }
    }

    .page {
      display: none;
      animation: fadeIn 0.4s ease-out;
    }

    .page.active {
      display: block;
    }

    .section {
      background: var(--bg-glass);
      border: 1px solid var(--border);
      border-radius: var(--radius-xl);
      padding: 32px;
      margin-bottom: 32px;
    }

    .section h3 {
      font-size: 1.1rem;
      font-weight: 700;
      margin-bottom: 24px;
      display: flex;
      align-items: center;
      gap: 12px;
      color: var(--accent);
    }

    .flex {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .log-box {
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 16px;
      font-family: 'Cascadia Code', 'Consolas', 'JetBrains Mono', monospace;
      font-size: 0.75rem;
      color: #cbd5e1;
      overflow-y: auto;
      white-space: pre-wrap;
      word-break: break-all;
      line-height: 1.4;
      box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
      scrollbar-width: thin;
    }

    .spy-media-placeholder.loading {
      pointer-events: none;
      opacity: 0.6;
    }

    /* ===== 2FA Styles ===== */
    .login-step { display: none; }
    .login-step.active { display: block; animation: fadeIn 0.5s ease-out; }

    .otp-input {
      background: rgba(0,0,0,0.4); border: 2px solid var(--border-bright);
      border-radius: var(--radius-lg); color: #fff; font-size: 2rem;
      font-weight: 800; letter-spacing: 12px; text-align: center;
      padding: 16px; width: 100%; outline: none; transition: var(--transition);
      font-family: 'Cascadia Code','Consolas',monospace;
    }
    .otp-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }

    .otp-timer { font-size: 0.85rem; color: var(--text-dim); margin-top: 12px; }
    .otp-timer span { color: var(--accent); font-weight: 700; }

    .login-input, .login-btn {
      width: 100%; padding: 14px 20px; border-radius: var(--radius-lg);
      font-size: 1rem; margin-top: 16px; outline: none; transition: var(--transition);
    }
    .login-input {
      background: rgba(0,0,0,0.3); border: 1px solid var(--border-bright);
      color: #fff; font-weight: 500;
    }
    .login-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
    .login-btn {
      background: var(--accent-gradient); border: none; color: #fff;
      font-weight: 700; cursor: pointer;
    }
    .login-btn:hover { filter: brightness(1.15); box-shadow: 0 0 25px var(--accent-glow); }
    .login-btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

    .tfa-icon { font-size: 3rem; margin-bottom: 16px; }
    .tfa-subtitle { font-size: 0.9rem; color: var(--text-dim); margin-top: 8px; line-height: 1.5; }

    /* ===== Hamburger Menu ===== */
    .hamburger {
      display: none; position: fixed; top: 16px; left: 16px; z-index: 200;
      width: 44px; height: 44px; border-radius: 12px;
      background: var(--bg-glass); backdrop-filter: blur(16px);
      border: 1px solid var(--border-bright); cursor: pointer;
      align-items: center; justify-content: center; color: #fff;
    }
    .sidebar-overlay {
      display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
      z-index: 99; backdrop-filter: blur(4px);
    }
    .sidebar-overlay.active { display: block; }

    .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

    .bc-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 20px;
    }
    .bc-grid .bc-span-full { grid-column: 1 / -1; }
    .bc-meta {
      font-size: 0.78rem;
      color: var(--text-dim);
      margin-bottom: 12px;
      line-height: 1.45;
    }
    .bc-meta strong { color: var(--accent); }
    .bc-sticky-actions {
      display: flex;
      gap: 12px;
      margin-top: 20px;
      flex-wrap: wrap;
    }
    .bc-sticky-actions .btn { flex: 1; min-width: 140px; justify-content: center; }
    .bc-html-preview {
      min-height: 72px;
      padding: 12px 14px;
      border-radius: 12px;
      background: rgba(0, 0, 0, 0.25);
      border: 1px solid var(--border);
      font-size: 0.9rem;
      line-height: 1.5;
      color: #e4e4e7;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .bc-html-preview:empty::before { content: 'Введите текст выше…'; color: var(--text-dim); }
    .bc-html-preview tg-spoiler,
    .bc-html-preview .tg-spoiler {
      background: rgba(255, 255, 255, 0.12);
      border-radius: 4px;
      padding: 0 4px;
    }
    .bc-target-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 4px 10px;
      border-radius: 999px;
      background: rgba(99, 102, 241, 0.12);
      border: 1px solid rgba(129, 140, 248, 0.25);
      font-size: 0.72rem;
      font-weight: 700;
      color: #c7d2fe;
      margin-bottom: 10px;
    }
    .field-label {
      display: block;
      margin-bottom: 8px;
      font-size: 0.8rem;
      color: var(--text-dim);
      font-weight: 600;
    }

    .section h3 {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 1.05rem;
      font-weight: 700;
      margin-bottom: 20px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--border);
    }

    .page-lead {
      font-size: 0.88rem;
      color: var(--text-dim);
      margin-top: 6px;
      max-width: 520px;
      line-height: 1.5;
    }

    /* Broadcast redesign */
    .bc-live-banner {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
      flex-wrap: wrap;
      padding: 16px 20px;
      border-radius: var(--radius-xl);
      border: 1px solid var(--border);
      margin-bottom: 24px;
      background: rgba(15, 23, 42, 0.75);
      backdrop-filter: blur(12px);
    }
    .bc-live-banner--idle { border-color: rgba(255,255,255,0.06); }
    .bc-live-banner--running {
      border-color: rgba(16, 185, 129, 0.35);
      background: linear-gradient(135deg, rgba(16,185,129,0.12), rgba(15,23,42,0.9));
      box-shadow: 0 0 30px -12px rgba(16,185,129,0.4);
    }
    .bc-live-banner--auto {
      border-color: rgba(99, 102, 241, 0.35);
      background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(15,23,42,0.9));
    }
    .bc-live-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
    .bc-live-dot {
      width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
      background: var(--text-muted);
    }
    .bc-live-dot.on { background: var(--success); box-shadow: 0 0 12px var(--success); animation: pulse 1.5s infinite; }
    .bc-live-dot.wait { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
    @keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }
    .bc-live-title { font-weight: 800; font-size: 0.95rem; }
    .bc-live-sub { font-size: 0.78rem; color: var(--text-dim); margin-top: 2px; }
    .bc-live-right { text-align: right; }
    .bc-live-countdown { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.5px; color: #c7d2fe; }
    .bc-live-countdown-label { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

    .bc-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 20px;
      overflow-x: auto;
      padding-bottom: 4px;
      -webkit-overflow-scrolling: touch;
    }
    .bc-tab {
      flex-shrink: 0;
      padding: 10px 18px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: rgba(255,255,255,0.03);
      color: var(--text-dim);
      font-weight: 700;
      font-size: 0.85rem;
      cursor: pointer;
      transition: var(--transition);
    }
    .bc-tab:hover { color: var(--text); border-color: var(--border-bright); }
    .bc-tab.active {
      background: var(--accent-gradient);
      border-color: transparent;
      color: #fff;
      box-shadow: 0 4px 16px -4px rgba(99,102,241,0.5);
    }
    .bc-tab-panel { display: none; animation: fadeIn 0.25s ease-out; }
    .bc-tab-panel.active { display: block; }

    .bc-interval-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
    .bc-interval-input { width: 88px; text-align: center; }
    .bc-chip {
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: rgba(255,255,255,0.04);
      color: var(--text-dim);
      font-size: 0.78rem;
      font-weight: 700;
      cursor: pointer;
      transition: var(--transition);
    }
    .bc-chip:hover, .bc-chip.active {
      border-color: rgba(129,140,248,0.45);
      color: #c7d2fe;
      background: rgba(99,102,241,0.12);
    }
    .bc-auto-status {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-bottom: 18px;
    }
    .bc-auto-stat {
      background: rgba(0,0,0,0.25);
      border: 1px solid var(--border);
      border-radius: var(--radius-lg);
      padding: 14px;
      text-align: center;
    }
    .bc-auto-stat-val { font-size: 1.15rem; font-weight: 800; }
    .bc-auto-stat-lbl { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; margin-top: 4px; }
    .bc-recipients-hint {
      font-size: 0.78rem;
      color: var(--accent);
      margin-top: 6px;
      font-weight: 600;
    }
    .bc-actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
    .bc-actions-row .btn { flex: 1; min-width: 130px; justify-content: center; }
    .bc-toggle-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 16px;
      border-radius: var(--radius-lg);
      border: 1px solid var(--border);
      background: rgba(255,255,255,0.03);
      margin-bottom: 16px;
    }
    .bc-toggle-card.on { border-color: rgba(16,185,129,0.35); background: rgba(16,185,129,0.08); }
    .bc-toggle-label { font-weight: 700; font-size: 0.92rem; }
    .bc-toggle-hint { font-size: 0.75rem; color: var(--text-dim); margin-top: 2px; }

    @media (max-width: 768px) {
      .bc-auto-status { grid-template-columns: 1fr; }
      .bc-live-banner { padding: 14px 16px; }
      .bc-live-right { text-align: left; width: 100%; }
      .bc-actions-row .btn { flex: 1 1 100%; }
    }

    /* ===== RESPONSIVE ===== */
    @media (max-width: 1024px) {
      .hamburger { display: flex; }
      .sidebar {
        transform: translateX(-100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
        z-index: 150;
        padding-top: calc(40px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
      }
      .sidebar.open { transform: translateX(0); }
      .content { margin-left: 0; padding: 24px 20px; padding-top: calc(72px + env(safe-area-inset-top, 0px)); }
      .grid-2, .bc-grid { grid-template-columns: 1fr; }
      .spy-container { flex-direction: column; height: auto; min-height: 500px; }
      .spy-sidebar { width: 100%; max-height: 250px; border-right: none; border-bottom: 1px solid var(--border); }
      .spy-main { min-height: 400px; }
    }

    @media (max-width: 768px) {
      .input, .select, .textarea { font-size: 16px; }
      .btn { min-height: 44px; }
      .hamburger {
        top: calc(12px + env(safe-area-inset-top, 0px));
        left: 12px;
      }
      .spy-container { height: calc(100dvh - 140px); min-height: unset; flex-direction: row; }
      .spy-sidebar { width: 100%; max-height: none; border-bottom: none; border-right: none; display: flex; }
      .spy-main { display: none; width: 100%; height: 100%; min-height: 0; }
      .spy-container.chat-open .spy-sidebar { display: none; }
      .spy-container.chat-open .spy-main { display: flex; }
      .spy-back-btn { display: flex !important; }
      .spy-header { padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
      .spy-messages { padding: 12px 10px; }
      .spy-msg { max-width: 92%; }
      .spy-controls-wrap { width: 100%; justify-content: flex-start; }
      .spy-audio { min-width: 200px; width: 100%; }
      
      .login-card { padding: 32px 20px; }
      .login-card h1 { font-size: 1.8rem; }
      .title { font-size: 1.5rem !important; }
      .header { flex-direction: column; gap: 16px; align-items: flex-start; }
      .cards { grid-template-columns: 1fr 1fr; gap: 12px; }
      .card { padding: 16px; }
      .card-val { font-size: 1.6rem; }
      .section { padding: 20px; margin-bottom: 20px; }
      .content { padding: 16px 12px; padding-top: calc(68px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
      table { display: block; overflow-x: auto; white-space: nowrap; }
      #page-users table, #page-users thead, #page-users tbody, #page-users tr, #page-users td { display: revert; white-space: normal; }
      #page-users table { display: table; width: 100%; }
      #page-users thead { display: table-header-group; }
      #page-users tbody { display: table-row-group; }
      #page-users tr { display: table-row; }
      #page-users td, #page-users th { display: table-cell; padding: 10px 8px; font-size: 0.78rem; }
      #page-users .section { overflow-x: auto; -webkit-overflow-scrolling: touch; }
      th, td { padding: 10px 12px; font-size: 0.8rem; }
      .modal-overlay { align-items: flex-end; padding: 0; }
      .modal {
        max-width: 100%;
        border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
        max-height: 90vh;
        overflow-y: auto;
        padding: 24px 16px calc(24px + env(safe-area-inset-bottom, 0px));
      }
      .toast-container { top: calc(16px + env(safe-area-inset-top, 0px)); right: 12px; left: 12px; }
      .toast { font-size: 0.85rem; padding: 12px 16px; }
      .otp-input { font-size: 1.5rem; letter-spacing: 8px; padding: 12px; }
      .flex { flex-wrap: wrap; }
      .msg-bubble { max-width: 90%; }
      .spy-header { padding: 16px; }
      .spy-messages { padding: 16px; }
      .bc-sticky-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        margin: 16px -20px -20px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, rgba(3,7,18,0.98) 70%, transparent);
      }
      .bc-sticky-actions .btn { flex: 1 1 100%; }
      .nav-item { padding: 14px 16px; font-size: 0.95rem; }
    }

    @media (max-width: 480px) {
      .cards { grid-template-columns: 1fr; }
      .login-card h1 { font-size: 1.5rem; margin-bottom: 20px; }
      .otp-input { font-size: 1.3rem; letter-spacing: 6px; }
    }
/* =============================================================================
   CypSways Admin Panel v3 — layout, navigation, mobile UX
   ============================================================================= */

:root {
  --sidebar-w: 264px;
  --topbar-h: 56px;
  --bottom-nav-h: 64px;
  --surface: rgba(12, 18, 34, 0.92);
  --surface-2: rgba(20, 28, 48, 0.85);
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(99, 102, 241, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(236, 72, 153, 0.1), transparent),
    var(--bg);
}

#login-screen {
  background:
    radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.25), transparent 45%),
    radial-gradient(circle at 70% 80%, rgba(236, 72, 153, 0.15), transparent 40%),
    var(--bg);
}

.login-card {
  padding: 48px 36px;
  border: 1px solid rgba(129, 140, 248, 0.15);
}

.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), transparent 50%);
}

.login-card { position: relative; overflow: hidden; }

/* Sidebar v3 */
.sidebar {
  width: var(--sidebar-w);
  padding: 20px 12px;
  background: var(--surface);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-title {
  margin-bottom: 20px;
  font-size: 1.15rem;
}

.sidebar-title .ver-badge {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border: 1px solid rgba(129, 140, 248, 0.25);
  margin-left: auto;
}

.nav-group-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 14px 14px 6px;
  margin-top: 4px;
}

.nav-item {
  font-size: 0.88rem;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.nav-item svg, .nav-item i { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35), rgba(236, 72, 153, 0.2));
  border-color: rgba(129, 140, 248, 0.25);
  box-shadow: 0 4px 20px -8px rgba(99, 102, 241, 0.5);
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--border);
}

.sidebar-health {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-dim);
  min-width: 0;
}

#sidebar-health-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.sidebar-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  flex-shrink: 0;
}

.sidebar-health-dot.warn { background: var(--warning); box-shadow: 0 0 8px var(--warning); }

.nav-item.logout {
  color: #fca5a5;
  margin-top: 8px;
}

.nav-item.logout:hover { background: rgba(239, 68, 68, 0.12); }

/* Top bar */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--topbar-h);
  margin: -8px 0 28px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(to bottom, rgba(3, 7, 18, 0.95) 70%, transparent);
  backdrop-filter: blur(12px);
}

.topbar-breadcrumb {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.topbar-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

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

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  min-height: 38px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.btn-ghost kbd {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  margin-left: 6px;
  font-family: inherit;
}

.content {
  margin-left: var(--sidebar-w);
  padding: 24px 32px 48px;
  max-width: 1440px;
}

/* Quick actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  color: var(--text);
  font-family: inherit;
}

.qa-btn:hover {
  border-color: rgba(129, 140, 248, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -12px rgba(99, 102, 241, 0.4);
}

.qa-btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
}

.qa-btn-label { font-weight: 700; font-size: 0.85rem; }
.qa-btn-hint { font-size: 0.68rem; color: var(--text-muted); }

/* Stat cards v3 */
.cards .card {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}

.cards .card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
  pointer-events: none;
}

@media (hover: none) {
  .card:hover { transform: none; box-shadow: none; }
  .qa-btn:hover { transform: none; }
}

/* Command palette */
.cmd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}

.cmd-overlay.open { display: flex; }

.cmd-panel {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}

.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  outline: none;
}

.cmd-list { max-height: 320px; overflow-y: auto; padding: 8px; }

.cmd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.cmd-item:hover, .cmd-item.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(129, 140, 248, 0.2);
}

.cmd-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.cmd-item-text { font-weight: 600; font-size: 0.9rem; }
.cmd-item-sub { font-size: 0.72rem; color: var(--text-muted); }

/* Bottom nav mobile */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 180;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 0.62rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  min-height: 44px;
}

.bottom-nav-item.active { color: #c7d2fe; }
.bottom-nav-item svg { width: 20px; height: 20px; }

.analytics-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.analytics-mini {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.analytics-mini-val { font-size: 1.5rem; font-weight: 800; margin-top: 4px; }
.analytics-mini-lbl { font-size: 0.72rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

.top-list { display: flex; flex-direction: column; gap: 8px; }
.top-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.top-list-item b { color: var(--accent); font-family: monospace; }

@media (max-width: 1024px) {
  .content {
    margin-left: 0;
    padding-top: calc(64px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--bottom-nav-h) + 24px + env(safe-area-inset-bottom, 0px));
  }
  .bottom-nav { display: flex; }
  .app-topbar { margin-top: 0; }
}

@media (max-width: 768px) {
  .topbar-actions .btn-ghost kbd { display: none; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .page > .header .title { display: none; }
  .page > .header { margin-bottom: 16px; }
  .app-topbar { flex-wrap: wrap; }
}
