:root {
  --background: #f4f7f5;
  --surface: #ffffff;
  --surface-soft: #edf4ef;
  --text: #17231b;
  --muted: #647168;
  --line: #d9e3dc;
  --primary: #17643a;
  --primary-dark: #0e4b2a;
  --danger: #a42b2b;
  --shadow: 0 12px 34px rgba(21, 55, 35, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .35rem; font-size: clamp(1.75rem, 3vw, 2.4rem); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 1.15rem; }

.auth-page { background: radial-gradient(circle at top left, #d9eee0, transparent 48%), #f5f8f6; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-panel { width: min(100%, 430px); padding: 2.5rem; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 1.25rem; border-radius: 16px; background: var(--primary); color: white; font-weight: 800; letter-spacing: -.04em; }
.brand-mark.small { width: 35px; height: 35px; margin: 0; border-radius: 10px; font-size: .8rem; }
.eyebrow { margin-bottom: .35rem; color: var(--primary); font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.stack { display: grid; gap: .75rem; margin-top: 1.75rem; }
label, .search-label { color: #354239; font-size: .84rem; font-weight: 700; }
input { width: 100%; min-height: 44px; padding: .7rem .8rem; border: 1px solid #c9d6cd; border-radius: 10px; background: white; color: var(--text); outline: none; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 100, 58, .12); }

.button { min-height: 40px; padding: .62rem 1rem; border: 1px solid transparent; border-radius: 10px; cursor: pointer; font-weight: 750; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover:not(:disabled) { background: var(--primary-dark); }
.button.secondary { border-color: var(--line); background: white; color: var(--text); }
.button.ghost { background: transparent; color: var(--muted); }
.button.full { width: 100%; }
.danger-text { color: var(--danger) !important; }
.icon-button { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 1.6rem; }

.topbar { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 68px; padding: 0 max(1rem, calc((100vw - 1200px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 800; }
.nav { display: flex; align-items: center; gap: .35rem; }
.nav a { padding: .6rem .8rem; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 700; }
.nav a.active { background: var(--surface-soft); color: var(--primary); }

.page-shell { width: min(1200px, calc(100% - 2rem)); margin: 0 auto; padding: 2.5rem 0 4rem; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.panel { margin-bottom: 1.25rem; padding: 1.3rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 6px 18px rgba(21, 55, 35, .04); }
.panel.compact { padding: 1.2rem; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.inline-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr) auto; align-items: end; gap: 1rem; }
.inline-form div { display: grid; gap: .4rem; }
.message { margin: .75rem 0 0; color: var(--muted); font-size: .9rem; }
.message.error { color: var(--danger); }
.message.success { color: var(--primary); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem .75rem; border-bottom: 1px solid #e8eeea; text-align: left; }
th { color: var(--muted); font-size: .77rem; letter-spacing: .04em; text-transform: uppercase; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }

.pos-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr); align-items: start; gap: 1.25rem; }
.catalog { min-width: 0; }
.cart { position: sticky; top: 88px; }
.search-label { display: block; margin-bottom: .4rem; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; margin-top: 1rem; }
.product-card { display: grid; gap: .5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fcfdfc; }
.product-card h3 { margin: 0; font-size: 1rem; }
.product-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; }
.product-price { color: var(--primary); font-size: 1.05rem; font-weight: 800; }
.cart-items { display: grid; gap: .65rem; }
.cart-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem; padding-bottom: .7rem; border-bottom: 1px solid #e8eeea; }
.cart-row p { margin: 0; }
.cart-controls { display: flex; align-items: center; gap: .45rem; }
.qty-button { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
.empty-state { padding: 2rem 0; color: var(--muted); text-align: center; }
.cart-total { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0; padding-top: 1rem; border-top: 2px solid var(--line); }
.cart-total strong { color: var(--primary); font-size: 1.35rem; }

@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: .7rem 1rem; }
  .brand > span:last-child { display: none; }
  .nav { flex-wrap: wrap; justify-content: end; }
  .page-shell { width: min(100% - 1rem, 1200px); padding-top: 1.25rem; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .inline-form, .pos-layout { grid-template-columns: 1fr; }
  .cart { position: static; }
  .auth-panel { padding: 1.5rem; }
}
