/* ========== FP SIS — Shared Design System (Material Design 3) ========== */
:root {
  --md-primary: #1a73e8;
  --md-on-primary: #ffffff;
  --md-primary-container: #d3e3fd;
  --md-on-primary-container: #041e49;
  --md-secondary: #5f6368;
  --md-surface: #ffffff;
  --md-surface-dim: #f1f3f4;
  --md-surface-container: #f8f9fa;
  --md-surface-container-high: #e8eaed;
  --md-on-surface: #1f1f1f;
  --md-on-surface-variant: #5f6368;
  --md-outline: #dadce0;
  --md-outline-variant: #e8eaed;
  --md-error: #d93025;
  --md-success: #1e8e3e;
  --md-warning: #f9ab00;
  --md-info: #1a73e8;
  --md-elevation-1: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --md-elevation-2: 0 1px 2px 0 rgba(60,64,67,.3), 0 2px 6px 2px rgba(60,64,67,.15);
  --md-elevation-3: 0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --md-radius-sm: 8px;
  --md-radius-md: 12px;
  --md-radius-lg: 16px;
  --md-radius-xl: 28px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--md-surface-dim); color: var(--md-on-surface); font-size: 14px; }
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; }
.filled { font-variation-settings: 'FILL' 1; }
a { color: var(--md-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== TOP BAR ========== */
.top-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 64px; background: var(--md-surface); border-bottom: 1px solid var(--md-outline);
  display: flex; align-items: center; padding: 0 16px; gap: 8px;
}
.top-bar .logo { display: flex; align-items: center; gap: 10px; cursor: pointer; text-decoration: none; color: inherit; flex-shrink: 0; }
.top-bar .logo-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.top-bar .logo-text { font-size: 18px; font-weight: 600; color: var(--md-on-surface); white-space: nowrap; }
.top-bar .logo-text span { color: var(--md-on-surface-variant); font-weight: 400; font-size: 14px; }
.top-bar .spacer { flex: 1; }
.search-bar {
  flex: 0 1 720px; height: 44px; background: var(--md-surface-dim); border-radius: 22px;
  display: flex; align-items: center; padding: 0 16px; gap: 8px; border: 1px solid transparent;
  transition: all .2s; min-width: 0;
}
.search-bar:focus-within { background: var(--md-surface); border-color: var(--md-primary); box-shadow: var(--md-elevation-1); }
.search-bar input { flex: 1; border: none; background: none; font-size: 14px; outline: none; color: var(--md-on-surface); font-family: inherit; min-width: 0; }
.search-bar .material-symbols-outlined { color: var(--md-on-surface-variant); font-size: 20px; flex-shrink: 0; }

/* Icon / Avatar Buttons */
.icon-btn {
  width: 40px; height: 40px; border-radius: 20px; border: none; background: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--md-on-surface-variant); transition: background .15s; flex-shrink: 0;
}
.icon-btn:hover { background: var(--md-surface-container-high); }
.icon-btn.sm { width: 32px; height: 32px; }
.avatar {
  width: 32px; height: 32px; border-radius: 16px; background: var(--md-primary);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; cursor: pointer; flex-shrink: 0;
}
.notification-badge { position: relative; }
.notification-badge::after {
  content: attr(data-count); position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; background: var(--md-error); color: white;
  font-size: 10px; font-weight: 600; border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

/* ========== APP SWITCHER GRID ========== */
.app-grid-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.3); z-index: 200;
}
.app-grid-overlay.active { display: block; }
.app-grid-panel {
  position: absolute; top: 60px; right: 16px; width: 380px;
  background: var(--md-surface); border-radius: var(--md-radius-lg);
  box-shadow: var(--md-elevation-3); padding: 20px; max-height: 80vh; overflow-y: auto;
}
.app-grid-panel h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--md-on-surface-variant); margin-bottom: 16px; }
.app-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.app-tile {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 8px; border-radius: var(--md-radius-md); cursor: pointer;
  transition: background .15s; text-decoration: none !important; color: var(--md-on-surface);
}
.app-tile:hover { background: var(--md-surface-dim); }
.app-tile .app-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 24px; color: white;
}
.app-tile .app-name { font-size: 12px; font-weight: 500; text-align: center; line-height: 1.3; }
.app-icon.core { background: #1a73e8; }
.app-icon.academics { background: #e8710a; }
.app-icon.attendance { background: #9334e6; }
.app-icon.services { background: #e52592; }
.app-icon.health { background: #d93025; }
.app-icon.comms { background: #1e8e3e; }
.app-icon.finance { background: #188038; }
.app-icon.transport { background: #5f6368; }
.app-icon.staff { background: #185abc; }
.app-icon.analytics { background: #f9ab00; color: #1f1f1f !important; }
.app-icon.admin { background: #37474f; }
.app-icon.parent { background: #7b1fa2; }
.app-icon.student { background: #00897b; }
.app-icon.teacher { background: #c2185b; }

/* ========== APP LAYOUT ========== */
.app-layout { display: flex; margin-top: 64px; min-height: calc(100vh - 64px); }
.app-sidebar {
  width: 280px; background: var(--md-surface); border-right: 1px solid var(--md-outline);
  padding: 8px 12px; flex-shrink: 0; overflow-y: auto; height: calc(100vh - 64px);
  position: sticky; top: 64px;
}
.sidebar-section { margin-bottom: 4px; }
.sidebar-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--md-on-surface-variant); padding: 16px 16px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 40px;
  border-radius: var(--md-radius-xl); cursor: pointer; font-size: 14px;
  color: var(--md-on-surface-variant); transition: all .15s; font-weight: 500;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--md-surface-dim); color: var(--md-on-surface); }
.nav-item.active { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.nav-item .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; background: var(--md-error); color: white;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
}
.nav-item .count-badge { margin-left: auto; font-size: 12px; color: var(--md-on-surface-variant); }

.app-body, .main-content { flex: 1; padding: 24px 32px; overflow-y: auto; min-width: 0; }
.page-header { display: flex; align-items: center; gap: 16px; margin-bottom: 4px; flex-wrap: wrap; }
.page-header h1 { font-size: 24px; font-weight: 600; }
.page-header .spacer { flex: 1; }
.subtitle { font-size: 14px; color: var(--md-on-surface-variant); margin-bottom: 24px; }

/* ========== SCREEN MANAGEMENT ========== */
.screen { display: none; }
.screen.active { display: block; }

/* ========== CARDS ========== */
.card {
  background: var(--md-surface); border-radius: var(--md-radius-lg);
  box-shadow: var(--md-elevation-1); overflow: hidden;
}
.card-header {
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--md-outline-variant);
}
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--md-outline-variant); }

/* ========== STAT CARDS ========== */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--md-surface); border-radius: var(--md-radius-md); padding: 20px;
  box-shadow: var(--md-elevation-1); position: relative; overflow: hidden;
}
.stat-card .stat-label { font-size: 12px; color: var(--md-on-surface-variant); font-weight: 500; text-transform: uppercase; letter-spacing: .3px; }
.stat-card .stat-value { font-size: 32px; font-weight: 600; margin: 4px 0; line-height: 1.2; }
.stat-card .stat-change { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.stat-card .stat-change.up { color: var(--md-success); }
.stat-card .stat-change.down { color: var(--md-error); }
.stat-card .stat-change.neutral { color: var(--md-on-surface-variant); }
.stat-card .stat-icon {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px;
  border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px;
}

/* ========== DATA TABLES ========== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 600;
  color: var(--md-on-surface-variant); text-transform: uppercase; letter-spacing: .3px;
  border-bottom: 2px solid var(--md-outline); white-space: nowrap; background: var(--md-surface);
}
.data-table tbody td {
  padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--md-outline-variant);
  vertical-align: middle;
}
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--md-surface-dim); }
.data-table tbody tr.selected { background: var(--md-primary-container); }
.data-table tbody tr.row-warning { background: #fef7e0; }
.data-table tbody tr.row-error { background: #fce8e6; }
.student-cell { display: flex; align-items: center; gap: 10px; }
.student-avatar {
  width: 32px; height: 32px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white; flex-shrink: 0;
}
.student-avatar.sm { width: 28px; height: 28px; font-size: 10px; }
.student-avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.student-avatar.xl { width: 80px; height: 80px; font-size: 28px; }
.student-name { font-weight: 500; }
.student-id { font-size: 11px; color: var(--md-on-surface-variant); }
.table-pagination {
  padding: 12px 20px; display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--md-outline-variant); font-size: 13px; color: var(--md-on-surface-variant);
}
.page-btn {
  width: 32px; height: 32px; border-radius: 16px; border: none; background: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font-size: 13px; color: var(--md-on-surface-variant);
}
.page-btn:hover { background: var(--md-surface-dim); }
.page-btn.current { background: var(--md-primary-container); color: var(--md-on-primary-container); font-weight: 600; }

/* ========== CHIPS & BADGES ========== */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.chip.sm { padding: 2px 8px; font-size: 10px; }
.chip.active { background: #e6f4ea; color: #1e8e3e; }
.chip.inactive { background: #fce8e6; color: #d93025; }
.chip.pending { background: #fef7e0; color: #e37400; }
.chip.info { background: #e8f0fe; color: #1a73e8; }
.chip.purple { background: #f3e8fd; color: #7b1fa2; }
.chip.neutral { background: #e8eaed; color: #5f6368; }
.chip.outline { background: none; border: 1px solid var(--md-outline); color: var(--md-on-surface); }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 24px; height: 40px; border-radius: var(--md-radius-xl);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s;
  border: none; white-space: nowrap; font-family: inherit;
}
.btn.sm { height: 32px; padding: 0 16px; font-size: 13px; }
.btn.lg { height: 48px; padding: 0 32px; font-size: 15px; }
.btn-primary { background: var(--md-primary); color: var(--md-on-primary); }
.btn-primary:hover { box-shadow: var(--md-elevation-1); filter: brightness(1.1); }
.btn-danger { background: var(--md-error); color: white; }
.btn-danger:hover { box-shadow: var(--md-elevation-1); filter: brightness(1.1); }
.btn-success { background: var(--md-success); color: white; }
.btn-outline { background: none; border: 1px solid var(--md-outline); color: var(--md-primary); }
.btn-outline:hover { background: var(--md-surface-dim); }
.btn-text { background: none; color: var(--md-primary); padding: 0 12px; }
.btn-text:hover { background: var(--md-primary-container); }
.btn .material-symbols-outlined { font-size: 18px; }
.btn-sm, .btn.btn-sm { height: 32px; padding: 0 16px; font-size: 13px; }

/* ========== TOOLBAR & FILTERS ========== */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--md-outline); background: var(--md-surface);
  cursor: pointer; transition: all .15s; color: var(--md-on-surface);
}
.filter-chip:hover { background: var(--md-surface-dim); }
.filter-chip.selected { background: var(--md-primary-container); border-color: var(--md-primary); color: var(--md-on-primary-container); }
.filter-chip .material-symbols-outlined { font-size: 16px; }

/* ========== TABS ========== */
.tabs { display: flex; border-bottom: 2px solid var(--md-outline-variant); margin-bottom: 24px; gap: 0; }
.tab {
  padding: 12px 24px; font-size: 14px; font-weight: 500; cursor: pointer;
  color: var(--md-on-surface-variant); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s; white-space: nowrap;
}
.tab:hover { color: var(--md-on-surface); background: var(--md-surface-dim); }
.tab.active { color: var(--md-primary); border-bottom-color: var(--md-primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ========== STATS GRID ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card .stat-trend { font-size: 12px; display: flex; align-items: center; gap: 4px; }
.stat-card .stat-trend.up { color: var(--md-success); }
.stat-card .stat-trend.down { color: var(--md-error); }
.stat-card .stat-trend.neutral { color: var(--md-on-surface-variant); }

/* ========== FORMS ========== */
.form-section { margin-bottom: 32px; }
.form-section-title {
  font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 1px solid var(--md-outline-variant); display: flex; align-items: center; gap: 8px;
}
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.form-row.col-2 { grid-template-columns: 1fr 1fr; }
.form-row.col-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.col-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12px; font-weight: 500; color: var(--md-on-surface-variant); }
.form-field label .required { color: var(--md-error); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--md-outline); border-radius: var(--md-radius-sm);
  font-size: 14px; font-family: inherit; background: var(--md-surface); color: var(--md-on-surface);
  transition: border-color .15s;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--md-primary); box-shadow: 0 0 0 1px var(--md-primary);
}
.form-field input[readonly], .form-field select[readonly] {
  background: var(--md-surface-dim); color: var(--md-on-surface-variant); cursor: default;
}
.form-field .helper { font-size: 11px; color: var(--md-on-surface-variant); }
.form-field .error-text { font-size: 11px; color: var(--md-error); }
.form-field input.error { border-color: var(--md-error); }
.form-field textarea { resize: vertical; min-height: 80px; }

/* Aliases for alternate form markup patterns */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--md-on-surface-variant); }
.form-control {
  height: 40px; padding: 0 12px; border: 1px solid var(--md-outline); border-radius: var(--md-radius-sm);
  font-size: 14px; background: var(--md-surface); color: var(--md-on-surface); width: 100%;
}
.form-control:focus { outline: none; border-color: var(--md-primary); box-shadow: 0 0 0 1px var(--md-primary); }
textarea.form-control { height: auto; padding: 8px 12px; resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--md-primary); }
.radio-group { display: flex; gap: 16px; }
.radio-field { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.radio-field input { width: 18px; height: 18px; accent-color: var(--md-primary); }

/* ========== PROGRESS BARS ========== */
.progress-bar { height: 4px; background: var(--md-surface-container-high); border-radius: 2px; overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 2px; transition: width .3s; }
.progress-bar .fill.green { background: var(--md-success); }
.progress-bar .fill.blue { background: var(--md-primary); }
.progress-bar .fill.yellow { background: var(--md-warning); }
.progress-bar .fill.red { background: var(--md-error); }
.progress-bar .fill.purple { background: #9334e6; }

/* ========== ALERTS ========== */
.alert {
  padding: 12px 16px; border-radius: var(--md-radius-sm); font-size: 13px; display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.alert-info { background: #e8f0fe; color: #1a73e8; }
.alert-success { background: #e6f4ea; color: #1e8e3e; }
.alert-warning { background: #fef7e0; color: #e37400; }
.alert-error { background: #fce8e6; color: #d93025; }
.alert-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--md-radius-md); margin-bottom: 16px; font-size: 13px;
}
.alert-banner.warning { background: #fef7e0; color: #e37400; }
.alert-banner.error { background: #fce8e6; color: #d93025; }
.alert-banner.success { background: #e6f4ea; color: #1e8e3e; }
.alert-banner.info { background: #e8f0fe; color: #1a73e8; }

/* ========== TIMELINE ========== */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 16px; padding: 12px 0; position: relative; }
.timeline-item:not(:last-child)::after {
  content: ''; position: absolute; left: 15px; top: 44px; bottom: -4px;
  width: 2px; background: var(--md-outline-variant);
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 16px;
}
.timeline-content { flex: 1; }
.timeline-content .time { font-size: 12px; color: var(--md-on-surface-variant); }
.timeline-content .event { font-size: 13px; font-weight: 500; }
.timeline-content .detail { font-size: 12px; color: var(--md-on-surface-variant); margin-top: 2px; }

/* ========== STEPPER (Multi-step forms) ========== */
.stepper { display: flex; align-items: center; margin-bottom: 32px; padding: 0 16px; }
.step { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.step-number {
  width: 32px; height: 32px; border-radius: 16px; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 600;
  background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
}
.step.active .step-number { background: var(--md-primary); color: white; }
.step.completed .step-number { background: var(--md-success); color: white; }
.step-label { font-size: 13px; font-weight: 500; color: var(--md-on-surface-variant); }
.step.active .step-label { color: var(--md-on-surface); font-weight: 600; }
.step.completed .step-label { color: var(--md-success); }
.step-connector { flex: 1; height: 2px; background: var(--md-outline-variant); margin: 0 12px; min-width: 24px; }
.step-connector.completed { background: var(--md-success); }

/* ========== MODAL / DIALOG ========== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4); z-index: 300; display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--md-surface); border-radius: var(--md-radius-lg); box-shadow: var(--md-elevation-3);
  width: 90%; max-width: 640px; max-height: 90vh; overflow-y: auto;
}
.modal-header { padding: 20px 24px 12px; display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 20px; font-weight: 600; }
.modal-body { padding: 12px 24px 24px; }
.modal-footer { padding: 12px 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.modal.lg { max-width: 900px; }
.modal.sm { max-width: 480px; }

/* ========== GRID LAYOUTS ========== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

/* ========== SECTION ========== */
.section { margin-bottom: 32px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ========== PROFILE HEADER ========== */
.profile-header {
  display: flex; gap: 20px; align-items: center; padding: 24px;
  background: var(--md-surface); border-radius: var(--md-radius-lg);
  box-shadow: var(--md-elevation-1); margin-bottom: 24px;
}
.profile-info { flex: 1; }
.profile-info h2 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
.profile-info .profile-meta { font-size: 13px; color: var(--md-on-surface-variant); display: flex; gap: 16px; flex-wrap: wrap; }
.profile-info .profile-meta span { display: flex; align-items: center; gap: 4px; }
.profile-alerts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.profile-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ========== MISC ========== */
.divider { height: 1px; background: var(--md-outline-variant); margin: 16px 0; }
.text-muted { color: var(--md-on-surface-variant); }
.text-error { color: var(--md-error); }
.text-success { color: var(--md-success); }
.text-warning { color: #e37400; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.fw-600 { font-weight: 600; }
.mono { font-family: 'Roboto Mono', monospace; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* Mini chart placeholder */
.mini-chart { height: 60px; display: flex; align-items: flex-end; gap: 3px; padding: 4px 0; }
.mini-chart .bar { flex: 1; background: var(--md-primary); border-radius: 2px 2px 0 0; min-width: 6px; opacity: .7; }

/* ========== CROSS-APP ALIASES ========== */
/* Aliases for variant class names used across different app mockups */
.stat-number { font-size: 32px; font-weight: 600; margin: 4px 0; line-height: 1.2; }
.card-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.filter-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-row .filter-chip.active { background: var(--md-primary); color: var(--md-on-primary); border-color: var(--md-primary); }
.header-actions { display: flex; gap: 8px; margin-left: auto; }
.form-actions { display: flex; gap: 8px; margin-top: 24px; }
.form-select, .form-input { height: 40px; padding: 0 12px; border: 1px solid var(--md-outline); border-radius: var(--md-radius-sm); font-size: 14px; background: var(--md-surface); color: var(--md-on-surface); font-family: inherit; }
.form-textarea { padding: 8px 12px; border: 1px solid var(--md-outline); border-radius: var(--md-radius-sm); font-size: 14px; background: var(--md-surface); color: var(--md-on-surface); font-family: inherit; width: 100%; resize: vertical; }
.form-group .flex-2 { grid-column: span 2; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0; font-size: 13px; }
.page-info { color: var(--md-on-surface-variant); }
/* Button variant aliases */
.btn.primary, .btn-primary { background: var(--md-primary); color: var(--md-on-primary); }
.btn.outlined, .btn-outline { background: none; border: 1px solid var(--md-outline); color: var(--md-primary); }
.btn.text, .btn-text { background: none; color: var(--md-primary); padding: 0 12px; }
.btn.danger, .btn-danger { background: var(--md-error); color: white; }
/* Status chip (alias for badge-like elements used in health app) */
.status-chip {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; background: var(--md-surface-container-high); color: var(--md-on-surface-variant);
}
.status-chip.success { background: #e6f4ea; color: #1e8e3e; }
.status-chip.warning { background: #fef7e0; color: #e37400; }
.status-chip.danger { background: #fce8e6; color: #d93025; }
.status-chip.info { background: #e8f0fe; color: #1a73e8; }
/* Alert banner variant */
.alert-banner.danger { background: #fce8e6; color: #d93025; }
/* Data table compact variant */
.data-table.compact th, .data-table.compact td { padding: 8px 12px; font-size: 12px; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: var(--md-outline); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--md-on-surface-variant); }

/* ========== EMPTY STATE ========== */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .material-symbols-outlined { font-size: 48px; color: var(--md-on-surface-variant); margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--md-on-surface-variant); margin-bottom: 20px; }

/* ========== MOBILE MENU TOGGLE ========== */
.menu-toggle {
  display: none; width: 40px; height: 40px; border-radius: 20px; border: none;
  background: none; cursor: pointer; color: var(--md-on-surface-variant);
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s;
}
.menu-toggle:hover { background: var(--md-surface-container-high); }
.sidebar-backdrop {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4); z-index: 149;
}
.sidebar-backdrop.active { display: block; }

/* ========== RESPONSIVE — LARGE TABLET (<=1024px) ========== */
@media (max-width: 1024px) {
  .app-sidebar { width: 240px; }
  .grid-2, .grid-3, .grid-4, .card-grid-2, .card-grid { grid-template-columns: 1fr !important; }
  .form-row.col-3, .form-row.col-4 { grid-template-columns: 1fr 1fr !important; }
  .stepper { flex-wrap: wrap; gap: 8px; }
  .step-connector { min-width: 16px; }
  .profile-header { flex-wrap: wrap; }
  .profile-actions { width: 100%; justify-content: flex-start; }
}

/* ========== RESPONSIVE — TABLET (<=768px) ========== */
@media (max-width: 768px) {
  /* Top bar */
  .top-bar { padding: 0 8px; gap: 4px; }
  .top-bar .spacer { display: none; }
  .top-bar .logo-text span { display: none; }
  .search-bar { flex: 1; min-width: 0; }
  .menu-toggle { display: flex; }

  /* Sidebar becomes a slide-out drawer */
  .app-sidebar {
    position: fixed; top: 64px; left: -280px; width: 280px; height: calc(100vh - 64px);
    z-index: 150; transition: left .25s ease; box-shadow: none;
  }
  .app-sidebar.open { left: 0; box-shadow: var(--md-elevation-3); }
  .app-layout { display: block; }

  /* Content */
  .app-body, .main-content { padding: 16px; }
  .page-header h1 { font-size: 20px; }

  /* Stats */
  .stats-row, .stats-grid { grid-template-columns: 1fr 1fr !important; }
  .stat-card .stat-value, .stat-number { font-size: 24px; }

  /* Grids */
  .grid-2, .grid-3, .grid-4, .card-grid-2, .card-grid { grid-template-columns: 1fr !important; }
  .form-grid-2 { grid-template-columns: 1fr !important; }

  /* Forms */
  .form-row, .form-row.col-2, .form-row.col-3, .form-row.col-4 { grid-template-columns: 1fr !important; }

  /* Tables — horizontal scroll */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }

  /* Tabs */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { padding: 10px 16px; font-size: 13px; flex-shrink: 0; }

  /* Stepper */
  .stepper { flex-direction: column; align-items: flex-start; gap: 4px; padding: 0; }
  .step-connector { width: 2px; height: 16px; min-width: 2px; margin: 0 0 0 15px; }

  /* Toolbar */
  .toolbar { gap: 8px; }
  .toolbar .btn { font-size: 13px; padding: 0 16px; height: 36px; }

  /* Profile */
  .profile-header { flex-direction: column; text-align: center; }
  .profile-info .profile-meta { justify-content: center; }
  .profile-actions { justify-content: center; }

  /* Modal */
  .modal { width: 95%; max-width: none; margin: 16px; }
  .modal-header { padding: 16px 16px 8px; }
  .modal-body { padding: 8px 16px 16px; }
  .modal-footer { padding: 8px 16px 16px; }

  /* App grid overlay */
  .app-grid-panel { width: calc(100vw - 32px); right: 16px; left: 16px; }

  /* Timeline */
  .timeline-item { gap: 10px; }

  /* Pagination */
  .table-pagination { flex-wrap: wrap; gap: 8px; justify-content: center; }
  .pagination { flex-wrap: wrap; }

  /* Filter bar */
  .filter-bar, .filter-row { gap: 6px; }
  .filter-chip { padding: 4px 12px; font-size: 12px; }
}

/* ========== RESPONSIVE — MOBILE (<=480px) ========== */
@media (max-width: 480px) {
  /* Top bar — compact for small phones */
  .top-bar .logo-text { display: none; }
  .top-bar .logo-icon { width: 32px; height: 32px; font-size: 14px; border-radius: 6px; }
  .top-bar .icon-btn[title="Help"] { display: none; }
  .search-bar { height: 36px; padding: 0 10px; }
  .search-bar input { font-size: 13px; }
  .icon-btn { width: 34px; height: 34px; }
  .menu-toggle { width: 34px; height: 34px; }

  /* Hide search filter icon on small screens */
  .search-bar .material-symbols-outlined:last-child { display: none; }

  /* Content */
  .app-body, .main-content { padding: 12px; }
  .page-header { gap: 8px; }
  .page-header h1 { font-size: 18px; }
  .subtitle { font-size: 13px; margin-bottom: 16px; }

  /* Stats — single column */
  .stats-row, .stats-grid { grid-template-columns: 1fr !important; }
  .stat-card { padding: 16px; }
  .stat-card .stat-value, .stat-number { font-size: 28px; }

  /* Buttons */
  .btn { height: 36px; padding: 0 16px; font-size: 13px; }
  .btn.lg { height: 40px; padding: 0 20px; }
  .header-actions { flex-wrap: wrap; }

  /* Cards */
  .card-header { padding: 12px 16px; }
  .card-body { padding: 16px; }

  /* Chips */
  .quick-action-chip { padding: 8px 16px; font-size: 12px; }

  /* Empty state */
  .empty-state { padding: 32px 16px; }
  .empty-state .material-symbols-outlined { font-size: 40px; }

  /* Section spacing */
  .section { margin-bottom: 24px; }
  .form-section { margin-bottom: 24px; }
}
