/* ============ Tokens ============ */
:root {
  --paper: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F7F6F3;
  --ink: #17140F;
  --ink-soft: #55503F;
  --muted: #948C77;
  --border: #E7E3D8;

  --brass: #A9792F;
  --brass-deep: #7E5A22;
  --brass-tint: #EFE1C6;

  --espresso: #14110C;
  --espresso-2: #211C13;
  --hero-ink: #FFFFFF;
  --hero-ink-soft: #D9D4C6;

  --good: #3F7D4A;
  --good-bg: #E4F0E1;
  --warn: #C1652E;
  --warn-bg: #F6E3D3;
  --danger: #A83B2E;
  --danger-bg: #F5E0DB;
  --info: #3D6B73;
  --info-bg: #DEEAEC;

  --shadow: 0 1px 2px rgba(23, 20, 15, 0.05), 0 12px 32px -16px rgba(23, 20, 15, 0.22);
  --radius: 2px;
}

/* This mockup commits to one deliberate brand identity (white-forward,
   with Decormat's real logo gold as the one accent — rather than adapting
   to the viewer's OS theme; a client-facing brand demo should look the
   same for everyone looking at it). */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font-family: inherit; }
::selection { background: var(--brass-tint); color: var(--espresso); }
h1, h2, h3, h4 { text-wrap: balance; margin: 0; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* ============ Mode switcher (demo-only meta control) ============ */
#mode-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--espresso);
  color: var(--hero-ink-soft);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.55rem 1.1rem;
  font-size: 0.78rem;
}
#mode-bar .label {
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hero-ink-soft);
  opacity: 0.75;
}
#mode-bar .switch { display: flex; gap: 0.35rem; }
#mode-bar button {
  border: 1px solid rgba(246, 236, 218, 0.25);
  background: transparent;
  color: var(--hero-ink);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 0.15s, color 0.15s;
}
#mode-bar button.active {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--espresso);
  font-weight: 600;
}
#mode-bar button:not(.active):hover { background: rgba(246, 236, 218, 0.1); }
#mode-bar .tag {
  margin-left: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  opacity: 0.6;
}
@media (max-width: 640px) {
  #mode-bar { flex-wrap: wrap; row-gap: 0.4rem; position: static; }
  #mode-bar .tag { display: none; }
  #site-nav { top: 0; }
}

[data-mode-view], [data-site-page], [data-intranet-view] { display: none; }
[data-mode-view].active, [data-site-page].active, [data-intranet-view].active { display: block; }

/* ============ PUBLIC SITE ============ */
#site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 37px;
  z-index: 30;
}
.site-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.3rem 2rem;
  display: flex;
  align-items: center;
  gap: 2.6rem;
}
.site-logo { height: 40px; width: auto; flex-shrink: 0; }
.site-links { display: flex; gap: 2rem; flex: 1; flex-wrap: wrap; }
.site-links button {
  background: none;
  border: none;
  font-family: 'Jost', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
}
.site-links button:hover { color: var(--ink); }
.site-links button.active { color: var(--ink); border-bottom-color: var(--brass); }

