/* assets/css/style.css — SV Hostel design system v2
   Modern admin-suite look: dark gradient sidebar, white topbar, indigo palette,
   soft cards, glassy hero, responsive off-canvas nav. Class names unchanged. */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --accent: #06b6d4;
  --nav-bg: #101828;
  --nav-bg-2: #0c1226;
  --nav-text: #9fb0d0;
  --bg-main: #f3f5fb;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e7eaf3;
  --border-focus: #a5b4fc;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --danger-bg: #ffe4e6;
  --danger-text: #9f1239;
  --info-bg: #e0f2fe;
  --info-text: #0369a1;
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, 0.18);
  --grad-primary: linear-gradient(135deg, #6366f1, #4f46e5);
  --grad-brand: linear-gradient(135deg, #4f46e5 0%, #2563eb 60%, #0891b2 100%);
  --grad-danger: linear-gradient(135deg, #f43f5e, #e11d48);
  --grad-success: linear-gradient(135deg, #10b981, #059669);
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font);
}

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(900px 340px at 85% -80px, rgba(99, 102, 241, 0.10), transparent 70%),
    radial-gradient(700px 300px at -100px 30%, rgba(168, 85, 247, 0.06), transparent 70%),
    var(--bg-main);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 15px;
  line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

::selection { background: #c7d2fe; }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; border: 2px solid transparent; background-clip: content-box; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ================= TOP NAVBAR ================= */
.top-navbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 60;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s;
}
.menu-toggle:hover { background: #f1f5f9; }

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--grad-brand);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 6px 14px -4px rgba(99, 102, 241, 0.55);
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-user-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--grad-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.user-avatar svg { width: 18px; height: 18px; }

.user-details {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  padding-right: 6px;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.user-role {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #fff;
  border: 1px solid #fecdd3;
  color: #be123c;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 600;
  transition: all 0.18s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.logout-btn:hover {
  background: var(--grad-danger);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px -6px rgba(225, 29, 72, 0.5);
  transform: translateY(-1px);
}

/* Quick Role Switcher Bar for Demo */
.role-demo-bar {
  background: linear-gradient(90deg, #111827, #1e1b4b);
  color: #a5b4fc;
  padding: 7px 22px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.role-demo-bar a {
  color: #c7d2fe;
  font-weight: 600;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(199, 210, 254, 0.3);
  transition: all 0.15s;
}
.role-demo-bar a:hover {
  background: rgba(199, 210, 254, 0.15);
  text-decoration: none;
}

/* ================= LAYOUT ================= */
.app-container {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
  align-items: stretch;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.55);
  backdrop-filter: blur(2px);
  z-index: 70;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  padding: 18px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-category {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #5b6b8c;
  padding: 16px 14px 8px;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-category::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.18);
}

.sidebar-menu {
  list-style: none;
  margin-bottom: 6px;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin: 2px 0;
  font-size: 0.885rem;
  color: var(--nav-text);
  font-weight: 500;
  transition: all 0.16s ease;
  border-radius: 11px;
  border-left: none;
  position: relative;
}

.sidebar-item a:hover {
  background: rgba(148, 163, 184, 0.12);
  color: #f8fafc;
}

.sidebar-item.active a {
  background: var(--grad-primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 10px 20px -8px rgba(79, 70, 229, 0.65);
}

.sidebar-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  padding: 26px 30px 46px;
  background: transparent;
  overflow-y: auto;
  min-width: 0;
}

/* ================= BREADCRUMB & HEADER ================= */
.page-top-header {
  margin-bottom: 24px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  justify-content: flex-start;
}

.breadcrumb a {
  color: var(--primary);
  font-weight: 600;
}
.breadcrumb a:hover { text-decoration: underline; }

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.62rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0b1220;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
  max-width: 760px;
}

/* ================= STAT CARDS ================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon-blue { background: #eef2ff; color: #4f46e5; }
.stat-icon-green { background: #d1fae5; color: #059669; }
.stat-icon-amber { background: #fef3c7; color: #d97706; }
.stat-icon-purple { background: #f3e8ff; color: #9333ea; }

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: capitalize;
}

.stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  color: #0b1220;
  margin-top: 2px;
  letter-spacing: -0.02em;
}

/* ================= CARDS & PANELS ================= */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  overflow: hidden;
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid #eef1f8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #fdfdff, #f8f9ff);
}

.card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0b1220;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.card-body {
  padding: 22px;
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: 0 8px 16px -6px rgba(79, 70, 229, 0.5);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 12px 22px -8px rgba(79, 70, 229, 0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--grad-success);
  color: white;
  box-shadow: 0 8px 16px -6px rgba(5, 150, 105, 0.45);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--primary-dark);
  font-weight: 600;
}
.btn-outline:hover {
  background: #e0e7ff;
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--grad-danger);
  color: white;
  box-shadow: 0 8px 16px -6px rgba(225, 29, 72, 0.45);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #e11d48, #be123c);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 7px 13px;
  font-size: 0.8rem;
  border-radius: 9px;
}

/* ================= FILTER / TOOLBAR BARS ================= */
.toolbar-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.search-input-wrapper {
  position: relative;
  min-width: 260px;
  flex: 1;
}

.search-input-wrapper input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background-color: #ffffff;
  color: #334155;
  outline: none;
  min-width: 130px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

/* ================= TABLES ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: none;
  border-radius: 0;
  background: transparent;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.865rem;
}

.custom-table th {
  background: #f7f8fe;
  color: #5b6b8c;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 12px 13px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 12px 13px;
  border-bottom: 1px solid #eef1f8;
  color: #29344b;
  white-space: nowrap;
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: background 0.12s ease;
}

.custom-table tbody tr:hover {
  background: #f6f7ff;
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-occupied { background: var(--danger-bg); color: var(--danger-text); }
.badge-partially { background: #fef3c7; color: #92400e; }
.badge-vacant { background: var(--success-bg); color: var(--success-text); }
.badge-active { background: var(--success-bg); color: var(--success-text); }
.badge-published { background: #e0f2fe; color: #0369a1; }
.badge-expired { background: var(--danger-bg); color: var(--danger-text); }

/* Table action buttons */
.action-btn {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 7px;
  border-radius: 9px;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.action-btn:hover {
  background: #eef2ff;
}
.action-btn.view-btn:hover { color: #4f46e5; }
.action-btn.edit-btn:hover { color: #059669; background: #d1fae5; }
.action-btn.delete-btn:hover { color: #e11d48; background: #ffe4e6; }

/* Pagination */
.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid #eef1f8;
  font-size: 0.83rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-controls {
  display: flex;
  gap: 6px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-color);
  color: #475569;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  transition: all 0.15s;
}
.page-link:hover { border-color: var(--border-focus); color: var(--primary); }

.page-link.active {
  background: var(--grad-primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 12px -4px rgba(79, 70, 229, 0.5);
}

/* ================= FORMS ================= */
.form-section-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #0b1220;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef1f8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 18px 20px;
  margin-bottom: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #44506b;
}

.form-group .required {
  color: #e11d48;
}

.form-control {
  padding: 11px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: #0f172a;
  outline: none;
  background: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.form-control[readonly], .form-control:disabled {
  background-color: #f6f7fb;
  cursor: not-allowed;
  color: #64748b;
  border-style: dashed;
}

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* ================= NOTICES FEED (STUDENT) ================= */
.notices-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notice-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 18px 22px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  transition: box-shadow 0.2s, transform 0.2s;
  box-shadow: var(--shadow-sm);
}

.notice-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.notice-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  background: var(--primary-soft);
}

.notice-content {
  flex: 1;
  min-width: 0;
}

.notice-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 10px;
  flex-wrap: wrap;
}

.notice-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: #3730a3;
}

.notice-date {
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.notice-desc {
  font-size: 0.875rem;
  color: #44506b;
  line-height: 1.55;
}

/* ================= STUDENT DASHBOARD HERO ================= */
.welcome-banner {
  background:
    radial-gradient(600px 220px at 90% -40px, rgba(255, 255, 255, 0.18), transparent 70%),
    linear-gradient(120deg, #312e81 0%, #3730a3 45%, #1d4ed8 100%);
  border: none;
  border-radius: 20px;
  padding: 28px;
  margin-bottom: 26px;
  color: #ffffff;
  box-shadow: 0 24px 48px -18px rgba(79, 70, 229, 0.55);
}

.welcome-title {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
}
.welcome-subtitle {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
  margin-top: 4px;
}

.student-quick-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 22px;
  margin-bottom: 22px;
}

.quick-card {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 10px 24px -12px rgba(30, 27, 75, 0.45);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.quick-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px -12px rgba(30, 27, 75, 0.55);
}

.quick-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.student-action-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.student-action-btn {
  padding: 13px 18px;
  border-radius: 12px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 600;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
  transition: all 0.18s ease;
}

.student-action-btn:hover {
  background: rgba(255, 255, 255, 0.96);
  color: #3730a3;
  transform: translateY(-2px);
  box-shadow: 0 12px 22px -10px rgba(30, 27, 75, 0.5);
}

.btn-my-room, .btn-notices, .btn-my-profile {
  background: rgba(255, 255, 255, 0.13);
}

/* ================= MANUAL FEE RECEIPT (paper look) ================= */
.receipt-wrapper {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border: 1px solid #dbe2ee;
  border-radius: 14px;
  padding: 34px 42px;
  box-shadow: var(--shadow-lg);
}

.receipt-header {
  text-align: center;
  border-bottom: 2px solid #0f172a;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.receipt-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px auto;
  color: #4338ca;
}

.receipt-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #0f172a;
}

.receipt-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #475569;
}

