@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --sidebar-bg: #0b132b;
  --sidebar-hover: #16203d;
  --sidebar-active: #1d4ed8;
  --sidebar-active-glow: rgba(29, 78, 216, 0.35);
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-hover: #f1f5f9;
  --sidebar-text-active: #ffffff;

  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-subtle: #f1f5f9;
  
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #16a34a;
  --success-subtle: #dcfce7;
  --success-text: #15803d;

  --danger: #dc2626;
  --danger-subtle: #fee2e2;
  --danger-text: #b91c1c;

  --warning: #d97706;
  --warning-subtle: #fef3c7;
  --warning-text: #b45309;

  --info: #0284c7;
  --info-subtle: #e0f2fe;
  --info-text: #0369a1;

  --purple: #7c3aed;
  --purple-subtle: #f3e8ff;
  --purple-text: #6d28d9;

  --orange: #ea580c;
  --orange-subtle: #fff7ed;
  --orange-text: #c2410c;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

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

/* ==========================================================================
   Sidebar Navigation
   ========================================================================== */
aside.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--sidebar-bg);
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 30;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.brand {
  height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 14px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  position: relative;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-hover);
}

.sidebar-link:hover svg {
  opacity: 1;
  transform: translateX(1px);
}

.sidebar-link.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: 0 4px 12px var(--sidebar-active-glow);
}

.sidebar-link.active svg {
  opacity: 1;
  color: #ffffff;
}

.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: #64748b;
  padding: 14px 14px 6px;
  margin-top: 6px;
}

/* ==========================================================================
   Shell & Topbar
   ========================================================================== */
.shell {
  margin-left: 260px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 70px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.branch-selector-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.branch-selector-widget:hover {
  border-color: #cbd5e1;
}

.branch-selector-widget select {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.branch-widget-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
}

.branch-widget-text {
  display: flex;
  flex-direction: column;
}

.branch-widget-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: capitalize;
  line-height: 1.1;
}

.branch-widget-value {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.topbar-center {
  flex: 1;
  max-width: 520px;
  margin: 0 20px;
}

.global-search-btn {
  width: 100%;
  height: 42px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.global-search-btn:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  color: var(--text);
}

.search-placeholder-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}

.search-shortcut-badge {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.notification-badge-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
}

.user-avatar-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0f172a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.user-name-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
main.content {
  flex: 1;
  padding: 28px 32px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.breadcrumbs a {
  color: var(--text-muted);
  font-weight: 500;
}

.breadcrumbs a:hover {
  color: var(--primary);
}

.breadcrumbs .separator {
  color: var(--text-light);
  font-size: 12px;
}

.breadcrumbs .current {
  color: var(--text);
  font-weight: 600;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 20px;
  flex-wrap: wrap;
}

.page-header-title {
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin: 0;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

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

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.btn.danger {
  background: #ffffff;
  border-color: #fecaca;
  color: var(--danger);
}

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

.btn.sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 6px;
}

.btn.lg {
  height: 46px;
  padding: 0 22px;
  font-size: 14.5px;
  border-radius: 10px;
}

.btn.icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.stat-card-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon svg {
  width: 24px;
  height: 24px;
}

.stat-card-icon.blue {
  background: var(--primary-subtle);
  color: var(--primary);
}

.stat-card-icon.green {
  background: var(--success-subtle);
  color: var(--success);
}

.stat-card-icon.orange {
  background: var(--orange-subtle);
  color: var(--orange);
}

.stat-card-icon.purple {
  background: var(--purple-subtle);
  color: var(--purple);
}

.stat-card-icon.amber {
  background: var(--warning-subtle);
  color: var(--warning);
}

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

.stat-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-card-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-card-arrow {
  color: var(--text-light);
  display: flex;
  align-items: center;
}

.stat-card-arrow svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Filter Bar Container
   ========================================================================== */
.filter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.filter-form-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  flex: 1;
}

.filter-field.sm {
  max-width: 130px;
  min-width: 100px;
  flex: 0 0 auto;
}

.filter-field.wide {
  min-width: 220px;
  flex: 1.5;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.filter-input, .filter-select {
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--text);
  width: 100%;
  transition: all 0.15s ease;
}

.filter-input.has-icon {
  padding-left: 36px;
}

.filter-input:focus, .filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   Table & Data Grid
   ========================================================================== */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  white-space: nowrap;
}

thead {
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}

