*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #1a56a0; --primary-dark: #0f3d7a; --primary-light: #e8f0fb;
  --success: #166534; --success-bg: #dcfce7;
  --danger:  #991b1b; --danger-bg:  #fee2e2;
  --warning: #92400e; --warning-bg: #fef3c7;
  --info:    #1e40af; --info-bg:    #dbeafe;
  --gray-50: #f9fafb; --gray-100: #f3f4f6; --gray-200: #e5e7eb;
  --gray-500: #6b7280; --gray-700: #374151; --gray-900: #111827;
  --sidebar-w: 220px; --radius: 8px;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--gray-900); background: var(--gray-50); }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; background: #0f1e35; color: #fff; display: flex; flex-direction: column; z-index: 100; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo { width: 34px; height: 34px; background: var(--primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .9rem; flex-shrink: 0; }
.sidebar-title { font-size: .88rem; font-weight: 600; }
.sidebar-sub   { font-size: .68rem; opacity: .5; margin-top: 1px; }
.sidebar-nav   { flex: 1; padding: .5rem 0; }
.nav-section   { padding: .25rem 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.nav-label     { font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; opacity: .4; padding: .5rem 1rem .2rem; }
.nav-link      { display: flex; align-items: center; gap: 9px; padding: 8px 1rem; color: rgba(255,255,255,.7); text-decoration: none; font-size: .83rem; transition: background .12s, color .12s; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.1); color: #fff; }
.nav-link i    { width: 16px; text-align: center; font-size: .82rem; }
.sidebar-footer { padding: .75rem 1rem; font-size: .7rem; opacity: .35; border-top: 1px solid rgba(255,255,255,.07); }

/* Main */
.main    { margin-left: var(--sidebar-w); min-height: 100vh; }
.topbar  { height: 52px; background: #fff; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: .95rem; font-weight: 600; }
.topbar-user  { font-size: .8rem; color: var(--gray-500); }
.content { padding: 1.5rem; }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 8px; padding: .75rem 1rem; border-radius: var(--radius); font-size: .85rem; margin-bottom: 1rem; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info    { background: var(--info-bg);    color: var(--info); }

/* Cards */
.card         { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 1.25rem; }
.card-header  { padding: .9rem 1.25rem; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: .9rem; font-weight: 600; }
.card-body    { padding: 1.25rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th { padding: 9px 12px; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); background: var(--gray-50); border-bottom: 1px solid var(--gray-200); font-weight: 500; }
td { padding: 9px 12px; border-bottom: 1px solid var(--gray-100); font-size: .85rem; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 6px; font-size: .82rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; text-decoration: none; transition: all .13s; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-dark); }
.btn-danger  { background: #dc2626; color: #fff; }        .btn-danger:hover  { background: #b91c1c; }
.btn-success { background: #16a34a; color: #fff; }        .btn-success:hover { background: #15803d; }
.btn-outline { background: #fff; color: var(--gray-700); border-color: var(--gray-200); } .btn-outline:hover { background: var(--gray-50); }
.btn-sm { padding: 4px 10px; font-size: .76rem; }

/* Badges */
.badge { display: inline-block; padding: 2px 7px; border-radius: 20px; font-size: .7rem; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-gray    { background: var(--gray-100);   color: var(--gray-500); }

/* Forms */
.form-group { margin-bottom: 1rem; }
label { display: block; font-size: .8rem; font-weight: 500; color: var(--gray-700); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--gray-200); border-radius: 6px;
  font-size: .875rem; color: var(--gray-900); transition: border .13s; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,160,.1); }
.form-hint { font-size: .73rem; color: var(--gray-500); margin-top: 3px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--gray-100); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: .82rem; }
.input-icon input { padding-left: 32px; }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .875rem; margin-bottom: 1.25rem; }
.stat-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1rem; }
.stat-label { font-size: .72rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-top: 4px; }
.stat-sub   { font-size: .73rem; color: var(--gray-500); margin-top: 3px; }

/* Checkbox table */
.cb-table td { padding: 8px 12px; }
.cb-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: normal; }
.cb-label input[type=checkbox] { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
code { background: var(--gray-100); padding: 1px 5px; border-radius: 3px; font-size: .8rem; font-family: monospace; }

/* Status dot */
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot-green { background: #22c55e; } .dot-red { background: #ef4444; } .dot-orange { background: #f97316; }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-50); }
.login-card { background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; padding: 2.25rem; width: 100%; max-width: 370px; }
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-icon { width: 50px; height: 50px; background: var(--primary); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: .75rem; }
.login-icon i { color: #fff; font-size: 1.3rem; }
.login-title { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); }
.login-sub   { font-size: .78rem; color: var(--gray-500); margin-top: 3px; }
.btn-block   { width: 100%; justify-content: center; padding: 10px; margin-top: .5rem; }
