:root {
  color-scheme: light;
  --bg: color-mix(in srgb, var(--soft-blush) 34%, #ffffff);
  --surface: #ffffff;
  --surface-2: color-mix(in srgb, var(--soft-blush) 24%, #ffffff);
  --ink: #171717;
  --muted: #6b6f76;
  --line: color-mix(in srgb, var(--primary) 24%, #ffffff);
  --soft-blush: #fbe4e3;
  --primary: #d72638;
  --primary-strong: color-mix(in srgb, var(--primary) 72%, #000000);
  --secondary: #3f0d12;
  --success: #147a50;
  --warning: #936412;
  --danger: #98111e;
  --shadow: 0 18px 48px color-mix(in srgb, var(--secondary) 10%, transparent);
  --focus-ring: color-mix(in srgb, var(--primary) 20%, transparent);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.boot-error {
  max-width: 560px;
  margin: 12vh auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 24px;
}

.boot-error h1 {
  margin-bottom: 10px;
}

.boot-error button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  padding: 0 16px;
}

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

button {
  cursor: pointer;
}

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

.app-shell[hidden] {
  display: none !important;
}

body.auth-pending {
  overflow: hidden;
  background: #07111f;
}

body.sat-disabled .sat-only {
  display: none !important;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 22px 16px;
  background: var(--secondary);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 24px;
}

.brand-platform {
  flex: 0 0 auto;
  color: #fff;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
}

.brand-platform span,
.auth-platform span {
  color: color-mix(in srgb, var(--primary) 78%, #ffffff);
}

.sidebar-company-logo {
  width: auto;
  max-width: 76px;
  height: auto;
  max-height: 38px;
  object-fit: contain;
}

.brand strong {
  display: block;
  max-width: 132px;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand small {
  display: block;
}

.brand small {
  color: color-mix(in srgb, var(--primary) 28%, #ffffff);
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.76);
  text-align: left;
  padding: 0 14px;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  outline: none;
}

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

.topbar,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
}

.account-chip span {
  max-width: 260px;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-switcher {
  width: min(220px, 35vw);
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  padding: 0 34px 0 10px;
  font-size: 14px;
  font-weight: 800;
}

.support-banner {
  position: sticky;
  z-index: 18;
  top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: -6px 0 18px;
  border: 1px solid #7aa7e8;
  border-radius: var(--radius);
  background: #e9f2ff;
  box-shadow: 0 10px 28px rgba(15, 45, 92, 0.14);
  color: #0f2d5c;
  padding: 10px 12px;
  font-weight: 800;
}

.support-banner .button {
  flex: 0 0 auto;
  min-height: 38px;
}

.subscription-banner {
  margin: -6px 0 18px;
  border: 1px solid #f1d79d;
  border-radius: var(--radius);
  background: #fff7dd;
  color: #6f4b00;
  padding: 12px 14px;
  font-weight: 800;
}

.subscription-banner.is-danger {
  border-color: #f0b8b8;
  background: #fff1f1;
  color: var(--danger);
}

.button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 16px;
  font-weight: 700;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover,
.button.primary:focus-visible {
  background: var(--primary-strong);
}

.button.ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.button.subtle {
  background: var(--soft-blush);
  color: var(--primary-strong);
}

.button.whatsapp {
  border-color: #dceee5;
  background: #f3fbf6;
  color: #2f6f52;
}

.button.whatsapp:hover,
.button.whatsapp:focus-visible {
  border-color: #b9dec8;
  background: #eaf7ef;
  color: #1f5f45;
}

.button.sat {
  border-color: #bdd4ed;
  background: #eef6ff;
  color: #2f5f91;
}

.button.sat:hover,
.button.sat:focus-visible {
  border-color: #93b7dc;
  background: #dfefff;
  color: #214f7f;
}

.button.full {
  width: 100%;
}

.icon-soft {
  display: inline-grid;
  width: 44px;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #dceee5;
  border-radius: var(--radius);
  background: #f3fbf6;
  color: #2f8a5f;
  padding: 0;
}

.icon-soft.full {
  width: 100%;
}

.icon-soft:hover,
.icon-soft:focus-visible {
  border-color: #b9dec8;
  background: #eaf7ef;
  color: #1f734d;
}

.icon-soft svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.work-panel,
.summary-panel,
.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.summary-panel {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.is-hidden {
  display: none !important;
}

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

.client-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.client-results {
  max-height: 220px;
}

.client-result.is-selected {
  border-color: #b9dec8;
  background: #f3fbf6;
}

label {
  display: grid;
  gap: 6px;
  color: #38342e;
  font-size: 13px;
  font-weight: 800;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.sat-required-missing input,
.sat-required-missing textarea,
.sat-required-missing select,
.table-wrap.sat-required-missing {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.sat-validator {
  display: grid;
  gap: 4px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.sat-validator strong {
  color: var(--secondary);
}

.sat-validator span {
  color: var(--muted);
  font-size: 13px;
}

.sat-validator.is-warning {
  border-color: #fecaca;
  background: #fff1f2;
}

.sat-validator.is-warning strong {
  color: #991b1b;
}

.sat-validator.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.sat-validator.is-ok strong {
  color: #166534;
}

.service-picker {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.picker-results {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}

.result-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  text-align: left;
}

.result-item strong,
.service-title strong {
  display: block;
}

.result-item span,
.service-title span {
  color: var(--muted);
  font-size: 13px;
}

.service-title em {
  display: block;
  margin-top: 4px;
  color: var(--danger);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.money,
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8) {
  font-variant-numeric: tabular-nums;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.editable-table {
  min-width: 720px;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--soft-blush);
  color: var(--secondary);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.editable-table input {
  min-height: 38px;
  padding: 6px 8px;
}

.compact-select {
  min-height: 38px;
  min-width: 180px;
  padding: 6px 8px;
}

.editable-table th:nth-child(2),
.editable-table td:nth-child(2) {
  width: 92px;
}

.editable-table th:nth-child(3),
.editable-table td:nth-child(3) {
  width: 132px;
}

.editable-table th:nth-child(4),
.editable-table td:nth-child(4) {
  width: 104px;
}

.editable-table th:nth-child(5),
.editable-table td:nth-child(5) {
  width: 132px;
}

.editable-table th:nth-child(6),
.editable-table td:nth-child(6) {
  width: 56px;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
}

.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 260px;
}

.demo-badge,
.member-status {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  margin-left: 7px;
  border: 1px solid #a8c8ee;
  border-radius: 999px;
  background: #eaf3ff;
  color: #174f91;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.member-status.active {
  border-color: #b9dec8;
  background: #eaf7ef;
  color: #1f734d;
}

.member-status.invited {
  border-color: #e7cf93;
  background: #fff8df;
  color: #795800;
}

.member-status.disabled {
  border-color: #e8b7b7;
  background: #fff0f0;
  color: var(--danger);
}

.status-check {
  align-items: center;
  background: #eaf7ef;
  border: 1px solid #b9dec8;
  border-radius: 999px;
  color: #1f734d;
  display: inline-flex;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.status-stack {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.status-file {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid #bdd4ed;
  border-radius: 999px;
  background: #eef6ff;
  color: #2f5f91;
  font-size: 11px;
  font-weight: 900;
  padding: 0 8px;
}

.document-icon {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #bdd4ed;
  border-radius: 999px;
  background: #eef6ff;
  color: #2f5f91;
  padding: 0;
}

.document-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

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

.risk-row {
  background: #fff0f0;
}

.danger-input {
  border-color: var(--danger);
  color: var(--danger);
  font-weight: 800;
}

.danger-text {
  color: var(--danger);
  font-weight: 900;
}

.summary-card {
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--secondary), var(--primary-strong));
  color: #fff;
  padding: 18px;
}

.summary-card p,
.summary-card span {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
}

.summary-card strong {
  display: block;
  margin: 4px 0;
  font-size: 32px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

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

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

.summary-list dt {
  color: var(--muted);
}

.summary-list dd {
  margin: 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.sat-attachment-card {
  display: grid;
  gap: 5px;
  border: 1px dashed #bdd4ed;
  border-radius: var(--radius);
  background: #f8fbff;
  color: #2f5f91;
  cursor: pointer;
  padding: 12px;
}

.attachment-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.attachment-view,
.attachment-remove {
  justify-self: start;
  min-height: 32px;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 0 10px;
}

.attachment-view {
  border: 1px solid #b9dec8;
  color: #1f734d;
}

.attachment-remove {
  border: 1px solid #e8b7b7;
  color: var(--danger);
}

.sat-attachment-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.sat-attachment-card.is-dragover,
.sat-attachment-card:focus-visible {
  border-color: #2f5f91;
  box-shadow: 0 0 0 3px rgba(47, 95, 145, 0.16);
  outline: none;
}

.sat-attachment-card.has-file {
  border-style: solid;
  border-color: #b9dec8;
  background: #f3fbf6;
  color: #1f734d;
}

.quick-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}

.quick-filter {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--secondary);
  font-size: 13px;
  font-weight: 800;
  padding: 0 12px;
}

.quick-filter.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.category-manager {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) repeat(4, auto);
  gap: 10px;
  align-items: end;
  margin: -4px 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal-category-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #ece7dc;
  color: #433c31;
  font-size: 12px;
  font-weight: 800;
}

.badge.approved {
  background: #dff1e8;
  color: var(--success);
}

.badge.sent,
.badge.negotiating {
  background: #fff1cd;
  color: var(--warning);
}

.badge.rejected {
  background: #f7ddd9;
  color: var(--danger);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: rgba(23, 23, 23, 0.42);
  padding: 20px;
}

.modal.is-visible {
  display: grid;
}

.modal-card {
  width: min(840px, 100%);
  max-height: min(760px, 92dvh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(23, 23, 23, 0.22);
  padding: 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

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

.settings-grid.is-visible {
  display: grid;
}

.settings-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.settings-card.wide {
  grid-column: 1 / -1;
}

.admin-directory .table-wrap,
#teamPanel .table-wrap,
.billing-reminders .table-wrap {
  max-height: 430px;
  overflow: auto;
}

.admin-directory table,
#teamPanel table,
.billing-reminders table {
  min-width: 780px;
}

.billing-status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.billing-status.upcoming {
  background: #e8f1ff;
  color: #174ea6;
}

.billing-status.urgent {
  background: #fff1cd;
  color: #8a5b00;
}

.billing-status.overdue {
  background: #f7ddd9;
  color: #9f1f18;
}

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

.guide-grid article {
  border-left: 3px solid var(--primary);
  background: var(--surface-2);
  padding: 12px 14px;
}

.guide-grid p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.theme-preset-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.company-logo-field {
  display: grid;
  gap: 8px;
}

.field-label {
  color: var(--ink);
  font-weight: 800;
}

.company-logo-upload {
  display: grid;
  grid-template-columns: minmax(150px, 190px) 1fr;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.company-logo-preview {
  display: grid;
  width: 100%;
  height: 110px;
  place-items: center;
  border: 1px dashed var(--line);
  background: #ffffff;
  padding: 10px;
}

.company-logo-preview img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 88px;
  object-fit: contain;
}

.company-logo-preview span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.company-logo-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.company-logo-controls small {
  flex-basis: 100%;
  color: var(--muted);
  line-height: 1.4;
}

.upload-logo-button {
  cursor: pointer;
}

.theme-preset {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  padding: 8px 10px;
  font-weight: 800;
  text-align: left;
}

.theme-preset:hover,
.theme-preset:focus-visible {
  border-color: var(--primary);
}

.theme-preset.is-active {
  border-color: var(--primary);
  background: var(--soft-blush);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.theme-swatches {
  display: inline-flex;
  flex: 0 0 auto;
}

.theme-swatches i {
  width: 18px;
  height: 18px;
  margin-left: -5px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(23, 23, 23, 0.12);
}

.theme-swatches i:first-child {
  margin-left: 0;
}

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

.company-status-grid div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.company-status-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.company-status-grid strong {
  display: block;
  margin-top: 4px;
}

.company-access {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.company-access span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.company-access a {
  color: var(--primary-strong);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.access-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--secondary);
  padding: 11px 13px;
  font-size: 14px;
  font-weight: 800;
}

.field-help {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field-help.is-valid {
  color: var(--success);
}

.field-help.is-invalid {
  color: var(--danger);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, #07111f 0%, #0f2d5c 58%, #153f7c 100%);
  padding: 22px;
}

.auth-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
  padding: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.auth-platform {
  color: var(--secondary);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.auth-company-logo {
  width: auto;
  max-width: 132px;
  height: 42px;
  object-fit: contain;
}

.auth-card p {
  margin: 0;
  color: var(--muted);
}

.auth-link {
  justify-self: start;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--primary-strong);
  padding: 0;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tenant-missing {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  background: var(--secondary);
  padding: 22px;
}

.tenant-missing-card {
  width: min(480px, 100%);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px;
  text-align: center;
}

.tenant-missing-card h1 {
  margin-bottom: 12px;
}

.tenant-missing-card p {
  color: var(--muted);
}

body.is-readonly input:not([type="search"]),
body.is-readonly select,
body.is-readonly textarea {
  background: #f3f4f6;
}

.settings-note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
}

.preset-list {
  display: grid;
  gap: 8px;
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}

.preset-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.preset-list strong {
  color: var(--secondary);
}

.switch-row {
  align-items: center;
  grid-template-columns: auto 1fr;
  gap: 10px;
  cursor: pointer;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  border: 1px solid #e8b7b7;
  border-radius: 999px;
  background: #f8d7d6;
  transition: 180ms ease;
}

.switch-ui::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(63, 13, 18, 0.22);
  content: "";
  transition: 180ms ease;
}

.switch-row input:checked + .switch-ui {
  border-color: var(--primary);
  background: var(--primary);
}

.switch-row input:checked + .switch-ui::after {
  transform: translateX(18px);
}

.switch-row input:focus-visible + .switch-ui {
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 320px;
  transform: translateY(20px);
  border-radius: var(--radius);
  background: var(--secondary);
  color: #fff;
  opacity: 0;
  padding: 12px 14px;
  transition: 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

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

  .sidebar {
    position: sticky;
    z-index: 20;
    width: 100%;
    min-width: 0;
    height: auto;
    padding: 12px;
  }

  .brand {
    padding-bottom: 12px;
  }

  .nav-list {
    display: flex;
    max-width: 100%;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 18px;
  }

  .quote-layout,
  .settings-grid.is-visible,
  .category-manager,
  .modal-category-panel {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  h1 {
    font-size: 24px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .form-grid,
  .metric-grid,
  .theme-preset-picker {
    grid-template-columns: 1fr;
  }

  .company-logo-upload {
    grid-template-columns: 1fr;
  }

  .company-status-grid {
    grid-template-columns: 1fr;
  }

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

  .account-chip,
  .support-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .company-switcher {
    width: 100%;
  }

  .company-access {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-card {
    min-width: 0;
  }

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

  .editable-table {
    min-width: 0;
  }

  .editable-table,
  .editable-table thead,
  .editable-table tbody,
  .editable-table tr,
  .editable-table th,
  .editable-table td {
    display: block;
    width: 100%;
  }

  .editable-table thead {
    display: none;
  }

  .editable-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }

  .editable-table td {
    border-bottom: 0;
    padding: 0;
  }

  .editable-table td:first-child,
  .editable-table td:nth-child(5),
  .editable-table td:nth-child(6) {
    grid-column: 1 / -1;
  }

  .editable-table td:nth-child(2)::before {
    content: "Cantidad";
  }

  .editable-table td:nth-child(3)::before {
    content: "Precio";
  }

  .editable-table td:nth-child(4)::before {
    content: "Descuento";
  }

  .editable-table td:nth-child(5)::before {
    content: "Total";
  }

  .editable-table td:nth-child(n + 2)::before {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }
}

@media print {
  body {
    background: #fff;
  }
}