.receipt-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  row-gap: 12px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.receipt-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.receipt-meta-item .label {
  font-weight: 600;
  color: #334155;
}

.receipt-meta-item .value {
  font-weight: 700;
  border-bottom: 1px dashed #94a3b8;
  padding-bottom: 2px;
  flex: 1;
}

.badge-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  font-weight: 700;
  color: var(--primary);
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.875rem;
}

.receipt-table th, .receipt-table td {
  border: 1px solid #cbd5e1;
  padding: 8px 12px;
}

.receipt-table th {
  background: #f1f5f9;
  font-weight: 700;
}

.receipt-table .text-right {
  text-align: right;
}

.receipt-signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 50px;
  padding-top: 10px;
}

.signature-box {
  text-align: center;
  width: 140px;
}

.signature-line {
  border-top: 1px dotted #475569;
  margin-top: 30px;
  padding-top: 6px;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ================= 19-COLUMN DAILY FEE SPREADSHEET ================= */
.daily-fee-table {
  font-size: 0.775rem;
}

.daily-fee-table th {
  padding: 8px 6px;
  font-size: 0.7rem;
  text-align: center;
}

.daily-fee-table td {
  padding: 6px 4px;
}

.daily-fee-table input {
  width: 100%;
  min-width: 60px;
  padding: 4px;
  font-size: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  text-align: right;
}
.daily-fee-table input:focus {
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* ================= MODAL ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 30, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.18s ease;
}

.modal-box {
  background: white;
  border-radius: 18px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #eef1f8;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #0b1220;
}

.modal-body {
  padding: 22px 24px;
}

.modal-footer {
  padding: 15px 24px;
  border-top: 1px solid #eef1f8;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8f9ff;
}

/* ================= SHARED COMPONENT CLASSES (moved from page-local styles) ================= */
.tok-chip {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border: 1px solid #c7d2fe;
  border-radius: 7px;
  padding: 2px 9px;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

.bank-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
}

.bill-paid { color: #059669; }
.bill-due { color: #e11d48; }

.pw-reveal {
  background: #fefce8;
  border: 2px dashed #fde047;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

/* Status tabs (complaints etc.) */
.tab-btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: #334155;
  font-weight: 600;
  font-size: 0.84rem;
  text-decoration: none;
  margin-right: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.tab-btn:hover { border-color: var(--border-focus); color: var(--primary-dark); }
.tab-btn.active {
  background: var(--grad-primary);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 16px -6px rgba(79, 70, 229, 0.5);
}

/* Complaint cards (student + staff) */
.complaint-card, .complaint-admin {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.18s;
}
.complaint-card:hover, .complaint-admin:hover { box-shadow: var(--shadow-md); }
.complaint-card.resolved, .complaint-admin.resolved {
  border-color: #a7f3d0;
  background: #f2fdf9;
}
.complaint-reply {
  background: #f6f7ff;
  border-left: 3px solid var(--primary);
  border-radius: 0 10px 10px 0;
  padding: 10px 14px;
  margin-top: 10px;
  font-size: 0.88rem;
  color: #29344b;
}

/* Removed-student cards */
.removed-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 18px;
  background: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.removed-card .head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: linear-gradient(180deg, #fdfdff, #f6f7fd);
  border-bottom: 1px solid #eef1f8;
}

/* Fees hero (student) */
.tok-hero {
  background:
    radial-gradient(500px 200px at 88% -30px, rgba(255, 255, 255, 0.2), transparent 70%),
    linear-gradient(120deg, #312e81, #1d4ed8);
  color: #fff;
  border-radius: 18px;
  padding: 22px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  box-shadow: 0 20px 40px -16px rgba(79, 70, 229, 0.55);
}
.tok-hero .big-token {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* Attendance table (warden) */
.att-table { font-size: 0.85rem; }

/* Receipt page layout (staff) — collapses on small screens */
.receipt-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }

/* ---- inline field validation (assets/js/validate.js) ---- */
.field-error { color: #e11d48; font-size: 0.75rem; margin-top: 4px; font-weight: 600; }
.invalid-input { border-color: #f43f5e !important; background: #fff1f2 !important; }

/* ================= LOGIN / AUTH PAGES ================= */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 46%) 1fr;
}

.auth-hero {
  background:
    radial-gradient(700px 300px at 80% -60px, rgba(255, 255, 255, 0.16), transparent 70%),
    linear-gradient(150deg, #1e1b4b 0%, #312e81 50%, #1d4ed8 100%);
  color: #fff;
  padding: 56px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  bottom: -180px;
  right: -120px;
}

.auth-hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-hero-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 10px;
}

.auth-hero-sub {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.95rem;
  max-width: 420px;
  line-height: 1.6;
}

.auth-hero-points {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 34px 0;
  position: relative;
  z-index: 1;
}

.auth-hero-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.94);
}

.auth-hero-points .pt-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background:
    radial-gradient(700px 320px at 110% -80px, rgba(99, 102, 241, 0.10), transparent 70%),
    #f6f7fd;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 38px 36px 30px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px auto;
  border-radius: 16px;
  background: var(--grad-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 22px -8px rgba(99, 102, 241, 0.6);
}

.login-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0b1220;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.92rem;
  color: #64748b;
  margin-bottom: 26px;
}

.login-form { text-align: left; }

.form-group-login {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-login label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #44506b;
}

.input-with-icon { position: relative; }

.input-with-icon input,
.input-with-icon select {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}

.input-with-icon input:focus,
.input-with-icon select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.input-with-icon select { cursor: pointer; }

.input-icon-left {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  display: inline-flex;
}

.input-icon-right {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: inline-flex;
}
.input-icon-right:hover { color: var(--primary); background: var(--primary-soft); }

.login-btn-primary {
  width: 100%;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 20px -8px rgba(79, 70, 229, 0.6);
  transition: all 0.18s;
  margin-top: 6px;
}
.login-btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -8px rgba(79, 70, 229, 0.65);
}

.demo-credentials-box {
  margin-top: 20px;
  background: #f6f7fd;
  border: 1px dashed #c7d2fe;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.8rem;
  color: #44506b;
}

.demo-chip {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 999px;
  margin: 4px 4px 0 0;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-dark);
  transition: all 0.15s;
}

