:root {
  --bg: #f4f0e5;
  --sidebar: #071a10;
  --surface: #ffffff;
  --surface-2: #f7f4ec;
  --ink: #17221b;
  --muted: #68726b;
  --line: #d9ded4;
  --green: #087a27;
  --green-dark: #064617;
  --blue: #245a7a;
  --amber: #b77418;
  --wood: #7a4b24;
  --danger: #b42318;
  --shadow: 0 18px 40px rgba(28, 36, 26, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  margin: 0;
  background:
    linear-gradient(90deg, rgba(122, 75, 36, 0.08), transparent 18%, transparent 82%, rgba(8, 122, 39, 0.06)),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-shell {
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  background: var(--bg);
}

.auth-brand-panel,
.auth-form-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 6vw, 88px);
}

.auth-brand-panel {
  color: #fff;
  background: var(--sidebar);
  border-right: 8px solid var(--wood);
}

.auth-brand-panel > img {
  width: 112px;
  height: 112px;
  margin-bottom: 28px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.auth-brand-panel h1 {
  max-width: 520px;
  margin-bottom: 14px;
  color: #fff;
  font-size: 52px;
}

.auth-brand-panel > p:not(.eyebrow) {
  max-width: 560px;
  color: #c7d8cc;
  font-size: 17px;
  line-height: 1.6;
}

.auth-trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.auth-trust-list span,
.user-chip {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-form-panel {
  align-items: center;
}

.auth-form,
.auth-status {
  width: min(100%, 480px);
}

.auth-form {
  display: grid;
  gap: 15px;
  border-top: 5px solid var(--green);
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.auth-form .button {
  width: 100%;
}

.auth-status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-status.is-error {
  color: var(--danger);
}

.auth-status.is-success {
  color: var(--green);
}

.user-chip {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--green-dark);
}

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

  .auth-brand-panel,
  .auth-form-panel {
    padding: 24px;
  }

  .auth-brand-panel {
    min-height: 290px;
    border-right: 0;
    border-bottom: 7px solid var(--wood);
  }

  .auth-brand-panel > img {
    width: 76px;
    height: 76px;
    margin-bottom: 14px;
  }

  .auth-brand-panel h1 {
    font-size: 34px;
  }

  .auth-form {
    padding: 22px;
  }
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(8, 122, 39, 0.22), transparent 42%),
    var(--sidebar);
  border-right: 5px solid var(--wood);
  color: white;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 900;
}

.brand img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #b9d8c3;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 12px;
  color: #d8e8dd;
  font-weight: 800;
}

.sidebar nav img {
  width: 22px;
  height: 22px;
  padding: 3px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: var(--green);
  color: white;
}

main {
  display: grid;
  gap: 20px;
  align-content: start;
  padding: 24px;
}

.workspace-header,
.panel,
.status-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-top: 4px solid var(--green);
  background:
    linear-gradient(90deg, rgba(8, 122, 39, 0.08), transparent 45%),
    var(--surface);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Impact, "Arial Black", Inter, sans-serif;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1;
  color: var(--green-dark);
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

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

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.date-chip {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface-2);
  color: var(--green-dark);
  font-weight: 900;
}

.button.danger {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.button.small {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.status-grid article {
  position: relative;
  overflow: hidden;
  padding: 18px;
  box-shadow: none;
  border-top: 5px solid var(--green);
}

.status-grid article img {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
}

.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-grid strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  line-height: 1;
  color: var(--green-dark);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.7fr);
  gap: 20px;
}

@media (min-width: 981px) {
  #crews.split {
    grid-template-columns: minmax(0, 1fr) minmax(400px, 0.8fr);
  }
}

.blueprint-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
  gap: 20px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-header > img {
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 8px;
  background: #e8f4ea;
}

