/* ServSync Desktop — consolidated styles.css */

:root {
  --ir-red: rgb(255, 0, 0);
  --serv-green: #00b050;
  --nav: #111111;
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #d9dee7;
  --muted: #5f6877;
  --shadow: 0 2px 9px rgba(0, 0, 0, 0.08);
  --header-h: 96px;
  --nav-h: 40px;
  --shell-top: 136px;
}

* { box-sizing: border-box; }

html, body {
  min-width: 1180px;
  width: 100%;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: #071426;
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
  font-weight: 500;
}

.brandbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-h);
  min-height: var(--header-h);
  max-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 24px;
  background: #fff;
  border-bottom: 5px solid var(--ir-red);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
}

#brandLogo,
.brand img {
  width: auto;
  height: 72px;
  max-width: 140px;
  max-height: 72px;
  object-fit: contain;
}

.brand h1 {
  margin: 0 0 4px;
  font-size: 39px;
  line-height: 1.05;
  font-weight: 900;
}

.brand p {
  margin: 0;
  font-size: 19.5px;
  line-height: 1.15;
  color: #354052;
}

.brandbarActions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  margin-left: auto;
}

.brandbarActions .productLogo {
  margin-left: 0;
  margin-right: 0;
}

.exitAppBtn {
  flex: 0 0 auto;
  min-width: 72px;
}

#exitConfirmModal {
  width: min(440px, 92vw);
}

#exitConfirmModal #exitConfirmForm {
  padding: 0;
  background: #fff;
}

#exitConfirmModal .modalHead {
  background: #111;
  color: #fff;
  margin: 0;
  padding: 18px 22px 14px;
  border-bottom: 4px solid var(--ir-red);
}

#exitConfirmModal .modalHead h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

#exitConfirmModal .modalHead .iconBtn {
  background: transparent;
  color: #fff;
  border: 0;
  font-size: 28px;
  line-height: 1;
  padding: 0 4px;
}

#exitConfirmModal .exitConfirmPrompt {
  margin: 0;
  padding: 24px 24px 12px;
  font-size: 16px;
  line-height: 1.5;
  color: #354052;
}

#exitConfirmModal .exitConfirmActions {
  justify-content: flex-end;
  padding: 0 24px 24px;
  margin: 0;
  gap: 10px;
}

#exitConfirmModal .exitConfirmActions button {
  min-width: 96px;
  justify-content: center;
}

.productLogo {
  flex: 0 0 auto;
  height: 72px;
  max-height: 72px;
  width: auto;
  max-width: 320px;
  object-fit: contain;
  object-position: right center;
  margin-right: 0;
}

.brandbar .productLogo {
  cursor: pointer;
}

.brandbar .productLogo:hover {
  opacity: 0.88;
}

.xlsxBannerStatus {
  flex: 0 1 auto;
  max-width: min(420px, 34vw);
  margin-left: 16px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: none;
}

.xlsxBannerStatus:not(:empty) {
  display: block;
}

.xlsxBannerStatus.isSaving {
  background: #eef5ff;
  border: 1px solid #7eb0e6;
  color: #1a4480;
}

.xlsxBannerStatus.isOk {
  background: #ecfdf3;
  border: 1px solid #6bc58a;
  color: #146834;
}

.xlsxBannerStatus.isError {
  background: #fff1f1;
  border: 1px solid #e08888;
  color: #8a1f1f;
}

/* ============================================================
   NAV
   ============================================================ */
.tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 999;
  height: var(--nav-h);
  min-height: var(--nav-h);
  max-height: var(--nav-h);
  background: linear-gradient(#151515, #0f0f0f);
  padding: 0 12px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tabGroup {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.tab {
  min-width: 0;
  height: 30px;
  border: 0;
  border-radius: 9px;
  padding: 0 10px;
  background: transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}

.tab.active {
  background: var(--ir-red);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--ir-red) 35%, transparent);
}

.roleBar {
  flex: 0 0 auto;
  width: 88px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: stretch;
}

