* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--surface-page);
  font-family: var(--font-body);
  color: var(--text-primary);
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }

.layout { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: 232px;
  flex: none;
  background: var(--dark-gray);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  overflow: hidden;
  transition: width 0.18s ease, padding 0.18s ease;
}
body.sidebar-collapsed .sidebar { width: 0; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar > * { opacity: 0; }
.sidebar-header {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-header-main { min-width: 0; }
.sidebar-header img { height: 26px; width: auto; display: block; }
.sidebar-collapse-btn {
  flex: none; background: none; border: 1px solid rgba(255,255,255,0.2); border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7); font-size: 14px; line-height: 1; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.sidebar-collapse-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }
.sidebar-expand-btn {
  display: none; position: fixed; top: 20px; left: 12px; z-index: 20;
  width: 30px; height: 30px; border-radius: var(--radius-sm); border: 1px solid var(--light-gray);
  background: #fff; color: var(--text-secondary); font-size: 14px; line-height: 1;
  align-items: center; justify-content: center; cursor: pointer;
}
.sidebar-expand-btn:hover { color: var(--text-primary); }
body.sidebar-collapsed .sidebar-expand-btn { display: flex; }
.sidebar-header .subtitle {
  margin-top: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  color: rgba(255,255,255,0.85);
}
.sidebar-nav { padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: block;
  text-align: left;
  text-decoration: none;
  border: none;
  cursor: pointer;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  background: transparent;
  color: rgba(255,255,255,0.72);
}
.sidebar-nav a:hover { color: #fff; }
.sidebar-nav a.active { background: var(--eduthing-blue); color: #fff; }
.sidebar-nav .section-label {
  padding: 9px 14px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.32);
}
.sidebar-nav .section-sub {
  padding: 9px 14px; margin-top: -4px; font-size: 10.5px; color: rgba(255,255,255,0.22);
}
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 14px 12px; }

.sidebar-footer {
  margin-top: auto; padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.12);
  display: flex; flex-direction: column; gap: 12px; overflow: hidden;
}
.user-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--eduthing-blue);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; flex: none;
  overflow: hidden;
}
.sidebar-footer .user-id { min-width: 0; flex: 1; }
.sidebar-footer .name {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.footer-actions { display: flex; align-items: center; justify-content: space-between; }
.settings-link {
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex: none;
}
.settings-link img { width: 13px; height: 13px; filter: invert(1); opacity: 0.55; }
.settings-link:hover { background: rgba(255,255,255,0.1); }
.settings-link:hover img { opacity: 1; }
.settings-link.active { background: var(--eduthing-blue); }
.settings-link.active img { opacity: 1; }
.sign-out-btn {
  flex: none; background: none; border: 1px solid rgba(255,255,255,0.2); border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.7); font-family: var(--font-body); font-size: 11px; padding: 5px 8px; cursor: pointer;
}
.sign-out-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

/* Main */
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 36px; border-bottom: 1px solid var(--light-gray); background: #fff;
}
.topbar .title { font-family: var(--font-display); font-weight: 900; font-size: 22px; color: var(--text-primary); }
.topbar .date { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.content { flex: 1; padding: 28px 36px 48px; overflow-y: auto; }
.screen { display: none; }
.screen.active { display: block; }

.eyebrow {
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary);
  margin-bottom: 8px;
}

.panel {
  background: #fff; border: 1px solid var(--light-gray); border-radius: var(--radius-sm);
}
.panel-padded { padding: 18px 20px; }

