:root {
  color-scheme: light;
  --ink: #172b43;
  --muted: #485c72;
  --blue: #164d84;
  --blue-deep: #153b64;
  --blue-soft: #edf5ff;
  --orange: #f4a348;
  --orange-deep: #df8731;
  --orange-soft: #fff2df;
  --paper: #f3f6fa;
  --white: #fff;
  --line: #d7e1ec;
  --green: #185a40;
  --green-soft: #e5f3ea;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 "Segoe UI", system-ui, sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

p, dl, dd { margin: 0; }
h1, h2, h3 { margin: 0; line-height: 1.24; }
h1 { font-size: clamp(2rem, 3.9vw, 2.85rem); letter-spacing: -0.04em; }
h2 { font-size: 1.25rem; letter-spacing: -0.02em; }
h3 { font-size: 1rem; }

.muted, .intro-note, .section-note, .site-footer { color: var(--muted); }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 66px;
}

.brand { color: var(--blue-deep); font-size: 1.0625rem; font-weight: 750; }

.demo-label {
  padding: 0.28rem 0.68rem;
  border-radius: 6px;
  background: var(--orange-soft);
  color: #754616;
  font-size: 0.8125rem;
  font-weight: 650;
}

.page-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 31px 0 22px;
}

.business-name { margin-bottom: 5px; color: var(--blue); font-size: 0.875rem; font-weight: 700; }
.intro-note { margin-top: 9px; }

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

.sidebar { display: grid; gap: 18px; }

.card {
  min-width: 0;
  padding: 21px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.field, .stacked-form, .date-fields { display: grid; }
.field { gap: 5px; min-width: 0; }
.stacked-form { gap: 12px; margin-top: 14px; }
.stacked-form > button { justify-self: start; }
.date-fields { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 8px; }

label { font-weight: 650; font-size: 0.875rem; }
label .muted { font-weight: 400; }

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

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid #a9bbcf;
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
}

textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #576b81; }

button {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--white);
  color: var(--blue-deep);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

button:disabled { cursor: not-allowed; opacity: 0.56; }
.button-secondary:not(:disabled):hover { background: var(--blue-soft); }
.button-primary { border-color: #bc6619; background: var(--orange); color: #21170e; }
.button-primary:not(:disabled):hover { background: var(--orange-deep); }

.inquiry-list, .timeline {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.inquiry-list { display: grid; gap: 7px; }
.inquiry-list li { min-width: 0; }

.inquiry-button {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 8px;
  width: 100%;
  text-align: left;
  overflow-wrap: anywhere;
  border-color: var(--line);
  color: var(--ink);
}

.inquiry-button:hover, .inquiry-button[aria-current="true"], .inquiry-button[aria-pressed="true"], .inquiry-button.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.inquiry-button p, .inquiry-button small { color: var(--muted); font-weight: 400; }

.detail-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  justify-content: space-between;
  gap: 8px 14px;
  overflow-wrap: anywhere;
}

.detail-facts {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr);
  gap: 12px;
  padding: 12px 0 15px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-facts dt { color: var(--muted); font-size: 0.8125rem; font-weight: 650; }
.detail-facts dd { overflow-wrap: anywhere; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge[data-state="visita"], .badge-visita { background: var(--orange-soft); color: #754616; }
.badge[data-state="seguimiento"], .badge-seguimiento { background: var(--green-soft); color: var(--green); }
.badge[data-state="cerrada"], .badge-cerrada { background: #edf0f4; color: #49596a; }

.detail-work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.work-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.section-note, .empty-state { margin-top: 6px; font-size: 0.875rem; }
.section-note:empty { display: none; }
.card.empty-state { margin: 0; }

.status-message:not(:empty) {
  margin-bottom: 16px;
  padding: 9px 13px;
  border: 1px solid #b7cce2;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue-deep);
  font-size: 0.9rem;
}

.status-message.error, .status-message[data-kind="error"] {
  background: #fff0eb;
  border-color: #e6b3a3;
  color: #852d1c;
}

.history { margin-top: 17px; }

.history-event {
  padding: 0 0 10px 12px;
  margin-left: 3px;
  border-left: 2px solid var(--line);
  overflow-wrap: anywhere;
}

.history-event:last-child { padding-bottom: 0; }
.history-event time { display: block; color: var(--muted); font-size: 0.8125rem; }
.site-footer { padding-block: 22px; font-size: 0.875rem; }

@media (max-width: 900px) {
  .detail-work { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .shell { width: calc(100% - 32px); }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .sidebar { gap: 14px; }
  .card { padding: 17px; }
}

@media (max-width: 460px) {
  .page-intro { align-items: start; flex-direction: column; margin-top: 22px; }
  .detail-facts { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

@media (max-width: 360px) {
  .date-fields { grid-template-columns: minmax(0, 1fr); }
}
