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

:root {
  --brand-500: #2b76ff; --brand-600: #1456f5; --brand-700: #0d42e1;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-300: #d1d5db; --gray-400: #9ca3af; --gray-500: #6b7280;
  --gray-700: #374151; --gray-800: #1f2937; --gray-900: #111827;
  --green-500: #22c55e; --red-500: #ef4444; --yellow-500: #eab308;
  --radius: 8px; --shadow: 0 1px 3px rgba(0,0,0,.1);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--gray-50); color: var(--gray-900); line-height: 1.5; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 256px; background: #0f172a; color: white; display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; z-index: 40; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid #1e293b; }
.sidebar-brand .logo { width: 32px; height: 32px; background: var(--brand-600); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.sidebar-brand span { font-size: 18px; font-weight: 600; letter-spacing: -0.025em; }
.sidebar-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #94a3b8; font-size: 14px; font-weight: 500; transition: all .15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: #1e293b; color: white; text-decoration: none; }
.sidebar-user { padding: 16px; border-top: 1px solid #1e293b; display: flex; align-items: center; gap: 12px; }
.sidebar-user .avatar { width: 36px; height: 36px; background: var(--brand-600); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 500; font-size: 14px; }
.sidebar-user .info { flex: 1; min-width: 0; }
.sidebar-user .info .name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .info .plan { font-size: 12px; color: #64748b; }
.sidebar-user .logout { font-size: 12px; color: #64748b; cursor: pointer; background: none; border: none; }
.sidebar-user .logout:hover { color: white; }

.main-content { flex: 1; margin-left: 256px; }
.top-bar { height: 64px; background: white; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; padding: 0 24px; }
.top-bar h1 { font-size: 18px; font-weight: 600; }
.page-content { padding: 24px; }

/* Cards */
.card { background: white; border: 1px solid var(--gray-200); border-radius: 12px; box-shadow: var(--shadow); }
.card-header { padding: 16px 24px; border-bottom: 1px solid var(--gray-100); }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 24px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; font-size: 14px; font-weight: 500; border-radius: var(--radius); border: none; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--brand-600); color: white; }
.btn-primary:hover { background: var(--brand-700); }
.btn-secondary { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger { background: var(--red-500); color: white; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Inputs */
.input { width: 100%; padding: 10px 14px; font-size: 14px; border: 1px solid var(--gray-300); border-radius: var(--radius); outline: none; transition: border .15s; background: white; }
.input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(43,118,255,.15); }
select.input { appearance: auto; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; font-size: 12px; font-weight: 500; border-radius: 99px; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fef2f2; color: #991b1b; }
.badge-yellow { background: #fefce8; color: #854d0e; }
.badge-blue { background: #eff6ff; color: #1e40af; }

/* Status dots */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green-500); }
.dot-red { background: var(--red-500); }
.dot-yellow { background: var(--yellow-500); }
.dot-gray { background: var(--gray-400); }
.dot-pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Grid helpers */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* Stat card */
.stat-card .label { font-size: 14px; color: var(--gray-500); font-weight: 500; }
.stat-card .value { font-size: 30px; font-weight: 700; margin-top: 4px; color: var(--gray-900); }
.stat-card .sub { font-size: 12px; font-weight: 500; margin-top: 4px; padding: 2px 8px; border-radius: 99px; display: inline-block; }

/* List rows */
.list-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--gray-100); cursor: pointer; transition: background .1s; }
.list-row:hover { background: var(--gray-50); }
.list-row:last-child { border-bottom: none; }
.list-row .left { display: flex; align-items: center; gap: 12px; }
.list-row .right { display: flex; align-items: center; gap: 12px; font-size: 13px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal { background: white; border-radius: 12px; max-width: 700px; width: 95%; max-height: 80vh; overflow-y: auto; box-shadow: 0 25px 50px rgba(0,0,0,.25); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--gray-400); }
.modal-close:hover { color: var(--gray-700); }
.modal-body { padding: 24px; }

/* Auth pages */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-50); }
.auth-box { width: 100%; max-width: 420px; padding: 0 16px; }
.auth-box .header { text-align: center; margin-bottom: 32px; }
.auth-box .header .logo { width: 48px; height: 48px; background: var(--brand-600); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: white; font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.auth-box .header h1 { font-size: 24px; font-weight: 700; }
.auth-box .header p { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.error-msg { background: #fef2f2; color: #991b1b; padding: 12px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.link-text { text-align: center; font-size: 14px; color: var(--gray-500); margin-top: 16px; }

/* Flex helpers */
.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; } .mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 14px; } .text-xs { font-size: 12px; }
.text-gray { color: var(--gray-500); } .text-mono { font-family: monospace; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.w-full { width: 100%; }
.hidden { display: none; }

/* Progress bar */
.progress-bar { height: 8px; background: var(--gray-100); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .3s; }

/* Empty state */
.empty { text-align: center; padding: 48px 24px; color: var(--gray-400); }
.empty .icon { font-size: 32px; margin-bottom: 8px; }

/* Responsive */
@media (max-width: 1024px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
}
