/* ==========================================================================
   DataU Portal — 100% Light Theme Enterprise UI
   Strictly for Teacher Data Management & Records Updation
   Clean, Lightweight, Pro SaaS Design with SVG Color Icon Controls
   ========================================================================== */

/* ── 1. Light Design Tokens & Variables ──────────────────────────────────── */
:root {
  /* Slate Light Palette */
  --slate-50:  #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  /* Brand Accents (Vibrant Pro Indigo) */
  --primary:        #4F46E5;
  --primary-hover:  #4338CA;
  --primary-light:  #EEF2FF;
  --primary-border: #C7D2FE;
  --primary-glow:   rgba(79, 70, 229, 0.14);

  /* Semantic Status Colors */
  --success:        #10B981;
  --success-bg:     #ECFDF5;
  --success-border: #A7F3D0;
  --success-text:   #047857;

  --warning:        #F59E0B;
  --warning-bg:     #FFFBEB;
  --warning-border: #FDE68A;
  --warning-text:   #B45309;

  --danger:         #EF4444;
  --danger-bg:      #FEF2F2;
  --danger-border:  #FECACA;
  --danger-text:    #B91C1C;

  --info:           #0284C7;
  --info-bg:        #F0F9FF;
  --info-border:    #BAE6FD;
  --info-text:      #0369A1;

  /* 100% Light Surfaces */
  --bg:             #F8FAFC;
  --surface:        #FFFFFF;
  --surface-alt:    #F1F5F9;
  --border:         #E2E8F0;
  --border-subtle:  #F1F5F9;
  --text:           #0F172A;
  --text-muted:     #64748B;
  --text-subtle:    #94A3B8;

  /* Dimensions */
  --sidebar-w: 240px;
  --header-h:  58px;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-pill: 9999px;

  /* Soft Light Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.03);

  --transition-fast: 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  --transition:      0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── 2. Reset & High-Performance Typography ──────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--primary-hover);
}

img, svg {
  display: block;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* Slim Styled Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--slate-300);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--slate-400);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  color: var(--slate-900);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.25;
}
h1 { font-size: 1.35rem; font-weight: 700; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
h4 { font-size: 0.875rem; }

p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.text-xs { font-size: 0.725rem !important; }
.text-sm { font-size: 0.8rem !important; }
.text-base { font-size: 0.875rem !important; }
.text-muted { color: var(--text-muted) !important; }
.text-subtle { color: var(--text-subtle) !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }

/* ── 3. App Shell Layout (Light Theme) ───────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
  background: var(--bg);
}

body.has-sidebar .main-content {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-content {
  padding: 20px 24px 36px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── 4. Pure Light Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
  user-select: none;
  box-shadow: 1px 0 3px rgba(0, 0, 0, 0.02);
}

.sidebar-header {
  height: var(--header-h);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #FFFFFF;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--slate-900);
  text-decoration: none;
}
.sidebar-brand:hover {
  color: var(--primary);
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  display: inline-block;
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.brand-badge.school-badge {
  color: #0284C7;
  background: #F0F9FF;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--slate-500);
  padding: 5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.sidebar-close-btn:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

/* Sidebar Nav */
.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: #FFFFFF;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-400);
  padding: 8px 10px 4px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--slate-600);
  font-size: 0.825rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-nav .nav-link:hover {
  background: var(--slate-50);
  color: var(--slate-900);
}

.sidebar-nav .nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--slate-500);
}
.sidebar-nav .nav-link.active .nav-icon {
  color: var(--primary);
}

.sidebar-nav .nav-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar User Footer */
.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: #FFFFFF;
}

.user-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.775rem;
  font-weight: 700;
  flex-shrink: 0;
}
.user-avatar.school-avatar {
  background: #F0F9FF;
  color: #0284C7;
  border-color: #BAE6FD;
}

.user-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  color: var(--slate-900);
  font-size: 0.775rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-role-pill {
  color: var(--slate-500);
  font-size: 0.65rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  color: var(--slate-400);
  padding: 6px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.sidebar-logout-btn:hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.25);
  backdrop-filter: blur(2px);
  z-index: 99;
}