.modePill,
.roleBar .modePill {
  background: #111;
  color: #fff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.roleBar button,
.roleBar .smallBtn {
  width: 100%;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  background: #fff;
  border: 1px solid #aeb6c3;
  color: #111;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.tab[data-tab="dashboard"]::before { content: "◔"; font-size: 16px; }
.tab[data-tab="tracker"]::before { content: "☷"; font-size: 16px; }
.tab[data-tab="actions"]::before { content: "☑"; font-size: 16px; }
.tab[data-tab="trips"]::before { content: "▣"; font-size: 14px; }
.tab[data-tab="admin"]::before { content: "⚙"; font-size: 15px; }

body:not(.admin) .tab[data-tab="admin"] { display: none !important; }

/* ============================================================
   MAIN SHELL
   ============================================================ */
main {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--shell-top);
  bottom: 0;
  overflow: hidden;
  padding: 8px;
  background: var(--bg);
}

.tabPage { display: none; }
.tabPage.active { display: block; }

.pageHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.compactPageHead {
  justify-content: space-between;
  margin-bottom: 10px;
}

.compactPageHead .pageHeadLeft,
.compactPageHead .pageActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.compactPageHead .pageActions {
  margin-left: auto;
}

.pageHead p,
.commentBox p { margin: 4px 0 0; color: var(--muted); }

h2 { margin: 0 0 10px; font-size: 24px; font-weight: 900; }

.pageActions,
.modalActions,
.adminButtonGrid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

button,
.fileBtn {
  border: 0;
  border-radius: 10px;
  padding: 10px 13px;
  background: var(--ir-red);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
}

button.secondary,
.fileBtn.secondary {
  background: #eceff3;
  color: #111;
  border: 1px solid var(--line);
}

button.danger { background: #111; color: #fff; }
.fileBtn input { display: none; }

.iconBtn {
  background: #fff;
  color: #111;
  font-size: 26px;
  padding: 2px 10px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

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

/* ============================================================
   DASHBOARD
   ============================================================ */
#dashboard.tabPage.active {
  position: absolute;
  inset: 8px;
  overflow: hidden;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 8px;
  margin: 0 0 8px;
  height: 58px;
  min-height: 58px;
  max-height: 58px;
}

.kpi-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  overflow: visible;
  min-width: 0;
}

.kpi-card > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.kpi-card .kpi-label {
  font-size: 17px;
  color: #111;
  font-weight: 900;
  line-height: 1.2;
  flex: 1 1 auto;
  min-width: 0;
}

.kpi-card .kpi-value {
  font-size: 18px;
  color: var(--ir-red);
  font-weight: 900;
  margin: 0;
  line-height: 1.2;
  flex: 0 0 auto;
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.kpi-card .kpi-pair {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.kpi-card .kpi-sep {
  color: #667085;
  font-weight: 800;
  padding: 0 1px;
}

.kpi-card::before {
  content: "";
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  background: no-repeat center / contain;
}

.kpi-card[data-kpi="open"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4 4 8l8 4 8-4-8-4zm-8 6 8 4 8-4M4 16l8 4 8-4' fill='none' stroke='%230070c0' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.kpi-card[data-kpi="high"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4 21 20H3L12 4z' fill='none' stroke='%23ff0018' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M12 10v5M12 17h.01' stroke='%23ff0018' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

.kpi-card[data-kpi="capa"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 5h12a2 2 0 0 1 2 2v2a2 2 0 0 0 0 4v2a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-2a2 2 0 0 0 0-4V7a2 2 0 0 1 2-2z' fill='none' stroke='%230070c0' stroke-width='2'/%3E%3C/svg%3E");
}

.kpi-card[data-kpi="idm"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 12s3.5-6 9-6 9 6 9 6-3.5 6-9 6-9-6-9-6z' fill='none' stroke='%23ea580c' stroke-width='2'/%3E%3Ccircle cx='12' cy='12' r='2.5' fill='none' stroke='%23ea580c' stroke-width='2'/%3E%3C/svg%3E");
}

.kpi-card[data-kpi="idm-priority"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%239333ea' d='M13 3 7 13h5l-1 8 8-12h-5l-1-6z'/%3E%3C/svg%3E");
}

.kpi-card[data-kpi="actions"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='6' width='12' height='14' rx='2' fill='none' stroke='%2300a651' stroke-width='2'/%3E%3Cpath d='M9 4h6v3H9z' fill='none' stroke='%2300a651' stroke-width='2'/%3E%3Cpath d='M9 13.5 11 15.5 15 11.5' fill='none' stroke='%2300a651' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.kpi-card.kpi-link {
  cursor: pointer;
}

.kpi-card.kpi-link:hover {
  background: #fafcff;
  border-color: #c5d4ef;
}

.kpi-card.kpi-link:focus-visible {
  outline: 2px solid var(--ir-red);
  outline-offset: 2px;
}


#dashboard .dashboard-grid {
  position: absolute;
  left: 0;
  right: 0;
  top: 66px;
  bottom: 0;
  display: grid;
  grid-template-columns: 65fr 35fr;
  grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "issues summary"
    "actions trips";
  gap: 10px;
  overflow: hidden;
}

#dashboard .dashboard-grid .panel {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

#dashboard .dashboard-grid .panel:nth-child(1) { grid-area: issues; }
#dashboard .dashboard-grid .panel:nth-child(2) { grid-area: actions; }
#dashboard .dashboard-grid .panel:nth-child(3) { grid-area: trips; }
#dashboard .dashboard-grid .panel:nth-child(4) {
  grid-area: summary;
  padding: 10px 12px 12px;
}

#dashboard .dashboard-grid .panel:nth-child(4) h2 {
  margin-bottom: 8px;
  padding-bottom: 8px;
}

.panelTitleRow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  flex: 0 0 auto;
  margin-bottom: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e6eaf0;
}

.panelTitleRow h2 {
  margin: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
}

#dashboard .dashboard-grid .panel h2 {
  flex: 0 0 auto;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e6eaf0;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 12px;
}