@media (max-width: 760px) {
  .site-nav-inner { flex-wrap: wrap; padding: 1rem 1.2rem; gap: 0.7rem 1rem; }
  .site-links { order: 3; width: 100%; gap: 0.7rem 1.1rem; }
  .site-cta { order: 2; margin-left: auto; padding: 0.55rem 1.1rem; font-size: 0.72rem; }
}
.site-cta {
  background: none;
  color: var(--ink);
  border: 1px solid var(--ink);
  padding: 0.62rem 1.4rem;
  border-radius: 0;
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
.site-cta:hover { background: var(--ink); color: #fff; }

.site-page { max-width: 1180px; margin: 0 auto; padding: 0 1.5rem; }

/* Full-bleed cinematic hero */
.hero {
  position: relative;
  height: 86vh;
  min-height: 520px;
  max-height: 880px;
  overflow: hidden;
  color: var(--hero-ink);
}
.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: kenburns 26s ease-in-out infinite alternate;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(20,17,12,0.82) 0%, rgba(20,17,12,0.32) 46%, rgba(20,17,12,0.08) 72%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  padding: 0 1.5rem 4.2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.hero-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass-tint);
  margin-bottom: 1.2rem;
}
.hero h1 {
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: clamp(2.4rem, 5.2vw, 4.2rem);
  font-weight: 500;
  line-height: 1.06;
  margin-bottom: 1.4rem;
  max-width: 16ch;
}
.hero h1 em { color: var(--brass-tint); font-style: italic; }
.hero p.lead {
  font-size: 1.08rem;
  color: var(--hero-ink-soft);
  max-width: 46ch;
  margin-bottom: 2rem;
  font-weight: 300;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-brass {
  background: var(--brass);
  color: #fff;
  border: 1px solid var(--brass);
  padding: 0.85rem 1.8rem;
  border-radius: 0;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-brass:hover { background: var(--brass-deep); border-color: var(--brass-deep); }
.btn-brass:active, .btn-solid:active, .site-cta:active, .btn-ghost:active, .btn-outline:active { transform: scale(0.98); }
.btn-brass, .btn-solid, .site-cta, .btn-ghost, .btn-outline { transition: transform 0.1s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease; }
.btn-ghost {
  background: transparent;
  color: var(--hero-ink);
  border: 1px solid rgba(255,255,255,0.55);
  padding: 0.85rem 1.8rem;
  border-radius: 0;
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); border-color: #fff; }

@keyframes kenburns {
  from { transform: scale(1) translate(0, 0); }
  to   { transform: scale(1.08) translate(-1%, -1%); }
}

.section { padding: 6rem 0; }
.section-head { margin-bottom: 3rem; max-width: 60ch; }
.section-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.9rem;
}
.section-head h2 {
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 500;
  color: var(--ink);
}
.section-head p { color: var(--ink-soft); margin-top: 0.9rem; font-weight: 300; }

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 2.2rem 1.6rem;
}
.catalog-card {
  background: none;
  border: none;
  border-radius: 0;
  overflow: visible;
  transition: transform 0.3s ease;
}
.catalog-card:hover { transform: translateY(-2px); }
.catalog-card .swatch {
  aspect-ratio: 4/5;
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
}
.catalog-card .swatch img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.9) contrast(1.02);
  transition: transform 0.6s ease;
}
.catalog-card:hover .swatch img { transform: scale(1.05); }
.catalog-card .swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, rgba(20,17,12,0.04), rgba(20,17,12,0.16) 100%);
  mix-blend-mode: multiply;
}
.catalog-card .body { padding: 1.1rem 0.1rem 0; border-top: 1px solid var(--border); }
.catalog-card h4 { font-family: 'Bodoni Moda', serif; font-size: 1.05rem; font-weight: 500; margin-bottom: 0.35rem; }
.catalog-card .price { color: var(--ink-soft); font-weight: 400; font-size: 0.82rem; letter-spacing: 0.02em; }

.steps-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2.5rem 1.5rem;
}
@media (max-width: 760px) { .steps-row { grid-template-columns: repeat(2, 1fr); } }
.step-card {
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 1.4rem 0 0;
}
.step-card .num {
  font-family: 'JetBrains Mono', monospace;
  color: var(--brass);
  font-weight: 500;
  font-size: 0.78rem;
  margin-bottom: 0.7rem;
  letter-spacing: 0.05em;
}
.step-card h4 { font-family: 'Bodoni Moda', serif; font-size: 1.05rem; font-weight: 500; margin-bottom: 0.5rem; }
.step-card p { color: var(--ink-soft); font-size: 0.87rem; font-weight: 300; line-height: 1.6; }

.placeholder-page { padding: 3.5rem 0 5rem; }
.placeholder-page h2 {
  font-family: 'Bodoni Moda', Georgia, serif;
  font-size: 2rem;
  margin-bottom: 0.9rem;
}
.placeholder-page p.lead { color: var(--ink-soft); max-width: 62ch; margin-bottom: 2rem; font-size: 1.02rem; }
.ghost-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 760px) { .ghost-grid { grid-template-columns: 1fr; } }
.ghost-block {
  height: 130px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 10px, var(--surface) 10px 20px);
}

