:root {
  --bg: #061015;
  --surface: rgba(10, 18, 24, 0.88);
  --surface-strong: rgba(12, 22, 29, 0.96);
  --surface-soft: rgba(14, 28, 38, 0.72);
  --line: rgba(173, 196, 214, 0.16);
  --line-strong: rgba(173, 196, 214, 0.28);
  --text: #edf3f7;
  --muted: #93a7b6;
  --accent: #ff8b36;
  --teal: #66d9c2;
  --warn: #f1b84b;
  --danger: #ff6262;
  --success: #58cf81;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Aptos, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(255, 139, 54, 0.15), transparent 24%),
    radial-gradient(circle at left 18% top 20%, rgba(102, 217, 194, 0.12), transparent 24%),
    linear-gradient(180deg, #071116 0%, #04090c 100%);
}

body::before {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(255, 255, 255, 0.6), transparent 88%);
}

h1,
h2,
h3,
strong,
button,
select {
  font-family: Bahnschrift, "Segoe UI Semibold", sans-serif;
}

p,
button,
input,
select,
textarea,
table {
  font: inherit;
}

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

button,
input,
select,
textarea {
  border: 0;
  outline: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 2rem 1.5rem;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 22%),
    rgba(4, 10, 14, 0.72);
  backdrop-filter: blur(18px);
  z-index: 30;
}

.sidebar h1,
.topbar h2,
.hero-strip h3,
.panel h3 {
  margin: 0;
  line-height: 1.05;
}

.sidebar h1 {
  margin-top: 0.45rem;
  font-size: clamp(2rem, 4vw, 2.9rem);
  letter-spacing: -0.04em;
}

.sidebar-copy,
.panel-copy,
.hero-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-groups {
  display: grid;
  gap: 0.45rem;
  margin: 2.25rem 0;
}

.nav-button {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  color: #d8e4ec;
  text-align: left;
  background: transparent;
  transition: background-color 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.nav-button:hover,
.nav-button:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(4px);
}

.nav-button.is-active {
  border-color: rgba(255, 139, 54, 0.3);
  background: rgba(255, 139, 54, 0.12);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.dashboard-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.85fr);
  gap: 1rem;
}

.dashboard-core-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  gap: 1rem;
  margin-top: 1rem;
}

.dashboard-core-single {
  grid-template-columns: 1fr;
}

.dashboard-extra-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.dashboard-left-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.de-section {
  border: 1px solid var(--border);
  border-radius: .75rem;
  overflow: hidden;
}

.de-section-title {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .6rem 1rem;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
  margin: 0;
  color: var(--accent);
}

.de-field-grid {
  display: flex;
  flex-direction: column;
}

.de-field-row {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(160px, 0.5fr);
  align-items: center;
  gap: 1rem;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--border);
}

.de-field-row:last-child {
  border-bottom: none;
}

.de-label {
  font-size: .88rem;
  color: var(--text-muted);
}

.de-input {
  padding: .4rem .65rem;
  border-radius: .4rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  font-size: .9rem;
  width: 100%;
  max-width: 180px;
}

.executive-panel,
.side-intelligence-panel {
  min-height: 100%;
}

.mis-summary-board {
  margin-top: 0.5rem;
}

.mis-summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.mis-summary-cell {
  padding: 0.95rem 1rem;
  border-right: 1px solid var(--line);
}

.mis-summary-cell:last-child {
  border-right: 0;
}

.mis-summary-cell span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mis-summary-cell strong {
  display: block;
  margin-top: 0.4rem;
  font-size: 1.45rem;
}

.summary-filter-cell {
  cursor: pointer;
  transition: background 140ms ease;
}

.summary-filter-cell:hover {
  background: rgba(255, 139, 54, 0.07);
}

.summary-select {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0;
  background: transparent !important;
  color: var(--text) !important;
  border: 0;
  outline: 0;
  font-family: Bahnschrift, "Segoe UI Semibold", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.summary-select option {
  background: #0c161d;
  color: var(--text);
}

.executive-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.summary-button,
.kpi-card-button,
.table-link-button {
  border: 0;
}

.summary-button {
  text-align: left;
  color: #0f1a21;
  background: rgba(248, 248, 248, 0.98);
}

.summary-button span {
  color: #7b92a6;
}

.summary-button strong {
  color: #0f1a21;
}

.summary-button:hover,
.summary-button:focus-visible,
.kpi-card-button:hover,
.kpi-card-button:focus-visible,
.table-link-button:hover,
.table-link-button:focus-visible {
  background: rgba(255, 255, 255, 0.06);
}

.kpi-card-button {
  width: 100%;
  text-align: left;
}

.notification-mini {
  min-width: 72px;
  text-align: right;
}

.notification-mini strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.5rem;
}