.demo-chip:hover {
  background: var(--primary-soft);
  border-color: var(--border-focus);
}

.login-footer {
  margin-top: 26px;
  font-size: 0.82rem;
  color: #94a3b8;
}
.login-footer a { color: var(--primary); font-weight: 600; }

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px) {
  .main-content { padding: 22px 20px 40px; }
}

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-hero { display: none; }

  .menu-toggle { display: inline-flex; }
  .brand-title { font-size: 0.92rem; }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    height: calc(100vh - var(--topbar-h));
    transform: translateX(-105%);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 80;
    box-shadow: none;
    width: 278px;
  }

  body.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar-backdrop { display: block; }

  .top-navbar { padding: 0 14px; }
  .user-details { display: none; }
  .logout-btn span { display: none; }
  .logout-btn { padding: 9px 11px; border-radius: 12px; }

  .main-content { padding: 18px 14px 40px; }
  .page-title { font-size: 1.35rem; }
  .welcome-banner { padding: 20px; border-radius: 16px; }
  .welcome-title { font-size: 1.35rem; }
  .student-action-btn { min-width: 46%; }
  .card-body { padding: 16px; }
  .card-header { padding: 14px 16px; }
  .receipt-wrapper { padding: 22px 18px; }
  .receipt-layout { grid-template-columns: 1fr; }
  .modal-overlay { padding: 12px; }
}