/* Settings */
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 16px 20px; border-bottom: 1px solid var(--light-gray);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-label { font-size: 13.5px; font-weight: 700; color: var(--text-primary); }
.settings-row-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.settings-note { font-size: 12px; color: var(--text-secondary); margin-top: 10px; }
.switch {
  position: relative; flex: none; width: 40px; height: 22px; border: none; border-radius: var(--radius-pill);
  background: var(--gray); cursor: pointer; padding: 0; transition: background 0.15s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--elevation-sm); transition: transform 0.15s ease;
}
.switch[aria-checked="true"] { background: var(--eduthing-blue); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* Alert log — read as a dispatch log, not a notification feed */
.mono { font-family: var(--font-mono); }
.alert-log { background: #fff; }
.alert-row {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center;
  gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--light-gray);
}
.alert-row:last-child { border-bottom: none; }
.alert-time { font-size: 11px; color: var(--text-secondary); }
.alert-headline { font-size: 13.5px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.alert-headline .alert-module { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-secondary); }
.alert-sub { font-size: 12px; color: var(--text-secondary); line-height: 1.3; }
.chip {
  font-weight: 700; font-size: 10.5px; letter-spacing: 0.03em;
  text-transform: uppercase; color: #fff; padding: 3px 9px; border-radius: 2px; white-space: nowrap;
}

/* Overview grid */
.overview-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.overview-customers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.panel-title { font-family: var(--font-display); font-weight: 800; font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-primary); }
.panel-header { display: flex; align-items: center; justify-content: space-between; }

.stage-row { display: flex; align-items: center; gap: 10px; }
.stage-label { width: 100px; flex: none; font-size: 11.5px; color: var(--text-secondary); }
.stage-track { flex: 1; height: 8px; background: var(--light-gray); border-radius: 4px; overflow: hidden; }
.stage-bar { height: 100%; border-radius: 5px; }
.stage-count { width: 16px; flex: none; font-size: 12px; font-weight: 700; color: var(--text-primary); text-align: right; }

.deadline-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-primary); padding: 3px 0; }

.status-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-primary); padding: 3px 0; }
.status-dot { width: 8px; height: 8px; flex: none; border-radius: 2px; display: inline-block; }

.engineer-cover-panel { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; }
.coverage-pct { font-family: var(--font-display); font-weight: 900; font-size: 26px; color: var(--text-primary); line-height: 1; }
.patch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; max-width: 340px; }
.patch-cell { height: 18px; border-radius: 3px; }
.legend { display: flex; gap: 14px; font-size: 10.5px; color: var(--text-secondary); margin-top: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }

/* Tables */
.table-toolbar { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.field label { display: block; font-size: 11.5px; color: var(--text-secondary); margin-bottom: 4px; }
.field input, .field select {
  height: 36px; padding: 0 10px; border: 1px solid var(--gray); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 13px; width: 260px; background: #fff;
}
.toolbar-note { font-size: 11.5px; color: var(--text-secondary); padding-bottom: 11px; }

.table-head, .table-row {
  display: grid; column-gap: 14px; padding: 13px 20px; align-items: center; font-size: 13px;
}
.table-head {
  padding: 12px 20px; background: var(--surface-muted); font-family: var(--font-display);
  font-weight: 700; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary);
}
.table-head-sort {
  display: flex; align-items: center; gap: 5px; cursor: pointer; user-select: none;
}
.table-head-sort:hover { color: var(--text-primary); }
.table-head-sort.active { color: var(--eduthing-blue); }
.table-head-sort .sort-arrow { font-size: 9px; width: 8px; flex: none; }
.table-row { border-top: 1px solid var(--light-gray); color: var(--text-primary); }
.table-empty { padding: 28px 20px; text-align: center; font-size: 13px; color: var(--text-secondary); }

.cols-schools { grid-template-columns: 1.9fr 1.1fr 0.8fr 1.2fr 1.2fr 1fr 1.1fr; }
.cols-fleet { grid-template-columns: 1fr 1.5fr 1.5fr 1.2fr 1.3fr 1.3fr 1.1fr 1.2fr; }
.cols-employees { grid-template-columns: 1.8fr 1fr 1fr 0.8fr 1fr; }
.cols-tenders { grid-template-columns: 1.8fr 0.8fr 1.4fr 1fr 1.2fr; }

