:root {
  color-scheme: light;
  --bg: #eef3f5;
  --panel: #ffffff;
  --ink: #121a22;
  --muted: #667482;
  --line: #d8e0e5;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --accent-soft: #e4f4f1;
  --amber: #b7791f;
  --red: #b42318;
  --blue: #2563eb;
  --green: #15803d;
  --sidebar: #101820;
  --sidebar-2: #17232d;
  --shadow: 0 18px 44px rgba(25, 32, 40, 0.08);
  --shadow-soft: 0 8px 26px rgba(25, 32, 40, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8fbfc 0, var(--bg) 360px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.app.is-locked {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.14), transparent 42%),
    linear-gradient(0deg, rgba(37, 99, 235, 0.08), transparent 58%),
    var(--bg);
}

.auth-card {
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  background: white;
  box-shadow: var(--shadow);
}

.auth-card .mark {
  margin-bottom: 18px;
  color: white;
}

.auth-card h1 {
  margin: 0 0 8px;
  font-size: 36px;
  line-height: 1;
}

.auth-card p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.45;
}

.auth-card form {
  display: grid;
  gap: 14px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.auth-message,
.auth-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.auth-message {
  display: block;
  min-height: 18px;
  margin-top: 14px;
}

.auth-status {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-status strong {
  color: var(--ink);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.16), transparent 220px),
    var(--sidebar);
  color: white;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
}

.brand span,
.sidebar-note span,
.eyebrow,
.panel-head span,
.meta,
.model-grid span {
  color: var(--muted);
  display: block;
  font-size: 12px;
}

.sidebar .brand span,
.sidebar-note span {
  color: #b8c0c8;
}

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(145deg, #179688, var(--accent-strong));
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.24);
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 36px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 12px 14px;
  background: transparent;
  color: #e6ecef;
  text-align: left;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

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

.nav-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-note {
  position: absolute;
  right: 18px;
  bottom: 20px;
  left: 18px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.main {
  padding: 30px;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  margin: -30px -30px 0;
  padding: 26px 30px 18px;
  border-bottom: 1px solid rgba(216, 224, 229, 0.72);
  background: rgba(248, 251, 252, 0.88);
  backdrop-filter: blur(14px);
}

.topbar,
.panel-head,
.actions,
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1,
.detail h2,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 32px;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.primary,
.ghost,
.icon {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 0 15px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

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

.primary:hover {
  background: var(--accent-strong);
}

.ghost:hover,
.icon:hover {
  border-color: rgba(15, 118, 110, 0.38);
  background: var(--accent-soft);
}

.primary:disabled,
.ghost:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(150px, 1fr));
  gap: 12px;
  margin: 22px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-soft);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 118, 110, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.1);
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 18px;
}

.kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  content: "";
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 27px;
  line-height: 1.08;
}

.grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

.panel {
  padding: 20px;
}

.panel-head h2 {
  font-size: 18px;
}

.admin-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) 160px 140px auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

.supplier-form,
.quote-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 18px;
}

.toggle-row {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 8px;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.admin-hint {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.users-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.option-form {
  grid-template-columns: minmax(220px, 0.8fr) minmax(260px, 1fr) auto;
}

.option-values-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}

.option-row span {
  font-weight: 800;
  color: var(--ink);
}

.option-row button {
  min-height: 32px;
  border: 1px solid #f2c4bf;
  border-radius: 6px;
  background: #fff5f4;
  color: #a54238;
  font-size: 12px;
  font-weight: 800;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) 130px 100px auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.user-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.user-row button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  font-size: 12px;
  font-weight: 800;
}

.supplier-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.supplier-actions button {
  min-width: 72px;
}

.supplier-actions .delete-supplier {
  border-color: #f2c4bf;
  background: #fff5f4;
  color: #a54238;
}

.stock-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.stock-indicator span {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #cbd5e1;
}

.stock-indicator.reserved {
  border-color: #f4d28f;
  background: #fff8e5;
  color: #9a6500;
}

.stock-indicator.reserved span {
  background: #d99a13;
}

.stock-indicator.used {
  border-color: #bde7c8;
  background: #ecfdf1;
  color: #20773a;
}

.stock-indicator.used span {
  background: #31a354;
}

.stock-indicator.canceled {
  border-color: #f2c4bf;
  background: #fff5f4;
  color: #a54238;
}

.stock-indicator.canceled span {
  background: #c4493d;
}

.summary-cards,
.finance-decision-card,
.approval-grid,
.quote-table {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.summary-cards,
.finance-decision-card,
.approval-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-cards div,
.finance-decision-card div,
.approval-grid div,
.quote-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: white;
}

