/* ============================================
   LINEAR DESIGN SYSTEM — JCWXYZ Studio
   Based on Linear.app design tokens
   ============================================ */

/* Font Imports */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Backgrounds */
  --bg-deep: #010102;
  --bg-page: #08090a;
  --bg-panel: #0f1011;
  --bg-elevated: #191a1b;
  --bg-surface: #28282c;

  /* Text */
  --text-primary: #f7f8f8;
  --text-secondary: #d0d6e0;
  --text-tertiary: #8a8f98;
  --text-muted: #62666d;

  /* Brand */
  --brand-bg: #5e6ad2;
  --brand: #7170ff;
  --brand-hover: #828fff;

  /* Status */
  --green: #10b981;
  --red: #ef4444;
  --yellow: #f59e0b;

  /* Borders */
  --border-subtle: rgba(255,255,255,0.05);
  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(113,112,255,0.3);

  /* Sidebar */
  --sidebar-w: 260px;

  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Font */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Transitions */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

body {
  font-family: var(--font);
  font-feature-settings: 'cv01', 'ss03';
  background: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: var(--radius-full); }

/* Selection */
::selection { background: var(--border-focus); }

/* ========================
   SIDEBAR
   ======================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-logo .logo-text {
  display: flex;
  align-items: center;
  gap: 1px;
}

.sidebar-logo .logo-dot {
  display: inline-block;
  width: 8px; height: 8px;
  background: var(--brand);
  border-radius: 50%;
  margin-left: 2px;
}

.sidebar-section {
  padding: 20px 12px 4px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.sidebar-nav { flex: 1; padding: 4px 8px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 1px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  transition: all 0.15s var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.06);
}

.nav-item.disabled {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .nav-icon { opacity: 1; }

.nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.06);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border-subtle);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: default;
}

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--brand-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-handle {
  font-size: 0.7rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer .nav-item {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 99;
}

/* ========================
   MAIN CONTENT
   ======================== */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 32px 40px;
  max-width: 1280px;
}

/* ========================
   PAGE HEADER
   ======================== */
.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.page-header p {
  font-size: 0.88rem;
  color: var(--text-tertiary);
}

/* ========================
   CARDS & CONTAINERS
   ======================== */
.card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s var(--ease);
}

.card:hover { border-color: rgba(255,255,255,0.12); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.card-body { padding: 20px; }

/* ========================
   STATS CARDS
   ======================== */
.stat-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s var(--ease);
}

.stat-card:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
}

.stat-card .stat-icon-box {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.02);
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 4px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  color: var(--text-tertiary);
  font-size: 0.82rem;
  font-weight: 500;
}

/* ========================
   BUTTONS
   ======================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.86rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  border: none;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand-bg);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand);
}

.btn-ghost {
  background: rgba(255,255,255,0.02);
  color: var(--text-secondary);
  border: 1px solid rgb(36, 40, 44);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.btn-danger {
  color: var(--red);
  background: transparent;
  border: 1px solid transparent;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.08);
}

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.btn-icon:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

/* ========================
   FORM ELEMENTS
   ======================== */
.input, .input-field {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s var(--ease);
}
.input:focus, .input-field:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--border-focus);
}
.input::placeholder, .input-field::placeholder { color: var(--text-muted); }

select.input, select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8f98' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input, textarea.input-field {
  resize: vertical;
  min-height: 80px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group {
  margin-bottom: 16px;
}

/* ========================
   FILE GRID
   ======================== */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.file-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: all 0.15s var(--ease);
  cursor: pointer;
  position: relative;
}
.file-card:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
}

.file-card .file-preview {
  width: 100%;
  height: 100px;
  border-radius: 4px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
}

.file-card .file-name {
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.file-card .file-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
}

.file-card .file-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 4px;
}

.file-card:hover .file-actions { display: flex; }

.file-card .file-actions button {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.08);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  transition: all 0.15s var(--ease);
}
.file-card .file-actions button:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ========================
   UPLOAD ZONE
   ======================== */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.2s var(--ease);
  cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--brand);
  background: rgba(113,112,255,0.05);
}
.upload-zone .upload-icon {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  opacity: 0.4;
}
.upload-zone .upload-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.upload-zone .upload-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ========================
   FILTER PILLS
   ======================== */
.filter-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  border: 1px solid rgb(36, 40, 44);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
}
.filter-pill:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}
.filter-pill.active {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.08);
}

/* ========================
   PROGRESS BAR
   ======================== */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-bar .progress-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-full);
  transition: width 0.3s var(--ease);
}

/* ========================
   TOAST
   ======================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: rgba(0,0,0,0.4) 0px 2px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.86rem;
  animation: slideIn 0.25s var(--ease);
  max-width: 380px;
  pointer-events: auto;
}

.toast .toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--brand); }

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

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ========================
   SKELETON LOADING
   ======================== */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.02) 25%, rgba(255,255,255,0.04) 50%, rgba(255,255,255,0.02) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========================
   MODAL
   ======================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.2s var(--ease);
}