.widget-edit-button {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.widget-edit-button:hover,
.widget-edit-button:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.notification-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.notification-meta > div {
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.notification-meta strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.35rem;
}

.accident-table-wrap {
  border-radius: 18px;
}

.accident-table th,
.accident-table td {
  white-space: normal;
}

.accident-table td:nth-child(2),
.accident-table td:nth-child(3) {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.table-link-button {
  padding: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
}

.reports-grid {
  grid-template-columns: 1fr;
}

.reports-grid .panel-wide {
  width: 100%;
}

.data-update-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.update-status {
  margin-top: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.54);
}

.settings-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(1100px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 1.2rem;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: rgba(7, 14, 18, 0.97);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.44);
}

.settings-head,
.settings-actions {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.settings-actions {
  align-items: center;
  margin-top: 1rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.settings-section {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.settings-section h4 {
  margin: 0 0 0.9rem;
}

.settings-toggle,
.settings-field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
  color: var(--muted);
}

.settings-toggle {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.settings-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.short-code-list {
  display: grid;
  gap: 0.7rem;
}

.short-code-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  gap: 0.75rem;
  align-items: center;
}

.toast {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 40;
  max-width: 320px;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--text);
  background: rgba(7, 14, 18, 0.94);
  box-shadow: var(--shadow);
}

}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.status-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(88, 207, 129, 0.12);
}

.workspace {
  grid-column: 2;
  padding: 1.35rem 1.35rem 4rem;
}

.topbar {
  position: sticky;
  top: 0.8rem;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  padding: 1.25rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(7, 14, 18, 0.84);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
}

/* Hide mobile-only elements on desktop */
.mobile-filter-btn { display: none; }
.sidebar-utility-row { display: none; }

.topbar h2 {
  margin-top: 0.3rem;
  font-size: clamp(1.35rem, 3vw, 2.25rem);
  letter-spacing: -0.04em;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.9rem;
}

