:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1d1c1a;
  --muted: #6f6a63;
  --line: #ded8cf;
  --red: #c9282d;
  --green: #177245;
  --gold: #c48a2c;
  --blue: #2f5f98;
  --shadow: 0 16px 45px rgba(36, 31, 25, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: #fffaf4;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 900; font-size: 22px; color: var(--red); }
.topbar nav { display: flex; gap: 14px; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); font-weight: 700; }
.user-pill { border: 1px solid var(--line); padding: 8px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); }
.lang-switch { display: flex; gap: 6px; align-items: center; }
.lang-switch a {
  min-width: 38px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 850;
  font-size: 12px;
}
.lang-switch a.active { background: var(--ink); color: white; border-color: var(--ink); }
.shell { max-width: 1220px; margin: 0 auto; padding: 30px 20px 60px; }
.login {
  min-height: calc(100vh - 128px);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 420px;
  gap: 42px;
  align-items: center;
}
.login h1 { font-size: clamp(38px, 6vw, 72px); line-height: 1; margin: 0 0 18px; max-width: 820px; }
.login p { font-size: 18px; color: var(--muted); max-width: 660px; }
.eyebrow { color: var(--green) !important; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: 13px !important; }
.heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 22px; }
.heading h1 { margin: 0; font-size: 38px; }
.heading p { margin: 6px 0 0; color: var(--muted); }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel h2 { margin: 0 0 16px; font-size: 20px; }
.panel h3 { margin: 14px 0 8px; font-size: 15px; color: var(--muted); }
.grid { display: grid; gap: 18px; margin-bottom: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}
.shop-menu-panel .cards {
  max-height: none;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.checkout-panel {
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 106px);
  overflow: auto;
}
.checkout-submit {
  position: sticky;
  bottom: 0;
  box-shadow: 0 -10px 20px rgba(255, 255, 255, .92);
}
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #26231f; color: white; padding: 18px; border-radius: 8px; }
.stat span { display: block; color: #d8cec1; margin-bottom: 6px; }
.stat strong { font-size: 28px; }
.form { display: grid; gap: 12px; align-content: start; }
label { display: grid; gap: 6px; font-weight: 750; color: #34312d; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  font: inherit;
  background: #fffdf9;
  color: var(--ink);
}
textarea { min-height: 82px; resize: vertical; }
button {
  border: 0;
  border-radius: 6px;
  background: var(--red);
  color: white;
  padding: 11px 15px;
  font-weight: 850;
  cursor: pointer;
}
button:hover { filter: brightness(.96); }
button.danger { background: #8d2626; }
.text-button {
  background: transparent;
  color: var(--blue);
  padding: 0;
  border-radius: 0;
  font-weight: 850;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #26231f;
  color: white;
  padding: 10px 12px;
  font-weight: 850;
}
.text-link { color: var(--blue); font-weight: 850; }
.check { display: flex; align-items: center; gap: 10px; }
.check input { width: auto; }
.row { display: grid; grid-template-columns: 1fr 110px; gap: 10px; align-items: end; }
.alert { padding: 13px 16px; border-radius: 8px; margin-bottom: 18px; font-weight: 750; }
.alert.ok { background: #e7f4ec; color: #17623c; border: 1px solid #b9dfc8; }
.alert.bad { background: #fff0ec; color: #9c2929; border: 1px solid #efb7ac; }
.muted, small { color: var(--muted); }
code { background: #f1ebe2; padding: 2px 5px; border-radius: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; }
td small { display: block; margin-top: 4px; }
.badge { background: #f2eadf; border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; font-weight: 800; color: #665c50; }
.cards { display: grid; gap: 10px; max-height: 540px; overflow: auto; }
.product, .order {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.product img, .noimg { width: 74px; height: 74px; border-radius: 6px; object-fit: cover; background: linear-gradient(135deg, #c9282d, #177245 55%, #c48a2c); }
.product strong, .order strong { display: block; }
.product small, .order small { display: block; margin: 3px 0; }
.shop-product > div { display: grid; gap: 8px; }
.shop-product button { justify-self: start; }
.order { grid-template-columns: 1fr auto; }
.inline, .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline select, .inline input, .actions input { width: auto; min-width: 140px; }
.kanban { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
.ticket { border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 12px; background: #fffdf9; }
.ticket ul { padding-left: 18px; color: var(--muted); }
.order-detail p { color: var(--muted); }
.order-builder {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.order-builder h2 { margin-bottom: 0; }
.order-summary-head,
.order-ticket-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 88px 88px;
  gap: 10px;
  align-items: start;
}
.order-summary-head {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 0 0 8px;
  text-transform: uppercase;
}
.order-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
  background: #fffdf9;
}
.order-lines { display: grid; gap: 0; }
.order-line {
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}
.order-ticket-row strong { display: block; }
.order-ticket-row { cursor: pointer; }
.order-ticket-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.order-ticket-row .js-line-breakdown {
  color: #4f4941;
}
.order-ticket-row > div:nth-child(2) small,
.order-ticket-row > div:nth-child(3) small {
  font-size: 11px;
  max-width: 95px;
}
.line-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 5px;
}
.line-actions .text-button {
  font-size: 12px;
  text-align: left;
}
.order-line-editor {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  padding: 10px;
}
.order-line-editor:not([hidden]) {
  display: grid;
  gap: 10px;
}
.order-line-controls {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
}
.order-line-controls label:only-child {
  grid-column: 1 / -1;
}
.addon-list {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffaf4;
}
.addon-group {
  margin-top: 4px;
  font-weight: 850;
  color: var(--ink);
}
.order-detail-view { display: grid; gap: 20px; }
.order-detail-view .panel { box-shadow: none; }
.order-detail-view table th { width: 150px; }
.logbox {
  overflow: auto;
  max-height: 70vh;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #181613;
  color: #f4eee5;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .login, .grid.two, .grid.three, .kanban, .metrics, .shop-layout { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 16px 20px; gap: 12px; }
  .heading h1 { font-size: 30px; }
  .checkout-panel { position: static; max-height: none; order: -1; }
  .shop-menu-panel .cards { grid-template-columns: 1fr; }
  .order-summary-head { display: none; }
  .order-ticket-row { grid-template-columns: minmax(0, 1fr) auto; }
  .order-ticket-row > div:nth-child(2) { display: none; }
  .order-line-controls { grid-template-columns: 1fr; }
}