.pill {
  display: inline-block; color: #fff; font-family: var(--font-display); font-weight: 700;
  font-size: 10.5px; letter-spacing: 0.02em; padding: 3px 9px; border-radius: var(--radius-pill);
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--light-gray); border-radius: var(--radius-md); padding: 18px 20px; }
.stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-family: var(--font-display); font-weight: 900; font-size: 26px; color: var(--text-primary); }

/* Engineer cover screen */
.notice-bar {
  background: var(--light-gray); border-radius: var(--radius-sm); padding: 10px 16px;
  font-size: 12.5px; color: var(--cool-gray); margin-bottom: 18px;
}
.engineers-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.map-panel { border-radius: var(--radius-md); box-shadow: var(--elevation-sm); overflow: hidden; }
.map-panel-header { padding: 14px 20px; border-bottom: 1px solid var(--light-gray); display: flex; flex-direction: column; gap: 8px; }
.map-panel-title { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--text-primary); white-space: nowrap; }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--text-secondary); }
.map-legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.map-frame { width: 100%; height: 520px; border: none; display: block; }

.side-panel { background: #fff; border: 1px solid var(--light-gray); border-radius: var(--radius-md); box-shadow: var(--elevation-sm); padding: 20px; }
.side-panel-title { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--text-primary); margin-bottom: 14px; }
.patch-row { display: grid; grid-template-columns: 1.3fr 0.7fr 0.7fr 0.6fr; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--light-gray); }
.patch-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.shift-pill { justify-self: start; font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; padding: 3px 8px; border-radius: var(--radius-pill); color: #fff; }
.patch-count { font-size: 12px; color: var(--text-secondary); text-align: right; }

/* Clickable table rows */
a.school-row-link, a.employee-row-link, a.vehicle-row-link, a.tender-row-link { text-decoration: none; color: inherit; transition: background 0.1s; }
a.school-row-link:hover, a.employee-row-link:hover, a.vehicle-row-link:hover, a.tender-row-link:hover { background: var(--surface-muted); color: inherit; }

/* Buttons and forms (tenders) */
.btn-primary {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border: none;
  border-radius: var(--radius-sm); background: var(--indigo); color: #fff; font-family: var(--font-body);
  font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: none; align-self: flex-end;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.form-field input, .form-field select { width: 100%; }
.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.form-error { font-size: 12.5px; color: var(--crimson); }

textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--gray); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 13px; resize: vertical; box-sizing: border-box;
}

/* Config / dropdown options admin */
.dropdown-option-list { display: flex; flex-direction: column; gap: 6px; }
.dropdown-option-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.dropdown-option-order { display: flex; gap: 2px; }
.dropdown-option-row input[type="text"] {
  height: 34px; padding: 0 10px; border: 1px solid var(--gray); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 13px; width: 100%; box-sizing: border-box; background: #fff;
}
.dropdown-option-add { display: flex; gap: 10px; margin-top: 12px; }
.dropdown-option-add input[type="text"] {
  height: 36px; padding: 0 10px; border: 1px solid var(--gray); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 13px; flex: 1; box-sizing: border-box; background: #fff;
}
.icon-btn {
  width: 26px; height: 26px; border: 1px solid var(--light-gray); border-radius: var(--radius-sm);
  background: #fff; color: var(--text-secondary); font-size: 10px; cursor: pointer; line-height: 1;
}
.icon-btn:hover { background: var(--surface-muted); color: var(--text-primary); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn:disabled:hover { background: #fff; color: var(--text-secondary); }
.icon-btn-danger { color: var(--crimson); border-color: var(--crimson); }
.icon-btn-danger:hover { background: var(--crimson); color: #fff; }

/* Tenders: Active / Completed tabs */
.tender-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--light-gray); }
.tender-tab {
  border: none; background: none; padding: 10px 4px; margin-right: 20px; cursor: pointer;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tender-tab:hover { color: var(--text-primary); }
.tender-tab.active { color: var(--indigo); border-bottom-color: var(--indigo); }

/* School detail page */
.detail-back {
  font-size: 13px; color: var(--text-secondary); text-decoration: none;
  display: inline-block; margin-bottom: 8px;
}
.detail-back:hover { color: var(--eduthing-blue); }
.detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 20px; flex-wrap: wrap;
}
.detail-header-left { min-width: 0; }
.detail-title {
  font-family: var(--font-display); font-weight: 900; font-size: 26px;
  color: var(--text-primary); line-height: 1.2;
}
.detail-code { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }
.detail-header-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 4px; }