/* ── 5. Page Header / Topbar ─────────────────────────────────────────────── */
.page-header {
  height: var(--header-h);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-header .hamburger {
  display: none;
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  color: var(--slate-700);
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.page-header .hamburger:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.page-title-group {
  flex: 1;
  min-width: 0;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── 6. Stat Cards / KPI Grid ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--slate-300);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon.blue, .stat-icon:not([class*="green"]):not([class*="orange"]):not([class*="red"]):not([class*="cyan"]) {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}
.stat-icon.green {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}
.stat-icon.orange {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}
.stat-icon.red {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}
.stat-icon.cyan {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-info .label, .stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  line-height: 1.2;
}

.stat-info .value, .stat-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 2px 0 1px;
}

.stat-info .sub {
  font-size: 0.7rem;
  color: var(--text-subtle);
  line-height: 1.2;
}

/* ── 7. Cards & Containers ───────────────────────────────────────────────── */
.card, .table-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header, .table-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FFFFFF;
}

.card-header h3, .table-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-900);
  letter-spacing: -0.015em;
}

.card-body {
  padding: 18px;
}

.card-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--slate-50);
}

/* ── 8. High-Density Pro Tables ──────────────────────────────────────────── */
.table-wrap, .table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #FFFFFF;
}

table, .data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.815rem;
  background: #FFFFFF;
}

thead th {
  background: var(--slate-50);
  padding: 9px 12px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-800);
  vertical-align: middle;
  line-height: 1.4;
}

tbody tr {
  transition: background var(--transition-fast);
}

tbody tr:hover {
  background: var(--slate-50);
}

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

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

/* Inline Edit Row Mode */
.edit-row td {
  background: #FFFDF0 !important;
}

.edit-row td .form-control {
  height: 30px;
  padding: 0 8px;
  font-size: 0.775rem;
  border-color: var(--primary);
  background: #FFFFFF;
}

/* Fit Columns on Page View */
.table-fit-page {
  table-layout: fixed !important;
  width: 100% !important;
}
.table-fit-page th,
.table-fit-page td {
  min-width: 0 !important;
  padding: 6px 4px !important;
  font-size: 0.74rem !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
  line-height: 1.25 !important;
}
.table-fit-page th:nth-child(1),
.table-fit-page td:nth-child(1) {
  width: 45px !important;
  min-width: 40px !important;
  max-width: 50px !important;
  text-align: center !important;
}
.table-fit-page .col-actions {
  width: 80px !important;
  min-width: 75px !important;
  max-width: 90px !important;
}

/* ── 9. SVG Color Icon Action Buttons (Replacing bulky text buttons) ──────── */
.icon-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  cursor: pointer;
  background: #FFFFFF;
  color: var(--slate-600);
  transition: all var(--transition-fast);
  padding: 0;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.icon-btn:active {
  transform: scale(0.95);
}

/* Colored Icon Button Variants */
.icon-btn-edit {
  background: #EEF2FF;
  border-color: #C7D2FE;
  color: #4F46E5;
}
.icon-btn-edit:hover {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
}

.icon-btn-delete {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #DC2626;
}
.icon-btn-delete:hover {
  background: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
}

.icon-btn-key {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #D97706;
}
.icon-btn-key:hover {
  background: #D97706;
  border-color: #D97706;
  color: #FFFFFF;
}

.icon-btn-view {
  background: #F0F9FF;
  border-color: #BAE6FD;
  color: #0284C7;
}
.icon-btn-view:hover {
  background: #0284C7;
  border-color: #0284C7;
  color: #FFFFFF;
}

.icon-btn-status-on {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #059669;
}
.icon-btn-status-on:hover {
  background: #059669;
  border-color: #059669;
  color: #FFFFFF;
}

.icon-btn-status-off {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #DC2626;
}
.icon-btn-status-off:hover {
  background: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
}

.icon-btn-save {
  background: #ECFDF5;
  border-color: #A7F3D0;
  color: #059669;
}
.icon-btn-save:hover {
  background: #059669;
  border-color: #059669;
  color: #FFFFFF;
}

.icon-btn-cancel {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #64748B;
}
.icon-btn-cancel:hover {
  background: #64748B;
  border-color: #64748B;
  color: #FFFFFF;
}

.icon-btn-export {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: #16A34A;
}
.icon-btn-export:hover {
  background: #16A34A;
  border-color: #16A34A;
  color: #FFFFFF;
}

.icon-btn-add {
  background: #EEF2FF;
  border-color: #C7D2FE;
  color: #4F46E5;
}
.icon-btn-add:hover {
  background: #4F46E5;
  border-color: #4F46E5;
  color: #FFFFFF;
}

