@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@600;700&family=Source+Sans+3:wght@400;500;600;700&display=swap");

:root {
  --olive: #5c6b38;
  --olive-dark: #2c3320;
  --olive-mid: #3f4a24;
  --olive-soft: #e8ebd9;
  --beige: #b9a57c;
  --cream: #f3efe6;
  --ink: #1c1d18;
  --muted: #6a675e;
  --white: #fffcf7;
  --danger: #8f3a32;
  --ok: #3a5c38;
  --line: #ddd6c6;
  --shadow: 0 1px 2px rgba(44, 51, 32, 0.06), 0 10px 28px rgba(44, 51, 32, 0.06);
  --sidebar: 268px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background:
    linear-gradient(180deg, #f7f4ec 0%, var(--cream) 180px);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15.5px;
  letter-spacing: 0.01em;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--olive-dark); letter-spacing: 0; }
h1 { font-size: 2rem; margin: 0; line-height: 1.15; }
h2 { font-size: 1.28rem; margin: 0 0 10px; }
h3 { font-size: 1.08rem; margin: 0 0 8px; }
p { line-height: 1.55; }

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--olive);
  font-weight: 700;
  font-family: var(--sans);
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #252b1c 0%, var(--olive-dark) 100%);
  color: #f4efe4;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  border-right: 1px solid #1a1e14;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 8px; position: relative; }
.nav-toggle,
.nav-close,
.nav-backdrop { display: none; }
.brand img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.06);
  object-fit: contain;
  border: 1px solid rgba(255,255,255,0.08);
}
.brand strong { display: block; font-family: var(--serif); font-size: 1.22rem; font-weight: 700; }
.brand span {
  display: block;
  font-size: 0.72rem;
  opacity: 0.62;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; overflow-y: auto; padding: 0 4px; }
.sidebar nav button,
.sidebar nav a {
  display: block;
  text-align: left;
  text-decoration: none;
  border: 0;
  background: transparent;
  color: #d9d3c4;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
}
.sidebar nav button:hover,
.sidebar nav a:hover {
  background: rgba(255, 252, 246, 0.08);
  color: #fff;
}
.sidebar nav button.active,
.sidebar nav a.active {
  background: rgba(232, 235, 217, 0.14);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--beige);
  font-weight: 600;
}
.sidebar-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 14px 8px 4px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  min-width: 0;
  flex-shrink: 0;
}
.sidebar-foot > div { min-width: 0; }
.sidebar-foot strong { display: block; font-weight: 600; }
.sidebar-foot span {
  display: block;
  margin-top: 4px;
  opacity: 0.65;
  font-size: 0.7rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-all;
}
.sidebar-foot .ghost {
  color: #f6f1e4;
  border-color: rgba(255,255,255,0.22);
  background: transparent;
  margin: 0;
  width: 100%;
  text-align: center;
}
.sidebar-foot .ghost:hover { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.35); }

.workspace { min-width: 0; }
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 36px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar-lead {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.topbar-copy { min-width: 0; }
.topbar-actions { flex-shrink: 0; padding-top: 4px; }
.bell-wrap { position: relative; }
.bell-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.bell-btn:hover { border-color: var(--olive); background: var(--olive-soft); }
.bell-icon { color: var(--olive-dark); display: block; }
.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.bell-badge[hidden] { display: none !important; }
.bell-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(340px, 82vw);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(28, 29, 24, 0.16);
  padding: 14px 14px 12px;
  z-index: 20;
}
.bell-panel[hidden] { display: none !important; }
.bell-panel strong { display: block; margin: 2px 0 10px; font-family: var(--serif); font-size: 1.15rem; }
.bell-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.bell-item:last-child { border-bottom: 0; }
.bell-item .hint { margin: 2px 0 0; }
.bell-panel .primary { width: 100%; margin-top: 12px; }
.pay-prov {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--olive-soft);
  color: var(--olive-dark);
}
.pay-ev-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pay-ev-item {
  position: relative;
  width: 44px;
  height: 44px;
}
.pay-ev-item img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: block;
  background: #eee8d8;
}
.pay-ev-item .ghost {
  position: absolute;
  top: -6px;
  right: -6px;
  min-height: 0;
  width: 20px;
  height: 20px;
  padding: 0;
  line-height: 1;
  font-size: 0.85rem;
  border-radius: 999px;
  background: var(--white);
}
main { padding: 22px 36px 64px; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  box-shadow: var(--shadow);
}
.card .label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card .value {
  font-family: var(--serif);
  font-size: 1.65rem;
  margin-top: 8px;
  color: var(--olive-dark);
  font-weight: 700;
}