.detail-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px;
}
.detail-card {
  background: #fff; border: 1px solid var(--light-gray); border-radius: var(--radius-md);
  padding: 18px 20px;
}
.detail-card-label {
  font-size: 11px; color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 6px;
}
.detail-card-value {
  font-family: var(--font-display); font-weight: 800; font-size: 16px;
  color: var(--text-primary); line-height: 1.3;
}

.detail-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.detail-rows { display: flex; flex-direction: column; }
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--light-gray);
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { font-size: 13px; color: var(--text-secondary); }
.detail-row-value { font-size: 13px; font-weight: 600; color: var(--text-primary); text-align: right; }

.state-message { padding: 28px 20px; text-align: center; font-size: 13px; color: var(--text-secondary); }
.state-message.error { color: var(--crimson); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--gray); border-radius: 4px; }

/* Section sub-nav (e.g. Employees: Directory / Who's Out) */
.section-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--light-gray); }
.section-tab {
  border: none; background: none; padding: 10px 4px; margin-right: 20px; cursor: pointer;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none;
}
.section-tab:hover { color: var(--text-primary); }
.section-tab.active { color: var(--indigo); border-bottom-color: var(--indigo); }

/* Who's Out leave grid */
.leave-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.leave-toolbar-left { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.leave-date-nav { display: flex; align-items: center; gap: 12px; }
.leave-date-nav-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--gray); background: #fff;
  color: var(--azure-blue); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.leave-date-nav-btn:hover { background: var(--surface-muted); }
.leave-date-range { font-family: var(--font-display); font-weight: 800; font-size: 15px; color: var(--text-primary); }
.leave-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-secondary); flex-wrap: wrap; }
.leave-legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }

.leave-grid { background: #fff; border: 1px solid var(--light-gray); border-radius: var(--radius-sm); overflow-x: auto; }
.leave-grid-row { display: grid; align-items: center; column-gap: 2px; padding: 8px 20px; border-top: 1px solid var(--light-gray); min-width: 760px; }
.leave-grid-row:first-child { border-top: none; }
.leave-grid-header { background: var(--surface-muted); padding: 10px 20px; }
.leave-grid-person { display: flex; align-items: center; gap: 10px; min-width: 0; padding-right: 12px; }
.leave-grid-person .avatar { width: 30px; height: 30px; font-size: 12px; }
.leave-grid-person-text { min-width: 0; }
.leave-grid-person-name { font-size: 13px; font-weight: 700; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leave-grid-person-dept { font-size: 11px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leave-day-header { text-align: center; font-size: 10px; color: var(--text-secondary); line-height: 1.5; }
.leave-day-header .dow { display: block; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.leave-day-header .dom { display: block; font-family: var(--font-display); font-weight: 800; font-size: 12.5px; color: var(--text-primary); }
.leave-day-header.weekend { background: var(--surface-muted); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.leave-day-header.today .dom { color: #fff; background: var(--azure-blue); border-radius: 50%; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; }
.leave-day-cell { height: 26px; display: flex; align-items: center; justify-content: center; }
.leave-day-cell.weekend { background: var(--surface-muted); }
.leave-day-mark { width: 100%; height: 18px; border-radius: 3px; }
.leave-grid-empty { padding: 28px 20px; text-align: center; font-size: 13px; color: var(--text-secondary); }