th {
  padding: 12px 18px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

th a {
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

th a:hover {
  color: var(--text);
}

th.numeric, td.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

th.center, td.center {
  text-align: center;
}

tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s ease;
}

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

tbody tr:hover {
  background: #f8fafc;
}

td {
  padding: 14px 18px;
  color: var(--text);
  vertical-align: middle;
}

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

/* Checkbox styling */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   Status Badges (Pills with dot indicator)
   ========================================================================== */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-pill.available, .status-pill.active, .status-pill.paid, .status-pill.posted {
  background: var(--success-subtle);
  color: var(--success-text);
}
.status-pill.available .status-dot, .status-pill.active .status-dot, .status-pill.paid .status-dot, .status-pill.posted .status-dot {
  background: var(--success);
}

.status-pill.occupied, .status-pill.full, .status-pill.unpaid, .status-pill.cancelled, .status-pill.suspended, .status-pill.inactive {
  background: var(--danger-subtle);
  color: var(--danger-text);
}
.status-pill.occupied .status-dot, .status-pill.full .status-dot, .status-pill.unpaid .status-dot, .status-pill.cancelled .status-dot, .status-pill.suspended .status-dot, .status-pill.inactive .status-dot {
  background: var(--danger);
}

.status-pill.maintenance, .status-pill.partial, .status-pill.pending, .status-pill.reversed {
  background: var(--warning-subtle);
  color: var(--warning-text);
}
.status-pill.maintenance .status-dot, .status-pill.partial .status-dot, .status-pill.pending .status-dot, .status-pill.reversed .status-dot {
  background: var(--warning);
}

.status-pill.closed, .status-pill.left {
  background: #f1f5f9;
  color: #475569;
}
.status-pill.closed .status-dot, .status-pill.left .status-dot {
  background: #94a3b8;
}

/* ==========================================================================
   Pagination Footer
   ========================================================================== */
.pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
  gap: 14px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
}

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

.page-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

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

/* ==========================================================================
   Show / Detail Page Layout (Image 2)
   ========================================================================== */
.show-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-icon {
  color: var(--primary);
  display: flex;
  align-items: center;
}

.card-title-icon svg {
  width: 20px;
  height: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.card-action-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-action-link:hover {
  color: var(--primary-hover);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
}

.detail-table tr {
  border-bottom: 1px solid #f1f5f9;
}

.detail-table tr:last-child {
  border-bottom: none;
}

.detail-table th {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13.5px;
  padding: 12px 0;
  width: 40%;
}

.detail-table td {
  padding: 12px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-align: left;
}

/* Occupancy Donut Gauge Widget */
.occupancy-gauge-box {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 0 20px;
}

.gauge-circle {
  width: 110px;
  height: 110px;
  position: relative;
  flex-shrink: 0;
}

.gauge-circle svg {
  transform: rotate(-90deg);
  width: 110px;
  height: 110px;
}

.gauge-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.gauge-pct {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.gauge-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.occupancy-breakdown {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.occupancy-breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.15s ease;
}

.occupancy-breakdown-row:hover {
  background: #f1f5f9;
}

.occupancy-row-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.occupancy-row-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.occupancy-row-icon.blue { background: var(--primary-subtle); color: var(--primary); }
.occupancy-row-icon.green { background: var(--success-subtle); color: var(--success); }
.occupancy-row-icon.amber { background: var(--warning-subtle); color: var(--warning); }

.occupancy-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.occupancy-row-count {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

/* Empty state */
.empty-state-box {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.empty-state-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* Tags widget */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--primary-subtle);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

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

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="month"], select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 42px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  font-size: 14px;
  width: 100%;
  transition: all 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.error {
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
  margin-top: 4px;
}

.alert {
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13.5px;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert.error {
  background: var(--danger-subtle);
  border-color: #fca5a5;
  color: var(--danger-text);
}

.savebar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 16px 28px;
  margin: 24px -32px -28px;
  z-index: 10;
}

/* Mode Switcher for Bulk vs Single */
.mode-switcher {
  display: inline-flex;
  gap: 8px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  border: 1px solid var(--border);
}

.mode-btn {
  padding: 8px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.mode-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Dialog & Drawer */
dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: calc(100% - 32px);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  width: 820px;
  max-width: 96vw;
  border: none;
  border-left: 1px solid var(--border);
  padding: 18px 22px;
  background: var(--surface);
  box-shadow: -15px 0 40px -10px rgba(15, 23, 42, 0.2);
  z-index: 50;
  overflow-y: auto;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.drawer-header-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(59, 130, 246, 0.18));
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.15);
}

