:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --line: #e2e8f0;
  --text: #1e293b;
  --text-light: #64748b;
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: url("../../assets/aegis-care-shield-web-bacground.webp");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { width: min(1200px, 94vw); margin: 0 auto; }

/* Layout */
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  margin: 24px 0;
  align-items: start;
}

.admin-sidebar {
  position: sticky;
  top: 100px;
  padding: 20px;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* Navigation */
.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-light);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 500;
  transition: all 0.2s;
}

.admin-nav-link:hover {
  background: var(--brand-light);
  color: var(--brand);
}

.admin-nav-link.active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

/* Header */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 150px;
}

.brand-block { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex-shrink: 0; }
.brand { text-decoration: none; display: flex; align-items: center; flex-shrink: 0; }
.brand img { height: 100px; width: auto; display: block; object-fit: contain; }
.brand-tagline { 
    font-size: 0.75rem; 
    color: #000; 
    margin: 0; 
    font-weight: 700;
    font-family: 'Inter', sans-serif;
}

.header-links { display: flex; gap: 12px; }

/* Cards & Components */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.theme-fostering {
  border-top: 6px solid #9e0fd2;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eyebrow {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 9999px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* Forms */
label { font-size: 0.875rem; font-weight: 600; color: var(--text); margin-bottom: 6px; display: block; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: var(--text);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge.pending { background: var(--warning-light); color: var(--warning); }
.badge.signed { background: var(--success-light); color: var(--success); }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -24px; padding: 0 24px; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-light);
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }

/* Visual Dashboard */
.visual-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.metric-card {
    padding: 24px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}

.metric-value { font-size: 2rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.metric-label { font-size: 0.875rem; color: var(--text-light); font-weight: 500; }

.alert-red { border-top: 4px solid var(--danger); }
.alert-amber { border-top: 4px solid var(--warning); }
.alert-blue { border-top: 4px solid var(--brand); }

/* Utilities */
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.note { font-size: 0.875rem; color: var(--text-light); }
.error { color: var(--danger); font-weight: 600; }
.status-ok { color: var(--success); font-weight: 600; }

@media (max-width: 1024px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; }
  .grid.two { grid-template-columns: 1fr; }
}

/* Global Search */
.search-container { position: relative; margin-bottom: 12px; }
#adminGlobalSearch {
    padding-left: 40px;
    border-radius: 10px;
    background: #f1f5f9;
    border: none;
}
.search-icon { position: absolute; left: 14px; top: 10px; color: var(--text-light); }