.agenda-panel,
.system-panel {
  border-top: 4px solid var(--wood);
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.timeline span {
  color: var(--green);
  font-weight: 900;
}

.timeline strong {
  min-width: 0;
}

.timeline em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.agenda-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.agenda-toolbar > span {
  color: var(--green-dark);
  font-weight: 950;
}

.agenda-toolbar label,
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.agenda-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.agenda-day {
  min-width: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.agenda-day header {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.agenda-events {
  display: grid;
  gap: 6px;
  min-height: 128px;
  padding: 8px;
}

.agenda-event {
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.agenda-event.order {
  border-left-color: var(--wood);
}

.agenda-event strong,
.agenda-event span {
  display: block;
}

.agenda-event span {
  color: var(--muted);
  margin-top: 3px;
}

.crew-roster {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.crew-access-management {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.crew-access-management h3 {
  margin: 4px 0 12px;
  color: var(--green-dark);
}

.crew-user-assignments {
  display: grid;
  gap: 8px;
}

.crew-user-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 0.9fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.crew-user-row small {
  display: block;
  color: var(--muted);
}

.crew-user-row select {
  min-width: 0;
}

.user-management-panel {
  border-top: 4px solid var(--green);
}

.user-create-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(170px, 0.9fr) minmax(150px, 0.7fr) minmax(170px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.user-create-grid label,
.managed-user-row label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.temporary-access {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(230px, 0.9fr) auto auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  border: 1px solid color-mix(in srgb, var(--green) 55%, var(--line));
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
}

.temporary-access span,
.temporary-access strong {
  display: block;
}

.temporary-access span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.temporary-access input {
  font-family: Consolas, "Courier New", monospace;
  font-weight: 800;
}

.user-management-list {
  display: grid;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.managed-user-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.15fr) minmax(145px, 1fr) minmax(115px, 0.7fr) minmax(145px, 0.85fr) minmax(120px, 0.7fr) minmax(130px, 0.85fr) minmax(150px, auto);
  gap: 9px;
  align-items: end;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.managed-user-identity {
  align-self: center;
  min-width: 0;
}

.managed-user-identity strong,
.managed-user-identity small {
  display: block;
  overflow-wrap: anywhere;
}

.managed-user-identity .status-pill {
  margin: 5px 0;
}

.managed-user-identity small,
.managed-user-meta small {
  color: var(--muted);
}

.managed-user-meta {
  align-self: center;
  min-width: 0;
}

.managed-user-meta span,
.managed-user-meta small {
  display: block;
  overflow-wrap: anywhere;
}

.managed-user-meta span {
  color: var(--green-dark);
  font-weight: 900;
}

.managed-user-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-management-status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.auth-management-status.is-error {
  color: var(--danger);
}

/* The fixed admin rail leaves less usable space than the viewport suggests. */
@media (max-width: 1400px) {
  .managed-user-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .managed-user-identity,
  .managed-user-actions {
    grid-column: 1 / -1;
  }
}

.auth-management-status.is-success {
  color: var(--green-dark);
}

.crew-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.crew-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.crew-card h3 {
  margin: 0;
  color: var(--green-dark);
  font-size: 16px;
}

.crew-card small {
  color: var(--muted);
  font-weight: 800;
}

.crew-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.crew-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.order-editor-panel {
  border-top: 4px solid var(--green);
}

.content-panel {
  border-top: 4px solid var(--green);
}

.content-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.content-editor-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.gallery-admin {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr);
  gap: 14px;
  margin-top: 16px;
}

.gallery-admin-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  overflow-x: auto;
}

.gallery-admin-card,
.upload-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.gallery-admin-card {
  overflow: hidden;
}

.gallery-admin-card img {
  width: 100%;
  aspect-ratio: 1.22;
  display: block;
  object-fit: cover;
}

.gallery-admin-card div,
.upload-note {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.gallery-admin-card strong,
.upload-note strong {
  color: var(--green-dark);
  font-size: 13px;
}

.gallery-admin-card span,
.upload-note span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.content-actions {
  grid-template-columns: repeat(2, minmax(0, 220px));
}

.order-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.order-editor-grid label,
.order-notes {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.order-notes {
  margin-top: 12px;
}

.work-items-editor {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.order-operational-brief,
.order-evidence-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.order-brief-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--green-dark);
}

.order-brief-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-operational-brief dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.order-operational-brief dl > div {
  padding: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.order-operational-brief dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.order-operational-brief dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.order-customer-media,
.order-evidence-grid {
  display: grid;
  gap: 6px;
}

.order-customer-media a,
.order-evidence-grid a {
  color: var(--green);
  font-weight: 800;
  overflow-wrap: anywhere;
}

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

.order-evidence-grid a {
  display: grid;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  text-decoration: none;
}

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

.work-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.work-item-row strong,
.work-item-row small {
  display: block;
}

.work-item-row small {
  color: var(--muted);
  font-weight: 800;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  font-weight: 800;
}

.system-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.system-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
  color: var(--muted);
  font-weight: 750;
}

.system-list img {
  width: 28px;
  height: 28px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td strong,
td small {
  display: block;
}

td small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

tr.selected td {
  background: #eef8f0;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e8f4ea;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.urgent {
  background: #fdecea;
  color: var(--danger);
}

.status-pill.neutral {
  background: #eef2f4;
  color: var(--blue);
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  gap: 12px;
}

.detail-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.quote-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.55fr);
  gap: 20px;
}

.quote-builder-panel {
  border-top: 4px solid var(--green);
}

.quote-summary-panel {
  border-top: 4px solid var(--wood);
}

.quote-context {
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  color: var(--green-dark);
  font-weight: 900;
}

.quote-controls,
.quote-tuning {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) 120px 150px auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
}

.quote-tuning {
  grid-template-columns: minmax(220px, 1fr) 150px 150px;
}

.quote-controls label,
.quote-tuning label,
.quote-message {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quote-items {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.quote-line {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 74px 100px 108px 36px;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.quote-line img {
  width: 30px;
  height: 30px;
}

.quote-line strong,
.quote-line span {
  display: block;
}

.quote-line span,
.quote-line small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quote-line button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--danger);
  font-weight: 900;
  cursor: pointer;
}

.quote-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.quote-message {
  margin-top: 14px;
}

.quote-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.totals-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.totals-list div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.totals-list dt {
  color: var(--muted);
  font-weight: 800;
}

.totals-list dd {
  margin: 0;
  color: var(--green-dark);
  font-weight: 950;
}

.quote-summary-panel h2 {
  color: var(--green-dark);
  font-size: 42px;
  line-height: 1;
}

.quote-flow {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.quote-flow span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 900;
}

.quote-flow span.done {
  border-color: color-mix(in srgb, var(--green) 40%, var(--line));
  background: #eaf6ed;
  color: var(--green-dark);
}

.order-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.quote-portal-admin {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.quote-portal-heading {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.quote-portal-heading img {
  width: 30px;
  height: 30px;
}

.quote-portal-heading h3 {
  margin: 0;
  color: var(--green-dark);
  font-size: 15px;
}

.portal-admin-status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.portal-admin-status.is-active {
  border-color: #9dc8a6;
  background: #e8f6ec;
  color: #176b34;
}

.portal-admin-status.is-approved {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.portal-admin-status.is-warning {
  border-color: #e0bd77;
  background: #fff4d8;
  color: #795100;
}

.portal-admin-status.is-rejected {
  border-color: #e4a3a0;
  background: #feeceb;
  color: #9f2118;
}

.quote-portal-summary {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
}

.quote-portal-url {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.quote-portal-url input {
  font-family: Consolas, monospace;
  font-size: 11px;
}

.quote-portal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.quote-portal-response {
  border-left: 4px solid var(--green);
  padding: 10px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.detail-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.checklist {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.checklist li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  font-weight: 800;
}

.checklist .done {
  border-left: 5px solid var(--green);
}

.checklist .pending {
  border-left: 5px solid var(--amber);
}

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

.outbox {
  display: grid;
  gap: 10px;
}

.outbox-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.lead-workspace {
  display: grid;
  grid-template-columns: minmax(400px, 0.78fr) minmax(520px, 1.22fr);
  gap: 20px;
  align-items: start;
}

#leadDetailPanel {
  border-top: 4px solid var(--green);
}

.lead-operational-detail {
  display: grid;
  gap: 0;
  margin-top: 14px;
}

.lead-operational-detail[hidden] {
  display: none;
}

.lead-record-heading,
.lead-section-heading,
.lead-section-heading > div,
.lead-route-actions,
.lead-signal-row {
  display: flex;
  align-items: center;
}

.lead-record-heading,
.lead-section-heading {
  justify-content: space-between;
  gap: 12px;
}

.lead-record-heading h3,
.lead-section-heading h3 {
  margin: 0;
  color: var(--green-dark);
}

.lead-record-heading h3 {
  font-size: 20px;
}

.lead-record-id {
  max-width: 48%;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  overflow-wrap: anywhere;
  text-align: right;
}

.lead-signal-row {
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0 2px;
}

.lead-signal {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  background: #eef2f4;
  color: #3d5260;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.lead-signal.is-good {
  border-color: #a7d6b2;
  background: #e8f6ec;
  color: #176b34;
}

.lead-signal.is-warning {
  border-color: #e5c487;
  background: #fff5dc;
  color: #7d4c00;
}

.lead-signal.is-danger {
  border-color: #e8aaa5;
  background: #feeceb;
  color: #9f2118;
}

.lead-record-section {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.lead-section-heading > div {
  gap: 8px;
}

.lead-section-heading > div > span {
  color: var(--wood);
  font-size: 11px;
  font-weight: 950;
}

.lead-section-heading h3 {
  font-size: 15px;
}

.lead-route-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.lead-address {
  margin: 11px 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.45;
}

.lead-location-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.65fr);
  gap: 14px;
  align-items: stretch;
}

.lead-map-frame {
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e6eee6;
}

.lead-map-frame iframe {
  width: 100%;
  min-height: 300px;
  height: 100%;
  display: block;
  border: 0;
}

.lead-map-empty,
.lead-media-empty {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 22px;
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 800;
  text-align: center;
}

.lead-fact-grid {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 0;
  margin: 0;
}

.lead-fact-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
}

.lead-fact-grid > div {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.lead-fact-grid dt {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.lead-fact-grid dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.lead-record-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.lead-service-list,
.lead-risk-list {
  display: grid;
  gap: 0;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.lead-service-list li,
.lead-risk-list li {
  position: relative;
  border-bottom: 1px solid var(--line);
  padding: 8px 4px 8px 20px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.lead-service-list li::before,
.lead-risk-list li::before {
  content: "";
  position: absolute;
  top: 13px;
  left: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.lead-risk-list li::before {
  background: var(--amber);
}

.lead-notes-copy {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.lead-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.lead-media-item {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.lead-media-item img,
.lead-media-item video,
.lead-media-file-icon {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
  object-fit: cover;
  background: #0b1710;
}

.lead-media-file-icon {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  font-weight: 950;
}

.lead-media-item figcaption {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.lead-media-item strong,
.lead-media-item span,
.lead-media-item a {
  overflow-wrap: anywhere;
}

.lead-media-item strong {
  color: var(--green-dark);
  font-size: 12px;
}

.lead-media-item span,
.lead-media-item a {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.lead-media-item a {
  color: var(--green);
  text-decoration: underline;
}

.lead-media-empty {
  min-height: 74px;
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (min-width: 1201px) {
  .lead-workspace #leads table {
    table-layout: fixed;
  }

  .lead-workspace #leads th,
  .lead-workspace #leads td {
    padding-inline: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .lead-workspace #leads th:nth-child(1),
  .lead-workspace #leads td:nth-child(1),
  .lead-workspace #leads th:nth-child(4),
  .lead-workspace #leads td:nth-child(4),
  .lead-workspace #leads th:nth-child(6),
  .lead-workspace #leads td:nth-child(6) {
    display: none;
  }

  .lead-workspace #leads th:nth-child(2) {
    width: 29%;
  }

  .lead-workspace #leads th:nth-child(3) {
    width: 25%;
  }

  .lead-workspace #leads th:nth-child(5) {
    width: 22%;
  }

  .lead-workspace #leads th:nth-child(7) {
    width: 24%;
  }

  .lead-workspace #leads td:nth-child(3) {
    white-space: nowrap;
  }

  .lead-workspace #leads .row-actions {
    gap: 5px;
  }

  .lead-workspace #leads .button.small {
    width: 100%;
    padding-inline: 6px;
    white-space: nowrap;
  }
}

@media (max-width: 1200px) {
  .lead-workspace {
    grid-template-columns: 1fr;
  }

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

  .user-create-grid .button {
    justify-self: start;
  }

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

  .managed-user-identity,
  .managed-user-actions {
    grid-column: 1 / -1;
  }

  .lead-workspace #leads .table-wrap {
    overflow-x: visible;
  }

  .lead-workspace #leads table,
  .lead-workspace #leads tbody {
    display: block;
    width: 100%;
  }

  .lead-workspace #leads thead {
    display: none;
  }

  .lead-workspace #leads tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--green);
    border-radius: 8px;
    padding: 14px;
    background: var(--surface-2);
  }

  .lead-workspace #leads td {
    min-width: 0;
    border: 0;
    padding: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .lead-workspace #leads td::before {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .lead-workspace #leads td:nth-child(1)::before { content: "ID"; }
  .lead-workspace #leads td:nth-child(2)::before { content: "Customer"; }
  .lead-workspace #leads td:nth-child(3)::before { content: "Phone"; }
  .lead-workspace #leads td:nth-child(4)::before { content: "Service"; }
  .lead-workspace #leads td:nth-child(5)::before { content: "Status"; }
  .lead-workspace #leads td:nth-child(6)::before { content: "Created"; }
  .lead-workspace #leads td:nth-child(7)::before { content: "Action"; }

  .lead-workspace #leads td:nth-child(1),
  .lead-workspace #leads td:nth-child(7) {
    grid-column: 1 / -1;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .workspace-header,
  .split,
  .blueprint-grid,
  .quote-workbench,
  .quote-controls,
  .quote-tuning,
  .crew-roster,
  .order-editor-grid,
  .content-editor-grid {
    grid-template-columns: 1fr;
  }

  .gallery-admin {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-header {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .checklist.readiness,
  .detail-actions {
    grid-template-columns: 1fr;
  }

  .quote-line {
    grid-template-columns: 34px minmax(0, 1fr) 76px;
  }

  .quote-line span,
  .quote-line small,
  .quote-line button {
    grid-column: 2 / -1;
  }

  .timeline li {
    grid-template-columns: 56px 1fr;
  }

  .timeline em {
    grid-column: 2;
  }

  .agenda-board {
    grid-template-columns: repeat(7, minmax(180px, 1fr));
  }

  .work-item-row {
    grid-template-columns: 1fr;
  }

  .gallery-admin-list {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 580px) {
  .quote-portal-heading,
  .quote-portal-actions {
    grid-template-columns: 1fr;
  }

  .quote-portal-heading img {
    display: none;
  }

  .portal-admin-status {
    justify-self: start;
  }

  .crew-user-row,
  .user-create-grid,
  .temporary-access,
  .managed-user-row,
  .order-operational-brief dl,
  .order-evidence-grid {
    grid-template-columns: 1fr;
  }

  .managed-user-identity,
  .managed-user-actions {
    grid-column: auto;
  }

  .managed-user-actions .button,
  .user-create-grid .button,
  .temporary-access .button {
    width: 100%;
  }

  main {
    padding: 14px;
  }

  .sidebar nav,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .lead-record-columns,
  .lead-location-layout,
  .lead-fact-grid.compact,
  .lead-media-grid {
    grid-template-columns: 1fr;
  }

  .lead-record-heading,
  .lead-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .lead-record-id {
    max-width: 100%;
    text-align: left;
  }

  .lead-route-actions {
    justify-content: flex-start;
  }

  .lead-map-frame,
  .lead-map-frame iframe {
    min-height: 260px;
  }

  .lead-workspace #leads tr {
    grid-template-columns: 1fr;
  }

  .lead-workspace #leads td:nth-child(1),
  .lead-workspace #leads td:nth-child(7) {
    grid-column: auto;
  }
}

/* Emergency V36.0 — priority queue and mobile-safe admin controls */
.emergency-queue-panel {
  margin: 18px 0;
  border: 2px solid rgba(180, 35, 24, 0.44);
  border-radius: 18px;
  padding: 18px;
  background:
    radial-gradient(circle at 92% 4%, rgba(180, 35, 24, 0.10), transparent 34%),
    linear-gradient(180deg, #fff8f6, #fffdfb);
  box-shadow: 0 16px 34px rgba(104, 29, 22, 0.10);
}

.emergency-queue-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.emergency-queue-header h2 {
  margin: 2px 0 5px;
  color: #7f1d16;
}

.emergency-queue-header p:last-child {
  margin: 0;
  color: #6a3a35;
  font-weight: 700;
}

.emergency-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(180, 35, 24, 0.24);
  border-radius: 999px;
  padding: 8px 11px;
  color: #8f2018;
  background: #fff;
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.emergency-live-badge span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d92d20;
  box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.32);
  animation: emergencyPulse 1.8s infinite;
}

@keyframes emergencyPulse {
  0% { box-shadow: 0 0 0 0 rgba(217, 45, 32, 0.32); }
  70% { box-shadow: 0 0 0 8px rgba(217, 45, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 45, 32, 0); }
}

.emergency-queue {
  display: grid;
  gap: 11px;
}

.emergency-empty {
  border: 1px dashed rgba(127, 29, 22, 0.24);
  border-radius: 13px;
  padding: 18px;
  color: #6f514d;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
  font-weight: 800;
}

.emergency-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid rgba(180, 35, 24, 0.30);
  border-left: 7px solid #d92d20;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(104, 29, 22, 0.08);
}

.emergency-card.is-e1 { border-left-color: #f79009; }
.emergency-card.is-e2 { border-left-color: #d97706; }
.emergency-card.is-e3 { border-left-color: #667085; }
.emergency-card.is-acknowledged { opacity: 0.86; }

.emergency-card-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.emergency-card-topline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.emergency-triage-badge,
.emergency-flag,
.emergency-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.emergency-triage-badge {
  color: #fff;
  background: #b42318;
}

.emergency-card.is-e1 .emergency-triage-badge { background: #d97706; }
.emergency-card.is-e2 .emergency-triage-badge { background: #a15c00; }
.emergency-card.is-e3 .emergency-triage-badge { background: #475467; }

.emergency-status-badge {
  color: #7f1d16;
  background: #fee4e2;
}

.emergency-flag {
  color: #5b3a00;
  background: #fff0c2;
}

.emergency-flag.is-danger {
  color: #7f1d16;
  background: #fee4e2;
}

.emergency-flag.is-safe {
  color: #176b34;
  background: #dcfae6;
}

.emergency-card h3 {
  margin: 0;
  color: #241513;
  font-size: 18px;
}

.emergency-card-summary {
  margin: 0;
  color: #5d403c;
  font-weight: 760;
  line-height: 1.45;
}

.emergency-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #694b46;
  font-size: 12px;
  font-weight: 730;
}

.emergency-card-actions {
  min-width: 190px;
  display: grid;
  align-content: start;
  gap: 7px;
}

.emergency-card-actions .button,
.emergency-card-actions a.button {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.emergency-card-actions .emergency-call {
  color: #fff;
  background: #b42318;
  border-color: #b42318;
}

.emergency-card-actions .emergency-ack {
  color: #fff;
  background: #087a27;
  border-color: #087a27;
}

.emergency-detail {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 14px;
  padding: 13px;
  background: #fff8f6;
}

.emergency-detail[hidden] { display: none; }

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

.emergency-detail-title strong { color: #9f2118; }
.emergency-detail-title span { color: #75514c; font-size: 12px; font-weight: 800; }

.emergency-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.emergency-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
}

.emergency-detail-grid div {
  border: 1px solid rgba(180, 35, 24, 0.12);
  border-radius: 10px;
  padding: 9px;
  background: #fff;
}

.emergency-detail-grid dt {
  color: #7f1d16;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.emergency-detail-grid dd {
  margin: 4px 0 0;
  color: #2d211f;
  font-size: 12px;
  font-weight: 760;
  line-height: 1.4;
}

body.has-open-emergency::before {
  content: "EMERGENCIA 24/7 ABIERTA";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: block;
  padding: 5px 10px;
  color: #fff;
  background: #b42318;
  text-align: center;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.05em;
}

body.has-open-emergency .sidebar,
body.has-open-emergency main {
  margin-top: 24px;
}

@media (max-width: 760px) {
  .emergency-queue-panel {
    margin: 12px 0;
    border-radius: 14px;
    padding: 12px;
  }

  .emergency-queue-header {
    display: grid;
  }

  .emergency-live-badge {
    justify-self: start;
  }

  .emergency-card {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .emergency-card-actions {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .emergency-card-actions .emergency-call {
    grid-column: 1 / -1;
  }

  .emergency-detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .emergency-live-badge span { animation: none; }
}

/* Agenda V35.6 — five one-hour visits with one-hour operational buffers. */
.agenda-events-v356 {
  align-content: start;
  min-height: 0;
}

.agenda-slot {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface);
  font-size: 11px;
}

.agenda-slot strong,
.agenda-slot span,
.agenda-slot b,
.agenda-slot small,
.agenda-slot a {
  display: block;
}

.agenda-slot strong {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 950;
}

.agenda-slot span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.agenda-slot b {
  margin-top: 2px;
  font-size: 12px;
}

.agenda-slot small {
  color: var(--muted);
}

.agenda-slot a {
  color: var(--green-dark);
  font-weight: 900;
}

.agenda-slot.is-available {
  border-left-color: #7aa889;
  background: color-mix(in srgb, var(--surface) 92%, #dff4e5 8%);
}

.agenda-slot.is-booked {
  border-left-color: var(--wood);
  background: color-mix(in srgb, var(--surface) 90%, #f4e8d9 10%);
}

.agenda-slot.is-conflict {
  border-color: #b42318;
  border-left-color: #b42318;
  background: #fff0ee;
}

.agenda-slot.is-conflict span {
  color: #b42318;
}

.agenda-slot.is-closed {
  opacity: 0.65;
  border-left-color: #858b86;
}

.agenda-orders {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.agenda-orders > strong {
  color: var(--wood-dark, var(--green-dark));
  font-size: 10px;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .agenda-slot {
    min-width: 170px;
  }
}

/* V42.2 · Customer-facing quote copy guard */
.quote-message > small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

/* V42.3 · Structured quote negotiation */
.quote-negotiation {
  display: grid;
  gap: 14px;
  margin-top: 5px;
  border: 1px solid color-mix(in srgb, var(--green) 26%, var(--line));
  border-radius: 12px;
  padding: 15px;
  background: color-mix(in srgb, var(--surface-2) 82%, #eef8ef);
}
.quote-negotiation-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.quote-negotiation-heading h4 { margin: 0; color: var(--green-dark); font-size: 16px; }
.quote-negotiation-heading > span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}
.quote-negotiation-heading > span.is-waiting { border-color: #e0bd77; background: #fff4d8; color: #795100; }
.quote-negotiation-heading > span.is-complete { border-color: #9dc8a6; background: #e8f6ec; color: #176b34; }
.quote-change-request {
  border-left: 4px solid #d49a27;
  border-radius: 0 9px 9px 0;
  padding: 12px 13px;
  background: #fff9e9;
  color: #493a17;
}
.quote-change-request blockquote { margin: 8px 0; font-size: 13px; font-weight: 800; line-height: 1.55; white-space: pre-line; }
.quote-change-request > p:last-child { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.quote-change-request small { color: #806525; font-size: 10px; font-weight: 800; }
.quote-negotiation-timeline { display: grid; gap: 8px; }
.quote-negotiation-timeline article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px;
  background: var(--surface);
}
.quote-negotiation-timeline article.is-customer { border-left: 4px solid #d49a27; }
.quote-negotiation-timeline article.is-admin { border-left: 4px solid var(--green); }
.quote-negotiation-timeline article > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.quote-negotiation-timeline strong { color: var(--green-dark); font-size: 12px; }
.quote-negotiation-timeline p { margin: 0; color: var(--ink); font-size: 12px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.quote-negotiation-timeline small { color: var(--muted); font-size: 10px; }
.quote-negotiation-editor { display: grid; gap: 13px; border-top: 1px solid var(--line); padding-top: 14px; }
.quote-negotiation-instruction { margin: 0; color: var(--muted); font-size: 12px; font-weight: 750; line-height: 1.55; }
.quote-negotiation-outcomes { display: grid; gap: 8px; margin: 0; border: 0; padding: 0; }
.quote-negotiation-outcomes legend { margin-bottom: 8px; color: var(--green-dark); font-size: 12px; font-weight: 950; }
.quote-negotiation-outcomes label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: var(--surface);
  cursor: pointer;
}
.quote-negotiation-outcomes input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--green); }
.quote-negotiation-outcomes span { display: grid; gap: 3px; }
.quote-negotiation-outcomes strong { color: var(--green-dark); font-size: 12px; }
.quote-negotiation-outcomes small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.quote-negotiation-response { display: grid; gap: 7px; color: var(--green-dark); font-size: 12px; font-weight: 900; }
.quote-negotiation-response textarea { min-height: 118px; resize: vertical; }
.quote-negotiation-response small { color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.4; }
.quote-negotiation-actions { display: grid; gap: 8px; }
.quote-negotiation-actions > span { min-height: 18px; color: var(--muted); font-size: 11px; font-weight: 800; }
.quote-negotiation-actions > span.is-success { color: #176b34; }
.quote-negotiation-actions > span.is-error { color: #9f2118; }

@media (max-width: 580px) {
  .quote-negotiation-heading,
  .quote-negotiation-timeline article > div { align-items: flex-start; flex-direction: column; }
}

/* V42.4 approved-scope integrity */
.quote-scope-details {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.quote-scope-details small {
  line-height: 1.45;
}

.scope-authorization-note {
  margin-top: 12px;
  border: 1px solid #9fcca8;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 10px 12px;
  background: #eef8f0;
  color: #174b28;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.5;
}

.quote-line-main {
  min-width: 0;
}

.quote-line-main label {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.quote-line-main textarea {
  min-height: 58px;
  resize: vertical;
  font-size: 12px;
  line-height: 1.4;
}

.work-item-description {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
}

.order-preview-services {
  display: grid;
  gap: 7px;
  margin: 10px 0;
  padding: 0;
  list-style: none;
}

.order-preview-services li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  background: var(--surface-2);
}

.order-preview-services li span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.order-preview-services li small {
  color: var(--muted);
  font-weight: 850;
}

@media (max-width: 900px) {
  .quote-line {
    grid-template-columns: 34px minmax(0, 1fr) 36px;
  }

  .quote-line > span {
    grid-column: 2;
  }

  .quote-line > button {
    grid-column: 3;
    grid-row: 1;
  }
}

/* V42.4 · exact included scope and commercial terms */
.quote-commercial-terms {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid #cbd8cc;
  border-radius: 14px;
  background: #f6faf6;
}
.quote-commercial-terms label {
  min-width: 0;
  font-weight: 800;
  color: #173b24;
}
.quote-commercial-terms textarea {
  width: 100%;
  margin-top: 7px;
  resize: vertical;
  line-height: 1.55;
}
@media (max-width: 760px) {
  .quote-commercial-terms { grid-template-columns: 1fr; }
}

/* V42.5 · Admin operations, notification center and separated schedules */
.notification-center {
  position: relative;
  z-index: 50;
}

.notification-bell {
  position: relative;
  width: 44px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--green-dark);
  cursor: pointer;
}

.notification-bell:hover,
.notification-bell:focus-visible {
  border-color: var(--green);
  outline: 3px solid rgba(8, 122, 39, 0.16);
}

.notification-bell svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 23px;
  height: 23px;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 950;
}

.notification-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 110px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(7, 26, 16, 0.24);
}

.notification-popover > header,
.notification-family-link,
.outbox-item-heading {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.notification-popover h2 {
  margin: 0;
  font-size: 20px;
}

.notification-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

.notification-help {
  margin: 12px 0;
  border-left: 4px solid var(--green);
  padding: 9px 11px;
  background: #eef8f0;
  color: #274f33;
  font-size: 12px;
  line-height: 1.45;
}

.notification-groups,
.notification-family,
.notification-family-items {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.notification-family {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.notification-family-link {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 9px;
  padding: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.notification-family-link:hover,
.notification-family-link:focus-visible {
  background: var(--surface-2);
  outline: 2px solid rgba(8, 122, 39, 0.13);
}

.notification-family-arrow {
  color: var(--green);
  font-weight: 900;
}

.notification-family-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--green-dark);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.notification-family-link strong,
.notification-family-link small {
  display: block;
}

.notification-family-link small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.notification-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: var(--surface-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.notification-item:hover,
.notification-item:focus-visible {
  border-color: var(--green);
  outline: 2px solid rgba(8, 122, 39, 0.13);
}

.notification-item.is-unread {
  border-left: 5px solid var(--green);
  background: #eef8f0;
}

.notification-dot {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 999px;
  background: transparent;
}

.notification-item.is-unread .notification-dot {
  background: var(--green);
}

.notification-item-copy,
.notification-item-copy strong,
.notification-item-copy span,
.notification-item-copy small {
  min-width: 0;
  display: block;
  overflow-wrap: anywhere;
}

.notification-item-copy strong {
  font-size: 13px;
}

.notification-item-copy span {
  margin-top: 3px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
}

.notification-item-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.scheduling-separation {
  min-width: 0;
  display: grid;
  gap: 20px;
}

.system-summary-grid {
  grid-template-columns: 1fr;
}

.estimate-agenda-panel {
  border-top: 5px solid var(--blue);
}

.operations-agenda-panel {
  border-top: 5px solid var(--green);
}

.schedule-kind-badge,
.orders-limit-note {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.schedule-kind-badge.estimate {
  background: #eaf4fb;
  color: #174e70;
}

.schedule-kind-badge.operations,
.orders-limit-note {
  background: #e8f4ea;
  color: var(--green-dark);
}

.operations-toolbar {
  align-items: end;
}

.operations-toolbar label {
  display: grid;
  gap: 4px;
}

.operations-toolbar select {
  min-width: 180px;
}

.operations-agenda-board {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(250px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.operations-day {
  min-width: 250px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-2);
  overflow: hidden;
}

.operations-day > header {
  padding: 11px 12px;
  background: var(--green-dark);
  color: #fff;
  font-weight: 900;
}

.operations-day-content,
.crew-day-lane,
.crew-day-orders {
  display: grid;
  gap: 9px;
}

.operations-day-content {
  padding: 10px;
}

.crew-day-lane {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
  background: var(--surface);
}

.crew-day-lane > header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--green-dark);
  font-size: 12px;
}

.crew-day-lane > header span {
  border-radius: 999px;
  padding: 3px 7px;
  background: #e8f4ea;
  font-size: 10px;
  font-weight: 900;
}

.crew-day-lane > header span.at-capacity {
  background: #fff0e8;
  color: #8a331f;
}

.operation-event {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 8px;
  padding: 9px;
  background: var(--surface-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.operation-event:hover,
.operation-event:focus-visible {
  border-color: var(--green);
  outline: 2px solid rgba(8, 122, 39, 0.13);
}

.operation-event.is-overrun {
  border-left-color: var(--danger);
  background: #fff1ef;
}

.operation-sequence {
  grid-row: 1 / span 4;
  min-width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: var(--green-dark);
  color: #fff;
  font-size: 11px;
  font-weight: 950;
}

.operation-time,
.operation-event strong,
.operation-event small,
.operation-event em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.operation-time,
.operation-event strong {
  font-size: 12px;
  font-weight: 900;
}

.operation-event small,
.operation-event em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  line-height: 1.35;
}

.operation-event.is-overrun em {
  color: var(--danger);
  font-weight: 900;
}

.crews-module {
  min-width: 0;
}

.orders-module {
  min-width: 0;
  border-top: 5px solid var(--green);
}

.orders-module-header {
  align-items: flex-start;
}

.orders-workspace {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(390px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.orders-list-column,
.orders-table-wrap,
.order-editor-panel,
.audit-panel,
.outbox,
.outbox-item {
  min-width: 0;
}

.orders-table-wrap {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.orders-table {
  min-width: 1180px;
}

.orders-table tr[data-order-id] {
  cursor: pointer;
}

.orders-table tr[data-order-id]:hover td,
.orders-table tr[data-order-id]:focus td {
  background: #f0f8f1;
}

.orders-table th:last-child,
.orders-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: -8px 0 12px rgba(23, 34, 27, 0.06);
}

.orders-table tr.selected td:last-child {
  background: #eef8f0;
}

.order-editor-panel {
  position: sticky;
  top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--surface-2);
}

.operational-schedule-callout {
  display: grid;
  gap: 5px;
  margin: 12px 0 15px;
  border: 1px solid #9fcca8;
  border-left: 5px solid var(--green);
  border-radius: 10px;
  padding: 11px 12px;
  background: #eef8f0;
  color: #174b28;
  font-size: 12px;
  line-height: 1.45;
}

.order-editor-grid output {
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 850;
}

.order-save-status {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.order-save-status.is-success {
  color: var(--green);
}

.order-save-status.is-error {
  color: var(--danger);
}

.audit-panel {
  overflow: hidden;
}

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

.outbox-item {
  overflow: hidden;
}

.outbox-item-heading strong,
.outbox-item p,
.outbox-item small {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.outbox-item-heading strong {
  flex: 1 1 auto;
  font-size: 12px;
}

.outbox-item p {
  margin: 7px 0;
  font-size: 12px;
  line-height: 1.4;
}

.agenda-slot[type="button"] {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.agenda-phone {
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
}

@media (max-width: 1280px) {
  .orders-workspace {
    grid-template-columns: 1fr;
  }

  .order-editor-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .notification-popover {
    position: fixed;
    top: 72px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .operations-agenda-board {
    grid-template-columns: repeat(7, minmax(230px, 1fr));
  }

  .orders-limit-note {
    align-self: flex-start;
  }
}

@media (max-width: 620px) {
  .header-actions {
    align-items: center;
  }

  .notification-bell {
    width: 42px;
  }

  .orders-table {
    min-width: 980px;
  }

  .order-editor-panel {
    padding: 14px;
  }
}

/* ========================================================================== 
   ADMIN UX V43.0 · PREMIUM INFORMATION ARCHITECTURE
   ========================================================================== */
:root {
  --admin-sidebar-width: 272px;
  --admin-header-height: 88px;
  --admin-canvas: #f5f6f2;
  --admin-card: #ffffff;
  --admin-card-soft: #f8faf7;
  --admin-border: #dfe6dd;
  --admin-border-strong: #c7d2c7;
  --admin-ink: #16221a;
  --admin-muted: #66736a;
  --admin-green: #087a27;
  --admin-green-strong: #045619;
  --admin-green-soft: #eaf5ec;
  --admin-gold: #9b6b2f;
  --admin-red: #b42318;
  --admin-amber: #a66008;
  --admin-blue: #245a7a;
  --admin-radius: 16px;
  --admin-radius-sm: 10px;
  --admin-shadow: 0 12px 36px rgba(21, 39, 27, .08);
  --admin-shadow-soft: 0 5px 18px rgba(21, 39, 27, .06);
}

html { scroll-behavior: smooth; }
body {
  grid-template-columns: var(--admin-sidebar-width) minmax(0, 1fr);
  background: var(--admin-canvas);
  color: var(--admin-ink);
  overflow-x: hidden;
}
body.admin-menu-open { overflow: hidden; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sidebar {
  width: var(--admin-sidebar-width);
  gap: 14px;
  padding: 20px 16px 14px;
  border-right: 1px solid rgba(255,255,255,.12);
  background:
    radial-gradient(circle at 12% 4%, rgba(21, 150, 57, .24), transparent 28%),
    linear-gradient(180deg, #071c11 0%, #06150d 100%);
  box-shadow: 12px 0 35px rgba(6, 24, 13, .11);
  z-index: 60;
}
.sidebar .brand {
  min-height: 68px;
  padding: 8px 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar .brand img { width: 52px; height: 52px; border-radius: 12px; }
.sidebar .brand strong { font-size: 18px; }
.sidebar .brand small { margin-top: 3px; color: #9fc2a8; font-size: 10px; letter-spacing: .08em; }
.sidebar-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.nav-label {
  margin: 18px 10px 8px;
  color: #83a68d;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sidebar nav { gap: 4px; }
.sidebar nav a {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #d5e4d8;
  font-size: 13px;
  font-weight: 760;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.sidebar nav a img { width: 19px; height: 19px; filter: brightness(0) invert(1); opacity: .78; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.08); transform: translateX(2px); }
.sidebar nav a.active { background: #f4f8f4; border-color: #fff; color: #064617; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.sidebar nav a.active img { filter: none; opacity: 1; }
.nav-counter {
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border-radius: 999px;
  background: #d92d20;
  color: #fff;
  font-size: 10px;
}
.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 13px 10px 2px;
  border-top: 1px solid rgba(255,255,255,.12);
  color: #9fc2a8;
  font-size: 11px;
}
.sidebar-footer .text-button { color: #fff; }

main { min-width: 0; padding: 0 34px 52px; }
.workspace-header {
  position: sticky;
  top: 0;
  min-height: var(--admin-header-height);
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 24px;
  margin: 0 -34px 26px;
  padding: 14px 34px;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(250, 251, 248, .94);
  backdrop-filter: blur(16px);
  z-index: 45;
}
.page-heading { min-width: 0; }
.page-heading .eyebrow { margin-bottom: 3px; }
.page-heading h1 { margin: 0; font-size: clamp(23px, 2vw, 30px); line-height: 1.15; }
.page-heading > p:last-child { margin: 5px 0 0; color: var(--admin-muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 9px; }
.global-search { width: min(28vw, 330px); }
.global-search input,
.module-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--admin-border-strong);
  border-radius: 12px;
  background: #fff;
  padding: 0 14px;
  color: var(--admin-ink);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.02);
}
.global-search input:focus,
.module-search input:focus { outline: 3px solid rgba(8, 122, 39, .13); border-color: var(--admin-green); }
.icon-button,
.mobile-menu-button {
  min-width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--admin-border);
  border-radius: 11px;
  background: #fff;
  color: var(--admin-green-strong);
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}
.mobile-menu-button { display: none; }
.button.quiet { background: transparent; }

.global-alert {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(420px, calc(100vw - 48px));
  z-index: 100;
  border: 1px solid #f2b8b5;
  border-left: 5px solid var(--admin-red);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
  color: #771f18;
  box-shadow: var(--admin-shadow);
  font-size: 13px;
  font-weight: 750;
}
.global-alert.is-success { border-color: #a6d8b2; border-left-color: var(--admin-green); color: var(--admin-green-strong); }

.admin-page { display: none; animation: adminPageIn .2s ease; }
.admin-page.active { display: block; }
@keyframes adminPageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.page-intro {
  min-height: 64px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 20px;
}
.page-intro h2 { margin: 1px 0 5px; font-size: clamp(22px, 2.2vw, 34px); }
.page-intro p:not(.eyebrow) { max-width: 760px; margin: 0; color: var(--admin-muted); line-height: 1.55; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel,
.metric-card,
.emergency-queue-panel,
.quote-workbench > .panel,
.orders-module {
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  background: var(--admin-card);
  box-shadow: var(--admin-shadow-soft);
}
.panel { overflow: hidden; }
.panel-header { border-bottom-color: var(--admin-border); }
.panel-header h2 { font-size: 20px; }

.actionable-status-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}
.metric-card {
  min-height: 138px;
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto auto auto;
  gap: 2px 13px;
  padding: 20px;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.metric-card:hover { transform: translateY(-3px); border-color: #b5c8b8; box-shadow: var(--admin-shadow); }
.metric-card img { grid-row: 1 / 4; width: 38px; height: 38px; padding: 8px; border-radius: 11px; background: var(--admin-green-soft); }
.metric-card span { color: var(--admin-muted); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .03em; }
.metric-card strong { font-size: 30px; line-height: 1.15; color: var(--admin-green-strong); }
.metric-card small { color: var(--admin-muted); font-size: 11px; }
.metric-card.urgent { border-color: #efc2bf; }
.metric-card.urgent img { background: #fff0ef; }
.metric-card.urgent strong { color: var(--admin-red); }

.dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 18px; }
.action-list,
.timeline-list { display: grid; gap: 0; padding: 4px 20px 18px; }
.action-item,
.timeline-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 12px 0;
  border-bottom: 1px solid #edf0ec;
}
.action-item:last-child,
.timeline-item:last-child { border-bottom: 0; }
.action-item-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--admin-green); }
.action-item.is-urgent .action-item-dot { background: var(--admin-red); box-shadow: 0 0 0 5px #fff0ef; }
.action-item strong,
.timeline-item strong { display: block; font-size: 13px; }
.action-item span,
.timeline-item span { display: block; margin-top: 3px; color: var(--admin-muted); font-size: 11px; }
.action-item button,
.timeline-item button { white-space: nowrap; }

.module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.segmented-control {
  max-width: 100%;
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #edf1ec;
  overflow-x: auto;
}
.segmented-control button,
.entity-tabs button,
.order-detail-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 9px;
  padding: 8px 13px;
  background: transparent;
  color: #4e5d53;
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
  cursor: pointer;
}
.segmented-control button.active,
.entity-tabs button.active,
.order-detail-tabs button.active { background: #fff; color: var(--admin-green-strong); box-shadow: 0 2px 8px rgba(18, 45, 25, .09); }
.module-search { width: min(360px, 100%); }
.module-search.wide { width: min(580px, 100%); }

.emergency-queue-panel { margin-bottom: 16px; box-shadow: none; }
.emergency-queue-header { border-radius: var(--admin-radius) var(--admin-radius) 0 0; }
.inbox-workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, .7fr); gap: 16px; }
.inbox-workspace > .panel { min-width: 0; }
#leadDetailPanel { position: sticky; top: calc(var(--admin-header-height) + 18px); align-self: start; max-height: calc(100vh - var(--admin-header-height) - 48px); overflow-y: auto; }
#leads .table-wrap { max-height: calc(100vh - 310px); }
#leads table { min-width: 860px; }
#leads td:first-child { max-width: 115px; overflow: hidden; text-overflow: ellipsis; }
.row-actions { flex-wrap: nowrap; }

.calendar-tabs,
.entity-tabs { margin-bottom: 16px; }
.calendar-tab-panel { display: none; }
.calendar-tab-panel.active { display: block; }
.scheduling-separation { display: block; }
.calendar-tab-panel .agenda-panel,
.calendar-tab-panel .operations-agenda-panel { width: 100%; min-height: 540px; }

.entity-tabs {
  position: sticky;
  top: calc(var(--admin-header-height) + 1px);
  z-index: 30;
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--admin-border);
  border-radius: 13px;
  background: rgba(245,246,242,.96);
  backdrop-filter: blur(12px);
  overflow-x: auto;
}
.quote-entity-workspace { grid-template-columns: minmax(0, 1fr) minmax(330px, 420px); gap: 16px; }
.quote-builder-panel [data-quote-section],
.quote-summary-panel[data-quote-section] { display: none; }
.quote-entity-workspace[data-active-quote-tab="builder"] [data-quote-section="builder"],
.quote-entity-workspace[data-active-quote-tab="terms"] [data-quote-section="terms"],
.quote-entity-workspace[data-active-quote-tab="portal"] [data-quote-section="portal"] { display: grid; }
.quote-entity-workspace[data-active-quote-tab="builder"] .quote-summary-panel,
.quote-entity-workspace[data-active-quote-tab="terms"] .quote-summary-panel { display: block; }
.quote-entity-workspace[data-active-quote-tab="portal"] .quote-builder-panel { display: none; }
.quote-actions { position: sticky; bottom: 0; z-index: 8; margin: 20px -24px -24px; padding: 14px 24px; border-top: 1px solid var(--admin-border); background: rgba(255,255,255,.95); backdrop-filter: blur(10px); }
#convertQuoteOrder { display: none; }
.quote-summary-panel { align-self: start; position: sticky; top: calc(var(--admin-header-height) + 72px); max-height: calc(100vh - var(--admin-header-height) - 90px); overflow-y: auto; }

.orders-entity-workspace { padding: 0; }
.orders-module-header { padding: 18px 20px; }
.orders-workspace { display: grid; grid-template-columns: minmax(0, .9fr) minmax(430px, 1.1fr); gap: 0; }
.orders-list-column { border-right: 1px solid var(--admin-border); }
.orders-table-wrap { max-height: calc(100vh - 275px); overflow: auto; }
.orders-table { min-width: 0 !important; width: 100%; table-layout: fixed; }
.orders-table th:nth-child(3), .orders-table td:nth-child(3),
.orders-table th:nth-child(4), .orders-table td:nth-child(4) { display: none; }
.orders-table th:nth-child(1) { width: 29%; }
.orders-table th:nth-child(2) { width: 31%; }
.orders-table th:nth-child(5) { width: 15%; }
.orders-table th:nth-child(6) { width: 15%; }
.orders-table th:nth-child(7) { width: 10%; }
.orders-table td { padding: 13px 10px; vertical-align: middle; }
.orders-table td strong, .orders-table td small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-editor-panel { position: relative; min-width: 0; padding: 22px; border: 0; border-radius: 0 0 var(--admin-radius) 0; background: #fff; max-height: calc(100vh - 245px); overflow-y: auto; }
.order-detail-tabs { display: flex; gap: 3px; margin: 18px 0; padding: 4px; border: 1px solid var(--admin-border); border-radius: 12px; background: #edf1ec; overflow-x: auto; }
.order-editor-panel [data-order-section] { display: none !important; }
.order-editor-panel[data-active-order-tab="summary"] [data-order-section="summary"],
.order-editor-panel[data-active-order-tab="schedule"] [data-order-section="schedule"],
.order-editor-panel[data-active-order-tab="crew"] [data-order-section="crew"],
.order-editor-panel[data-active-order-tab="collection"] [data-order-section="collection"],
.order-editor-panel[data-active-order-tab="evidence"] [data-order-section="evidence"] { display: grid !important; }
.order-editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.order-editor-panel .detail-actions { position: sticky; bottom: -22px; z-index: 8; margin: 20px -22px -22px; padding: 14px 22px; border-top: 1px solid var(--admin-border); background: rgba(255,255,255,.96); }

.clients-workspace { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr); gap: 16px; }
.client-detail { position: sticky; top: calc(var(--admin-header-height) + 18px); align-self: start; padding: 22px; }
.client-summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 18px; }
.client-summary-grid div { border: 1px solid var(--admin-border); border-radius: 11px; padding: 12px; background: var(--admin-card-soft); }
.client-summary-grid strong { display: block; margin-top: 4px; }
.compact-table { min-width: 720px; }

.report-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 18px; }
.report-card { border: 1px solid var(--admin-border); border-radius: var(--admin-radius); padding: 18px; background: #fff; box-shadow: var(--admin-shadow-soft); }
.report-card span { color: var(--admin-muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.report-card strong { display: block; margin-top: 8px; font-size: 27px; color: var(--admin-green-strong); }
.report-card small { display: block; margin-top: 5px; color: var(--admin-muted); }
.bar-report { display: grid; gap: 12px; padding: 18px 22px 24px; }
.bar-report-row { display: grid; grid-template-columns: minmax(100px,.7fr) minmax(120px,1.3fr) 36px; align-items: center; gap: 10px; font-size: 12px; }
.bar-report-track { height: 9px; border-radius: 999px; background: #edf1ec; overflow: hidden; }
.bar-report-fill { height: 100%; border-radius: inherit; background: var(--admin-green); }

.notification-page-layout { display: grid; grid-template-columns: 260px minmax(0,1fr); gap: 16px; }
.notification-family-nav { padding: 10px; align-self: start; position: sticky; top: calc(var(--admin-header-height) + 18px); }
.notification-family-nav button { width: 100%; display: flex; justify-content: space-between; gap: 12px; border: 0; border-radius: 10px; padding: 11px 12px; background: transparent; color: var(--admin-ink); text-align: left; font-weight: 760; cursor: pointer; }
.notification-family-nav button:hover,
.notification-family-nav button.active { background: var(--admin-green-soft); color: var(--admin-green-strong); }
.notification-page-list { padding: 10px 20px; }
.notification-page-list .notification-family { border-bottom: 1px solid var(--admin-border); padding: 10px 0 18px; }
.notification-page-list .notification-family-link { pointer-events: none; }
.notification-page-list .notification-family-items { max-height: none; }

#content.panel, #users.panel, #crews.panel, #audit.panel { box-shadow: var(--admin-shadow-soft); }
#content, #users, #crews, #audit { margin: 0; }
#users { display: block; }
#systemPage .blueprint-grid { grid-template-columns: 1fr; }
.system-audit-card { margin-top: 16px; }

.notification-popover { right: 0; width: min(460px, calc(100vw - 30px)); max-height: min(680px, calc(100vh - 100px)); border-radius: 15px; box-shadow: 0 20px 65px rgba(9, 27, 16, .24); }
.notification-bell { border-radius: 11px; }
.notification-item { border-radius: 10px; }
.outbox-item { overflow-wrap: anywhere; }

.text-button { border: 0; background: transparent; color: var(--admin-green); font-weight: 850; cursor: pointer; }
.empty-state { padding: 26px; color: var(--admin-muted); text-align: center; }

@media (max-width: 1280px) {
  :root { --admin-sidebar-width: 238px; }
  main { padding-left: 24px; padding-right: 24px; }
  .workspace-header { margin-left: -24px; margin-right: -24px; padding-left: 24px; padding-right: 24px; }
  .global-search { width: 250px; }
  .actionable-status-grid, .report-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .orders-workspace { grid-template-columns: minmax(0,.8fr) minmax(400px,1.2fr); }
}

@media (max-width: 1050px) {
  body { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-104%);
    transition: transform .22s ease;
  }
  body.admin-menu-open .sidebar { transform: none; }
  body.admin-menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(3,16,8,.55); z-index: 55; }
  main { padding: 0 20px 42px; }
  .workspace-header { grid-template-columns: auto minmax(0,1fr) auto; margin: 0 -20px 22px; padding: 12px 20px; }
  .mobile-menu-button { display: inline-grid; }
  .page-heading > p:last-child, .date-chip { display: none; }
  .global-search { width: 210px; }
  .inbox-workspace, .clients-workspace, .dashboard-layout { grid-template-columns: 1fr; }
  #leadDetailPanel, .client-detail { position: static; max-height: none; }
  .quote-entity-workspace { grid-template-columns: 1fr; }
  .quote-summary-panel { position: static; max-height: none; }
  .orders-workspace { grid-template-columns: 1fr; }
  .orders-list-column { border-right: 0; border-bottom: 1px solid var(--admin-border); }
  .orders-table-wrap { max-height: 420px; }
  .order-editor-panel { max-height: none; border-radius: 0 0 var(--admin-radius) var(--admin-radius); }
}

@media (max-width: 760px) {
  main { padding: 0 14px 34px; }
  .workspace-header { grid-template-columns: auto minmax(0,1fr) auto; margin-left: -14px; margin-right: -14px; padding: 10px 14px; min-height: 72px; }
  .page-heading .eyebrow, .page-heading > p:last-child { display: none; }
  .page-heading h1 { font-size: 20px; }
  .global-search, .user-chip, .header-actions .button.quiet { display: none; }
  .header-actions { gap: 6px; }
  .page-intro { display: block; }
  .page-intro .quick-actions { margin-top: 14px; }
  .actionable-status-grid, .report-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric-card { min-height: 112px; grid-template-columns: 32px 1fr; padding: 14px; }
  .metric-card img { width: 32px; height: 32px; padding: 6px; }
  .metric-card strong { font-size: 23px; }
  .module-toolbar { align-items: stretch; flex-direction: column; }
  .segmented-control { width: 100%; }
  .module-search { width: 100%; }
  .entity-tabs { top: 72px; }
  .inbox-workspace { display: block; }
  #leadDetailPanel { margin-top: 14px; }
  .quote-controls, .quote-tuning, .quote-commercial-terms, .content-editor-grid, .user-create-grid, .order-editor-grid { grid-template-columns: 1fr !important; }
  .orders-table th:nth-child(5), .orders-table td:nth-child(5) { display: none; }
  .orders-table th:nth-child(1) { width: 34%; }
  .orders-table th:nth-child(2) { width: 38%; }
  .orders-table th:nth-child(6) { width: 18%; }
  .orders-table th:nth-child(7) { width: 10%; }
  .order-detail-tabs { margin-left: -6px; margin-right: -6px; }
  .notification-page-layout { grid-template-columns: 1fr; }
  .notification-family-nav { position: static; display: flex; overflow-x: auto; }
  .notification-family-nav button { width: auto; white-space: nowrap; }
  .client-summary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .actionable-status-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 96px; }
  .page-intro h2 { font-size: 25px; }
  .orders-table th:nth-child(2), .orders-table td:nth-child(2) { display: none; }
  .orders-table th:nth-child(1) { width: 58%; }
  .orders-table th:nth-child(6) { width: 28%; }
  .orders-table th:nth-child(7) { width: 14%; }
  .notification-popover { position: fixed; inset: 74px 10px auto; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ========================================================================== 
   ADMIN UX V43.1A · ESPAÑOL ADMINISTRATIVO Y MAESTRO-DETALLE RESPONSIVE
   ========================================================================== */
:root { --admin-ux-release: "admin-ux-v43.1"; }

/* La administrativa usa un solo desplazamiento vertical. */
#leads .table-wrap,
#leadDetailPanel,
.orders-table-wrap,
.order-editor-panel {
  scrollbar-gutter: stable;
}

.inbox-workspace {
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

#leadDetailPanel {
  position: static;
  max-height: none;
  overflow: visible;
  min-width: 0;
}

#leadDetailPanel.panel { overflow: visible; }
#leads .table-wrap {
  max-height: none;
  overflow-x: auto;
  overflow-y: visible;
}
#leads table { min-width: 900px; }
#leads th,
#leads td { vertical-align: middle; }
#leads td strong,
#leads td small { overflow-wrap: anywhere; }
#leads td:last-child .button { min-width: 78px; white-space: nowrap; }
#leads .status-pill { max-width: 100%; white-space: normal; line-height: 1.2; text-align: center; }

/* El expediente deja de competir con su ID técnico. */
.lead-record-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 34%);
  align-items: start;
}
.lead-record-id {
  max-width: none;
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  background: var(--admin-card-soft);
  text-align: left;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.lead-record-id small {
  color: var(--admin-muted);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Información secundaria en acordeones: menos ruido, misma lógica. */
.lead-record-accordion {
  padding: 0;
  border-top: 1px solid var(--admin-border);
}
.lead-record-accordion > summary {
  min-height: 58px;
  padding: 14px 2px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.lead-record-accordion > summary::-webkit-details-marker { display: none; }
.lead-record-accordion > summary:hover h3 { color: var(--admin-green); }
.lead-record-section-body { padding: 0 2px 18px; }
.lead-section-tools { display: flex; justify-content: flex-end; margin: 0 0 8px; }
.accordion-indicator {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--admin-green-soft);
  color: var(--admin-green-strong);
}
.accordion-indicator::before { content: "+"; font-size: 17px; font-weight: 900; line-height: 1; }
details[open] > summary .accordion-indicator::before { content: "−"; }

/* Paneles de detalle claros y sin traslapes. */
.lead-location-layout { grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); }
.lead-map-frame { min-height: 260px; }
.lead-map-frame iframe { min-height: 260px; }
.lead-signal-row { align-items: flex-start; }
.lead-signal { line-height: 1.2; }
.detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid label:last-child { grid-column: 1 / -1; }
.detail-actions { gap: 8px; flex-wrap: wrap; }

/* Vista dividida solo en monitores realmente amplios. */
@media (min-width: 1680px) {
  .inbox-workspace {
    grid-template-columns: minmax(700px, .95fr) minmax(620px, 1.05fr);
    align-items: start;
  }
  #leadDetailPanel {
    position: sticky;
    top: calc(var(--admin-header-height) + 18px);
  }
}

/* En laptop se eliminan columnas técnicas y el scroll horizontal. */
@media (max-width: 1350px) {
  #leads table { min-width: 0; width: 100%; table-layout: fixed; }
  #leads th:nth-child(1), #leads td:nth-child(1),
  #leads th:nth-child(6), #leads td:nth-child(6) { display: none; }
  #leads th:nth-child(2) { width: 30%; }
  #leads th:nth-child(3) { width: 17%; }
  #leads th:nth-child(4) { width: 24%; }
  #leads th:nth-child(5) { width: 18%; }
  #leads th:nth-child(7) { width: 11%; }
  #leads td { padding: 13px 10px; }
}

/* Tarjetas legibles en tablet y móvil, con etiquetas en español. */
@media (max-width: 900px) {
  #leads .table-wrap { overflow: visible; }
  #leads table,
  #leads tbody { display: block; min-width: 0; }
  #leads thead { display: none; }
  #leads tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 0 0 12px;
    padding: 15px;
    border: 1px solid var(--admin-border);
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(13, 44, 22, .05);
  }
  #leads tr.selected { border-color: #8bc79a; background: #f2faf4; }
  #leads td,
  #leads td:nth-child(n) {
    min-width: 0;
    display: block;
    padding: 0;
    border: 0;
  }
  #leads td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--admin-muted);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
  }
  #leads td:nth-child(1), #leads td:nth-child(6) { display: none; }
  #leads td:nth-child(2), #leads td:nth-child(4) { grid-column: 1 / -1; }
  #leads td:last-child { display: flex; align-items: end; justify-content: flex-end; }
  #leads td:last-child::before { display: none; }
  #leads td:last-child .button { width: 100%; }
  .lead-record-heading { grid-template-columns: 1fr; }
  .lead-record-id { width: 100%; }
  .lead-location-layout,
  .lead-record-columns,
  .lead-fact-grid.compact,
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid label:last-child { grid-column: auto; }
}

@media (max-width: 560px) {
  #leads tr { grid-template-columns: 1fr; }
  #leads td:nth-child(n) { grid-column: auto; }
  #leads td:last-child { display: block; }
  .lead-section-heading { align-items: flex-start; }
  .lead-section-heading h3 { line-height: 1.3; }
  .lead-section-tools { justify-content: stretch; }
  .lead-section-tools .button { width: 100%; text-align: center; }
}
@media (max-width: 1200px) {
  .lead-workspace #leads td:nth-child(1)::before,
  .lead-workspace #leads td:nth-child(2)::before,
  .lead-workspace #leads td:nth-child(3)::before,
  .lead-workspace #leads td:nth-child(4)::before,
  .lead-workspace #leads td:nth-child(5)::before,
  .lead-workspace #leads td:nth-child(6)::before,
  .lead-workspace #leads td:nth-child(7)::before { content: attr(data-label); }
}

/* ========================================================================== 
   ADMIN UX V43.2 · REVISIÓN PERSISTENTE Y DETALLE EN LÍNEA
   ========================================================================== */
:root { --admin-ux-release: "admin-ux-v43.2b"; }

/* La bandeja siempre es una secuencia: registro, detalle abierto y registros siguientes. */
.inbox-workspace { display: block !important; grid-template-columns: none !important; }
#leadDetailParking { display: none !important; }
#leadDetailPanel {
  position: static !important;
  inset: auto !important;
  width: 100%;
  max-width: none;
  margin: 0;
  border: 1px solid #8bc79a;
  border-top: 4px solid var(--admin-green);
  border-radius: 0 0 14px 14px;
  box-shadow: 0 12px 28px rgba(14, 52, 25, .09);
}
.request-inline-detail-row > td {
  padding: 0 0 20px !important;
  border: 0 !important;
  background: transparent !important;
}
.request-inline-detail-row:hover > td { background: transparent !important; }
#leads tr.selected > td {
  border-bottom-color: transparent;
  background: #f0f8f2;
}
#leads tr.selected > td:first-child { box-shadow: inset 4px 0 0 var(--admin-green); }

/* Estado de revisión visible y persistente por usuario administrativo. */
.request-open-cell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  align-items: center;
}
.request-review-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 8px;
  border: 1px solid #cdd7cf;
  border-radius: 999px;
  background: #f4f6f4;
  color: #5d685f;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}
.request-review-badge > span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}
.request-review-badge.unread {
  border-color: #efb864;
  background: #fff7e8;
  color: #8b5100;
}
.request-review-badge.updated {
  border-color: #72afd4;
  background: #eaf6fd;
  color: #155d86;
}
.request-review-badge.reviewed {
  border-color: #b7d8c0;
  background: #edf8f0;
  color: #216a36;
}
#leads tr.request-review-unread:not(.selected) > td { background: #fffdf7; }
#leads tr.request-review-updated:not(.selected) > td { background: #f7fbfe; }

@media (max-width: 1350px) {
  #leads th:nth-child(2) { width: 28%; }
  #leads th:nth-child(3) { width: 16%; }
  #leads th:nth-child(4) { width: 20%; }
  #leads th:nth-child(5) { width: 17%; }
  #leads th:nth-child(7) { width: 19%; }
  #leads td:last-child .button { width: 100%; }
}

@media (max-width: 900px) {
  #leads tr.request-inline-detail-row {
    display: block !important;
    margin: -7px 0 16px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  #leads tr.request-inline-detail-row > td {
    display: block !important;
    width: 100%;
    padding: 0 !important;
  }
  #leads tr.request-inline-detail-row > td::before { display: none !important; }
  #leadDetailPanel { border-radius: 12px; padding: 18px; }
  .request-open-cell { grid-template-columns: minmax(0, 1fr) minmax(110px, .7fr); }
  #leads td:last-child { display: block; }
}

@media (max-width: 560px) {
  .request-open-cell { grid-template-columns: 1fr; }
}


/* ========================================================================== 
   ADMIN UX V43.2B · HOTFIX DE EXPEDIENTE EN LÍNEA ROBUSTO
   ========================================================================== */
:root { --admin-ux-release: "admin-ux-v43.2b"; }

#leads tr.request-inline-detail-row {
  display: table-row !important;
}
#leads tr.request-inline-detail-row > td {
  display: table-cell !important;
  width: auto !important;
  white-space: normal !important;
}
.request-inline-detail-mount {
  display: block;
  width: 100%;
  min-width: 0;
}
.request-inline-loading {
  margin: 0;
  padding: 18px;
  color: var(--admin-muted);
  font-weight: 800;
}
.request-inline-detail-mount > #leadDetailPanel {
  display: block;
  width: 100%;
}
.inline-detail-error {
  display: grid;
  gap: 5px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #d89898;
  border-radius: 10px;
  background: #fff4f4;
  color: #7d2020;
}

@media (max-width: 900px) {
  #leads tr.request-inline-detail-row {
    display: block !important;
  }
  #leads tr.request-inline-detail-row > td {
    display: block !important;
    width: 100% !important;
  }
}
/* El colspan debe ocupar toda la tabla incluso cuando V43.1 oculta columnas técnicas. */
#leads tr.request-inline-detail-row > td {
  width: 100% !important;
  min-width: 100% !important;
  max-width: none !important;
}
#leads tr.request-inline-detail-row #leadDetailPanel {
  width: 100% !important;
  max-width: none !important;
}