#dashboard .dashboard-grid .panel:nth-child(1) h2::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 3px solid #ff2638;
  color: #ff2638;
  border-radius: 50%;
  font-weight: 900;
  font-size: 15px;
  line-height: 1;
  background: none;
}

#dashboard .dashboard-grid .panel:nth-child(2) h2::before {
  content: "✓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 3px solid #00b050;
  color: #00b050;
  border-radius: 4px;
  font-weight: 900;
}

#dashboard .dashboard-grid .panel:nth-child(3) h2::before {
  content: "";
  display: inline-block;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ea580c' d='M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3A8.994 8.994 0 0 0 13 3.06V1h-2v2.06A8.994 8.994 0 0 0 3.06 11H1v2h2.06A8.994 8.994 0 0 0 11 20.94V23h2v-2.06A8.994 8.994 0 0 0 20.94 13H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z'/%3E%3C/svg%3E");
}

#dashboard .dashboard-grid .panel:nth-child(4) h2::before {
  content: "◔";
  color: #0069d9;
  font-size: 28px;
}

#dashboard .stack {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

#dashboard .stack::-webkit-scrollbar,
#dashboard .pieLegend::-webkit-scrollbar {
  width: 10px;
}

#dashboard .stack::-webkit-scrollbar-thumb,
#dashboard .pieLegend::-webkit-scrollbar-thumb {
  background: #c5ccd6;
  border-radius: 8px;
}

#dashboard .stack::-webkit-scrollbar-thumb:hover,
#dashboard .pieLegend::-webkit-scrollbar-thumb:hover {
  background: #98a2b3;
}

#dashboard .panel:nth-child(-n+3) {
  --dash-meta-gap: 10px;
  --dash-meta-track: 260px;
}

#dashboard .panel:nth-child(1) {
  --dash-meta-cols: 76px 92px 72px;
}

#dashboard .panel:nth-child(2) {
  --dash-meta-cols: 92px 72px 76px;
}

#dashboard .panel:nth-child(3) {
  --dash-meta-cols: 64px 88px 76px 68px;
  --dash-meta-track: 320px;
}

#dashboard .panel:nth-child(-n+3) .panelTitleRow,
#dashboard .panel:nth-child(-n+3) .miniCard .cardTop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--dash-meta-track);
  column-gap: 12px;
  align-items: start;
}

#dashboard .panel:nth-child(-n+3) .dashMetaCols {
  display: grid;
  grid-template-columns: var(--dash-meta-cols);
  column-gap: var(--dash-meta-gap);
  justify-items: center;
  align-items: start;
  width: var(--dash-meta-track);
  box-sizing: border-box;
}

#dashboard .issueTypeChart {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.issueTypePie {
  display: flex;
  align-items: stretch;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.pieSvg {
  flex: 0 0 auto;
  width: auto;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0;
}

.pieSlicePct {
  fill: #fff;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
  paint-order: stroke fill;
  stroke: rgba(0, 0, 0, 0.35);
  stroke-width: 2px;
}

.pieFilterLink {
  cursor: pointer;
}

.pieFilterLink:hover .pieLegendLabel,
.pieFilterLink:focus-visible .pieLegendLabel {
  color: var(--ir-red);
}

.pieFilterLink:hover .pieLegendSwatch,
.pieFilterLink:focus-visible .pieLegendSwatch {
  filter: brightness(0.92);
}

.pieFilterLink:focus-visible {
  outline: 2px solid var(--ir-red);
  outline-offset: 2px;
}

#dashboard .pieSlice.pieFilterLink path {
  transition: filter 0.15s ease;
}

#dashboard .pieSlice.pieFilterLink:hover path,
#dashboard .pieSlice.pieFilterLink:focus-visible path {
  filter: brightness(0.92);
}

#dashboard .pieSlicePct {
  font-size: clamp(11px, 1.4vh, 14px);
}

.pieLegend {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: center;
  overflow-y: auto;
  padding-right: 2px;
}

#dashboard .pieLegend {
  align-content: space-evenly;
  gap: clamp(10px, 2.2vh, 20px);
  padding: 6px 4px 6px 10px;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.pieLegendItem {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  font-size: 12px;
}

#dashboard .pieLegendItem {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  font-size: 17px;
}

.pieLegendSwatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 22px;
  padding: 0;
  border-radius: 5px;
  flex: 0 0 auto;
  box-sizing: border-box;
}

#dashboard .pieLegendSwatch {
  width: 58px;
  min-width: 58px;
  height: 30px;
  padding: 0;
  border-radius: 6px;
}

.pieLegendCount {
  display: block;
  width: 100%;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

#dashboard .pieLegendCount {
  font-size: clamp(14px, 1.8vh, 17px);
}

.pieLegendLabel {
  font-weight: 800;
  color: #111;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#dashboard .pieLegendLabel {
  font-size: clamp(17px, 2.1vh, 22px);
  line-height: 1.15;
}

.stack { display: flex; flex-direction: column; gap: 0; min-height: 0; }

