/* ============================================================
   ICDS Anganwadi Management System — Design Tokens
   ============================================================ */
:root {
  --navy-900: #082744;
  --navy-800: #0d3b66;
  --navy-700: #124a7d;
  --navy-600: #1a5a97;
  --saffron: #f4a300;
  --saffron-dark: #d68f00;
  --green: #2e7d32;
  --green-light: #e6f4ea;
  --red: #c62828;
  --red-light: #fdecea;
  --amber: #b45309;
  --amber-light: #fef3e0;
  --blue-light: #e8f1fb;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e6ec;
  --text: #1f2937;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 32, 55, 0.06);
  --shadow: 0 2px 10px rgba(15, 32, 55, 0.08);
  --shadow-lg: 0 8px 30px rgba(15, 32, 55, 0.12);
  --sidebar-w: 264px;
  --topbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
  font-weight: 700;
  color: var(--navy-900);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

a { color: var(--navy-700); text-decoration: none; }
a:hover { color: var(--saffron-dark); }

p { margin: 0 0 10px; }

/* ============================================================
   Auth pages
   ============================================================ */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
}
.auth-brand {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 64px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.auth-brand::before {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: rgba(244, 163, 0, 0.15);
}
.auth-brand::after {
  content: "";
  position: absolute;
  left: -80px;
  bottom: -100px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.auth-brand .emblem {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: var(--saffron);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--navy-900); font-size: 22px;
  margin-bottom: 28px;
}
.auth-brand h1 { color: #fff; font-size: 30px; max-width: 460px; margin-bottom: 14px; }
.auth-brand p.lead { color: rgba(255,255,255,0.78); max-width: 420px; font-size: 15px; }
.auth-brand .brand-stats { display: flex; gap: 32px; margin-top: 44px; position: relative; z-index: 1; }
.auth-brand .brand-stats div strong { display: block; font-size: 22px; color: var(--saffron); }
.auth-brand .brand-stats div span { font-size: 12.5px; color: rgba(255,255,255,0.65); text-transform: uppercase; letter-spacing: .05em; }

.auth-panel {
  flex: 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 24px; margin-bottom: 4px; }
.auth-box .sub { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.form-control, select.form-control, textarea.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(18, 74, 125, 0.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.checkbox-row input { width: 16px; height: 16px; }
.checkbox-row label { margin: 0; text-transform: none; font-weight: 500; font-size: 14px; }
.form-hint { font-size: 12px; color: var(--text-faint); margin-top: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform .1s, box-shadow .15s, background .15s;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); color: #fff; }
.btn-accent { background: var(--saffron); color: var(--navy-900); }
.btn-accent:hover { background: var(--saffron-dark); color: var(--navy-900); }
.btn-outline { background: #fff; color: var(--navy-800); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--navy-600); color: var(--navy-800); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }

/* ============================================================
   App shell
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-900);
  color: #cdd8e3;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand .emblem {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--saffron);
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; flex-shrink: 0;
}
.sidebar-brand .name { color: #fff; font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.sidebar-brand .name small { display: block; color: #9db3c8; font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }

.sidebar-nav { padding: 14px 12px; flex: 1; }
.sidebar-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6f8dab;
  padding: 14px 10px 6px;
  font-weight: 700;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: #c3d2e0;
  font-size: 13.6px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.sidebar-nav a .ic {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active { background: var(--saffron); color: var(--navy-900); font-weight: 700; }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 11.5px; color: #7d95ab; }

.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 18px; margin: 0; }
.topbar .breadcrumb { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--bg); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy-800); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700;
}
.user-chip .who { line-height: 1.2; }
.user-chip .who strong { display: block; font-size: 12.8px; }
.user-chip .who span { font-size: 11px; color: var(--text-muted); }
.role-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--blue-light);
  color: var(--navy-700);
  text-transform: uppercase;
  letter-spacing: .03em;
}

.content { padding: 26px 28px 60px; }

/* ============================================================
   Cards & KPIs
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy-700);
  box-shadow: var(--shadow-sm);
}
.kpi-card .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; margin-bottom: 8px; }
.kpi-card .value { font-size: 28px; font-weight: 800; color: var(--navy-900); }
.kpi-card .sub { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.kpi-card.c-saffron { border-left-color: var(--saffron); }
.kpi-card.c-green { border-left-color: var(--green); }
.kpi-card.c-red { border-left-color: var(--red); }
.kpi-card.c-navy { border-left-color: var(--navy-700); }

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
}
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-header h3 { font-size: 15.5px; margin: 0; }
.panel-body { padding: 20px; }
.panel-body.no-pad { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.6px; }
table.data-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tbody tr:hover { background: #fafbfd; }
table.data-table tbody tr:last-child td { border-bottom: none; }
.cell-title { font-weight: 600; color: var(--navy-900); }
.cell-sub { font-size: 12px; color: var(--text-faint); }

/* ============================================================
   Badges / Pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.3px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: capitalize;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-amber { background: var(--amber-light); color: var(--amber); }
.badge-blue { background: var(--blue-light); color: var(--navy-700); }
.badge-gray { background: #eef1f5; color: var(--text-muted); }

/* ============================================================
   Buttons row / filters / toolbar
   ============================================================ */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-control { min-width: 160px; padding: 8px 12px; font-size: 13.5px; }
.search-input { position: relative; }
.search-input input { padding-left: 34px; min-width: 220px; }
.search-input::before {
  content: "";
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px;
  border: 2px solid var(--text-faint);
  border-radius: 50%;
}

.action-row { display: flex; gap: 8px; }

/* ============================================================
   Workflow Stepper
   ============================================================ */
.stepper { display: flex; align-items: flex-start; gap: 0; overflow-x: auto; padding: 10px 4px 4px; }
.step { display: flex; flex-direction: column; align-items: center; flex: 1; min-width: 90px; position: relative; }
.step .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: #eef1f5; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 800;
  border: 2px solid var(--border);
  z-index: 1;
}
.step .line { position: absolute; top: 13px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.step:last-child .line { display: none; }
.step .label { font-size: 10.8px; color: var(--text-muted); margin-top: 8px; text-align: center; font-weight: 600; max-width: 90px; }
.step.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.step.done .line { background: var(--green); }
.step.active .dot { background: var(--saffron); border-color: var(--saffron); color: var(--navy-900); }
.step.active .label { color: var(--navy-900); }

/* ============================================================
   Progress bar
   ============================================================ */
.progress-track { height: 8px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--saffron), var(--navy-700)); border-radius: 999px; }

/* ============================================================
   Detail view
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.detail-item .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-weight: 700; margin-bottom: 4px; }
.detail-item .v { font-size: 14.5px; color: var(--text); font-weight: 600; }

.timeline { border-left: 2px solid var(--border); margin-left: 8px; padding-left: 22px; }
.timeline-item { position: relative; padding-bottom: 22px; }
.timeline-item::before {
  content: "";
  position: absolute; left: -28px; top: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--navy-700); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--navy-700);
}
.timeline-item .t-date { font-size: 11.5px; color: var(--text-faint); font-weight: 700; }
.timeline-item .t-note { margin-top: 4px; font-size: 13.8px; }
.timeline-item img { margin-top: 8px; max-width: 220px; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .ic { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.empty-state h4 { color: var(--text-muted); margin-bottom: 6px; }

/* ============================================================
   Alerts / Flash
   ============================================================ */
.flash-stack { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.flash {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.6px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideIn .25s ease-out;
  display: flex; align-items: center; gap: 8px;
}
.flash-success { background: var(--green); color: #fff; }
.flash-error { background: var(--red); color: #fff; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   Login page emblem replicated in sidebar; misc
   ============================================================ */
.card-link { display: block; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { background: var(--blue-light); color: var(--navy-700); padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }

.fund-bar-wrap { margin-bottom: 10px; }
.fund-bar-labels { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.report-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.report-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.report-tile .ic-box { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-light); display: flex; align-items: center; justify-content: center; color: var(--navy-700); font-weight: 800; }
.report-tile h4 { margin: 0; font-size: 14.5px; }
.report-tile p { font-size: 12.5px; color: var(--text-muted); margin: 0; }

/* Mobile */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .grid-2, .grid-3, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}
.hamburger { display: none; background: none; border: none; cursor: pointer; }
@media (max-width: 900px) {
  .hamburger { display: flex; flex-direction: column; gap: 4px; padding: 6px; }
  .hamburger span { width: 20px; height: 2px; background: var(--navy-900); display: block; }
}