.dash { display: flex; flex-direction: column; gap: 18px; }
.dash-rings { display: flex; flex-direction: column; gap: 16px; }
.dash-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.dash-counts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.ring-stat,
.count-stat {
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(232, 235, 217, 0.55), transparent 55%),
    var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.ring-stat.drawn,
.count-stat.drawn {
  opacity: 1;
  transform: none;
}
.ring-stat:nth-child(2),
.count-stat:nth-child(2) { transition-delay: 0.05s; }
.ring-stat:nth-child(3),
.count-stat:nth-child(3) { transition-delay: 0.1s; }
.ring-stat:nth-child(4),
.count-stat:nth-child(4) { transition-delay: 0.15s; }
.count-stat:nth-child(5) { transition-delay: 0.2s; }
.count-stat:nth-child(6) { transition-delay: 0.25s; }
.ring-wrap {
  position: relative;
  width: 118px;
  height: 118px;
}
.ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring-track,
.ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}
.ring-track { stroke: #ebe6d8; }
.ring-fill {
  stroke: var(--olive);
  stroke-dasharray: var(--ring-len);
  stroke-dashoffset: var(--ring-len);
  transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring-stat.drawn .ring-fill { stroke-dashoffset: var(--ring-offset); }
.tone-beige .ring-fill { stroke: var(--beige); }
.tone-ok .ring-fill { stroke: var(--ok); }
.tone-mid .ring-fill { stroke: var(--olive-mid); }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.ring-center strong {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--olive-dark);
  line-height: 1.1;
}
.ring-center span {
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.ring-meta { text-align: center; width: 100%; }
.ring-meta .label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ring-meta .hint { margin: 4px 0 0; font-size: 0.78rem; }
.count-orb {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 28%, #fff 0%, transparent 42%),
    linear-gradient(145deg, var(--olive-soft), #dfe4c8);
  border: 1px solid #d5d9c2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.count-orb strong {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--olive-dark);
  line-height: 1;
}
.profit-panel {
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(92, 107, 56, 0.1), transparent 45%),
    radial-gradient(70% 90% at 0% 100%, rgba(185, 165, 124, 0.14), transparent 50%),
    var(--white);
  border-radius: 18px;
  overflow: hidden;
}
.profit-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.profit-hero {
  text-align: right;
  min-width: 180px;
}
.profit-hero .label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.profit-hero strong {
  display: block;
  font-family: var(--serif);
  font-size: 2.35rem;
  line-height: 1.05;
  color: var(--ok);
  margin-top: 4px;
}
.profit-rings {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.profit-rings .ring-stat {
  opacity: 1;
  transform: none;
  background: rgba(255, 252, 247, 0.72);
}
.profit-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.profit-strip > div {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(232, 235, 217, 0.35);
}
.profit-strip .label {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.profit-strip strong {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--olive-dark);
}
.profit-strip-net {
  background: rgba(58, 92, 56, 0.12) !important;
}
.profit-strip-net strong { color: var(--ok); }
.dash-month-card .dash-month-value {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--olive-dark);
  margin-top: 4px;
}
.dash-month-card.soft {
  background:
    linear-gradient(160deg, rgba(185, 165, 124, 0.12), transparent 55%),
    var(--white);
}
.brand-bars { display: flex; flex-direction: column; gap: 14px; }
.brand-bar { opacity: 0; transform: translateY(6px); transition: opacity 0.4s ease, transform 0.4s ease; }
.brand-bar.drawn { opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * 0.06s); }
.brand-bar-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 0.92rem;
}
.brand-bar-top strong { color: var(--olive-dark); }
.brand-bar-track {
  height: 10px;
  border-radius: 999px;
  background: #ebe6d8;
  overflow: hidden;
}
.brand-bar-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--olive-mid), var(--olive));
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 0.06s);
}
.brand-bar.drawn .brand-bar-track span { width: var(--w); }
.brand-bar .hint { margin: 6px 0 0; }

.page { display: none; }
.page.visible { display: block; }
#print-area.visible {
  display: block;
  padding-bottom: 32px;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

form.panel, .panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}
.panel.note { max-width: 760px; }
.table-wrap { overflow-x: auto; }

label { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 12px; font-weight: 600; letter-spacing: 0.02em; }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover, select:hover, textarea:hover { border-color: #cfc6b2; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 3px var(--olive-soft);
}
select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding: 11px 42px 11px 14px;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='%234f5c2c' d='M4.2 6.2a.75.75 0 0 1 1.06 0L8 8.94l2.74-2.74a.75.75 0 1 1 1.06 1.06l-3.27 3.27a.75.75 0 0 1-1.06 0L4.2 7.26a.75.75 0 0 1 0-1.06z'/></svg>"),
    linear-gradient(#fff, #fff);
  background-repeat: no-repeat, no-repeat;
  background-position: right 12px center, 0 0;
  background-size: 16px, 100%;
}
select:hover {
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='%233f4a24' d='M4.2 6.2a.75.75 0 0 1 1.06 0L8 8.94l2.74-2.74a.75.75 0 1 1 1.06 1.06l-3.27 3.27a.75.75 0 0 1-1.06 0L4.2 7.26a.75.75 0 0 1 0-1.06z'/></svg>"),
    linear-gradient(#fffcf6, #f6f1e4);
}
table select {
  width: auto;
  min-width: 210px;
  margin: 0;
  padding: 6px 32px 6px 10px;
  background-position: right 8px center, 0 0;
  background-size: 14px, 100%;
  font-size: 0.85rem;
}
textarea { min-height: 180px; resize: vertical; }
.row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.product-picker {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf8f2;
}
.product-picker-search label { margin-top: 0; }
.product-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 12px;
  margin-top: 10px;
  align-items: start;
}
.product-picker-select label,
.product-picker-qty label { margin-top: 0; }
#add-product {
  min-height: 220px;
  height: 220px;
  padding: 8px;
  font-size: 0.92rem;
  line-height: 1.45;
  background-image: none;
  overflow: auto;
}
#add-product optgroup {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--olive-dark);
  background: var(--olive-soft);
}
#add-product option {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 6px 8px;
  color: var(--ink);
  background: #fff;
}
.product-picker-qty {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.product-picker-qty .ghost {
  width: 100%;
  margin-top: 4px;
}
.stack { display: grid; gap: 4px; }
.field-block {
  margin-top: 4px;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f3ea;
}
.field-block label {
  margin-top: 0;
  color: var(--olive-dark);
  font-size: 0.84rem;
}
.field-block input,
.field-block textarea {
  margin-top: 8px;
  background: #fff;
  min-height: 0;
}
.field-block textarea {
  min-height: 64px;
  resize: vertical;
}
.addr-line {
  margin-top: 4px;
  font-size: 0.86rem;
  color: var(--ink);
  line-height: 1.35;
}

button.primary,
button.ghost,
button.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
button.primary {
  background: var(--olive-mid);
  color: white;
  border: 1px solid var(--olive-mid);
}
button.primary:hover { background: var(--olive-dark); border-color: var(--olive-dark); }
button.ghost {
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--olive-dark);
}
button.ghost:hover { border-color: var(--olive); background: var(--olive-soft); }
button.danger {
  background: #f8ece9;
  color: var(--danger);
  border: 1px solid #ead2cd;
}
button.danger:hover { background: #f0d8d3; border-color: #d9b3ad; }
.panel > button.primary,
.panel > button.ghost,
form.panel > button.primary,
form.panel > button.ghost { margin-top: 16px; }
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 16px;
}
.actions button { margin-top: 0; }
td.actions {
  margin-top: 0;
  min-width: 240px;
}
table .actions button,
table button.primary,
table button.ghost,
table button.danger {
  padding: 6px 11px;
  font-size: 0.8rem;
  border-radius: 7px;
}
.product-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.product-cell span { min-width: 0; }
a.wa { color: var(--olive-dark); font-weight: 600; text-decoration: none; }
a.wa:hover { text-decoration: underline; }

