:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1a1f2e;
  --sidebar-text: #a0aec0;
  --sidebar-active: #4f9eed;
  --primary: #4f9eed;
  --primary-dark: #3a7bc8;
  --danger: #e53e3e;
  --warning: #d69e2e;
  --success: #38a169;
  --bg: #f7fafc;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-muted: #718096;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

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

/* Sidebar */
.sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; overflow-y: auto; z-index: 100; }
.sidebar-brand { padding: 20px 16px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-icon { font-size: 1.4rem; }
.brand-name { font-size: 0.95rem; font-weight: 600; color: #fff; }
.sidebar-user { padding: 14px 16px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; flex-shrink: 0; }
.user-name { font-size: 0.85rem; color: #fff; font-weight: 500; }
.user-email { font-size: 0.75rem; color: var(--sidebar-text); }
.sidebar-nav { list-style: none; padding: 10px 0; flex: 1; }
.sidebar-nav li { margin: 2px 8px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: var(--sidebar-text); text-decoration: none; font-size: 0.875rem; transition: all .15s; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: rgba(79,158,237,.2); color: var(--sidebar-active); }
.nav-icon { font-size: 1rem; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.btn-logout { width: 100%; background: rgba(255,255,255,.08); color: var(--sidebar-text); border: none; padding: 8px; border-radius: 6px; cursor: pointer; font-size: 0.875rem; transition: background .15s; }
.btn-logout:hover { background: rgba(229,62,62,.3); color: #fff; }

/* Main content */
.main-content { margin-left: var(--sidebar-width); flex: 1; padding: 28px 32px; max-width: calc(100% - var(--sidebar-width)); }

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-top: 2px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); background: #f8fafc; }
.card-header h2, .card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 18px; }
.mt-4 { margin-top: 16px; }
.mt-2 { margin-top: 8px; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); }
.stat-icon { font-size: 2rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* Disk usage */
.disk-usage-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; background: var(--card-bg); padding: 12px 18px; border-radius: var(--radius); border: 1px solid var(--border); }
.disk-label { font-size: 0.875rem; color: var(--text-muted); min-width: 80px; }
.progress-bar { flex: 1; height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 5px; transition: width .3s; }
.progress-fill.warning { background: var(--warning); }
.progress-fill.danger { background: var(--danger); }
.disk-pct { font-size: 0.875rem; font-weight: 600; min-width: 40px; text-align: right; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }
.table-files .actions-cell { display: flex; gap: 6px; }

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-success, .badge-active { background: #c6f6d5; color: #22543d; }
.badge-warning, .badge-pending { background: #fefcbf; color: #744210; }
.badge-danger, .badge-suspended { background: #fed7d7; color: #742a2a; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); background: #fff; color: var(--text); cursor: pointer; font-size: 0.875rem; text-decoration: none; transition: all .15s; white-space: nowrap; }
.btn:hover { background: #f7fafc; border-color: #cbd5e0; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: #fff5f5; color: var(--danger); border-color: #fed7d7; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; }

/* Forms */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 5px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.875rem; background: #fff; color: var(--text); outline: none; transition: border-color .15s; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,158,237,.12); }

/* Modals */
.modal { border: none; border-radius: var(--radius); padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.2); max-width: 480px; width: 100%; }
.modal::backdrop { background: rgba(0,0,0,.5); }
.modal-box { padding: 24px; }
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 0.875rem; margin-bottom: 12px; }
.alert-error { background: #fff5f5; color: #742a2a; border: 1px solid #fed7d7; }

/* Toast */
.toast { padding: 10px 16px; border-radius: 6px; font-size: 0.875rem; }
.toast-success { background: #c6f6d5; color: #22543d; }
.toast-error { background: #fff5f5; color: #742a2a; }

/* Login page */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1a1f2e 0%, #2d3748 100%); }
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card { background: #fff; border-radius: 12px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 1.4rem; color: var(--text); margin-top: 10px; }
.login-logo p { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }

/* File manager */
.breadcrumb { display: flex; align-items: center; margin-bottom: 12px; font-size: 0.875rem; color: var(--text-muted); flex-wrap: wrap; }
.breadcrumb-item { color: var(--primary); cursor: pointer; }
.breadcrumb-item:hover { text-decoration: underline; }
.breadcrumb-sep { margin: 0 4px; color: var(--border); }
.file-link { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 6px; }
.file-link:hover { color: var(--primary); }
.file-icon { font-size: 1rem; }

/* Editor */
.editor-container { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.editor-container .cm-editor { min-height: 600px; font-size: 0.9rem; }

/* Code blocks */
.code-block { background: #1a1f2e; color: #a0aec0; padding: 14px 18px; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 0.875rem; overflow-x: auto; }

/* Row layout */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.col { min-width: 0; }

/* Table info variant */
.table-info th { width: 140px; }

/* Misc */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
code { background: #edf2f7; padding: 1px 6px; border-radius: 3px; font-family: 'Courier New', monospace; font-size: 0.85em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
}