@keyframes modalIn {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.15s var(--ease);
}
.modal-close:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ========================
   DATA TABLE
   ======================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.data-table thead th {
  padding: 10px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: rgba(255,255,255,0.02);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ========================
   BADGE / TAG
   ======================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-default {
  background: rgba(255,255,255,0.04);
  color: var(--text-tertiary);
}

.badge-green, .badge-success {
  background: rgba(16,185,129,0.1);
  color: var(--green);
}

.badge-red, .badge-danger {
  background: rgba(239,68,68,0.1);
  color: var(--red);
}

.badge-yellow, .badge-warning {
  background: rgba(245,158,11,0.1);
  color: var(--yellow);
}

.badge-blue, .badge-info {
  background: rgba(113,112,255,0.1);
  color: var(--brand);
}

/* ========================
   TABS
   ======================== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 20px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--brand);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========================
   TOGGLE SWITCH
   ======================== */
.toggle {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  transition: all 0.2s var(--ease);
}

.toggle .slider::before {
  content: '';
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: var(--text-tertiary);
  border-radius: 50%;
  transition: all 0.2s var(--ease);
}

.toggle input:checked + .slider {
  background: var(--brand-bg);
}

.toggle input:checked + .slider::before {
  transform: translateX(18px);
  background: white;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.toggle-row:last-child {
  border-bottom: none;
}

.toggle-label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.toggle-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ========================
   CHARTS & STATS BARS
   ======================== */
.stat-bar-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-bar-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-bar-label {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  min-width: 80px;
}

.stat-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease);
}

.stat-bar-value {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  min-width: 36px;
  text-align: right;
  font-family: var(--font-mono);
}

/* Mini donut placeholder */
.donut-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.donut-placeholder .donut-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================
   ACTIVITY FEED
   ======================== */
.activity-feed {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.02);
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 8px;
}

/* ========================
   FILE LIST ITEM
   ======================== */
.file-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-subtle);
  transition: all 0.1s;
  cursor: pointer;
}
.file-list-item:last-child { border-bottom: none; }
.file-list-item:hover {
  background: rgba(255,255,255,0.02);
}

/* ========================
   AUTH PAGE
   ======================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  position: relative;
  overflow: hidden;
}

.auth-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(113,112,255,0.08), transparent 70%);
  top: -250px;
  right: -200px;
  pointer-events: none;
}

.auth-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(94,106,210,0.05), transparent 70%);
  bottom: -150px;
  left: -100px;
  pointer-events: none;
}

.auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
}

.auth-card .auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card .auth-logo .auth-logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.auth-card .auth-logo h1 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.auth-card .auth-logo p {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ========================
   DASHBOARD LAYOUT
   ======================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 32px;
}

/* ========================
   APP CARDS (Sandbox)
   ======================== */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.app-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.15s var(--ease);
  cursor: pointer;
}

.app-card:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
}

.app-card .app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.app-card .app-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.app-card .app-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.app-card .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.app-card .status-dot.running { background: var(--green); }
.app-card .status-dot.stopped { background: var(--text-muted); }
.app-card .status-dot.error { background: var(--red); }

.app-card .app-desc {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  line-height: 1.4;
}

.app-card .app-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.app-card .app-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ========================
   TOOL CARDS
   ======================== */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.tool-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.15s var(--ease);
}

.tool-card:hover {
  border-color: rgba(255,255,255,0.12);
}

.tool-card .tool-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.02);
}

.tool-card .tool-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.tool-card .tool-desc {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  line-height: 1.4;
  margin-bottom: 12px;
}

/* ========================
   PAGINATION
   ======================== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.pagination .page-btn {
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(36, 40, 44);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s var(--ease);
  font-family: var(--font);
}

.pagination .page-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
}

.pagination .page-btn.active {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.08);
  color: var(--text-primary);
}

/* ========================
   EMPTY STATE
   ======================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.85rem;
  margin-bottom: 20px;
}

/* ========================
   STATUS CARDS (Monitor)
   ======================== */
.status-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.status-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-card .status-num {
  font-size: 1.8rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
}

.status-card .status-label {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 768px) {
  .sidebar {
    display: none;
    z-index: 200;
  }

  .sidebar.show {
    display: flex;
    position: fixed;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .mobile-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
    padding-top: 64px;
  }

  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .stats-row {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .app-grid,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .status-cards {
    grid-template-columns: 1fr 1fr;
  }

  .data-table {
    font-size: 0.78rem;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: 8px 10px;
  }

  .auth-card {
    max-width: 340px;
    padding: 28px 24px;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .stat-card .stat-value {
    font-size: 1.3rem;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    padding: 10px 14px;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .card-body {
    padding: 16px;
  }

  .modal {
    max-width: 92vw;
    margin: 0 10px;
  }
}

@media (max-width: 480px) {
  .status-cards {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 16px 12px;
    padding-top: 56px;
  }
}

/* ========================
   MOBILE TOP BAR
   ======================== */
.mobile-top-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 10px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  justify-content: space-between;
  height: 52px;
}

.mobile-top-bar .mobile-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-top-bar .mobile-user {
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .mobile-top-bar {
    display: flex;
  }
}

/* ========================
   UTILITY CLASSES
   ======================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-tertiary { color: var(--text-tertiary); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ========================
   SETTINGS PAGE
   ======================== */
.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.api-key-display {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-tertiary);
}

/* ========================
   SEARCH INPUT
   ======================== */
.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  opacity: 0.4;
}

.search-input-wrapper .input,
.search-input-wrapper .input-field {
  padding-left: 36px;
}