@media (max-width: 560px) {
  .student-action-btn { min-width: 100%; }
  .tok-hero { padding: 18px; }
  .tok-hero .big-token { font-size: 1.5rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ================= PRINT STYLES ================= */
@media print {
  body { background: white; }
  .top-navbar, .sidebar, .sidebar-backdrop, .menu-toggle, .role-demo-bar, .no-print, .breadcrumb, .page-top-header {
    display: none !important;
  }
  .app-container { display: block; }
  .main-content { padding: 0; }
  .receipt-wrapper {
    box-shadow: none;
    border: none;
    max-width: 100%;
    padding: 0;
  }
}

/* ============================================================
   ENHANCED INPUT SYSTEM — appended enhancement layer
   Covers all pages: admin, warden, student, auth, modals.
   Uses specificity overrides so nothing in PHP needs changing.
   ============================================================ */

/* ── 1. CSS tokens for the input system ── */
:root {
  --inp-h:          44px;
  --inp-radius:     11px;
  --inp-border:     #dde1ef;
  --inp-border-hov: #b8c0da;
  --inp-border-foc: #6366f1;
  --inp-bg:         #ffffff;
  --inp-bg-fill:    #f8f9ff;
  --inp-text:       #0f172a;
  --inp-placeholder:#94a3b8;
  --inp-shadow-foc: 0 0 0 3.5px rgba(99, 102, 241, 0.15);
  --inp-shadow-err: 0 0 0 3.5px rgba(244, 63, 94, 0.14);
  --inp-label-clr:  #374151;
  --inp-label-sz:   0.8rem;
  --inp-transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

/* ── 2. Universal base reset for ALL inputs, selects, textareas ── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--inp-text);
  background: var(--inp-bg);
  border: 1.5px solid var(--inp-border);
  border-radius: var(--inp-radius);
  padding: 10px 14px;
  outline: none;
  width: 100%;
  transition: var(--inp-transition);
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="tel"]:hover,
input[type="date"]:hover,
input[type="time"]:hover,
input[type="search"]:hover,
input[type="url"]:hover,
select:hover,
textarea:hover {
  border-color: var(--inp-border-hov);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
  border-color: var(--inp-border-foc);
  box-shadow: var(--inp-shadow-foc);
  background: #fff;
}

/* Placeholder */
input::placeholder,
textarea::placeholder {
  color: var(--inp-placeholder);
  font-size: 0.875rem;
  opacity: 1;
}

/* ── 3. .form-control override (main app forms) ── */
.form-control {
  height: var(--inp-h);
  padding: 0 14px;
  border: 1.5px solid var(--inp-border);
  border-radius: var(--inp-radius);
  font-size: 0.9rem;
  color: var(--inp-text);
  background: var(--inp-bg);
  transition: var(--inp-transition);
  box-shadow: none;
}

.form-control:hover:not(:focus):not([readonly]):not(:disabled) {
  border-color: var(--inp-border-hov);
  background: var(--inp-bg-fill);
}

.form-control:focus {
  border-color: var(--inp-border-foc) !important;
  box-shadow: var(--inp-shadow-foc) !important;
  background: #fff !important;
}

.form-control[readonly],
.form-control:disabled {
  background: #f1f3f9;
  border-color: #e2e6f0;
  border-style: solid;
  color: #8895b3;
  cursor: not-allowed;
  box-shadow: none;
}

textarea.form-control {
  height: auto;
  min-height: 96px;
  padding: 11px 14px;
  resize: vertical;
  line-height: 1.55;
}

/* ── 4. form-group — label enhancement ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  font-size: var(--inp-label-sz);
  font-weight: 650;
  color: var(--inp-label-clr);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
}

.form-group .required {
  color: #e11d48;
  font-size: 0.85em;
}

/* ── 5. form-grid improvements ── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px 22px;
  margin-bottom: 24px;
}

/* ── 6. form-section-title — elevated look ── */
.form-section-title {
  font-size: 0.95rem;
  font-weight: 750;
  color: #1e293b;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #eef1fb;
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: -0.01em;
}

/* ── 7. select — custom chevron arrow ── */
select.form-control,
.filter-select,
select:not([multiple]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
  cursor: pointer;
}

/* ── 8. filter-select toolbar ── */
.filter-select {
  height: var(--inp-h);
  padding: 0 38px 0 13px;
  border: 1.5px solid var(--inp-border);
  border-radius: var(--inp-radius);
  font-size: 0.875rem;
  color: #334155;
  background-color: #fff;
  transition: var(--inp-transition);
  min-width: 138px;
  font-weight: 500;
}

.filter-select:hover {
  border-color: var(--inp-border-hov);
  background-color: var(--inp-bg-fill);
}

.filter-select:focus {
  border-color: var(--inp-border-foc);
  box-shadow: var(--inp-shadow-foc);
}

/* ── 9. search-input-wrapper ── */
.search-input-wrapper input {
  height: var(--inp-h);
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--inp-border);
  border-radius: var(--inp-radius);
  font-size: 0.875rem;
  background: #fff;
  transition: var(--inp-transition);
}

.search-input-wrapper input:hover {
  border-color: var(--inp-border-hov);
  background: var(--inp-bg-fill);
}

.search-input-wrapper input:focus {
  border-color: var(--inp-border-foc);
  box-shadow: var(--inp-shadow-foc);
  background: #fff;
}

/* ── 10. login page inputs ── */
.input-with-icon input,
.input-with-icon select {
  height: var(--inp-h);
  padding: 0 14px 0 42px;
  border: 1.5px solid var(--inp-border);
  border-radius: var(--inp-radius);
  font-size: 0.9rem;
  background: var(--inp-bg-fill);
  transition: var(--inp-transition);
}

.input-with-icon input:hover,
.input-with-icon select:hover {
  border-color: var(--inp-border-hov);
  background: #fff;
}

.input-with-icon input:focus,
.input-with-icon select:focus {
  border-color: var(--inp-border-foc);
  box-shadow: var(--inp-shadow-foc);
  background: #fff;
}

/* ── 11. daily-fee-table inline inputs ── */
.daily-fee-table input[type="number"],
.daily-fee-table input[type="text"] {
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--inp-border);
  border-radius: 8px;
  font-size: 0.82rem;
  text-align: right;
  transition: var(--inp-transition);
}

.daily-fee-table input:hover {
  border-color: var(--inp-border-hov);
  background: var(--inp-bg-fill);
}

.daily-fee-table input:focus {
  border-color: var(--inp-border-foc);
  box-shadow: var(--inp-shadow-foc);
  background: #fff;
}

/* ── 12. modal form inputs ── */
.modal-body .form-control,
.modal-body input,
.modal-body select,
.modal-body textarea {
  background: var(--inp-bg-fill);
}

.modal-body .form-control:focus,
.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
  background: #fff;
}

