/* ============================================================
   SHG Management — Admin Theme
   ============================================================ */
:root {
  --sidebar-bg:     #0f1e3d;
  --sidebar-hover:  #1a2f55;
  --sidebar-active: #2563eb;
  --sidebar-text:   #c9d4e6;
  --sidebar-text-strong: #ffffff;

  --bg:             #f4f6fa;
  --card:           #ffffff;
  --border:         #e3e8ef;
  --text:           #1a2332;
  --text-muted:     #6b7785;

  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --success:        #16a34a;
  --warning:        #d97706;
  --danger:         #dc2626;
  --info:           #0891b2;

  --radius:         10px;
  --shadow-sm:      0 1px 2px rgba(15,30,61,.06);
  --shadow-md:      0 4px 12px rgba(15,30,61,.08);
  --shadow-lg:      0 12px 30px rgba(15,30,61,.12);
}

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; color: var(--text); }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

.muted { color: var(--text-muted); }

/* ---------- LAYOUT ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  letter-spacing: .3px;
}
.sidebar-brand small { display:block; font-weight: 400; font-size: .72rem; color: var(--sidebar-text); margin-top: 3px; letter-spacing: 0; }
.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .62rem 1.25rem;
  color: var(--sidebar-text);
  font-size: .88rem;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a.active {
  background: rgba(37,99,235,.15);
  color: #fff;
  border-left-color: var(--sidebar-active);
}
.sidebar-nav .nav-section {
  padding: 1rem 1.25rem .35rem;
  font-size: .7rem;
  letter-spacing: 1.4px;
  color: #64748b;
  text-transform: uppercase;
}
.sidebar-nav .icon { width: 18px; text-align: center; opacity: .9; }

.sidebar-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: .8rem;
  color: var(--sidebar-text);
}
.sidebar-footer a { color: #fff; }

/* ---------- MAIN ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: .8rem 1.75rem;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.topbar h1 { font-size: 1.1rem; margin: 0; }
.topbar-user { font-size: .85rem; color: var(--text-muted); }
.topbar-user b { color: var(--text); }

.content { padding: 1.75rem; flex: 1; }

/* ---------- CARDS ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: -1.25rem -1.5rem 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.card-header h2 { margin: 0; font-size: 1rem; }

/* ---------- STAT GRID ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: .78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 1.7rem; font-weight: 700; margin-top: .3rem; color: var(--text); }
.stat-value.green { color: var(--success); }
.stat-value.amber { color: var(--warning); }
.stat-value.red   { color: var(--danger); }
.stat-value.blue  { color: var(--primary); }

/* ---------- TABLES ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: .88rem;
}
table.table th, table.table td {
  text-align: left;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.table th {
  background: #f9fafb;
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
}
table.table tr:last-child td { border-bottom: none; }
table.table tr:hover td { background: #fafbfd; }
table.table td.right, table.table th.right { text-align: right; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem 1rem;
  font-size: .85rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.2;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover   { background: var(--primary-hover); color:#fff; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f3f4f6; color: var(--text); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover   { background: #15803d; color:#fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover    { background: #b91c1c; color:#fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover   { background: #b45309; color:#fff; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; border-radius: 6px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---------- FORMS ---------- */
.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  margin-bottom: .35rem;
  color: var(--text);
}
.form-row input[type=text],
.form-row input[type=email],
.form-row input[type=password],
.form-row input[type=number],
.form-row input[type=date],
.form-row input[type=tel],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border .15s, box-shadow .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-row textarea { min-height: 90px; resize: vertical; }
.form-row .help { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: .22rem .6rem;
  font-size: .74rem;
  font-weight: 600;
  border-radius: 999px;
  letter-spacing: .3px;
  text-transform: capitalize;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #cffafe; color: #155e75; }
.badge-muted   { background: #e5e7eb; color: #374151; }

/* ---------- ALERTS ---------- */
.alert {
  padding: .8rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .88rem;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ---------- LOGIN PAGE ---------- */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f1e3d 0%, #1e3a8a 100%);
  padding: 1rem;
}
.login-card {
  background: #fff;
  width: 100%; max-width: 400px;
  border-radius: 14px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
}
.login-card h1 { font-size: 1.35rem; margin-bottom: .25rem; text-align: center; }
.login-card .sub { text-align: center; color: var(--text-muted); font-size: .88rem; margin-bottom: 1.5rem; }
.login-card .brand-badge {
  display: block; text-align: center;
  margin: 0 auto 1rem;
  width: 56px; height: 56px;
  line-height: 56px;
  background: var(--primary);
  color: #fff;
  border-radius: 14px;
  font-weight: 700;
  font-size: 1.3rem;
}
.login-card .btn { margin-top: .5rem; padding: .7rem 1rem; font-size: .92rem; }

/* ---------- UTILITIES ---------- */
.flex { display: flex; gap: .5rem; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }

/* ---------- MOBILE ---------- */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-brand small, .sidebar-nav a span:not(.icon), .sidebar-nav .nav-section { display: none; }
  .sidebar-nav a { justify-content: center; padding: .7rem 0; }
  .content { padding: 1rem; }
  .topbar { padding: .7rem 1rem; }
}

/* ---------- ATTENDANCE BUTTON GROUP ---------- */
.btn-group {
  display: inline-flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.btn-group .btn {
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
  padding: .35rem .7rem;
  font-size: .78rem;
}
.btn-group .btn:last-child {
  border-right: none;
}
.btn-group .btn input[type="radio"] {
  display: none;
}