.dashList {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dashMainCol,
.cardMain {
  min-width: 0;
}

.dashColLabel {
  display: block;
  width: 100%;
  font-size: 11px;
  font-weight: 800;
  color: #667085;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.2;
}

.dashMetaCell {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.miniCard {
  border: 0;
  border-bottom: 1px solid #e6eaf0;
  border-radius: 0;
  padding: 8px;
  background: #fff;
}

.miniCard.dashboardLink { cursor: pointer; }
.miniCard.dashboardLink:hover { background: #fafcff; }

#dashboard .miniCard {
  min-height: 90px;
  padding: 10px 0;
}

#dashboard .stack > .miniCard:not(.dashboardLink) {
  font-size: 16px;
  font-weight: 700;
  color: #5f6877;
  line-height: 1.35;
  padding: 18px 0;
}

.cardTop {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.cardMain {
  min-width: 0;
}

.cardTitle {
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.2;
  white-space: normal;
}

#dashboard .cardTitle {
  font-size: 18px;
  line-height: 1.25;
}

.cardSub,
.cardNote {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cardSub { font-size: 10.5px; color: #1a2b46; }
.cardNote { font-size: 11px; color: #111; margin-top: 4px; }

#dashboard .cardSub {
  font-size: 15px;
  line-height: 1.3;
}

#dashboard .cardNote {
  font-size: 15px;
  line-height: 1.3;
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 6px;
  background: #eef0f3;
  font-weight: 900;
  font-size: 10px;
  white-space: nowrap;
}

.badge-empty {
  background: transparent;
  color: #9ca3af;
  font-weight: 700;
}

#dashboard .badge {
  font-size: 14.5px;
  padding: 6px 11px;
  border-radius: 7px;
  line-height: 1.15;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.priority-high, .priority-critical { background: #ffe1e4; color: #9f0013; }
.priority-med, .priority-medium { background: #fff2cc; color: #7a4d00; }
.closed, .complete { background: #dff5e8; color: #0f6935; }
.open, .in-progress { background: #e9eefc; color: #183b8d; }

.summaryRows { display: grid; gap: 8px; }

/* ============================================================
   TABLES
   ============================================================ */
#tracker.tabPage.active,
#actions.tabPage.active,
#trips.tabPage.active {
  position: absolute;
  inset: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#map.tabPage.active {
  position: absolute;
  inset: 8px;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.mapPage {
  display: flex;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.mapSidebar {
  flex: 0 0 280px;
  min-width: 240px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow: auto;
}

.mapSidebarHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mapSidebarHead h2 {
  margin: 0;
  font-size: 22px;
}

.mapSidebarActions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body.viewer #mapEditTerritoriesBtn,
body.technician #mapEditTerritoriesBtn {
  display: none !important;
}

.liveMap .leaflet-interactive:focus,
.liveMap .leaflet-interactive:active {
  outline: none !important;
}

.liveMap path.leaflet-interactive {
  cursor: default;
}

.territoryMapTooltip {
  background: rgba(17, 24, 39, 0.94) !important;
  border: 0 !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22) !important;
  color: #fff !important;
  padding: 8px 10px !important;
}

.territoryMapTip {
  line-height: 1.25;
}

.territoryTipRegion {
  font-weight: 800;
  font-size: 13px;
}

.territoryTipTsm {
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.92;
}

.mapStatus {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.mapStatus:empty {
  display: none;
}

.mapLegend h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.mapLegendToggle {
  display: grid;
  grid-template-columns: 16px 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-weight: 600;
  cursor: pointer;
}

.mapLegendToggle input {
  margin: 0;
  width: 14px;
  height: 14px;
}

.mapLegendLabel {
  line-height: 1.2;
  min-width: 0;
}

.mapLegendSwatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  flex: 0 0 auto;
}

.mapLegendSwatchIssues { background: #d92d20; }
.mapLegendSwatchActions { background: #12b76a; }
.mapLegendSwatchTrips { background: #0086c9; }

.mapLegendIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  flex: 0 0 32px;
  overflow: visible;
}

.mapLegendIcon svg,
.mapLegendSwatchTeam svg,
.mapLegendSwatchTeam .map-svg-standalone-icon {
  width: 32px;
  height: 32px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.mapLegendIconActions,
.mapLegendIconTrips,
.mapLegendIconIssues {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mapLegendSwatchTeam {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  flex: 0 0 32px;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.mapServiceTeamLegend {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.mapTeamLegendItem {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.mapTeamLegendItem .mapTeamLegendIcon {
  width: 36px;
  height: 36px;
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mapTeamLegendItem .mapTeamLegendIcon svg,
.mapTeamLegendItem .mapTeamLegendIcon .map-svg-standalone-icon {
  width: 36px;
  height: 36px;
  display: block;
}

.mapTeamLegendText {
  display: grid;
  gap: 2px;
  font-size: 13px;
  line-height: 1.25;
}

.mapTeamLegendText strong {
  font-weight: 800;
}

.mapTeamLegendText span {
  color: var(--muted);
  font-size: 12px;
}

.mapTeamLegendEmpty,
.serviceTeamEmpty,
.serviceTeamAdminIntro {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.serviceTeamAdminIntro {
  margin-bottom: 12px;
}

.serviceTeamAdminList {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.serviceTeamRow {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(120px, 1.2fr) minmax(100px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.serviceTeamColorPick input[type="color"] {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.serviceTeamWrenchPreview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.serviceTeamWrenchPreview svg,
.serviceTeamWrenchPreview .map-svg-standalone-icon {
  width: 36px;
  height: 36px;
  display: block;
}

.map-team-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.28));
}

.map-team-icon svg,
.map-svg-team-house {
  display: block;
  width: 28px;
  height: 28px;
  overflow: visible;
}

.serviceTeamNameInput,
.serviceTeamLocationInput,
.serviceTeamPhoneInput {
  min-width: 0;
}

.serviceTeamAdminPanel {
  left: auto;
  right: 20px;
  width: min(560px, calc(100vw - 40px));
}

body.viewer #mapEditServiceTeamBtn,
body.technician #mapEditServiceTeamBtn {
  display: none !important;
}

.leaflet-div-icon.map-pin-team,
.leaflet-div-icon.map-pin {
  background: transparent !important;
  border: none !important;
}

.map-pin-svg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35));
}

.map-pin-svg svg,
.map-svg-standalone-icon {
  display: block;
  width: 40px;
  height: 40px;
  overflow: visible;
}

.mapTeamPopupKind {
  background: #344054;
}

.mapOpacityControl {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #354052;
}

.mapOpacityControl input[type="range"] {
  width: 100%;
}

.mapTsmLegend {
  display: grid;
  gap: 6px;
}

.mapTsmItem {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #354052;
}

.mapTsmSwatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex: 0 0 auto;
}

.liveMap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #dbeafe;
}

.map-pin {
  background: transparent !important;
  border: 0 !important;
}

.leaflet-div-icon.map-pin {
  background: transparent !important;
  border: none !important;
}

.map-pin span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.mapIconAdminIntro {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.mapIconPreviewRow {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
}

.mapIconPreviewItem {
  display: grid;
  gap: 6px;
  justify-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #475467;
}

.mapIconPreview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
}

.mapIconPreview svg {
  display: block;
  width: 40px;
  height: 40px;
}

.mapIconIssuePriorityColors {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.mapIconPriorityColorRow {
  display: grid;
  grid-template-columns: 56px repeat(3, minmax(120px, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.mapIconPriorityLabel {
  font-size: 13px;
  font-weight: 700;
  color: #354052;
  padding-bottom: 8px;
}

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

  .mapIconPriorityLabel {
    grid-column: 1 / -1;
    padding-bottom: 0;
  }
}

.mapIconColorGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.mapIconColorGrid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #354052;
}

.mapIconColorGrid input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.mapIconColorHint {
  font-style: normal;
  font-weight: 500;
  color: #98a2b3;
}

.mapIconTypeControls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 16px;
  margin-bottom: 10px;
}

.mapIconCircleToggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #344054;
  cursor: pointer;
}

.mapIconCircleToggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.mapIconTypeColorLabel {
  display: grid;
  gap: 6px;
  min-width: 160px;
  font-size: 13px;
  font-weight: 600;
  color: #354052;
}

.mapIconTypeColorLabel input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.mapIconLibrarySections {
  display: grid;
  gap: 18px;
  margin-bottom: 16px;
}

.mapIconLibrarySection h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #344054;
}

.mapIconLibraryGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  max-width: 260px;
}

.mapIconLibraryOption {
  display: grid;
  gap: 6px;
  justify-items: center;
  padding: 8px 6px 6px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.mapIconLibraryOption:hover {
  border-color: #98a2b3;
  background: #f9fafb;
}

.mapIconLibraryOption.selected {
  border-color: var(--brand, #ef1b2d);
  background: #fff5f5;
  box-shadow: 0 0 0 1px rgba(239, 27, 45, 0.15);
}

.mapIconLibraryThumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.mapIconLibraryThumb svg {
  display: block;
  width: 40px;
  height: 40px;
}

.mapIconLibraryLabel {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  color: #667085;
}

.mapIconAdminActions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mapPopup {
  min-width: 220px;
  max-width: 320px;
}

.mapPopupKind {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #fff;
}

.mapPopupKind.kind-tracker { background: #d92d20; }
.mapPopupKind.kind-actions { background: #f79009; }
.mapPopupKind.kind-trips { background: #0086c9; }

.mapPopupTitle {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
}

.mapPopupMeta,
.mapPopupText {
  margin: 0 0 8px;
  color: #475467;
  font-size: 13px;
  line-height: 1.4;
}

.mapPopupBtn {
  margin-top: 8px;
  width: 100%;
}

.leaflet-container {
  font: inherit;
}

#tracker.tabPage.active .tableWrap,
#actions.tabPage.active .tableWrap,
#trips.tabPage.active .tableWrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.tableWrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: auto;
  width: 100%;
}

.trackerTable,
.actionsTable,
.tripsTable {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
}

table {
  border-collapse: collapse;
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}

th {
  position: sticky;
  top: 0;
  background: #111;
  color: #fff;
  text-align: left;
  padding: 8px;
  font-size: 12px;
  z-index: 3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filterRow th {
  top: 32px;
  background: #222;
  padding: 6px;
  z-index: 4;
  overflow: visible;
}

thead {
  position: relative;
  z-index: 5;
}

td {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  vertical-align: top;
  font-size: 12px;
  overflow: hidden;
  font-weight: 500;
}

td.wrap { white-space: normal; line-height: 1.25; }

.dataRow { cursor: pointer; }
.dataRow:hover td { background: #fafafa; }
.dataRow.selectedRow td { background: #fff3f4 !important; }

.dataRow.longPressActive td {
  background: #eef4ff !important;
}

.dataRow td {
  height: 58px;
  max-height: 58px;
  min-height: 58px;
  line-height: 1.25;
}

.dataRow td .cellClamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 45px;
}

.dataRow td.expandedCell {
  height: auto !important;
  max-height: none !important;
  background: #fffceb !important;
}

.dataRow td.expandedCell .cellClamp {
  display: block !important;
  max-height: none !important;
  white-space: pre-wrap !important;
  overflow: visible !important;
}

.dataRow.inlineEditing td {
  height: auto !important;
  max-height: none !important;
  min-height: 58px;
  vertical-align: top;
  background: #fffef5 !important;
}

.dataRow.inlineEditing .inlineCellInput {
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 5px 7px;
  border: 1px solid #c5ccd6;
  border-radius: 5px;
  background: #fff;
  color: #111;
  font: inherit;
  line-height: 1.25;
  box-sizing: border-box;
}

.dataRow.inlineEditing textarea.inlineCellInput {
  min-height: 72px;
  resize: vertical;
}

.dataRow.inlineEditing select.inlineCellInput {
  cursor: pointer;
}

.trackerTable th, .trackerTable td,
.actionsTable th, .actionsTable td,
.tripsTable th, .tripsTable td {
  min-width: 0;
}

.capaLink {
  color: var(--ir-red);
  font-weight: 900;
  text-decoration: none;
}

.capaLink:hover { text-decoration: underline; }

.quotePdfCell { padding: 4px 6px; }

.quotePdfBtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 4px;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.quotePdfBtn:hover { background: rgba(184, 92, 92, 0.08); }

.quotePdfIcon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.quotePdfName {
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quotePdfBtn:hover .quotePdfName { color: #1f2937; }

.quotePdfEmpty { color: #9ca3af; }

.quoteActionModal { width: min(420px, 92vw); }

.quoteActionPrompt {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.45;
  color: #374151;
}

.quoteActionButtons {
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.columnFilter,
.multiFilterBtn {
  width: 100%;
  min-width: 0;
  border: 1px solid #555;
  background: #fff;
  color: #111;
  border-radius: 7px;
  padding: 6px;
  font-size: 11px;
  font-weight: 700;
}

.multiFilter { position: relative; }
.multiFilterBtn { justify-content: space-between; display: flex; }

.multiFilterMenu {
  display: none;
  position: absolute;
  top: 32px;
  left: 0;
  z-index: 50;
  width: 250px;
  max-height: 320px;
  overflow: auto;
  background: #fff;
  color: #111;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px;
}

.multiFilterMenu.multiFilterMenuFloating {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10050;
  display: block;
}

.multiFilter.open .multiFilterMenu:not(.multiFilterMenuFloating) { display: block; }
.multiFilterMenu label {
  display: flex;
  gap: 7px;
  align-items: center;
  font-weight: 600;
  padding: 5px;
  border-radius: 6px;
}

.multiFilterMenu label:hover { background: #f3f4f6; }
.multiFilterMenu input[type=checkbox] { width: auto; }
.filterSearch { margin-bottom: 7px; }
.filterTools { display: flex; gap: 6px; margin-bottom: 6px; }
.filterTools button { font-size: 11px; padding: 5px 7px; }

.rowContextMenu {
  display: none;
  position: fixed;
  z-index: 12000;
  min-width: 140px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.15);
  padding: 4px 0;
}
.rowContextMenuItem {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  color: #b91c1c;
  cursor: pointer;
}
.rowContextMenuItem:hover { background: #fef2f2; }

.multiFilterBtn span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #333; }
th.sortable::after {
  content: " ↕";
  opacity: 0.55;
  font-size: 10px;
  pointer-events: none;
}
th.dragging { opacity: 0.5; }
th.dropTarget { outline: 3px solid var(--ir-red); outline-offset: -3px; }
th.resizable {
  position: sticky;
  overflow: visible;
  padding-right: 14px;
}

.resizeHandle {
  display: block;
  position: absolute;
  right: 0;
  top: 0;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  z-index: 110;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
}

th.resizable:hover .resizeHandle {
  background: rgba(255, 255, 255, 0.18);
}

/* ============================================================
   MODALS
   ============================================================ */
dialog {
  width: min(980px, 94vw);
  max-height: 92vh;
  border: 0;
  border-radius: 18px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.28);
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
}

dialog form {
  max-height: 92vh;
  overflow-y: auto;
}

.modalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px;
  padding: 16px 18px 10px;
}

#editModal { width: min(1040px, 96vw); }
#editForm { padding: 18px; }

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

.formGrid label,
.brandingGrid label { font-weight: 900; }

.formGrid label.wide,
.formGrid span,
.brandingGrid span {
  display: block;
  margin-bottom: 5px;
}

.formGrid label.wide { grid-column: 1 / -1; }

.commentBox {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: #fafafa;
  margin: 8px 0 14px;
}

.commentBox textarea { min-height: 100px; white-space: pre-wrap; }
#commentHistoryText { min-height: 170px; }

.photoPanel {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
}

.photoGrid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.photoItem {
  width: 112px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.photoItem img { width: 100%; height: 82px; object-fit: cover; }

.photoItem button {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 2px 6px;
  background: #111;
}

#loginModal { width: min(420px, 92vw); }

#loginModal #loginForm { padding: 0; background: #fff; }

#loginModal .modalHead {
  background: #111;
  color: #fff;
  margin: 0;
  border-bottom: 4px solid var(--ir-red);
}

#loginModal .modalHead .iconBtn {
  background: #111;
  color: #fff;
}

#loginModal label {
  display: block;
  font-weight: 900;
  margin: 18px 18px 0;
}

#loginModal input,
#loginModal select { margin-top: 6px; }

#loginModal .modalActions {
  padding: 16px 18px 18px;
}

.loginHelp {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  margin: 0 18px 16px;
}

#viewModal { width: min(900px, 94vw); }

.viewDetails {
  display: grid;
  gap: 10px;
  padding: 4px 18px 12px;
}

.viewRow {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.viewLabel {
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.viewValue {
  white-space: pre-wrap;
  line-height: 1.35;
}

/* Quote builder */
.quoteTools { margin: 10px 0; }

.quoteTools .quoteButton {
  background: #111;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 900;
}

.quoteModal { width: min(1180px, 96vw); }

#quoteForm {
  max-height: 94vh;
  overflow: auto;
  padding: 18px;
}

.quoteGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.quoteGrid label,
.quoteTotals label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 900;
}

.quoteGrid input,
.quoteGrid textarea,
.quoteTotals input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  font: inherit;
}

.quoteGrid .wide { grid-column: 1 / -1; }
.quoteGrid textarea { min-height: 70px; }

.quoteLineHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
}

.quoteLinesWrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.quoteLinesTable {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.quoteLinesTable th {
  background: #111;
  color: #fff;
  padding: 8px;
  text-align: left;
}

.quoteLinesTable td {
  border-bottom: 1px solid var(--line);
  padding: 6px;
}

.quoteLinesTable input {
  width: 100%;
  border: 1px solid #d6dbe3;
  border-radius: 6px;
  padding: 7px;
}

.quoteLinesTable .lineTotal {
  font-weight: 900;
  text-align: right;
}

.quoteTotals {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.quoteTotals input {
  font-size: 20px;
  font-weight: 900;
  text-align: right;
}

/* ============================================================
   ADMIN
   ============================================================ */
#admin.tabPage.active {
  position: absolute;
  inset: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 70px;
}

.adminBranding { margin-bottom: 16px; }

#admin .brandingGrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 12px 20px;
  align-items: start;
}

.brandingGrid label { font-weight: 900; }
.brandingGrid span { display: block; margin-bottom: 5px; }

.rgbGrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.logoUploadBlock {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 88px;
  min-width: 88px;
  max-width: 88px;
}

#admin .adminBranding .fileBtn.logoChangeBtn {
  width: 88px;
  max-width: 88px;
  min-width: 88px;
  height: 22px;
  min-height: 22px;
  max-height: 22px;
  padding: 2px 4px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.05;
  border-radius: 5px;
  justify-content: center;
  text-align: center;
  white-space: normal;
  overflow: hidden;
}

.logoUploadBlock .logoPreviewWrap,
.logoUploadBlock .productLogoAdminPreview {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  height: 34px;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logoUploadBlock .logoPreviewWrap img,
.logoUploadBlock .productLogoAdminPreview img {
  max-width: 80px;
  max-height: 28px;
  object-fit: contain;
}

#admin .adminBranding button.secondary {
  height: 28px;
  padding: 4px 10px;
  font-size: 11px;
  align-self: start;
}

.adminGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
}

.adminHeaderList {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.adminHeaderRow {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}

.showBox {
  display: flex !important;
  gap: 6px;
  align-items: center;
  font-weight: 900;
  margin: 0;
}

.showBox input { width: auto; margin: 0; }

.dashboardAdminPanel { margin-top: 16px; }

.dashboardEditGrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.dashboardEditGrid label { font-weight: 900; }
.dashboardEditGrid span { display: block; margin-bottom: 6px; }

.adminTools { margin-top: 16px; }

.territoryAdminPanel {
  position: fixed;
  z-index: 10050;
  top: 72px;
  left: 20px;
  width: min(480px, calc(100vw - 40px));
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.territoryAdminPanel[hidden] {
  display: none !important;
}

.territoryAdminDragHandle {
  cursor: move;
  user-select: none;
  touch-action: none;
  margin-bottom: 0;
}

.territoryAdminDragHandle h2 {
  pointer-events: none;
}

.territoryAdminDragHandle .iconBtn {
  cursor: pointer;
}

.territoryAdminBody {
  overflow-y: auto;
  padding: 0 14px 12px;
  max-height: calc(100vh - 210px);
}

.territoryAdminSection {
  margin-bottom: 18px;
}

.territoryAdminSection h3 {
  margin: 0 0 10px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.territoryTsmColorGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.territoryTsmColorItem {
  display: grid;
  grid-template-columns: 18px 1fr 44px;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
  font-weight: 700;
  font-size: 13px;
}

.territoryTsmColorSwatch,
.territoryRowSwatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.territoryTsmColorItem input[type="color"] {
  width: 44px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.territoryRegionList {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.territoryRegionRow {
  display: grid;
  grid-template-columns: 18px 1fr minmax(150px, 180px);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.territoryRegionName {
  font-size: 13px;
  font-weight: 700;
}

.territoryRegionRow select {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

.territoryAdminActions {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}
.emptyAdmin {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--shadow);
}

/* ============================================================
   ROLES
   ============================================================ */
body.viewer .pageActions button:not(.secondary),
body.viewer .pageActions .fileBtn:not(.secondary) { display: none; }

body.viewer #admin .adminGrid,
body.viewer #admin .adminBranding,
body.viewer #admin .pageHead .pageActions,
body.technician #admin .adminGrid,
body.technician #admin .adminBranding,
body.technician #admin .pageHead .pageActions { display: none; }

/* ============================================================
   FOOTER / PRINT
   ============================================================ */
.desktopFooter { display: none !important; }

@page { margin: 0.55in; }

@media print {
  html, body { margin: 0 !important; padding: 0 !important; }
  button, .noPrint { display: none !important; }
  a[href]::after { content: "" !important; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-height: 780px) {
  :root {
    --header-h: 84px;
    --nav-h: 36px;
    --shell-top: 120px;
  }

  #brandLogo, .brand img {
    height: 64px;
    max-height: 64px;
  }

  .productLogo {
    height: 64px;
    max-height: 64px;
  }

  .tab { height: 29px; }
}

@media (max-width: 1100px) {
  .brandbar {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .brand, .roleBar, .productLogo {
    grid-column: 1;
    justify-self: start;
  }

  .productLogo {
    transform: none;
    object-position: left center;
  }

  #dashboard .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "issues"
      "summary"
      "actions"
      "trips";
  }

  .adminBranding .brandingGrid,
  .adminGrid,
  .dashboardEditGrid {
    grid-template-columns: 1fr;
  }
}
/* Hide any old admin previews not inside logoUploadBlock */
.adminBranding > .logoPreviewWrap {
  display: none !important;
}

#admin .logoUploadBlock {
  width: 88px;
}

#admin .adminBranding .fileBtn.logoChangeBtn {
  width: 88px !important;
  height: 22px !important;
  padding: 2px 4px !important;
  font-size: 9px !important;
}

#admin .logoUploadBlock .logoPreviewWrap,
#admin .logoUploadBlock .productLogoAdminPreview {
  width: 88px !important;
  height: 34px !important;
  padding: 2px !important;
}

#admin .logoUploadBlock .logoPreviewWrap img,
#admin .logoUploadBlock .productLogoAdminPreview img {
  max-width: 80px !important;
  max-height: 28px !important;
  object-fit: contain !important;
}
/* ===== HOTFIX: nav + tabs + login ===== */

:root {
  --nav-h: 48px;
  --shell-top: 144px;
}

/* remove broken brace side-effect: force nav bar */
nav.tabs {
  background: #111 !important;
  height: var(--nav-h) !important;
  min-height: var(--nav-h) !important;
  max-height: var(--nav-h) !important;
  overflow: hidden !important;
}

/* tabs must NOT inherit generic button styling */
nav.tabs button.tab {
  background: transparent !important;
  color: #fff !important;
  border: 0 !important;
  min-width: 0 !important;
  height: 32px !important;
  padding: 0 10px !important;
  font-size: 12px !important;
  border-radius: 9px !important;
  gap: 5px !important;
}

nav.tabs button.tab.active {
  background: var(--ir-red) !important;
  color: #fff !important;
}

/* login on black bar: side-by-side, not stacked */
nav.tabs .roleBar {
  flex-direction: row !important;
  width: auto !important;
  gap: 8px !important;
  align-items: center !important;
}

nav.tabs .roleBar .modePill,
nav.tabs .roleBar button {
  width: auto !important;
  min-width: 64px !important;
  height: 28px !important;
  padding: 4px 10px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
}

main {
  top: var(--shell-top) !important;
}