.notify-bell {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.notify-bell:hover,
.notify-bell:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.notify-bell-icon {
  width: 22px;
  height: 22px;
}

.notify-bell-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notify-badge {
  position: absolute;
  top: -4px;
  right: -2px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #101214;
  font-size: 0.72rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff9f5f, #ffc588);
}

.notify-overlay {
  position: absolute;
  top: calc(100% - 10px);
  right: 1.2rem;
  z-index: 30;
  width: min(430px, calc(100vw - 2rem));
  padding: 1rem;
  border: 1px solid rgba(255, 139, 54, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(8, 14, 18, 0.96);
  backdrop-filter: blur(18px);
  box-shadow: 0 34px 84px rgba(0, 0, 0, 0.42);
}

.notify-overlay-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.notify-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.notify-close:hover,
.notify-close:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.toolbar label,
.incident-form label,
.search-box {
  display: grid;
  gap: 0.35rem;
  min-width: 150px;
}

.toolbar span,
.incident-form span,
.search-box span {
  color: var(--muted);
  font-size: 0.82rem;
}

select,
input,
textarea {
  width: 100%;
  padding: 0.88rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button {
  padding: 0.95rem 1.15rem;
  border-radius: 999px;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.primary-button {
  color: #101214;
  background: linear-gradient(135deg, #ff9f5f, #ffc588);
}

.secondary-button {
  color: var(--text);
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.hero-strip,
.panel,
.kpi-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  backdrop-filter: blur(12px);
}

.hero-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.55rem;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    linear-gradient(130deg, rgba(255, 139, 54, 0.18), rgba(255, 255, 255, 0.02) 46%, rgba(102, 217, 194, 0.12)),
    rgba(8, 16, 21, 0.92);
}

.hero-strip h3 {
  margin-top: 0.45rem;
  margin-bottom: 0.55rem;
  font-size: clamp(1.75rem, 4vw, 3.1rem);
  letter-spacing: -0.05em;
  max-width: 14ch;
}

.hero-badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(118px, 1fr));
  gap: 0.8rem;
  min-width: min(100%, 420px);
}

.hero-badges > div,
.kpi-card,
.stack-item,
.mobile-card,
.permit-column,
.contractor-card {
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
}

.hero-badges > div {
  padding: 1rem 1.1rem;
}

.badge-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.hero-badges strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.7rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.2rem;
}

.kpi-card {
  padding: 1.4rem 1.2rem;
}

.kpi-label {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.kpi-value {
  margin: 0;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  letter-spacing: -0.03em;
  font-weight: 700;
  overflow-wrap: break-word;
  word-break: break-all;
}

.kpi-note {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(280px, 0.95fr);
  gap: 1rem;
  margin-top: 1rem;
}

.workspace-grid > .panel-wide {
  min-width: 0;
}

.workspace-grid:has(.panel:nth-child(3)) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  padding: 1.25rem;
  border-radius: var(--radius-xl);
}

.panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel h3 {
  margin-top: 0.32rem;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 18px;
}

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

thead {
  background: rgba(255, 255, 255, 0.04);
}

th,
td {
  padding: 0.95rem 0.9rem;
  border-bottom: 1px solid rgba(173, 196, 214, 0.1);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.alert-list,
.stack-list,
.timeline-list {
  display: grid;
  gap: 0.75rem;
}

.alert-item,
.stack-item,
.timeline-item {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.alert-item {
  border-left: 4px solid var(--danger);
}

.alert-item.medium {
  border-left-color: var(--warn);
}

.alert-item.low {
  border-left-color: var(--teal);
}

.mini-label {
  display: inline-block;
  padding: 0.28rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mini-label.high {
  color: #ffd9d9;
  background: rgba(255, 98, 98, 0.18);
}

.mini-label.medium {
  color: #ffe8bf;
  background: rgba(241, 184, 75, 0.18);
}

.mini-label.low {
  color: #c9fff2;
  background: rgba(102, 217, 194, 0.18);
}

.risk-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.62rem;
  border-radius: 999px;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.risk-pill.high,
.status-pill.blocked,
.status-pill.expired,
.status-pill.blacklisted,
.status-pill.open {
  color: #ffd7d7;
  background: rgba(255, 98, 98, 0.18);
}

.risk-pill.medium,
.status-pill.pending,
.status-pill.flagged,
.status-pill.in-progress,
.status-pill.nearing-expiry {
  color: #ffe5b6;
  background: rgba(241, 184, 75, 0.18);
}

.risk-pill.low,
.status-pill.active,
.status-pill.completed,
.status-pill.approved,
.status-pill.closed,
.status-pill.ready,
.status-pill.execution,
.status-pill.request,
.status-pill.approval,
.status-pill.closure {
  color: #d6fff3;
  background: rgba(88, 207, 129, 0.16);
}

.contractor-grid,
.mobile-cards,
.permit-board {
  display: grid;
  gap: 0.9rem;
}

.contractor-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.contractor-card {
  padding: 1rem;
  border: 1px solid var(--line);
}

.contractor-card h4,
.mobile-card h4,
.permit-column h4 {
  margin: 0;
  font-size: 1.02rem;
}

.contractor-card p,
.mobile-card p,
.permit-item p,
.timeline-item p,
.stack-item p,
.alert-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.contractor-metrics,
.card-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.metric-chip {
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.metric-chip span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.metric-chip strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.2rem;
}

.permit-board {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.permit-column {
  padding: 1rem;
  border: 1px solid var(--line);
}

.permit-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.permit-item {
  padding: 0.9rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(173, 196, 214, 0.1);
}

.permit-item .permit-meta,
.timeline-meta,
.stack-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.heatmap {
  display: grid;
  gap: 0.45rem;
}

.heatmap-row {
  display: grid;
  grid-template-columns: minmax(108px, 1fr) repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: center;
}

.heatmap-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.heatmap-cell {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  font-size: 0.78rem;
}

.heatmap-cell.high {
  background: rgba(255, 98, 98, 0.22);
}

.heatmap-cell.medium {
  background: rgba(241, 184, 75, 0.22);
}

.heatmap-cell.low {
  background: rgba(88, 207, 129, 0.22);
}

.heatmap-cell.score-red {
  background: rgba(224, 82, 82, 0.38);
  color: #ffb3b3;
  font-weight: 600;
}

.heatmap-cell.score-orange {
  background: rgba(232, 164, 34, 0.32);
  color: #ffe0a0;
  font-weight: 600;
}

.heatmap-cell.score-green {
  background: rgba(76, 175, 125, 0.32);
  color: #b3f0d4;
  font-weight: 600;
}

/* CEO-friendly site comparison table */
#mainSiteTable .ceo-thead th {
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .45rem .6rem;
  white-space: nowrap;
}
.ceo-row td { padding: .38rem .6rem; vertical-align: middle; }
.ceo-project-name {
  font-weight: 600;
  text-align: left;
}
.ceo-num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ceo-rate {
  min-width: 80px;
  text-align: right;
}
.ceo-bar {
  height: 3px;
  background: rgba(255,255,255,.08);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}
.ceo-bar div {
  height: 100%;
  border-radius: 2px;
  transition: width .3s;
}

.timeline-item {
  border-left: 3px solid var(--teal);
}

.mobile-cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.mobile-card {
  padding: 1rem;
  border: 1px solid var(--line);
}

.mobile-card strong {
  display: block;
  margin-top: 0.6rem;
  font-size: 1.85rem;
}

.incident-form {
  display: grid;
  gap: 0.85rem;
}

#trendChart {
  width: 100%;
  min-height: 300px;
}

.chart-line {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-dasharray: 4 8;
}

.chart-axis,
.chart-text {
  fill: var(--muted);
  font-size: 12px;
}

.chart-dot {
  stroke: var(--surface-strong);
  stroke-width: 4;
}

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

.empty-state {
  padding: 1rem;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 1320px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .executive-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .data-update-grid,
  .dashboard-hero-grid,
  .dashboard-core-grid,
  .dashboard-main-grid,
  .dashboard-extra-grid,
  .workspace-grid,
  .workspace-grid:has(.panel:nth-child(3)) {
    grid-template-columns: 1fr;
  }

  .permit-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    overflow-y: visible;
    min-height: auto;
    padding: 1rem 1rem 1.15rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar h1 {
    font-size: clamp(1.8rem, 8vw, 3rem);
  }

  .nav-groups {
    display: flex;
    gap: 0.65rem;
    margin: 1.15rem -0.15rem 0;
    padding: 0 0.15rem 0.3rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .nav-groups::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    padding: 0.78rem 1rem;
  }

  .sidebar-status {
    margin-top: 0.6rem;
  }

  .workspace {
    grid-column: auto;
    padding: 1rem 1rem 3rem;
  }

  .topbar,
  .hero-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .toolbar,
  .hero-badges {
    width: 100%;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar label {
    min-width: calc(50% - 0.45rem);
  }

  .topbar .primary-button,
  .topbar .secondary-button {
    min-width: calc(50% - 0.45rem);
  }

  .panel-head {
    align-items: start;
    flex-wrap: wrap;
  }

  .panel-copy {
    flex: 1 0 100%;
  }

  .notify-bell {
    width: 52px;
    height: 52px;
  }

  .notify-overlay {
    right: 0.8rem;
    left: 0.8rem;
    top: auto;
    bottom: 1rem;
    width: auto;
  }
}

@media (max-width: 720px) {
  .sidebar {
    padding: calc(0.9rem + env(safe-area-inset-top, 0px)) 0.85rem 1rem;
  }

  .workspace {
    padding: 0.85rem 0.85rem calc(3rem + env(safe-area-inset-bottom, 0px));
  }

  .topbar,
  .hero-strip,
  .panel {
    border-radius: 22px;
  }

  .toolbar {
    justify-content: stretch;
  }

  .toolbar label,
  .search-box {
    min-width: 100%;
  }

  .topbar .primary-button,
  .topbar .secondary-button {
    width: 100%;
    min-width: 100%;
  }

  .topbar-actions {
    gap: 0.7rem;
  }

  .topbar h2 {
    font-size: clamp(1.2rem, 8vw, 2rem);
  }

  .sidebar-copy {
    max-width: 34ch;
  }

  .panel {
    padding: 1rem;
  }

  .panel h3 {
    font-size: 1.15rem;
  }

  .kpi-card,
  .mis-summary-cell {
    padding: 0.95rem 0.9rem;
  }

  .kpi-value {
    font-size: clamp(1.75rem, 9vw, 2.2rem);
  }

  .hero-badges,
  .kpi-grid,
  .executive-kpi-grid,
  .permit-board,
  .contractor-grid,
  .mobile-cards {
    grid-template-columns: 1fr;
  }

  .mis-summary-row,
  .notification-meta,
  .data-update-grid,
  .settings-grid,
  .short-code-item {
    grid-template-columns: 1fr;
  }

  .notify-overlay {
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.7rem;
    padding: 0.85rem;
    border-radius: 18px;
  }

  .notify-overlay-head {
    gap: 0.7rem;
  }

  .heatmap {
    min-width: 440px;
  }

  #heatmapPanel {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .heatmap-row {
    grid-template-columns: 1fr repeat(3, minmax(0, 1fr));
  }

  th,
  td {
    padding: 0.85rem 0.75rem;
  }

  .widget-edit-button,
  .notify-close {
    min-width: 40px;
    min-height: 40px;
  }
}

@media (max-width: 560px) {
  .sidebar h1 {
    max-width: 8ch;
  }

  .eyebrow {
    letter-spacing: 0.13em;
  }

  .toolbar {
    gap: 0.7rem;
  }

  .notify-bell {
    width: 48px;
    height: 48px;
  }

  .notify-bell-icon {
    width: 20px;
    height: 20px;
  }

  .notify-badge {
    min-width: 20px;
    height: 20px;
    font-size: 0.68rem;
  }

  #summaryProjects,
  .summary-select {
    font-size: 1.05rem;
  }

  .topbar {
    top: 0.4rem;
    padding: 1rem;
  }

  .table-wrap {
    border-radius: 16px;
  }
}

@media (max-width: 768px) {
  /* Sidebar: compact horizontal nav */
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; min-height: unset; padding: .6rem .75rem; }
  .sidebar > div:first-child h1 { font-size: 1.1rem; }
  .sidebar > div:first-child .eyebrow,
  .sidebar > div:first-child .sidebar-copy { display: none; }
  .nav-groups {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: .35rem;
    padding-bottom: .3rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    align-items: center;
  }
  .nav-groups::-webkit-scrollbar { display: none; }
  .nav-button { font-size: .72rem; padding: .35rem .6rem; white-space: nowrap; flex-shrink: 0; }

  /* Sidebar utility row: notification + settings on mobile only */
  .sidebar-utility-row {
    display: flex;
    gap: .4rem;
    margin-left: .25rem;
    flex-shrink: 0;
  }
  .sidebar-utility-row .notify-bell { width: 34px; height: 34px; }

  /* Topbar: hide topbar-actions icons on mobile (shown in sidebar) */
  .topbar { flex-direction: row; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: nowrap; padding: .6rem .75rem; }
  .topbar > div:first-child { flex: 1; min-width: 0; }
  .topbar > div:first-child .eyebrow { font-size: .65rem; }
  .topbar > div:first-child h2 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { gap: 0; }
  .topbar-actions .notify-bell { display: none; }

  /* Fix select dropdown white background on mobile */
  select {
    background-color: var(--surface-strong, #0c161d) !important;
    color: #fff !important;
    -webkit-appearance: none;
    appearance: none;
    border: 1px solid var(--border, #333) !important;
    border-radius: .4rem;
    padding: .4rem .6rem;
  }
  option { background: #0c161d; color: #fff; }

  /* Workspace */
  .workspace { padding: .4rem; }

  /* Heatmap: horizontal scroll, no wrapping */
  .heatmap-scroll-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .heatmap { min-width: 520px; }
  .heatmap-row { grid-template-columns: 70px repeat(6, 62px); }
  .heatmap-label { white-space: nowrap; font-size: .75rem; }
  .heatmap-cell { min-height: 36px; font-size: .75rem; }

  /* Grids */
  .dashboard-main-grid,
  .dashboard-extra-grid,
  .dashboard-hero-grid,
  .dashboard-core-grid,
  .workspace-grid { grid-template-columns: 1fr; }
  .dashboard-left-stack { gap: .75rem; }

  /* KPI grid: 2 columns */
  .executive-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { padding: .75rem; }
  .kpi-value { font-size: clamp(1.2rem, 6vw, 1.7rem); }

  /* Summary row: 2×2 grid on small screens */
  .mis-summary-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mis-summary-cell { padding: .5rem; }
  .summary-select { font-size: .95rem; border: 0 !important; border-radius: 0 !important; padding: 0 !important; background: transparent !important; }

  /* Data entry form */
  .de-field-row { grid-template-columns: 1fr auto; }
  .de-input { max-width: 110px; }

  /* Tables */
  table { font-size: .75rem; }
  th, td { padding: .35rem .4rem; }
}

@media print {
  body {
    background: white;
    color: black;
  }

  body::before,
  .sidebar,
  .toolbar,
  #incidentForm,
  .secondary-button,
  .primary-button {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .topbar,
  .hero-strip,
  .panel,
  .kpi-card {
    box-shadow: none;
    background: white;
    border-color: #d9d9d9;
    break-inside: avoid;
  }
}
