:root {
  --ink: #18201e;
  --ink-2: #26302d;
  --paper: #f6f0e3;
  --paper-2: #fffdf7;
  --line: #d8cfbd;
  --text: #202521;
  --muted: #66716c;
  --accent: #176b52;
  --accent-dark: #0f533f;
  --danger: #9d2d2d;
  --warning: #9a6721;
  --shadow: 0 3px 14px rgba(20, 30, 26, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: #ede8dc; min-height: 100%; }
body { margin: 0; color: var(--text); background: #ede8dc; min-height: 100vh; }
button, input { font: inherit; }
button { touch-action: manipulation; }
.hidden { display: none !important; }
.muted { opacity: .72; }
.hint { color: var(--muted); font-size: .92rem; line-height: 1.35; }
.no-margin { margin: 0; }
.topbar {
  position: sticky; top: 0; z-index: 50; background: var(--ink); color: white;
  padding: max(9px, env(safe-area-inset-top)) 12px 10px; box-shadow: var(--shadow);
}
.topline { display: flex; gap: 14px; align-items: center; justify-content: space-between; font-size: .91rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: 7px; align-items: center; margin-top: 9px; flex-wrap: wrap; }
.page { width: min(900px, 100%); margin: 0 auto; padding: 12px 10px 115px; }
.panel {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  margin: 0 0 12px; box-shadow: var(--shadow);
}
.auth-panel { max-width: 480px; margin: 8vh auto 0; }
.brand { font-weight: 900; letter-spacing: -.04em; font-size: 2rem; color: var(--accent); }
.brand span { color: var(--ink); }
h1 { font-size: 1.35rem; margin: 7px 0 14px; }
h2 { font-size: 1.08rem; margin: 0 0 10px; }
label { display: block; font-weight: 650; font-size: .94rem; margin: 10px 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input:not([type]) {
  width: 100%; margin-top: 5px; padding: 12px 13px; border: 1px solid #c7bfaf; border-radius: 10px;
  background: white; color: var(--text); outline: none; min-height: 46px;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23,107,82,.13); }
.btn { border: 0; border-radius: 10px; padding: 11px 14px; font-weight: 750; cursor: pointer; min-height: 44px; }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: white; }
.btn.primary:active { background: var(--accent-dark); }
.btn.secondary { background: #e6dfd0; color: var(--ink); }
.btn.danger { background: #f3d9d4; color: #7f2222; }
.btn.compact { min-height: 36px; padding: 7px 10px; font-size: .86rem; }
.btn.wide { width: 100%; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.status-pill { font-size: .78rem; border-radius: 999px; padding: 5px 9px; font-weight: 750; }
.status-pill.online { background: #d3eddf; color: #15553d; }
.status-pill.offline { background: #f5d9d5; color: #852e28; }
.status-pill.neutral { background: #ebe5d9; color: #514c43; }
.section-title-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.segmented { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.segment { border: 1px solid var(--line); border-radius: 10px; padding: 10px 7px; background: #f2ecdf; font-weight: 750; color: var(--ink); }
.segment.active { background: var(--ink); color: white; border-color: var(--ink); }
.segment.warning { color: #7a4b10; }
.client-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.catalog { display: grid; gap: 12px; }
.category-card { background: #f3ead5; border: 1px solid #d3c4a6; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.category-title { background: #e5d4af; padding: 10px 14px; font-size: 1.2rem; font-weight: 900; color: #382f21; }
.product-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 11px 12px; border-top: 1px solid rgba(125,105,72,.18); }
.product-row:first-of-type { border-top: 0; }
.product-name { font-weight: 850; font-size: .98rem; text-transform: uppercase; }
.product-meta { color: #74664f; font-size: .83rem; margin-top: 3px; }
.stepper { display: grid; grid-template-columns: 44px 48px 44px; align-items: center; gap: 4px; }
.stepper button { width: 44px; height: 44px; border: 0; border-radius: 9px; background: var(--ink); color: white; font-size: 1.45rem; font-weight: 900; }
.stepper .qty { text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; }
.payment-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.payment-choice { margin: 0; padding: 11px 8px; border: 1px solid var(--line); border-radius: 10px; background: #faf6ed; display: flex; align-items: center; gap: 8px; }
.payment-choice input { width: 20px; height: 20px; }
.recent-list { display: grid; gap: 8px; }
.sale-card { border: 1px solid var(--line); border-radius: 11px; padding: 10px; background: #fff; }
.sale-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.sale-number { font-weight: 900; }
.sale-total { font-weight: 900; font-size: 1.08rem; }
.sale-meta { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.sale-lines { font-size: .84rem; margin-top: 7px; color: #4c544f; }
.sale-actions { display: flex; gap: 7px; margin-top: 8px; }
.sale-tag { display: inline-block; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: 3px 7px; background: #e9e4d9; }
.sale-tag.pending { background: #f5e5b6; color: #725417; }
.sale-tag.paid { background: #d5edde; color: #145239; }
.sale-tag.voided, .sale-tag.failed { background: #f1d6d1; color: #7f2c27; }
.empty { color: var(--muted); padding: 12px 2px; }
.sticky-checkout {
  position: fixed; z-index: 60; left: 0; right: 0; bottom: 0; background: rgba(24,32,30,.97); color: white;
  padding: 10px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: flex; justify-content: space-between; gap: 14px; align-items: center; box-shadow: 0 -4px 18px rgba(0,0,0,.18);
}
.sticky-label { font-size: .75rem; opacity: .72; text-transform: uppercase; letter-spacing: .08em; }
.sticky-total { font-size: 1.55rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.checkout-button { min-width: 190px; }
.dialog { width: min(680px, calc(100vw - 20px)); max-height: 88vh; overflow: auto; border: 0; border-radius: 14px; padding: 0; background: var(--paper-2); box-shadow: 0 14px 60px rgba(0,0,0,.30); }
.dialog::backdrop { background: rgba(12,18,16,.62); }
.dialog-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; background: var(--ink); color: white; padding: 13px 15px; z-index: 2; }
.dialog-head h2 { margin: 0; }
.dialog > #recapBody, .dialog > p { padding: 14px 15px; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 15px 15px; border-top: 1px solid var(--line); }
.icon-button { border: 0; background: transparent; color: white; font-size: 1.8rem; cursor: pointer; }
.small-dialog { max-width: 460px; }
.metric-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.metric { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: white; }
.metric .value { font-weight: 900; font-size: 1.25rem; }
.metric .label { color: var(--muted); font-size: .78rem; margin-top: 2px; }
.recap-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .9rem; }
.recap-table th, .recap-table td { padding: 7px 5px; border-bottom: 1px solid var(--line); text-align: left; }
.recap-table td:last-child, .recap-table th:last-child { text-align: right; }
.alert { background: #fff1cf; border: 1px solid #e4c56b; border-radius: 10px; padding: 10px; margin: 10px 0; }
.toast { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: 100px; max-width: calc(100vw - 30px); background: #111916; color: white; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); }
@media (max-width: 620px) {
  .page { padding-left: 7px; padding-right: 7px; }
  .topline { font-size: .80rem; gap: 7px; }
  .client-fields { grid-template-columns: 1fr; gap: 0; }
  .segmented { grid-template-columns: 1fr 1fr; }
  .segmented .warning { grid-column: 1 / -1; }
  .payment-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .checkout-button { min-width: 160px; }
  .product-row { padding: 10px 8px; }
  .stepper { grid-template-columns: 42px 42px 42px; }
  .stepper button { width: 42px; height: 42px; }
}