/* Standard Buttons with Color SVG Icons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition-fast);
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #FFFFFF;
}

.btn-secondary {
  background: #FFFFFF;
  border-color: var(--slate-300);
  color: var(--slate-700);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-400);
  color: var(--slate-900);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}
.btn-success:hover {
  background: #059669;
  border-color: #059669;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #FFFFFF;
}
.btn-danger:hover {
  background: #DC2626;
  border-color: #DC2626;
}

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: #FFFFFF;
}
.btn-warning:hover {
  background: #D97706;
  border-color: #D97706;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--primary);
}
.btn-ghost:hover {
  background: var(--primary-light);
  color: var(--primary-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--slate-700);
}
.btn-outline:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 0.75rem;
}

.btn-xs {
  height: 24px;
  padding: 0 7px;
  font-size: 0.7rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  height: 40px;
  padding: 0 16px;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── 10. Forms & Controls (Light Theme) ──────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--slate-700);
  margin-bottom: 5px;
}
.form-label .req {
  color: var(--danger);
  margin-left: 2px;
}

.form-control {
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  color: var(--slate-900);
  font-size: 0.825rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-control::placeholder {
  color: var(--slate-400);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

textarea.form-control {
  height: auto;
  min-height: 80px;
  padding: 8px 11px;
  resize: vertical;
}

.form-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.input-group {
  display: flex;
  position: relative;
  width: 100%;
}
.input-group .form-control {
  flex: 1;
  padding-right: 38px;
}
.input-group .input-addon {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--slate-400);
  padding: 0;
}
.input-group .input-addon:hover {
  color: var(--primary);
}

/* ── 11. Filter Bar ──────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.search-input-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  pointer-events: none;
}

.search-input-wrap .form-control {
  padding-left: 32px;
}

/* ── 12. Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.675rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.3;
  white-space: nowrap;
}

.badge-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.badge-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.badge-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

.badge-secondary, .badge-default {
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  color: var(--slate-600);
}

/* ── 13. Alerts ──────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  line-height: 1.4;
}

.alert svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.alert-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: var(--info-text);
}

/* ── 14. Pagination ──────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pagination .page-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 8px;
}

.page-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--slate-700);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
  font-weight: 600;
}

/* ── 15. Modals (Pure Light Theme) ───────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(3px);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.open {
  display: flex !important;
}

.modal {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-lg {
  max-width: 760px;
}

.modal-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
}

.modal-header h3 {
  font-size: 1rem;
  color: var(--slate-900);
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--slate-400);
  padding: 4px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--slate-100);
  color: var(--slate-700);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  background: #FFFFFF;
}

.modal-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--slate-50);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── 16. Mobile Bottom Sheet ─────────────────────────────────────────────── */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  z-index: 400;
  display: none;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #FFFFFF;
  border-radius: 16px 16px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  z-index: 401;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-xl);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--slate-300);
  border-radius: var(--radius-pill);
  margin: 10px auto 0;
}

.bottom-sheet-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bottom-sheet-body {
  padding: 16px 18px 24px;
}

/* ── 17. Toasts ──────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  max-width: 360px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid var(--primary);
}

.toast.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-info    { border-left-color: var(--info); }

.toast .toast-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate-900);
}
.toast .toast-msg {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── 18. Pure Light Login Page ───────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: #F8FAFC;
  background-image: 
    radial-gradient(circle at 50% 0%, #EEF2FF 0%, #F8FAFC 75%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 30px;
  width: 100%;
  max-width: 410px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
}

.login-header {
  text-align: center;
  margin-bottom: 24px;
}

.login-header .login-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4F46E5, #6366F1);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.login-title {
  color: var(--slate-900);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.775rem;
  margin-top: 3px;
}

/* Login Tab Group (Light Segmented Control) */
.login-tab-group {
  display: flex;
  background: var(--slate-100);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
}

.login-tab {
  flex: 1;
  padding: 8px 12px;
  text-align: center;
  border: none;
  background: transparent;
  color: var(--slate-600);
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.login-tab.active {
  background: #FFFFFF;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.login-card .form-label {
  color: var(--slate-700);
}

.login-card .form-control {
  background: #FFFFFF;
  border-color: var(--slate-300);
  color: var(--slate-900);
}
.login-card .form-control:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.login-card .form-control::placeholder {
  color: var(--slate-400);
}

.login-card .input-addon {
  color: var(--slate-400);
}
.login-card .input-addon:hover {
  color: var(--primary);
}

.login-card .btn-primary {
  height: 40px;
  font-size: 0.875rem;
  margin-top: 8px;
}

/* ── 19. Steps & Import Wizard ───────────────────────────────────────────── */
.steps {
  display: flex;
  margin-bottom: 24px;
  border-radius: var(--radius);
  background: #FFFFFF;
  border: 1px solid var(--border);
  overflow: hidden;
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-right: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-muted);
  font-size: 0.775rem;
  font-weight: 500;
}
.step:last-child {
  border-right: none;
}