/* ── 13. input-prefix / input-suffix group ── */
.input-group {
  display: flex;
  align-items: stretch;
  border-radius: var(--inp-radius);
  overflow: hidden;
  border: 1.5px solid var(--inp-border);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.input-group:focus-within {
  border-color: var(--inp-border-foc);
  box-shadow: var(--inp-shadow-foc);
}

.input-group .input-group-text {
  padding: 0 13px;
  background: #f1f3fb;
  border-right: 1.5px solid var(--inp-border);
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-group input,
.input-group .form-control {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  flex: 1;
  min-width: 0;
}

/* ── 14. validation states ── */
.invalid-input,
.form-control.is-invalid {
  border-color: #f43f5e !important;
  background: #fff5f7 !important;
  box-shadow: var(--inp-shadow-err) !important;
}

.form-control.is-valid {
  border-color: #10b981 !important;
  background: #f0fdf9 !important;
  box-shadow: 0 0 0 3.5px rgba(16, 185, 129, 0.13) !important;
}

.field-error {
  color: #e11d48;
  font-size: 0.74rem;
  font-weight: 600;
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── 15. input[type=date] — fix icon color ── */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.45;
  cursor: pointer;
  filter: invert(38%) sepia(89%) saturate(748%) hue-rotate(222deg) brightness(95%);
}

/* ── 16. number input — hide spinners for clean look ── */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.4;
}

/* ── 17. form-actions (submit row) ── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1.5px solid #eef1fb;
}

/* ── 18. card-body form padding ── */
.card-body .form-grid:last-child,
.card-body .form-group:last-child {
  margin-bottom: 0;
}

/* ── 19. responsive — single col on mobile ── */
@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-control,
  .filter-select,
  .search-input-wrapper input,
  .input-with-icon input {
    font-size: 1rem; /* prevent iOS zoom */
  }
}


