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

:root {
  --green:       #1D9E75;
  --green-dark:  #0F6E56;
  --green-light: #E1F5EE;
  --red:         #E24B4A;
  --red-bg:      #FCEBEB;
  --amber:       #EF9F27;
  --amber-bg:    #FAEEDA;
  --blue:        #378ADD;
  --blue-bg:     #E6F1FB;
  --text:        #1a1a1a;
  --text-muted:  #5F5E5A;
  --border:      #D3D1C7;
  --bg:          #F8F7F4;
  --white:       #ffffff;
  --sidebar-w:   220px;
  --radius:      8px;
  --radius-lg:   12px;
}

body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* Shell */
.admin-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: var(--sidebar-w); background: var(--white); border-right: 0.5px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 1.25rem 1rem; border-bottom: 0.5px solid var(--border); }
.brand-dot { width: 28px; height: 28px; border-radius: 8px; background: var(--green); display: inline-block; flex-shrink: 0; }
.brand-dot.large { width: 36px; height: 36px; }
.sidebar-brand-name { font-size: 14px; font-weight: 600; color: var(--text); }
.sidebar-brand-sub  { font-size: 11px; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 0.75rem 0; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 1rem; font-size: 13px; color: var(--text-muted); text-decoration: none; border-radius: 0; transition: background 0.1s; }
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--green-light); color: var(--green-dark); font-weight: 500; border-right: 2px solid var(--green); }
.nav-icon { font-size: 14px; width: 18px; text-align: center; }
.sidebar-footer { padding: 1rem; border-top: 0.5px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.btn-logout { width: 100%; background: transparent; border: 0.5px solid var(--border); border-radius: var(--radius); padding: 7px; font-size: 12px; cursor: pointer; color: var(--text-muted); font-family: inherit; }
.btn-logout:hover { background: var(--bg); }

/* Main content */
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar { background: var(--white); border-bottom: 0.5px solid var(--border); padding: 0.85rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; }
.admin-page-title { font-size: 16px; font-weight: 500; }
.topbar-meta { font-size: 12px; color: var(--text-muted); }
.topbar-right { display: flex; gap: 1rem; align-items: center; }
.admin-content { padding: 1.5rem; flex: 1; }

/* Metrics grid */
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; margin-bottom: 1.25rem; }
.metric-card { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.metric-card--alert { border-color: #F09595; background: #FCEBEB; }
.metric-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.metric-val   { font-size: 28px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.metric-sub   { font-size: 11px; color: var(--text-muted); }
.metric-link  { font-size: 12px; color: var(--green); text-decoration: none; }

/* Dashboard grid */
.dash-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1rem; }
.dash-card { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.dash-card-title { font-size: 13px; font-weight: 500; }
.dash-card-link  { font-size: 12px; color: var(--green); text-decoration: none; }
.chart-note { font-size: 12px; color: var(--text-muted); background: var(--bg); border-radius: var(--radius); padding: 8px 12px; border-left: 3px solid var(--amber); border-radius: 0; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table--full { width: 100%; }
.data-table th { text-align: left; font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 0.5px solid var(--border); }
.data-table td { padding: 9px 10px; border-bottom: 0.5px solid var(--bg); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg); }

/* Badges */
.tag { background: var(--bg); border: 0.5px solid var(--border); border-radius: 20px; padding: 2px 8px; font-size: 11px; }
.severity-badge { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.severity-critical { background: var(--red-bg);   color: #791F1F; }
.severity-high     { background: var(--amber-bg);  color: #633806; }
.severity-medium   { background: var(--blue-bg);   color: #0C447C; }
.severity-watch    { background: var(--bg);         color: var(--text-muted); }
.priority-badge    { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.priority-critical { background: var(--red-bg);   color: #791F1F; }
.priority-high     { background: var(--amber-bg);  color: #633806; }
.priority-medium   { background: var(--blue-bg);   color: #0C447C; }
.priority-low      { background: var(--bg);         color: var(--text-muted); }
.status-badge  { padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.status-open   { background: var(--blue-bg);  color: #0C447C; }
.status-in_review { background: var(--amber-bg); color: #633806; }
.status-resolved  { background: #EAF3DE; color: #27500A; }
.status-rejected  { background: var(--red-bg); color: #791F1F; }
.badge-alert { background: var(--red-bg); color: #791F1F; font-size: 10px; padding: 2px 6px; border-radius: 4px; margin-left: 6px; font-weight: 600; }

/* Filter bar */
.filter-bar { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-count { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.filter-form select { padding: 6px 10px; border: 0.5px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--white); font-family: inherit; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; font-size: 13px; color: var(--text-muted); }

/* Buttons */
.btn-primary { display: inline-block; background: var(--green); color: #fff; padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500; border: none; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: transparent; color: var(--green); border: 1px solid var(--green); padding: 10px 20px; border-radius: var(--radius); font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; font-family: inherit; }
.btn-sm { padding: 5px 12px; font-size: 12px; border: 0.5px solid var(--border); border-radius: var(--radius); background: transparent; cursor: pointer; color: var(--text); text-decoration: none; display: inline-block; font-family: inherit; }
.btn-sm:hover { background: var(--bg); }
.btn-sm.btn-outline { color: var(--green); border-color: var(--green); }
.btn-full { width: 100%; text-align: center; }

/* Flash */
.flash-success { font-size: 12px; background: var(--green-light); color: var(--green-dark); padding: 4px 10px; border-radius: var(--radius); }
.flash-error   { font-size: 12px; background: var(--red-bg); color: #791F1F; padding: 4px 10px; border-radius: var(--radius); }

/* Login page */
.login-page { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 2rem; }
.login-brand-name { font-size: 16px; font-weight: 600; }
.login-brand-sub  { font-size: 12px; color: var(--text-muted); }
.login-form .field { margin-bottom: 1rem; }
.login-form label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 5px; }
.login-form input { width: 100%; padding: 9px 12px; border: 0.5px solid var(--border); border-radius: var(--radius); font-size: 14px; font-family: inherit; }
.login-note { font-size: 11px; color: var(--text-muted); margin-top: 1rem; text-align: center; }
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 1rem; font-size: 13px; }
.alert-error { background: var(--red-bg); color: #791F1F; }

@media (max-width: 768px) {
  .dash-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