.summary-cards span,
.finance-decision-card span,
.approval-grid span,
.quote-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-cards strong,
.finance-decision-card strong,
.approval-grid strong,
.quote-card strong {
  display: block;
  margin-top: 5px;
}

.quote-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: center;
}

.quote-card p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
}

.quote-actions,
.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quote-actions button,
.approval-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.approved-label,
.director-note,
.whatsapp-link,
.approval-link-box {
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.director-note {
  margin-top: 14px;
}

.whatsapp-link {
  display: inline-flex;
  margin-top: 14px;
  text-decoration: none;
}

.approval-link-box {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  overflow-wrap: anywhere;
}

.approval-link-box span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.project-stock-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 14px 0;
  background: #fbfcfd;
}

.section-title.compact {
  margin-bottom: 10px;
}

.project-stock-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.project-stock-kpis div,
.project-stock-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
}

.project-stock-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-stock-kpis strong {
  display: block;
  margin-top: 4px;
  font-size: 21px;
}

.project-stock-list {
  display: grid;
  gap: 8px;
}

.project-stock-list article {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.project-stock-list article > div:last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.inventory-form,
.prospect-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.inventory-form button,
.prospect-form button {
  min-height: 44px;
}

.prospect-filters {
  margin-top: 0;
}

.form-section {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfd;
}

.form-section legend {
  padding: 0 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.prospect-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.interaction-grid {
  grid-template-columns: minmax(160px, 0.45fr) minmax(0, 1.55fr);
}

.form-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.interaction-list {
  display: grid;
  gap: 10px;
}

.interaction-list.compact {
  margin-top: 12px;
}

.interaction-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: white;
}

.interaction-item strong {
  display: block;
  color: var(--accent-strong);
  font-size: 13px;
}

.interaction-item p {
  margin: 5px 0;
  color: var(--ink);
  font-weight: 700;
}

.prospect-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.prospect-funnel-panel,
.prospect-map-panel {
  min-width: 0;
}

.prospect-pipeline {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 4px 2px 12px;
  overflow-x: auto;
}

.prospect-lane {
  min-height: 390px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7fafb;
}

.prospect-lane-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: start;
  margin-bottom: 12px;
}

.prospect-lane-head strong {
  font-size: 14px;
  line-height: 1.2;
  text-transform: uppercase;
}