/* Photo grid (Nuestra empresa) */
.photo-grid { display: grid; grid-template-columns: 1.3fr 1fr; grid-template-rows: repeat(2, 190px); gap: 1.6rem; }
@media (max-width: 760px) { .photo-grid { grid-template-columns: 1fr; grid-template-rows: repeat(3, 200px); } }
.photo-grid .ph { border-radius: 0; overflow: hidden; position: relative; }
.photo-grid .ph img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.92); transition: transform 0.7s ease; }
.photo-grid .ph:hover img { transform: scale(1.05); }
.photo-grid .ph.tall { grid-row: span 2; }
.photo-grid .ph .cap {
  position: absolute; left: 0; bottom: 0; right: 0;
  color: #fff; font-size: 0.68rem; font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.1em;
  background: linear-gradient(0deg, rgba(20,17,12,0.65), transparent);
  padding: 1.6rem 1rem 0.7rem;
}

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }
.reveal-stagger.in-view > * { animation: fadeUp 0.6s ease both; }
.reveal-stagger.in-view > *:nth-child(1) { animation-delay: 0.02s; }
.reveal-stagger.in-view > *:nth-child(2) { animation-delay: 0.08s; }
.reveal-stagger.in-view > *:nth-child(3) { animation-delay: 0.14s; }
.reveal-stagger.in-view > *:nth-child(4) { animation-delay: 0.2s; }
.reveal-stagger.in-view > *:nth-child(5) { animation-delay: 0.26s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* View fade-in on switch */
[data-mode-view].active, [data-site-page].active, [data-intranet-view].active { animation: viewFade 0.35s ease; }
@keyframes viewFade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .hero-bg { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .reveal-stagger.in-view > * { animation: none; }
  [data-mode-view].active, [data-site-page].active, [data-intranet-view].active { animation: none; }
  #chat-bubble .pulse-ring { animation: none; display: none; }
  .catalog-card, .catalog-card .swatch img, .photo-grid .ph img { transition: none; }
}

footer.site-footer {
  background: var(--espresso);
  color: var(--hero-ink-soft);
  margin-top: 2rem;
  border-top: 1px solid var(--brass);
}
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}
.footer-inner .brand { display: flex; align-items: center; gap: 0.8rem; }
.footer-inner .brand img { height: 28px; filter: brightness(0) invert(1) opacity(0.9); }
.footer-inner nav { display: flex; gap: 1.8rem; flex-wrap: wrap; text-transform: uppercase; font-size: 0.72rem; letter-spacing: 0.08em; }

/* ============ INTRANET ============ */
#intranet-shell { display: flex; min-height: calc(100vh - 37px); }
#intranet-sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--espresso);
  color: var(--hero-ink-soft);
  display: flex;
  flex-direction: column;
  padding: 1.3rem 1rem;
}
#intranet-sidebar .brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.4rem 1.4rem; }
#intranet-sidebar .brand img { height: 30px; filter: brightness(0) invert(1); }
#intranet-sidebar nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.intranet-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  background: none;
  border: none;
  color: var(--hero-ink-soft);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.intranet-link svg { width: 17px; height: 17px; opacity: 0.85; flex-shrink: 0; }
.intranet-link:hover { background: rgba(246,236,218,0.06); color: var(--hero-ink); }
.intranet-link.active { background: var(--brass); color: #fff; font-weight: 600; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.5rem 0.2rem;
  border-top: 1px solid rgba(246,236,218,0.12);
  margin-top: 0.6rem;
  font-size: 0.82rem;
}
.sidebar-user .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brass);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.78rem;
  flex-shrink: 0;
}
.sidebar-user .who { line-height: 1.25; }
.sidebar-user .who b { display: block; color: var(--hero-ink); font-weight: 600; }
.sidebar-user .who span { color: var(--hero-ink-soft); font-size: 0.76rem; }

#intranet-main { flex: 1; min-width: 0; padding: 1.8rem 2.2rem 4rem; }
.intranet-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.6rem; flex-wrap: wrap; gap: 0.6rem; }
.intranet-header h2 { font-family: 'Bodoni Moda', Georgia, serif; font-size: 1.6rem; font-weight: 600; }
.intranet-header .sub { color: var(--muted); font-size: 0.88rem; }

/* Dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2.2rem; }
@media (max-width: 980px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.tile .k { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.tile .v { font-family: 'JetBrains Mono', monospace; font-size: 1.5rem; font-weight: 600; color: var(--ink); }
.tile .d { font-size: 0.8rem; margin-top: 0.35rem; }
.tile .d.up { color: var(--good); }
.tile .d.warn { color: var(--warn); }

.panel-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; }
@media (max-width: 980px) { .panel-grid { grid-template-columns: 1fr; } }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
}
.panel h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.activity-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.activity-row:last-child { border-bottom: none; }
.activity-row .who { color: var(--ink-soft); }
.risk-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.risk-row:last-child { border-bottom: none; }
.risk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex-shrink: 0; }

/* Toolbar (search + filter + export) */
.toolbar { display: flex; gap: 0.7rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar input[type="search"], .toolbar select {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  font-size: 0.87rem;
  color: var(--ink);
  font-family: inherit;
}
.toolbar input[type="search"] { min-width: 220px; }
.toolbar .spacer { flex: 1; }
.btn-outline {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.btn-outline:hover { border-color: var(--brass); color: var(--brass-deep); }
.btn-solid {
  border: none;
  background: var(--brass);
  color: #fff;
  padding: 0.55rem 1.05rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-solid:hover { background: var(--brass-deep); }

/* Table */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.87rem; min-width: 640px; }
table.data th {
  text-align: left;
  padding: 0.7rem 1rem;
  background: var(--surface-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
table.data th .arrow { opacity: 0.4; margin-left: 0.3rem; font-size: 0.7rem; }
table.data th.sorted .arrow { opacity: 1; color: var(--brass-deep); }
table.data td { padding: 0.7rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:hover { background: #FCF8EF; }
table.data td.num { font-family: 'JetBrains Mono', monospace; text-align: right; }

.pill { display: inline-flex; align-items: center; padding: 0.22rem 0.65rem; border-radius: 999px; font-size: 0.76rem; font-weight: 600; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.pill.info { background: var(--info-bg); color: var(--info); }

.empty-row td { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* Cotizador */
.cotizador-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3rem; align-items: start; }
@media (max-width: 900px) { .cotizador-grid { grid-template-columns: 1fr; } }
.form-card, .quote-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.4rem 1.5rem; }
.form-card h3, .quote-card h3 { font-size: 1rem; margin-bottom: 1.1rem; }
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 0.4rem; }
.field select, .field input[type="number"], .field input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
}
.field-row { display: grid; grid-template-columns: 2fr 1fr; gap: 0.8rem; }
.checks { display: flex; flex-direction: column; gap: 0.55rem; }
.check-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; }
.check-row .price { margin-left: auto; color: var(--muted); font-size: 0.8rem; font-family: 'JetBrains Mono', monospace; }
#items-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.item-row { display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.8rem; font-size: 0.85rem; }
.item-row button { border: none; background: none; color: var(--danger); cursor: pointer; font-size: 0.78rem; }

.quote-doc { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; background: var(--paper); }
.quote-doc .qhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--espresso); padding-bottom: 0.8rem; margin-bottom: 0.9rem; }
.quote-doc .qhead img { height: 42px; }
.quote-doc .qhead .meta { text-align: right; font-size: 0.78rem; color: var(--ink-soft); }
.quote-doc table { width: 100%; border-collapse: collapse; font-size: 0.83rem; margin-bottom: 0.8rem; }
.quote-doc table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; color: var(--muted); padding: 0.3rem 0.2rem; border-bottom: 1px solid var(--border); }
.quote-doc table td { padding: 0.4rem 0.2rem; border-bottom: 1px solid var(--border); }
.quote-doc table td.num { font-family: 'JetBrains Mono', monospace; text-align: right; }
.quote-totals { margin-left: auto; width: 220px; font-size: 0.87rem; }
.quote-totals div { display: flex; justify-content: space-between; padding: 0.25rem 0; }
.quote-totals .total { font-weight: 700; font-size: 1rem; border-top: 1px solid var(--border); margin-top: 0.3rem; padding-top: 0.5rem; }
.quote-doc .empty-note { color: var(--muted); font-size: 0.86rem; text-align: center; padding: 1.5rem 0; }
.quote-actions { display: flex; gap: 0.6rem; margin-top: 1rem; }

