:root {
    --primary: #fbbf24;
    --primary-hover: #fde68a;
    --primary-active: #d97706;
    --primary-soft: rgba(251, 191, 36, 0.14);
    --primary-dark: #0f1117;
    --bg: #0f1117;
    --bg-raised: #141720;
    --bg-card: #1a1d27;
    --bg-input: #141720;
    --bg-hover: #222633;
    --bg-subtle: #171b24;
    --border: #2a2f3a;
    --border-light: rgba(255, 255, 255, 0.1);
    --border-active: rgba(251, 191, 36, 0.32);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --text-faint: #475569;
    --text-subtle: #cbd5e1;
    --text-bright: #f1f5f9;
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.14);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.16);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-bg: rgba(239, 68, 68, 0.16);
    --inactive-bg: rgba(100, 116, 139, 0.22);
    --idle: #64748b;
    --idle-bg: rgba(100, 116, 139, 0.22);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-heading: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', 'SF Mono', 'Fira Code', monospace;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 17, 23, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
  }
  header h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.02em;
  }
  .app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .app-brand-icon {
    width: 28px;
    height: 28px;
    display: block;
  }
  header .status { font-size: 13px; color: var(--text-muted); }
  header .status .dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-right: 4px;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.35);
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
  }

  .container { display: flex; height: calc(100vh - 60px); }

  
  .view-toggle { margin-left: auto; display: flex; gap: 4px; }
  .view-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-subtle);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.18s ease;
  }
  .view-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
  }
  .view-btn.active {
    background: rgba(251, 191, 36, 0.08);
    border-color: var(--primary);
    color: var(--primary);
  }

  .empty-state {
    text-align: center;
    color: var(--text-faint);
    padding: 60px;
    font-size: 14px;
  }
  .empty-state .crab { font-size: 48px; margin-bottom: 12px; }
  .empty-state .empty-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 12px;
    display: block;
    opacity: 0.92;
  }

  
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  }
  .modal.modal-wide {
    width: 560px;
    max-width: 95vw;
  }
  .modal h3 {
    font-family: var(--font-heading);
    color: var(--text-bright);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
    text-align: center;
  }
  .modal input, .modal select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 12px;
  }
  .modal .btn-row { display: flex; gap: 8px; justify-content: flex-end; }
  .modal button {
    background: var(--primary);
    color: var(--primary-dark);
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    font-family: var(--font-heading);
  }
  .modal button:hover {
    background: var(--primary-hover);
  }
  .modal button.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-light);
    color: var(--text-subtle);
  }
  .modal button.secondary:hover { background: rgba(255, 255, 255, 0.08); }
  .modal button.danger { background: var(--danger); color: #fff; }
  .modal button.danger:hover { background: var(--danger-hover); }

  
  .spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  .loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted);
    font-size: 13px;
    gap: 8px;
  }