.prospect-lane-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.prospect-lane-head small {
  grid-column: 1 / -1;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.prospect-lane-items {
  display: grid;
  gap: 10px;
}

.prospect-empty-lane {
  border: 1px dashed #cfd9df;
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: white;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.prospect-card {
  cursor: pointer;
  padding: 13px;
  margin: 0;
  border: 1px solid #dce4e9;
  box-shadow: 0 10px 24px rgba(25, 32, 40, 0.05);
}

.prospect-card > strong {
  display: block;
  margin: 8px 0 3px;
  line-height: 1.18;
}

.prospect-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}

.prospect-date {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef4f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.prospect-money-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 11px;
}

.prospect-money-row span {
  border-radius: 8px;
  padding: 8px;
  background: #f5f8fa;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.prospect-money-row small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.prospect-map-panel .compact-map {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.prospect-map-panel .map-region {
  min-height: 360px;
}

.prospect-map-list {
  max-height: 270px;
}

.prospect-map-list .map-list-item {
  padding: 13px 14px;
}

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

.table-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.table-actions button[data-convert-prospect] {
  border-color: rgba(15, 118, 110, 0.22);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.stock-hint {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7fbfb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stock-hint:empty {
  display: none;
}

.stock-hint.warning {
  border-color: #ead39b;
  background: #fff7dd;
  color: #946b12;
}

.stock-selection {
  display: grid;
  gap: 4px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfc;
}

.stock-selection:empty {
  display: none;
}

.stock-selection strong {
  color: var(--ink);
}

.stock-selection span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inventory-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.inventory-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: white;
}

.inventory-item.compact {
  grid-template-columns: minmax(220px, 1fr) minmax(150px, auto);
}

.inventory-item strong {
  display: block;
}

.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.inventory-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.inventory-status-cell {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.danger-action {
  min-height: 32px;
  border: 1px solid #f2c4bf;
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff5f4;
  color: #a54238;
  font-size: 12px;
  font-weight: 800;
}

.empty-cell {
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.toast-host {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  transform: translateY(10px);
  opacity: 0;
  border: 1px solid rgba(44, 125, 115, 0.22);
  border-radius: 8px;
  padding: 14px 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.warning {
  border-color: #ead39b;
  background: #fffaf0;
}

.bars {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.bar-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #edf0f2;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.alerts,
.mini-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.alert,
.mini-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.alert strong,
.mini-item strong {
  display: block;
  margin-bottom: 4px;
}

.table-wrap {
  overflow: auto;
  margin: 14px -20px -20px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 13px 16px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f6f8fa;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

tr {
  cursor: pointer;
}

tr:hover td {
  background: #f7fbfb;
}

.project-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.project-thumb {
  flex: 0 0 auto;
  width: 48px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f5;
}

.project-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 10px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.green {
  background: #dcfce7;
  color: var(--green);
}

.badge.amber {
  background: #fef3c7;
  color: var(--amber);
}

.badge.red {
  background: #fee4e2;
  color: var(--red);
}

.pipeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.lane {
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f7f9;
  padding: 12px;
}

.lane h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: white;
  box-shadow: 0 8px 22px rgba(25, 32, 40, 0.05);
}

.card strong {
  display: block;
  margin-bottom: 8px;
}

.detail {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10;
  width: min(1180px, calc(100vw - 64px));
  height: 100vh;
  padding: 26px;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #f8fbfc;
  box-shadow: -18px 0 50px rgba(25, 32, 40, 0.14);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.detail.open {
  transform: translateX(0);
}

.icon {
  width: 38px;
  padding: 0;
}

.project-hero {
  position: relative;
  overflow: hidden;
  height: 320px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #182028;
}

.project-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-hero.empty {
  background: linear-gradient(135deg, #202a33, #3b4650);
}

.hero-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #cbd5df;
  font-weight: 800;
}

.hero-overlay {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(180deg, transparent, rgba(16, 24, 32, 0.82));
  color: white;
}

.hero-overlay span {
  display: block;
  margin-bottom: 4px;
  color: #d7dee4;
  font-size: 12px;
  font-weight: 800;
}

.hero-overlay strong {
  font-size: 18px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.summary-strip div,
.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.summary-strip div {
  padding: 12px;
}

.summary-strip span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-strip strong {
  display: block;
  overflow-wrap: anywhere;
}

.detail-tabs {
  position: sticky;
  top: -26px;
  z-index: 5;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 16px -26px 0;
  padding: 12px 26px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 252, 0.96);
  backdrop-filter: blur(8px);
}

.detail-tabs button {
  flex: 0 0 auto;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.detail-tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.tab-panel {
  display: none;
}

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

.detail-section {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

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

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

.step-card,
.work-item,
.timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.step-card {
  padding: 14px;
}

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

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

.finance-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: white;
}

.finance-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.finance-summary strong {
  font-size: 15px;
}

.roi-dashboard {
  display: grid;
  gap: 12px;
}

.roi-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.roi-kpis div,
.roi-insights div,
.scenario-grid article,
.executive-timeline article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.roi-kpis div {
  padding: 12px;
}

.roi-kpis span,
.scenario-grid span,
.executive-timeline span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.roi-kpis strong {
  display: block;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.roi-insights {
  display: grid;
  gap: 8px;
}

.roi-insights div {
  padding: 11px 12px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

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

.scenario-grid article {
  padding: 12px;
}

.scenario-grid strong {
  display: block;
  margin-bottom: 6px;
}

.scenario-grid small,
.timeline-milestone small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.project-timeline {
  overflow-x: auto;
  padding: 8px 2px 18px;
}

.timeline-scale,
.timeline-track {
  position: relative;
  min-width: 720px;
}

.timeline-scale {
  height: 34px;
  border-bottom: 1px solid var(--line);
}

.timeline-scale span {
  position: absolute;
  bottom: 8px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.timeline-scale span::after {
  position: absolute;
  left: 50%;
  bottom: -13px;
  width: 1px;
  height: 8px;
  background: var(--line);
  content: "";
}

.timeline-track {
  height: 230px;
  margin-top: 18px;
}

.timeline-track::before {
  position: absolute;
  top: 30px;
  right: 4%;
  left: 4%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  content: "";
}

.timeline-milestone {
  position: absolute;
  top: 0;
  width: min(190px, 28%);
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 64px 12px 12px;
  background: white;
  box-shadow: 0 10px 26px rgba(25, 32, 40, 0.08);
}

.timeline-milestone::before {
  position: absolute;
  top: 22px;
  left: 50%;
  width: 18px;
  height: 18px;
  transform: translateX(-50%);
  border: 4px solid white;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  content: "";
}

.timeline-milestone::after {
  position: absolute;
  top: 42px;
  left: 50%;
  width: 1px;
  height: 18px;
  background: var(--line);
  content: "";
}

.timeline-milestone.done::before {
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}

.timeline-milestone.roi::before {
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.timeline-milestone.finish::before {
  background: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}

.timeline-milestone span {
  display: none;
}

.timeline-milestone strong {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
}

.quick-add {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.6fr) 150px auto;
  gap: 10px;
}

.history-add {
  grid-template-columns: 160px minmax(260px, 1fr) auto;
}

.work-list,
.timeline {
  display: grid;
  gap: 10px;
}

.work-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.remove-work-item {
  grid-row: span 2;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.timeline-item {
  padding: 12px;
}

.timeline-item span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-item strong {
  display: block;
  font-size: 14px;
}

.empty-state {
  border: 1px dashed #b9c2ca;
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.photo-section {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.photo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.photo-card {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.photo-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #eef2f5;
}

.photo-card figcaption {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.photo-card figcaption span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.photo-actions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  font-size: 12px;
  font-weight: 800;
}

.photo-actions .set-main-photo {
  color: var(--accent-strong);
}

.photo-actions .remove-photo {
  color: var(--red);
}

.photo-card img.set-main-photo {
  cursor: zoom-in;
}

.photo-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px dashed #b9c2ca;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.map-canvas {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.7fr);
  gap: 14px;
}

.large-map {
  min-height: 560px;
  margin-top: 16px;
}

.dashboard-map-panel {
  margin-top: 16px;
}

.dashboard-map {
  min-height: 560px;
  margin-top: 14px;
}

.dashboard-map .map-region {
  min-height: 560px;
}

.dashboard-map .map-list {
  max-height: 560px;
}

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

.compact-map .map-list {
  max-height: 150px;
}

.map-region {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 42%),
    linear-gradient(0deg, rgba(37, 99, 235, 0.08), transparent 58%),
    #eef5f3;
}

.leaflet-map {
  position: absolute;
  inset: 0;
  z-index: 4;
  min-height: 100%;
}

.leaflet-popup-content {
  min-width: 190px;
}

.compact-map .map-region {
  min-height: 260px;
}

.map-region::before,
.map-region::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 48% 52% 44% 56%;
}

.map-region::before {
  inset: 9% 12% 28% 16%;
  background: rgba(255, 255, 255, 0.38);
  transform: rotate(-8deg);
}

.map-region::after {
  inset: 48% 24% 8% 8%;
  background: rgba(255, 255, 255, 0.26);
  transform: rotate(10deg);
}

.region-label,
.map-city {
  position: absolute;
  z-index: 1;
  display: none;
  color: rgba(24, 32, 40, 0.52);
  font-weight: 900;
  pointer-events: none;
}

.fallback-visible .region-label,
.fallback-visible .map-city {
  display: block;
}

.region-label {
  font-size: 54px;
}

.region-label.sc {
  right: 12%;
  bottom: 20%;
}

.region-label.pr {
  left: 14%;
  top: 14%;
}

.map-city {
  font-size: 11px;
}

.map-city.joinville {
  right: 12%;
  bottom: 32%;
}

.map-city.curitiba {
  left: 48%;
  top: 44%;
}

.map-city.ponta-grossa {
  left: 16%;
  top: 30%;
}

.map-city.itajai {
  right: 16%;
  bottom: 11%;
}

.map-marker {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid white;
  border-radius: 999px;
  padding: 0;
  background: var(--red);
  color: white;
  box-shadow: 0 8px 18px rgba(24, 32, 40, 0.22);
  transform: translate(-50%, -50%);
}

.map-fallback-note {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  max-width: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.map-marker.active {
  background: var(--green);
}

.map-marker.budget {
  background: var(--amber);
}

.map-marker span {
  font-size: 10px;
  font-weight: 900;
}

.map-marker:hover {
  z-index: 3;
  transform: translate(-50%, -50%) scale(1.12);
}

.map-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.map-list-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: white;
  cursor: pointer;
}

.map-list-item:hover {
  border-color: rgba(15, 118, 110, 0.45);
  background: #f7fbfb;
}

.map-list-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  position: sticky;
  bottom: -26px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 20px -26px -26px;
  padding: 14px 26px;
  border-top: 1px solid var(--line);
  background: rgba(248, 251, 252, 0.96);
  backdrop-filter: blur(8px);
}

.model p {
  max-width: 780px;
  color: var(--muted);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.model-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfd;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 8;
    height: auto;
    padding: 14px 18px;
  }

  .brand {
    min-height: 38px;
  }

  .mark {
    width: 38px;
    height: 38px;
  }

  .nav {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 9px 12px;
    white-space: nowrap;
  }

  .nav-item.active {
    box-shadow: inset 0 -3px 0 var(--accent);
  }

  .sidebar-note {
    position: static;
    margin-top: 12px;
  }

  .filters,
  .kpis,
  .grid.two,
  .model-grid,
  .map-canvas,
  .summary-strip,
  .compact-fields,
  .finance-summary,
  .roi-kpis,
  .scenario-grid,
  .quick-add,
  .history-add,
  .admin-form,
  .user-row,
  .supplier-form,
  .quote-form,
  .summary-cards,
  .finance-decision-card,
  .approval-grid,
  .quote-card,
  .prospect-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .topbar {
    top: 134px;
  }

  .prospect-workspace {
    grid-template-columns: 1fr;
  }

  .prospect-pipeline {
    grid-auto-columns: minmax(240px, 44vw);
  }

  .detail {
    width: 100vw;
  }
}

@media (max-width: 680px) {
  body {
    background: var(--bg);
  }

  .auth-screen {
    place-items: start center;
    padding: 18px;
  }

  .auth-card {
    margin-top: 24px;
    padding: 22px;
  }

  .auth-card h1 {
    font-size: 31px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 12px;
  }

  .brand span {
    font-size: 11px;
  }

  .sidebar-note {
    display: none;
  }

  .main {
    padding: 14px;
  }

  .topbar {
    position: static;
    margin: -14px -14px 0;
    padding: 18px 14px 14px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions,
  .filters,
  .kpis,
  .grid.two,
  .model-grid,
  .form-grid,
  .photo-grid,
  .map-canvas,
  .summary-strip,
  .compact-fields,
  .finance-summary,
  .roi-kpis,
  .scenario-grid,
  .quick-add,
  .history-add,
  .admin-form,
  .user-row,
  .supplier-form,
  .quote-form,
  .summary-cards,
  .finance-decision-card,
  .approval-grid,
  .quote-card,
  .prospect-form-grid,
  .interaction-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    gap: 8px;
  }

  .supplier-actions {
    justify-content: stretch;
  }

  .supplier-actions button {
    flex: 1;
  }

  .project-stock-kpis,
  .project-stock-list article {
    grid-template-columns: 1fr;
  }

  .project-stock-list article > div:last-child {
    justify-content: flex-start;
  }

  .auth-status {
    max-width: 100%;
  }

  .filters {
    margin-top: 14px;
    padding: 12px;
  }

  .panel {
    padding: 15px;
  }

  .table-wrap {
    margin: 12px -15px -15px;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 11px 12px;
  }

  .project-cell {
    min-width: 220px;
  }

  .detail {
    width: 100vw;
    padding: 16px;
  }

  .detail-head {
    align-items: flex-start;
  }

  .project-hero {
    height: 220px;
    margin-top: 14px;
  }

  .hero-overlay {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .detail-tabs {
    top: -16px;
    margin: 14px -16px 0;
    padding: 10px 16px;
  }

  .detail-section,
  .photo-section {
    padding: 13px;
  }

  .form-grid {
    gap: 10px;
  }

  .inventory-form,
  .prospect-form,
  .option-form {
    grid-template-columns: 1fr;
  }

  .inventory-item,
  .inventory-item.compact {
    grid-template-columns: 1fr;
  }

  .inventory-actions {
    justify-content: stretch;
  }

  .inventory-actions button {
    flex: 1;
  }

  .toast-host {
    right: 14px;
    bottom: 14px;
  }

  .map-region,
  .dashboard-map .map-region {
    min-height: 330px;
  }

  .large-map,
  .dashboard-map {
    min-height: 330px;
  }

  .dashboard-map .map-list,
  .map-list {
    max-height: 260px;
  }

  .prospect-pipeline {
    grid-auto-columns: minmax(230px, 82vw);
  }

  .prospect-lane {
    min-height: 280px;
  }

  .photo-head,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .remove-work-item {
    grid-row: auto;
  }

  .actions {
    display: grid;
    width: 100%;
  }

  .span-2 {
    grid-column: span 1;
  }

  .form-actions {
    bottom: -16px;
    margin: 18px -16px -16px;
    padding: 12px 16px;
  }
}

@media (max-width: 420px) {
  .topbar h1 {
    font-size: 27px;
  }

  .kpi strong {
    font-size: 23px;
  }

  .project-hero {
    height: 190px;
  }
}
