:root {
  color-scheme: light;
  color: #121826;
  background: #f5f8fd;
  font: 14px/1.45 system-ui, "Segoe UI", sans-serif;
  --surface: #fff;
  --background: #f5f8fd;
  --line: #d9e3f2;
  --ink: #121826;
  --muted: #526178;
  --blue: #2f7ae5;
  --blue-strong: #0f63dc;
  --blue-dark: #104491;
  --blue-soft: #eef4ff;
  --bad: #ffe6e8;
  --bad-ink: #9f1239;
  --ok: #e9f9f1;
  --ok-ink: #0f6d45;
  --shadow: 0 2px 4px #243e6610;
  --width: 76rem;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--blue-dark); font-weight: 650; }
button, input, select, .button { font: inherit; }
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 44px;
  padding: .55rem .85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: var(--blue-soft); border-color: #aac9f4; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--blue-strong); outline-offset: 3px; }
.primary { background: var(--blue-strong); border-color: var(--blue-strong); color: #fff; }
.primary:hover:not(:disabled) { background: #0b53bc; border-color: #0b53bc; color: #fff; }
.quiet { background: transparent; border-color: transparent; color: var(--blue-dark); }

.topbar, .workspace { width: min(calc(100% - 2rem), var(--width)); margin-inline: auto; }
.topbar {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.25rem;
  padding: .9rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; min-width: 0; gap: 1.15rem; }
.brand-logo { display: block; width: clamp(7rem, 16vw, 10.5rem); height: auto; max-width: 100%; }
.brand strong { display: block; font-size: 1.1rem; line-height: 1.2; }
#seller { display: block; margin-top: .2rem; color: var(--muted); overflow-wrap: anywhere; }
#seller:empty { display: none; }
.topbar nav, .section-heading, .line, .actions, .pages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
}
.topbar nav { font-size: .91rem; }
.notice-anchor { position: relative; }
.bell-button { color: var(--blue-dark); background: var(--blue-soft); border-color: #c6daf8; }
.notice-count { min-width: 1.5em; padding: 0 .36em; background: var(--bad-ink); color: #fff; border-radius: 2em; }
#notices {
  position: absolute;
  top: calc(100% + .65rem);
  right: 0;
  z-index: 5;
  width: min(24rem, calc(100vw - 3rem));
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 12px 36px #18294d26;
}
#notices .section-heading h2 { margin: 0; font-size: 1.05rem; }
#notice-list { display: grid; gap: .5rem; }
#mark-read { margin-top: .4rem; }
.notice { display: block; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; }
.notice-unread { border-inline-start: 4px solid var(--blue); background: var(--background); }

.workspace { padding-block: 1.5rem 3rem; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.55rem, 4vw, 2.05rem); line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; line-height: 1.25; }
h3 { font-size: 1rem; }
.section-heading { justify-content: space-between; margin-bottom: .85rem; }
.workspace-heading { margin-bottom: 1rem; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.metric {
  position: relative;
  display: grid;
  gap: .35rem;
  justify-content: unset;
  justify-items: start;
  min-width: 0;
  padding: 1rem;
  border-radius: 14px;
  text-align: start;
  box-shadow: var(--shadow);
}
.metric > span { color: var(--muted); font-size: .9rem; line-height: 1.2; }
.metric > strong { font-size: 1.8rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric[aria-pressed="true"] { border-color: #a5c8fc; background: var(--blue-soft); color: var(--blue-dark); }
.metric[aria-pressed="true"] > span { color: var(--blue-dark); }
.metric[aria-pressed="true"]::before {
  content: "";
  position: absolute;
  inset: .9rem auto .9rem 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue-strong);
}
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.1rem; box-shadow: var(--shadow); }
.panel h2, .panel h3 { margin-bottom: .75rem; }
#create { margin-bottom: 1rem; }
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: .8rem;
  margin-bottom: 1rem;
}
label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; font-weight: 650; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .45rem .65rem;
  border: 1px solid #bacbe2;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
.search { display: flex; flex-wrap: wrap; align-items: end; gap: .7rem 1rem; margin-bottom: 1rem; }
.search-field { flex: 1 1 22rem; min-width: 0; }
.search > .filter-field { flex: 0 1 10rem; }
.filter-field { display: grid; gap: .35rem; }
.search .line { flex-wrap: nowrap; margin-top: .35rem; }
.search input { flex: 1; }
.contacts { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.contact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
  align-items: center;
  gap: .8rem 1rem;
  min-width: 0;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow-wrap: anywhere;
}
.contact-link { display: inline-flex; align-items: center; min-height: 30px; color: var(--ink); font-size: 1.05rem; font-weight: 750; }
.contact-link:hover { color: var(--blue-strong); }
.contact-pending { display: flex; flex-wrap: wrap; gap: .3rem; }
.contact-pending > .due { flex-basis: 100%; }
.contact-row .actions { justify-content: flex-end; }
.contact-row .actions button:first-child { color: var(--blue-dark); border-color: #c6daf8; background: var(--blue-soft); }
.contact-row .actions button:first-child:hover:not(:disabled) { background: #dfeaff; }
.due { display: block; margin-top: .2rem; color: var(--muted); font-size: .85rem; }
.tag { display: inline-flex; width: fit-content; padding: .23rem .6rem; border-radius: 2em; background: var(--blue-soft); color: var(--blue-dark); font-size: .86rem; font-weight: 700; }
.green { color: var(--ok-ink); background: var(--ok); }
.red { color: var(--bad-ink); background: var(--bad); }
.brown { color: #623710; background: #f5e5d3; }
.temperature-initial { color: #145786; background: #dcefff; }
.temperature-quote { color: #825800; background: #fff0cc; }
.temperature-intent { color: #a01b28; background: #ffe1e1; }
.pages { justify-content: center; margin-top: 1rem; }
.empty { padding: 1.25rem; border: 1px dashed #b4c8e4; border-radius: 12px; background: var(--background); color: var(--muted); }
#detail { margin-bottom: .85rem; background: #f7faff; overflow-wrap: anywhere; }
#detail .section-heading h2 { margin: 0; }
#detail .actions, #detail section, #detail .line { margin-top: .75rem; }
#detail .outcome-actions { padding-top: .75rem; border-top: 1px solid var(--line); }
#detail .line label { min-width: min(12rem, 100%); }
#detail .line { align-items: end; }
#detail li { margin-bottom: .5rem; }
#error, #status { padding: .7rem; margin-bottom: .85rem; border-radius: 10px; }
#error { background: var(--bad); color: var(--bad-ink); }
#status { background: var(--ok); color: var(--ok-ink); }
.signin { display: grid; justify-items: start; gap: 1rem; margin: 12vh auto; width: min(calc(100% - 2rem), 26rem); padding: 1.5rem; }

.commercial-nav, .agenda-filters { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 1rem; }
.commercial-nav [aria-current="page"], .agenda-filters [aria-pressed="true"] {
  background: var(--blue-soft);
  border-color: #a5c8fc;
  color: var(--blue-dark);
}
.result-metric { background: var(--surface); border: 1px solid var(--line); cursor: auto; }
.report-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; gap: .9rem; }
.report-columns .section-heading h2 { margin: 0; }
.report-table table { width: 100%; border-collapse: collapse; }
.report-table th, .report-table td { padding: .65rem .35rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.report-table th:first-child { text-align: start; }
.report-table thead th { color: var(--muted); font-size: .88rem; }
.report-table td { text-align: center; }
.agenda-list { display: grid; gap: .6rem; list-style: none; margin: 0; padding: 0; }
.agenda-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .3rem .75rem;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-wrap: anywhere;
}
.agenda-row time { max-width: 100%; }
.goal-panel progress { width: min(28rem, 100%); accent-color: var(--blue-strong); margin-block: .8rem 0; }
.goal-panel .line { align-items: end; margin-top: 1rem; }
.contact-editor { padding: .65rem .75rem; margin-block: .7rem; border: 1px solid var(--line); border-radius: 10px; }
.contact-editor summary { color: var(--blue-dark); font-weight: 650; cursor: pointer; }
.contact-editor form { margin-top: .7rem; }
.field-error { color: var(--bad-ink); margin-top: .5rem; }
.actions .whatsapp { color: var(--ok-ink); border-color: #bfe8cf; background: var(--ok); }
.actions .whatsapp:hover { color: var(--ok-ink); border-color: #8cccaa; background: #def4e9; }

@media (max-width: 54rem) {
  .contact-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .contact-row .actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 46rem) {
  .topbar nav { position: static; }
  .notice-anchor { position: static; }
  #notices { inset: calc(100% + .6rem) 0 auto; width: 100%; }
  .report-columns { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 38rem) {
  .topbar, .workspace { width: calc(100% - 1.5rem); }
  .topbar { margin-top: .75rem; padding: .8rem; gap: .75rem; }
  .brand { gap: .75rem; }
  .workspace { padding-top: 1.15rem; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .metric { padding: .75rem; }
  .panel { padding: .8rem; }
  .search { gap: .65rem; }
  .search > .filter-field { flex: 1 1 8rem; }
  .contact-row { grid-template-columns: minmax(0, 1fr); gap: .55rem; padding: .75rem; }
  .contact-row .actions > * { flex: 1 1 auto; }
  input, select { font-size: 16px; }
}