/* Kanban (órdenes de trabajo) */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 980px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
.kanban-col { background: var(--surface-2); border-radius: var(--radius); padding: 0.9rem; min-height: 120px; }
.kanban-col h4 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 0.8rem; display: flex; justify-content: space-between; }
.kanban-col h4 .count { font-family: 'JetBrains Mono', monospace; color: var(--muted); }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 0.85rem; margin-bottom: 0.7rem; }
.kanban-card:last-child { margin-bottom: 0; }
.kanban-card .id { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; color: var(--muted); margin-bottom: 0.3rem; }
.kanban-card .cliente { font-weight: 600; font-size: 0.87rem; margin-bottom: 0.2rem; }
.kanban-card .producto { font-size: 0.8rem; color: var(--ink-soft); margin-bottom: 0.5rem; }
.kanban-card .fecha { font-size: 0.75rem; color: var(--muted); }
.kanban-card.risk { border-color: var(--warn); background: var(--warn-bg); }
.kanban-card .risk-flag { display: flex; align-items: center; gap: 0.35rem; font-size: 0.74rem; color: var(--warn); font-weight: 600; margin-top: 0.4rem; }

/* Toast */
#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--espresso);
  color: var(--hero-ink);
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 200;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ WhatsApp-style chat widget ============ */
#chat-bubble {
  position: fixed;
  bottom: 1.6rem;
  right: 1.6rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #25D366;
  border: none;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: transform 0.15s;
}
#chat-bubble:hover { transform: scale(1.06); }
#chat-bubble svg { width: 30px; height: 30px; position: relative; z-index: 1; }
#chat-bubble .ping {
  position: absolute;
  top: -3px; right: -3px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--paper);
  z-index: 2;
}
#chat-bubble .pulse-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #25D366;
  animation: pulseRing 2.4s ease-out infinite;
}
@keyframes pulseRing {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(1.7); opacity: 0; }
}

#chat-panel {
  position: fixed;
  bottom: 1.6rem;
  right: 1.6rem;
  width: 350px;
  max-width: calc(100vw - 2rem);
  height: 480px;
  max-height: calc(100vh - 3rem);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 50px -12px rgba(36,23,8,0.45);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 101;
  border: 1px solid var(--border);
}
#chat-panel.open { display: flex; }
.chat-head {
  background: #075E54;
  color: #fff;
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.chat-head .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brass);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.chat-head .who b { display: block; font-size: 0.88rem; }
.chat-head .who span { font-size: 0.72rem; opacity: 0.85; }
.chat-head button.close { margin-left: auto; background: none; border: none; color: #fff; opacity: 0.8; cursor: pointer; font-size: 1.1rem; line-height: 1; }
#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: #E9DFCF;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(180,120,42,0.06) 0, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(180,120,42,0.06) 0, transparent 40%);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.msg { max-width: 82%; padding: 0.55rem 0.75rem; border-radius: 10px; font-size: 0.86rem; line-height: 1.42; white-space: pre-wrap; }
.msg.bot { background: #fff; align-self: flex-start; border-bottom-left-radius: 2px; box-shadow: 0 1px 1px rgba(0,0,0,0.06); }
.msg.user { background: #DCF8C6; align-self: flex-end; border-bottom-right-radius: 2px; }
.msg.system { align-self: center; background: rgba(46,32,19,0.08); color: var(--ink-soft); font-size: 0.74rem; padding: 0.3rem 0.7rem; border-radius: 999px; }
.msg.typing { display: flex; gap: 0.25rem; padding: 0.7rem 0.85rem; }
.msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.msg.typing span:nth-child(2) { animation-delay: 0.2s; }
.msg.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
#chat-form { display: flex; gap: 0.5rem; padding: 0.7rem; background: var(--surface); border-top: 1px solid var(--border); }
#chat-form input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  font-size: 0.86rem;
  font-family: inherit;
}
#chat-form button {
  width: 38px; height: 38px; border-radius: 50%;
  background: #075E54;
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
#chat-form button:disabled { opacity: 0.5; cursor: default; }

/* ============ Print (Exportar PDF) ============ */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; top: 0; left: 0; width: 100%; }
  #mode-bar, #site-nav, #chat-bubble, #chat-panel { display: none !important; }
}
