/* Shared ElectricalApp web portals — include once per page; override --primary on body if needed */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --line: #d8e1ee;
  --text: #122033;
  --muted: #5e6d81;
  --primary: #1f4fcc;
  --topbar-bg: #10203a;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
body.portal-buyer {
  --primary: #0f7e62;
  --topbar-bg: #0f2433;
}
body.portal-worker {
  --primary: #2456d6;
  --topbar-bg: #1a2b4d;
}
.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--topbar-bg);
  color: #fff;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.topbar-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
.topbar-btn.ghost {
  background: transparent;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6b8cff, #243a8f);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
body.portal-buyer .avatar {
  background: linear-gradient(135deg, #2dd4bf, #0f5c4a);
}
.user-label {
  font-size: 13px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.api-hint {
  font-size: 11px;
  opacity: 0.75;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sync-dot {
  font-size: 11px;
  opacity: 0.85;
}
.layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: calc(100vh - 56px);
}
.sidebar {
  border-right: 1px solid var(--line);
  background: #f8fbff;
  padding: 14px 12px;
}
.main {
  padding: 16px;
}
.nav-group {
  margin-bottom: 14px;
}
.nav-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
  padding-left: 4px;
}
.nav-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  margin-bottom: 3px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.nav-btn:hover {
  background: #eef3fb;
}
.nav-btn.active {
  background: #e0e8f7;
  font-weight: 600;
}
.nav-sub-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 10px 7px 18px;
  margin-bottom: 2px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
}
.nav-sub-btn:hover {
  background: #eef3fb;
}
.nav-sub-btn.active {
  background: #dce6f8;
  font-weight: 600;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}
.kpi {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: #fcfdff;
}
.kpi .v {
  font-size: 24px;
  font-weight: 700;
}
input,
select,
button.field-like {
  border: 1px solid #c7d4e8;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}
input {
  min-width: 220px;
}
button {
  border: 1px solid #c7d4e8;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}
button.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 6px;
  font-size: 13px;
}
th {
  color: var(--muted);
  font-weight: 600;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.ok {
  color: #0b7f53;
}
.err {
  color: #b42323;
}
.hidden {
  display: none !important;
}
pre {
  margin: 0;
  background: #09101f;
  color: #cddcff;
  padding: 10px;
  border-radius: 8px;
  overflow: auto;
  font-size: 12px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
}
label.inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 24, 40, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal-backdrop.open {
  display: flex;
}
.modal-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  width: min(400px, 100%);
  border: 1px solid var(--line);
  max-height: 90vh;
  overflow-y: auto;
}
.field {
  margin-bottom: 12px;
}
.field label {
  display: block;
  margin-bottom: 4px;
}
.linkish {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 0;
  font-size: 13px;
}

/* Optional help: keep screens minimal; long copy lives behind ⓘ */
.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.card-title-row h1,
.card-title-row h2,
.card-title-row h3 {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.portal-info {
  flex-shrink: 0;
}
.portal-info > summary.portal-info-trigger {
  list-style: none;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #f1f5fb;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  user-select: none;
}
.portal-info > summary.portal-info-trigger::-webkit-details-marker {
  display: none;
}
.portal-info > summary.portal-info-trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.portal-info-body {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fcfdff;
  font-size: 13px;
  line-height: 1.45;
}
.modal-card .portal-info {
  display: inline-block;
  vertical-align: middle;
}
.modal-card .portal-info-body {
  max-width: 100%;
}

/* Buyer portal / app parity (Dashboard) */
body.portal-buyer .topbar-left strong {
  font-size: 17px;
  font-weight: 700;
}
.buyer-dashboard-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.dash-section-headline {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.buyer-dash-title-row {
  margin-bottom: 6px;
}
.buyer-dash-block {
  margin-top: 12px;
}
.buyer-scheduler-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.sched-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.sched-title-spacer {
  flex: 1;
  min-width: 8px;
}
.sched-mode-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.sched-month-label {
  font-weight: 600;
  margin: 6px 0 4px;
}
.sched-month-grid {
  grid-template-columns: repeat(7, minmax(0, 38px));
  gap: 5px;
  margin-top: 6px;
  justify-content: start;
}
.sched-month-cell {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  padding: 4px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.sched-month-cell.active-month-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.sched-cell-marks,
.sched-dot {
  font-size: 10px;
  color: var(--muted);
}
.buyer-date-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0 !important;
}
.sched-day-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.sched-slot-cell {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 10px;
}
.slot-time {
  min-width: 52px;
}
.sched-week-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-top: 8px;
}
.sched-week-column {
  flex: 0 0 120px;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  padding: 8px;
  text-align: left;
  font-size: 13px;
}
.sched-week-lines {
  margin-top: 6px;
  font-size: 12px;
}
.sched-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.sched-list-table {
  margin-top: 10px;
  font-size: 13px;
}
.outline-btn {
  background: #fff !important;
  border: 1px solid var(--line) !important;
  color: var(--text) !important;
}
.portal-dialog::backdrop {
  background: rgba(15, 24, 40, 0.45);
}
.portal-dialog {
  border: none;
  border-radius: 12px;
  padding: 18px;
  max-width: 440px;
  width: calc(100% - 32px);
}
.xs-btn {
  font-size: 12px;
  padding: 4px 8px !important;
}