.drawer iframe {
  width: 100%;
  height: calc(100vh - 86px);
  border: none;
  background: var(--bg);
  border-radius: var(--radius-md);
}

body.drawer-view {
  background: var(--bg);
  padding: 0;
  margin: 0;
}

body.drawer-view main.content {
  padding: 12px 14px;
}

body.drawer-view .show-grid {
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  body.drawer-view .show-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   Payment Modal / Top Student Identity Banner & Metrics
   ========================================================================== */
.student-payment-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.student-banner-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.student-banner-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.25);
  border: 2px solid #ffffff;
}

.student-banner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-banner-info {
  min-width: 0;
}

.student-banner-kpis {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.banner-kpi-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 6px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  min-width: 110px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.banner-kpi-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.banner-kpi-val {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
  margin-top: 2px;
}

.banner-kpi-val.text-success {
  color: var(--success);
}

.banner-kpi-item.kpi-due {
  background: #fef2f2;
  border-color: #fecaca;
}

.banner-kpi-item.kpi-due .banner-kpi-val {
  color: var(--danger);
}

.banner-kpi-item.kpi-cleared {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.banner-kpi-item.kpi-cleared .banner-kpi-val {
  color: var(--success);
}

@media (max-width: 680px) {
  .student-payment-banner {
    flex-direction: column;
    align-items: flex-start;
  }
  .student-banner-kpis {
    width: 100%;
    justify-content: space-between;
  }
  .banner-kpi-item {
    flex: 1;
    min-width: 0;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Month-by-Month Due & Paid Cards
   ========================================================================== */
.due-month-card {
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #fee2e2;
  border-left: 4px solid var(--danger);
  border-radius: 10px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.due-month-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.12);
  border-color: #fca5a5;
}

.paid-month-card {
  padding: 11px 14px;
  background: #ffffff;
  border: 1px solid #dcfce7;
  border-left: 4px solid var(--success);
  border-radius: 10px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(34, 197, 94, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.paid-month-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(34, 197, 94, 0.1);
}

.fee-breakdown-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #f1f5f9;
}

.quick-amount-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-amount-chip:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* Dropdown menu */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  z-index: 40;
  padding: 6px;
  display: none;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: #f1f5f9;
  color: var(--primary);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  padding-bottom: 4px;
}

.tab-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ==========================================================================
   Student Profile Specific Styles
   ========================================================================== */
.student-hero-card {
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.student-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.student-avatar-img {
  width: 88px;
  height: 88px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.student-avatar-initials {
  width: 88px;
  height: 88px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  font-size: 30px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
  border: 2px solid #e2e8f0;
}

.student-hero-content {
  flex: 1;
  min-width: 260px;
}

.student-hero-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.student-hero-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.student-code-badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 3px 10px;
  background: #f1f5f9;
  color: #334155;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.student-hero-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.student-hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.student-contact-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: #f8fafc;
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s ease;
}

.contact-chip:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--primary);
}

.contact-chip svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.contact-chip:hover svg {
  color: var(--primary);
}

.student-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 22px;
}

.student-actions-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.financial-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.financial-mini-stat {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid #f1f5f9;
}

.financial-mini-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.financial-mini-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.financial-mini-value.highlight {
  color: var(--primary);
}

.financial-mini-value.danger {
  color: var(--danger);
}

.financial-mini-value.success {
  color: var(--success);
}

/* Responsive */
@media (max-width: 1100px) {
  .show-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  aside.sidebar {
    display: none;
  }
  .shell {
    margin-left: 0;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar-center {
    display: none;
  }
  main.content {
    padding: 20px 16px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Student Profile Cards Grid (Image 1 Style)
   ========================================================================== */
.student-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.student-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.student-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  border-color: #cbd5e1;
}

.student-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.student-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
  border: 2px solid #ffffff;
}

.student-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-card-identity {
  flex: 1;
  min-width: 0;
}

.student-card-name {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  transition: color 0.15s ease;
}

.student-card-name:hover {
  color: var(--primary);
}

.student-card-room-badge {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.student-card-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.student-card-detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.student-card-financial {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-bottom: 14px;
}

.student-card-due-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
}

.student-card-due-box.has-due {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fee2e2;
}

.student-card-due-box.cleared {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #dcfce7;
}

.student-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}

@media print {
  aside.sidebar, .topbar, .page-actions, .filter-card, .savebar, .pagination-footer {
    display: none !important;
  }
  .shell {
    margin: 0 !important;
  }
  main.content {
    padding: 0 !important;
  }
  .card, .table-card {
    border: none !important;
    box-shadow: none !important;
  }
}