.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--olive-dark);
  border-radius: 999px;
  padding: 7px 13px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
}
button.chip { cursor: pointer; }
.chip strong { font-family: var(--sans); margin-left: 4px; font-weight: 700; }
.chip.active, .chip:hover { border-color: var(--olive); background: var(--olive-soft); }
.st {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.st-pedido { background: #f3e6d4; color: #7a4e1d; }
.st-cuenta-de-cobro { background: #efe6d2; color: #5c4a24; }
.st-cuenta-de-cobro-por-enviar { background: #f4ead4; color: #6b4e1f; }
.st-cuenta-de-cobro-enviada { background: #e4ebf4; color: #2c4a6e; }
.st-pagada { background: #e7ead8; color: #3f4a24; }
.st-empacada { background: #e4efe8; color: #2f5d45; }
.st-enviada { background: #dce8f4; color: #1f4d7a; }
.st-entregada { background: #dcecdc; color: #2d5a32; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 0.9rem; vertical-align: middle; }
th {
  color: var(--olive-dark);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #f7f4ec;
}
.table-wrap table { min-width: 640px; }
.muted { color: var(--muted); }
.discount-row td { color: var(--danger); }
.ok { color: var(--ok); font-weight: 600; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 10px; }
.error { color: var(--danger); font-size: 0.9rem; margin-top: 10px; font-weight: 600; }
.badge {
  display: inline-block;
  background: var(--olive-soft);
  color: var(--olive-dark);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.invoice {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: 36px 40px;
  border: 1px solid var(--line);
  border-top: 8px solid var(--olive-mid);
  border-radius: 4px;
  box-shadow: none;
}
.invoice-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.invoice-head img { width: 96px; height: 96px; object-fit: contain; }
.sign { width: 260px; height: auto; display: block; }

.auth {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 100vh;
}
.auth-art {
  background:
    radial-gradient(circle at 18% 16%, rgba(196, 176, 138, 0.22), transparent 42%),
    linear-gradient(165deg, #1f2418 0%, #3f4a24 52%, #6b6348 100%);
  color: #f6f1e4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
}
.auth-art-inner { max-width: 440px; }
.auth-art img {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  margin-bottom: 28px;
  object-fit: contain;
  border: 1px solid rgba(255,255,255,0.12);
}
.auth-art .eyebrow { color: #d4c4a0; }
.auth-art h1 { color: #fffcf6; font-size: 3.1rem; margin: 8px 0 14px; }
.auth-art p { opacity: 0.88; max-width: 36ch; }
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--cream);
}
.auth-card {
  width: min(400px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-card .primary { width: 100%; margin-top: 20px; }

.list-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.list-search { flex: 1; min-width: 220px; }
.list-search label { margin-top: 0; }
.list-toolbar > .primary,
.list-toolbar > .ghost {
  height: 42px;
  padding: 0 18px;
  flex-shrink: 0;
}
.toolbar-note { margin: 0; max-width: 42ch; align-self: center; }

#clientes table th,
#clientes table td {
  vertical-align: middle;
  text-align: center;
}
#clientes table td strong,
#clientes table td .hint {
  display: block;
  text-align: center;
}
#clientes td.actions {
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  padding: 8px;
  overflow: visible;
}
#clientes .client-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  width: 88px;
  margin: 0 auto;
}
#clientes .client-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  margin: 0;
  font-size: 0.78rem;
  line-height: 1;
  border-width: 1px;
  border-style: solid;
  border-radius: 7px;
  box-sizing: border-box;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(28, 29, 24, 0.52);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modal-fade 0.18s ease;
}
.modal[hidden] { display: none !important; }
.modal-card,
.modal .auth-card {
  width: min(440px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 26px;
  box-shadow: 0 24px 60px rgba(28, 29, 24, 0.22);
  max-height: 90vh;
  overflow: auto;
  animation: modal-rise 0.22s ease;
}
.modal-card-wide { width: min(720px, 100%); }
.modal-card-sm { width: min(380px, 100%); }
.modal-card h2,
.modal .auth-card h2 { margin: 4px 0 8px; font-family: var(--serif); }
.modal-card .actions,
.modal .auth-card .actions {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.modal-card .actions .primary,
.modal-card .actions .ghost,
.modal-card .actions .danger,
.modal .auth-card .actions .primary,
.modal .auth-card .actions .ghost {
  width: auto;
  margin-top: 0;
  min-height: 40px;
  padding: 0 16px;
  box-sizing: border-box;
}
@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.thumb {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.thumb img { width: 100%; height: 180px; object-fit: cover; display: block; background: #eee8d8; }
.thumb .pad { padding: 12px 14px 16px; }
.card small { display: block; margin-top: 6px; color: var(--muted); }
.stat-name { font-weight: 600; }
.stat-meter {
  width: 88px;
  min-width: 88px;
  padding-right: 4px;
}
.stat-meter span {
  display: block;
  height: 7px;
  background: var(--olive);
  border-radius: 99px;
  min-width: 4px;
}
.delta { display: block; margin-top: 6px; font-weight: 700; font-size: 0.82rem; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
#stats .split { margin-top: 4px; }

@media (max-width: 1100px) {
  .dash-hero,
  .profit-rings { grid-template-columns: repeat(2, 1fr); }
  .dash-counts { grid-template-columns: repeat(3, 1fr); }
  .profit-strip { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 18px 22px 14px; }
  main { padding: 18px 22px 48px; }
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    margin-top: 2px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--white);
    cursor: pointer;
    flex-shrink: 0;
  }
  .nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--olive-dark);
    border-radius: 99px;
  }
  .nav-close {
    display: grid;
    place-items: center;
    margin-left: auto;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    background: transparent;
    color: #f6f1e4;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
  }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(28, 29, 24, 0.45);
  }
  .nav-backdrop[hidden] { display: none !important; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 86vw);
    height: 100vh;
    z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    box-shadow: 12px 0 40px rgba(0,0,0,0.25);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open { overflow: hidden; }
  .sidebar nav {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .sidebar nav button {
    min-height: 44px;
    padding: 12px 14px;
  }
  .topbar {
    position: sticky;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
  }
  .topbar-lead { align-items: center; }
  #page-sub { display: none; }
  h1 { font-size: 1.55rem; }
  main { padding: 14px 16px 40px; }
  .cards,
  .split,
  .row,
  .auth { grid-template-columns: 1fr; }
  .dash-hero,
  .dash-counts,
  .profit-rings { grid-template-columns: 1fr 1fr; }
  .profit-strip { grid-template-columns: 1fr 1fr; }
  .profit-head { align-items: flex-start; }
  .profit-hero { text-align: left; }
  .panel,
  form.panel { padding: 16px; }
  .table-wrap {
    margin: 0 -4px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table { min-width: 560px; }
  .list-toolbar { align-items: stretch; }
  .list-search { min-width: 0; width: 100%; }
  .list-toolbar > .primary,
  .list-toolbar > .ghost { width: 100%; }
  .bell-panel {
    right: -8px;
    width: min(320px, calc(100vw - 28px));
  }
  .thumbs { grid-template-columns: 1fr; }
  .modal { padding: 12px; align-items: end; }
  .modal-card,
  .modal .auth-card,
  .modal-card-wide,
  .modal-card-sm {
    width: 100%;
    max-height: min(92vh, 720px);
    border-radius: 16px 16px 10px 10px;
  }
  .modal-card .actions,
  .modal .auth-card .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-card .actions .primary,
  .modal-card .actions .ghost,
  .modal-card .actions .danger,
  .modal .auth-card .actions .primary,
  .modal .auth-card .actions .ghost {
    width: 100%;
  }
  .invoice { padding: 22px 16px; }
  .invoice-head { flex-direction: column; align-items: flex-start; }
  .invoice-head img { width: 72px; height: 72px; }
  .sign { width: min(220px, 70vw); }
  .auth-art { display: none; }
  .auth-panel { padding: 24px 16px; min-height: 100vh; }
  .auth-card { padding: 28px 20px; }
  #clientes td.actions,
  #clientes .client-actions {
    width: auto;
    min-width: 0;
    max-width: none;
  }
  td.actions {
    white-space: normal;
  }
  table .actions button,
  table button.primary,
  table button.ghost,
  table button.danger {
    width: 100%;
  }
  .pipeline { gap: 6px; }
  .chip { font-size: 0.78rem; padding: 8px 11px; }
}

@media (max-width: 560px) {
  .dash-hero,
  .dash-counts,
  .profit-rings,
  .profit-strip { grid-template-columns: 1fr; }
  .ring-wrap { width: 108px; height: 108px; }
  .count-orb { width: 72px; height: 72px; }
  .profit-hero strong { font-size: 1.9rem; }
  .dash-month-card .dash-month-value { font-size: 1.65rem; }
  .topbar-actions { padding-top: 0; }
  .field-block input { font-size: 16px; }
  input, select, textarea { font-size: 16px; }
  #pay-kpis.cards { grid-template-columns: 1fr 1fr; }
  .product-picker-row { grid-template-columns: 1fr; }
  #add-product { min-height: 180px; height: 180px; }
}

@media (max-width: 380px) {
  #pay-kpis.cards { grid-template-columns: 1fr; }
  .brand span { display: none; }
}

@media print {
  .sidebar, .topbar, .no-print, .nav-toggle, .nav-backdrop, .nav-close { display: none !important; }
  .app { display: block; }
  body { background: white; }
  .page { display: none !important; }
  #print-area { display: block !important; }
}