/* ============================================================
   POLISH LAYER v3 — alignment, colour harmony, consistency
   Layout and class names are unchanged; this only refines.
   Palette: indigo (primary) + blue/cyan (accent) on cool slate.
   ============================================================ */
:root {
  --accent-soft: #ecfeff;
  --ring: 0 0 0 4px rgba(79, 70, 229, 0.13);
  --surface-tint: #f8faff;
}

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { text-wrap: balance; }
td, th, .stat-value, .si-stat-num { font-variant-numeric: tabular-nums; }

/* ---- Unified alerts (replaces scattered inline-styled boxes) ---- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: left;
  border: 1px solid transparent;
}
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-error   { background: #fff1f2; color: #9f1239; border-color: #fecdd3; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.login-card .alert { font-size: 0.82rem; margin-bottom: 14px; }

/* ---- Page header: always aligned, even where markup is simpler ---- */
.page-top-header:not(:has(.page-title-row)):has(> div + div) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.page-title-row > div:last-child:not(:first-child) {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.page-title-row form { display: inline-flex; margin: 0; }
.page-title { line-height: 1.2; }
.breadcrumb span:not(:last-child):not(:first-child) { color: #94a3b8; }

/* ---- Any inline flex row of buttons wraps instead of overflowing ---- */
[style*="display:flex"][style*="gap"],
[style*="display: flex"][style*="gap"] { flex-wrap: wrap; }

/* ---- Cards placed in grids: equal height, no stray bottom margin ---- */
[style*="grid-template-columns"] > .card {
  margin-bottom: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
[style*="grid-template-columns"] > .card > .card-body { flex: 1; display: flex; flex-direction: column; }
[style*="grid-template-columns"] > .card > .card-body > p { flex: 1; }
.card-header { background: var(--surface-tint); }
.card-title svg { color: var(--primary); }

/* ---- Stat cards ---- */
.stat-card { padding: 20px 22px; }
.stat-label { color: #64748b; letter-spacing: 0.01em; }
.stat-icon-blue   { background: #eef2ff; color: #4338ca; }
.stat-icon-green  { background: #dcfce7; color: #15803d; }
.stat-icon-amber  { background: #fef3c7; color: #b45309; }
.stat-icon-purple { background: #cffafe; color: #0e7490; }

/* ---- Light cards that reuse the dark sidebar-menu markup (Reports) ---- */
.card .sidebar-menu { padding: 8px; }
.card .sidebar-item a { color: #475569; font-weight: 600; margin: 2px 0; }
.card .sidebar-item a:hover { background: var(--primary-soft); color: var(--primary-dark); }
.card .sidebar-item.active a {
  background: var(--primary-soft);
  color: var(--primary-dark);
  box-shadow: none;
  font-weight: 700;
}
.card .sidebar-item .sidebar-icon { color: var(--primary); }

/* ---- Sidebar finish ---- */
.sidebar::-webkit-scrollbar-thumb { background: #27324f; border: 2px solid transparent; background-clip: content-box; }
.sidebar-item a { min-height: 42px; }
.sidebar-item.active a { background: linear-gradient(135deg, #4f46e5, #2563eb); }
.sidebar-icon svg { display: block; }

/* ---- Top bar ---- */
.top-navbar { box-shadow: 0 1px 0 rgba(16, 24, 40, 0.04), 0 8px 20px -16px rgba(16, 24, 40, 0.25); }
.brand-title { color: #0f172a; }
.user-role { color: var(--primary-dark); }
.role-demo-bar { background: linear-gradient(90deg, #0b1226, #172554); color: #a5b4fc; }
.role-demo-bar > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-demo-bar a { margin-left: 0; }

/* ---- Buttons ---- */
.btn { min-height: 40px; }
.btn-sm { min-height: 34px; }
.btn-primary, .page-link.active, .tab-btn.active, .login-btn-primary {
  background: linear-gradient(135deg, #4f46e5, #3b5bdb);
}
.btn-primary:hover, .login-btn-primary:hover { background: linear-gradient(135deg, #4338ca, #2f4ac4); }
.btn-outline { background: var(--primary-soft); }
.btn svg { flex-shrink: 0; }

/* ---- Toolbars / filters ---- */
.toolbar-bar { align-items: center; }
.search-filter-group > * { min-width: 0; }
.filter-select, .search-input-wrapper input { height: 42px; }
.form-grid .btn, .filter-row .btn { align-self: end; }

/* ---- Tables ---- */
.table-responsive { scrollbar-width: thin; }
.custom-table th { background: var(--surface-tint); color: #475569; }
.custom-table tbody tr:nth-child(even) { background: #fbfcff; }
.custom-table tbody tr:hover { background: #f1f5ff; }
.custom-table th, .custom-table td { vertical-align: middle; }
.custom-table td .btn, .custom-table td form { vertical-align: middle; }
.custom-table td form { display: inline-flex; margin: 0; }
.badge { line-height: 1.3; }
.badge-published { background: #dbeafe; color: #1d4ed8; }
.badge-partially { background: #fef3c7; color: #92400e; }

/* ---- Forms ---- */
.form-group { min-width: 0; }
.form-group label { display: block; }
input[type="file"] {
  width: 100%;
  font-size: 0.85rem;
  color: #475569;
  padding: 7px 10px;
  background: var(--surface-tint);
  border: 1.5px dashed #c7d2fe;
  border-radius: 11px;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}
input[type="file"]::file-selector-button:hover { background: #e0e7ff; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.form-actions { align-items: center; padding-top: 6px; }

/* ---- Student dashboard hero ---- */
.welcome-subtitle { margin-bottom: 16px; }
.welcome-banner .alert, .welcome-banner > div[style*="background"] { margin-top: 14px; }
.student-quick-cards { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.quick-card { min-height: 84px; }
.student-action-buttons { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.student-action-btn { min-height: 48px; }
.tok-hero { align-items: center; }

/* ---- Registers (index register / ledger) ---- */
.si-stats { align-items: stretch; }
.si-stat-card {
  border: 1px solid var(--border-color) !important;
  border-left: 1px solid var(--border-color) !important;
  border-radius: var(--radius) !important;
  padding: 18px 22px;
}
.si-stat-total .si-stat-num { color: var(--primary-dark); }
.si-stat-active .si-stat-num { color: #059669; }
.si-stat-inactive .si-stat-num { color: #d97706; }
.si-stat-num { font-size: 1.9rem; }

/* ---- Complaints / notices / misc cards ---- */
.complaint-card, .complaint-admin { padding: 18px 20px; }
.notice-item { align-items: center; }
.notice-title { color: #1e1b4b; }
.pw-reveal { background: #fffbeb; border-color: #fcd34d; }

/* ---- Modals ---- */
.modal-box { border: 1px solid var(--border-color); }
.modal-header { background: var(--surface-tint); }
.modal-header h3 { display: flex; align-items: center; gap: 8px; }

/* ---- Login / auth ---- */
.auth-hero > div:first-child { display: flex; flex-direction: column; position: relative; z-index: 1; }
.auth-hero-brand { order: 0; }
.auth-hero-title { order: 1; margin-top: 56px; font-size: 2.2rem; }
.auth-hero-sub { order: 2; }
.auth-hero-points { order: 3; margin: 36px 0 0 !important; }
.auth-hero-points .pt-ico { background: rgba(255,255,255,0.12); }
.login-card { padding: 36px 36px 28px; }
.login-title { text-wrap: balance; }
.login-subtitle { margin-bottom: 22px; }
.login-links { margin-top: 16px; text-align: center; font-size: 0.86rem; }
.login-link { color: var(--primary); font-weight: 600; }
.login-link:hover { color: var(--primary-dark); text-decoration: underline; }
.demo-credentials-box { background: var(--surface-tint); border-color: #c7d2fe; }
.input-with-icon input, .input-with-icon select { height: 46px; }

/* ---- Accessibility & motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---- Small screens ---- */
@media (max-width: 900px) {
  .page-title-row > div:last-child:not(:first-child) { justify-content: flex-start; width: 100%; }
  .auth-hero-title { margin-top: 0; }
}
@media (max-width: 560px) {
  .stat-card { padding: 16px; }
  .btn { white-space: normal; }
}

/* Input + button rows inside form groups stay on one line */
.form-group [style*="display:flex"],
.form-group [style*="display: flex"] { flex-wrap: nowrap; align-items: stretch; }
.form-group [style*="display:flex"] > input,
.form-group [style*="display:flex"] > .form-control,
.form-group [style*="display: flex"] > input { flex: 1; min-width: 0; }
.form-group [style*="display:flex"] > .btn { flex-shrink: 0; }

/* Buttons that follow fields directly get breathing room */
.card-body form > .btn:not(:first-child),
.card-body form > .form-group + .btn { margin-top: 8px; }