.step-circle {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  background: var(--slate-100);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.step.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #FFFFFF;
}

.step.done {
  color: var(--success);
}
.step.done .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: #FFFFFF;
}

.file-upload-area {
  border: 2px dashed var(--slate-300);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--slate-50);
}
.file-upload-area:hover, .file-upload-area.drag {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-upload-area svg {
  margin: 0 auto 10px;
  color: var(--slate-400);
}

/* ── 20. PWA Install Banner (Light) ──────────────────────────────────────── */
.pwa-banner {
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--slate-800);
  padding: 8px 14px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  font-size: 0.775rem;
}

/* ── 21. Utility Helpers ─────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }

.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

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

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ── 22. Responsive Breakpoints ──────────────────────────────────────────── */
@media (max-width: 991px) {
  :root {
    --sidebar-w: 240px;
  }

  body.has-sidebar .main-content {
    margin-left: 0;
    width: 100%;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .page-header {
    padding: 0 16px;
  }
  .page-header .hamburger {
    display: flex;
  }

  .page-content {
    padding: 16px;
  }

  .form-row, .form-row-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .page-header {
    height: 52px;
  }

  .page-title {
    font-size: 1.05rem;
  }

  .page-content {
    padding: 12px;
  }

  .card-body, .card-header {
    padding: 12px 14px;
  }

  .search-input-wrap {
    max-width: 100%;
    width: 100%;
  }

  .steps {
    flex-direction: column;
  }
  .step {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .step:last-child {
    border-bottom: none;
  }
}

@media (max-width: 420px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Form-wise Data Management Styles ──────────────────────────────────────── */
.form-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.form-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 6px 16px rgba(37,99,235,0.08);
  transform: translateY(-2px);
}

.form-card.active-card {
  border-color: var(--primary);
  background: linear-gradient(180deg, #FFFFFF 0%, #F5F7FF 100%);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15), 0 4px 12px rgba(37, 99, 235, 0.1);
}

.form-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.form-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.form-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.form-card-desc {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
  flex: 1;
}

.form-card-stats {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.form-card-stat {
  display: flex;
  flex-direction: column;
}

.form-card-stat .val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.form-card-stat .lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Save Status Indicator Pill */
.save-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.775rem;
  font-weight: 600;
  transition: all 0.25s ease;
}

.save-status-saved {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.save-status-saving {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.save-status-unsaved {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.save-status-error {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

/* Bulk Edit Spreadsheet Styles */
.bulk-edit-mode table input.bulk-cell-input,
.bulk-edit-mode table select.bulk-cell-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.8125rem;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.bulk-edit-mode table input.bulk-cell-input:hover,
.bulk-edit-mode table select.bulk-cell-input:hover {
  background: #FFFFFF;
  border-color: var(--border);
}

.bulk-edit-mode table input.bulk-cell-input:focus,
.bulk-edit-mode table select.bulk-cell-input:focus {
  background: #FFFFFF;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
  outline: none;
}

.bulk-edit-mode table td.cell-modified {
  background-color: #FEF3C7 !important;
  border-left: 2px solid var(--warning) !important;
}

.bulk-edit-mode table td.cell-saved {
  background-color: #D1FAE5 !important;
  transition: background-color 1s ease;
}

/* History Timeline in Modal */
.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 4px;
}

.history-item {
  border-left: 3px solid var(--primary);
  padding: 10px 14px;
  background: var(--slate-50);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.725rem;
  color: var(--text-muted);
}

.history-item-field {
  font-weight: 600;
  font-size: 0.825rem;
  color: var(--text);
}

.history-item-diff {
  font-size: 0.785rem;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-old-val {
  color: var(--danger-text);
  background: var(--danger-bg);
  padding: 2px 6px;
  border-radius: 3px;
  text-decoration: line-through;
}

.history-new-val {
  color: var(--success-text);
  background: var(--success-bg);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}

