@import url("https://fonts.cdnfonts.com/css/utendo");

:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --bg-soft: #eef3f8;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e8eef5;
  --line: #d8e1eb;
  --line-strong: #c0ccd9;
  --text: #172033;
  --muted: #66758a;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #e8efff;
  --accent: #0ea5e9;
  --accent-soft: #e0f2fe;
  --green: #16803c;
  --green-soft: #e4f7ea;
  --blue: #2563eb;
  --blue-soft: #e6efff;
  --red: #c2413b;
  --red-soft: #ffe8e5;
  --amber: #b7791f;
  --amber-soft: #fff4d8;
  --input: #ffffff;
  --shadow: 0 18px 45px rgb(23 32 51 / 10%);
  --shadow-soft: 0 10px 25px rgb(23 32 51 / 7%);
  --radius: 8px;
  --sidebar: #ffffff;
  --sidebar-text: #172033;
  font-family: "Utendo", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101216;
  --bg-soft: #151922;
  --surface: #191f29;
  --surface-2: #222a36;
  --surface-3: #2b3543;
  --line: #303b4a;
  --line-strong: #465367;
  --text: #f2f6fb;
  --muted: #9aa7b8;
  --primary: #78a7ff;
  --primary-strong: #adc8ff;
  --primary-soft: #1b2d52;
  --accent: #38bdf8;
  --accent-soft: #15334d;
  --green: #7bd88f;
  --green-soft: #193b24;
  --blue: #8bb8ff;
  --blue-soft: #1f314d;
  --red: #ff9188;
  --red-soft: #48211f;
  --amber: #f0c56b;
  --amber-soft: #43351c;
  --input: #121720;
  --shadow: 0 18px 45px rgb(0 0 0 / 28%);
  --shadow-soft: 0 10px 26px rgb(0 0 0 / 22%);
  --sidebar: #151922;
  --sidebar-text: #f2f6fb;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--primary-soft) 55%, transparent), transparent 34rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

button,
a,
input,
select,
textarea {
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

button {
  border: 0;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 28%, transparent);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.login-layout {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(500px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.theme-login-action {
  min-height: 36px;
}

.brand-mark {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0;
}

.login-panel h1,
.page-title h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.06;
  letter-spacing: 0;
}

.login-panel p,
.page-title p {
  color: var(--muted);
  margin: 8px 0 0;
}

.field {
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.field.compact {
  margin: 8px 0;
}

.field label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.search-input,
.compact-field input,
.line-inputs select,
.line-inputs input,
.check-row input[type="number"] {
  width: 100%;
  min-height: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  padding: 0 12px;
  line-height: normal;
  outline: none;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 4%);
}

.field textarea {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus,
.compact-field input:focus,
.line-inputs select:focus,
.line-inputs input:focus,
.check-row input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent);
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.main-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--sidebar) 86%, transparent);
  backdrop-filter: blur(24px) saturate(150%);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 10px 0 30px rgb(23 32 51 / 5%);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.nav-brand strong {
  display: block;
  color: var(--sidebar-text);
}

.nav-brand span {
  color: var(--muted);
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  overflow: hidden;
  padding: 8px 10px;
  text-align: left;
  touch-action: manipulation;
  transform: translateZ(0);
}

.nav-item::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

.nav-item:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.nav-item:hover::before {
  opacity: 1;
}

.nav-item.active {
  color: var(--primary-strong);
  font-weight: 560;
}

.nav-item.active::before {
  opacity: 1;
  background: color-mix(in srgb, var(--primary-soft) 84%, var(--surface) 16%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 20%, transparent);
}

.nav-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--primary-strong);
}

.nav-icon svg {
  width: 20px;
  height: 20px;
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.nav-item.active .nav-icon {
  background: var(--primary);
  color: #ffffff;
}

.nav-count {
  min-width: 24px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 9%, var(--surface));
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  padding: 2px 7px;
  text-align: center;
}

.nav-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 10px;
}

.user-card {
  display: grid;
  gap: 2px;
}

.user-card strong {
  font-size: 14px;
}

.user-card span {
  color: var(--muted);
  font-size: 12px;
}

.content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(70px, 6vw, 88px) clamp(18px, 3vw, 36px) 96px;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transform-origin: 50% 24px;
  transition: opacity .22s cubic-bezier(.22, 1, .36, 1), transform .26s cubic-bezier(.22, 1, .36, 1), filter .22s ease;
  will-change: opacity, transform;
}

.content.page-exit-left {
  opacity: 0;
  filter: blur(3px);
  transform: translate3d(-22px, 0, 0) scale(.992);
}

.content.page-exit-right {
  opacity: 0;
  filter: blur(3px);
  transform: translate3d(22px, 0, 0) scale(.992);
}

.content.page-enter[data-transition-direction="forward"] {
  opacity: 0;
  filter: blur(3px);
  transform: translate3d(24px, 0, 0) scale(.992);
}

.content.page-enter[data-transition-direction="back"] {
  opacity: 0;
  filter: blur(3px);
  transform: translate3d(-24px, 0, 0) scale(.992);
}

.content.page-enter-active,
.content.page-ready {
  opacity: 1;
  filter: none;
  transform: translate3d(0, 0, 0) scale(1);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 22px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  padding: 9px 13px;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.button.compact-action {
  min-width: 64px;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-width: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 18px;
  font-weight: 850;
  line-height: 1;
  padding: 0;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.icon-button:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
  box-shadow: var(--shadow-soft);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--primary-strong);
}

.button.ghost {
  border-color: var(--line);
  background: var(--surface);
}

.button.danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: color-mix(in srgb, var(--red) 24%, transparent);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
  box-shadow: none;
}

.floating-tools {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.sync-pill {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--muted);
  box-shadow: var(--shadow-soft);
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 750;
}

.theme-toggle:hover,
.sync-pill:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.sync-pill.online {
  color: var(--green);
}

.sync-pill.offline,
.sync-pill.attention {
  color: var(--amber);
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.kpis {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.08fr) minmax(min(360px, 100%), .92fr);
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.card h2,
.card h3 {
  margin: 0 0 12px;
  font-size: 17px;
  letter-spacing: 0;
}

.section-head {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head.horizontal {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.section-head p {
  color: var(--muted);
  margin: 4px 0 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented .button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 116px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1.05;
  letter-spacing: 0;
}

.analytics-command-center {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.analytics-view-body {
  display: grid;
  gap: 14px;
}

.analytics-view-body.is-soft-updating {
  cursor: progress;
}

.analytics-kpis {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.analytics-metric {
  min-height: 126px;
  align-content: start;
}

.analytics-category-kpi {
  gap: 7px;
}

.analytics-category-kpi-list {
  display: grid;
  gap: 5px;
  margin-top: 2px;
}

.analytics-category-kpi-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.analytics-category-kpi-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-category-kpi-list b {
  color: var(--text);
  font-size: 13px;
}

.analytics-category-empty {
  color: var(--muted);
  font-size: 12px;
}

.analytics-delta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.analytics-delta.positive {
  color: var(--green);
}

.analytics-delta.negative {
  color: var(--red);
}

.analytics-grid,
.analytics-split {
  margin-top: 0;
}

.analytics-toolbar {
  margin-bottom: 0;
}

.analytics-bars,
.analytics-rank-list {
  display: grid;
  gap: 10px;
}

.analytics-ranking-card {
  display: flex;
  flex-direction: column;
}

.analytics-ranking-card .analytics-rank-list {
  flex: 1;
}

.analytics-bar-row,
.analytics-rank-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.analytics-rank-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  cursor: pointer;
}

.analytics-rank-row:hover,
.analytics-rank-row.active {
  border-color: color-mix(in srgb, var(--primary) 48%, var(--line));
  background: var(--primary-soft);
}

.analytics-rank-main,
.analytics-bar-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.analytics-rank-main small,
.analytics-bar-main span {
  color: var(--muted);
  font-size: 13px;
}

.analytics-rank-value {
  color: var(--primary-strong);
  font-weight: 850;
}

.analytics-bar-track {
  width: 100%;
  height: 8px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.analytics-bar-track span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.analytics-bar-with-percent {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.analytics-bar-percent {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-align: right;
}

.analytics-detail-card {
  align-self: start;
}

.analytics-mini-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.analytics-mini-kpi {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.analytics-mini-kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.analytics-mini-kpi strong {
  font-size: 19px;
  line-height: 1.1;
}

.analytics-detail-section {
  display: grid;
  gap: 10px;
}

.analytics-detail-section h3 {
  margin: 0;
}

.analytics-detail-cta p {
  margin: 0;
  color: var(--muted);
}

.analytics-full-page {
  display: grid;
  gap: 14px;
}

.analytics-detail-content {
  display: grid;
  gap: 14px;
  overflow-anchor: none;
  transition: opacity .16s ease, filter .16s ease;
}

.analytics-detail-content.is-soft-updating {
  opacity: .74;
  filter: saturate(.92);
  pointer-events: none;
}

.analytics-detail-period {
  margin-bottom: 0;
}

.analytics-list-footer {
  display: flex;
  justify-content: center;
  margin-top: auto;
  padding-top: 14px;
}

.analytics-more-button {
  justify-self: center;
  min-width: 180px;
}

.analytics-breakdown-row > div {
  width: 100%;
  display: grid;
  gap: 8px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.period-actions {
  align-items: center;
}

.period-pill {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 9px 14px;
}

.period-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.period-pill strong {
  font-size: 13px;
  font-weight: 800;
}

.week-calendar-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.week-day {
  min-height: 58px;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.week-day strong {
  color: var(--text);
  font-size: 20px;
}

.week-day.today {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.week-day.today strong {
  color: var(--primary-strong);
}

.compact-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-field input {
  min-height: 42px;
  height: 42px;
  padding: 0 10px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.accounting-export-panel {
  margin-top: 14px;
}

.accounting-grid {
  margin-top: 14px;
}

.accounting-exports {
  margin-top: 12px;
}

.export-link {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  padding: 13px;
  text-decoration: none;
}

.export-card {
  align-content: stretch;
}

.export-format-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.export-format-actions .button {
  min-height: 34px;
  padding: 8px 11px;
}

.export-link:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.export-link span,
.accounting-amount span {
  color: var(--muted);
  font-size: 13px;
}

.toolbar .search-input {
  flex: 1 1 260px;
  height: 46px;
  min-height: 46px;
  padding-top: 1px;
  line-height: normal;
}

.product-toolbar-card {
  margin-bottom: 14px;
}

.client-toolbar-card {
  margin-bottom: 14px;
}

.client-toolbar {
  align-items: center;
}

.client-view-switch {
  flex: 0 0 auto;
}

.pill-row,
.chip-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.category-chip,
.chip-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  padding: 0 11px;
  line-height: 1;
  text-align: center;
}

.category-chip strong {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 650;
}

.category-chip.muted {
  color: var(--muted);
  cursor: default;
}

.category-chip:disabled {
  cursor: default;
}

.chip-button.active,
.category-chip:hover {
  border-color: color-mix(in srgb, var(--primary) 46%, var(--line));
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.allergen-chip-group {
  gap: 6px;
}

.allergen-chip-group .chip-button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.product-list {
  display: block;
}

.list {
  display: grid;
  gap: 10px;
}

.list-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  box-shadow: 0 1px 2px rgb(23 32 51 / 4%);
}

.list-row:hover {
  border-color: var(--line-strong);
}

.list-row.selected {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-soft);
}

.list-row.compact {
  grid-template-columns: minmax(0, 1fr);
}

.product-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.product-row-main {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.product-info {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.product-name {
  overflow-wrap: anywhere;
}

.product-side,
.product-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  align-self: end;
}

.product-side {
  flex-direction: column;
  align-items: flex-end;
}

.product-price {
  min-width: 96px;
  text-align: right;
  font-size: 18px;
  white-space: nowrap;
}

.category-manager-list {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.category-manager-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.category-create-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, auto) auto;
  gap: 10px;
  align-items: end;
}

.category-create-form .category-form {
  display: contents;
}

.category-create-form .field {
  margin: 0;
}

.category-create-button {
  align-self: end;
}

.row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 5px;
}

.row-title strong {
  overflow-wrap: anywhere;
}

.row-meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
}

.accounting-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.accounting-client-row {
  grid-template-columns: minmax(0, 1fr);
}

.accounting-client-due {
  justify-self: center;
  color: var(--red);
  font-weight: 850;
  text-align: center;
}

.accounting-meta {
  justify-content: flex-end;
}

.accounting-amount {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.due-order-actions {
  min-width: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.due-order-actions > div {
  display: grid;
  gap: 3px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
}

.badge.gold {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.green {
  background: var(--green-soft);
  color: var(--green);
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.red {
  background: var(--red-soft);
  color: var(--red);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
  color: var(--muted);
  padding: 22px;
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgb(15 20 30 / 58%);
  padding: 18px;
}

.modal-panel {
  width: min(780px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px;
}

.modal-panel:has(.product-form) {
  width: min(720px, 100%);
}

.product-form,
.category-form {
  display: grid;
  gap: 8px;
}

.product-main-grid {
  grid-template-columns: minmax(190px, .75fr) minmax(260px, 1fr);
  align-items: start;
}

.modal-panel:has(.client-form) {
  width: min(760px, 100%);
}

.compact-modal {
  width: min(600px, 100%);
}

#modal-form > .actions,
.modal-form-actions {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-close {
  margin-left: auto;
  display: inline-grid;
  place-items: center;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.confirm-panel {
  display: grid;
  gap: 6px;
}

.confirm-panel p {
  margin: 0;
}

.muted-text {
  color: var(--muted);
}

.client-form {
  gap: 8px 10px;
}

.client-form .field {
  margin: 0;
}

.client-form textarea {
  min-height: 68px;
}

.client-row.archived {
  background: color-mix(in srgb, var(--surface-2) 58%, var(--surface));
}

.order-client-groups,
.order-client-group {
  display: grid;
  gap: 12px;
}

.preparation-order-groups,
.preparation-order-group {
  display: grid;
  gap: 12px;
}

.order-client-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.preparation-order-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.order-client-group-head span {
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
}

.preparation-order-group-head span {
  color: var(--text);
  font-size: 15px;
  font-weight: 760;
}

.order-client-group-head strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.preparation-order-group-head strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.client-detail {
  display: grid;
  gap: 14px;
}

.client-detail-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 20px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 11px;
}

.detail-item.wide {
  grid-column: 1 / -1;
}

.detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-item strong {
  overflow-wrap: anywhere;
}

.slide-page {
  animation: slideIn .22s ease both;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.detail-page,
.order-flow,
.order-history-page {
  display: grid;
  gap: 14px;
}

.detail-page-head,
.flow-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.flow-head h2 {
  margin: 0;
  font-size: 24px;
}

.flow-head p,
.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.order-product-toolbar,
.order-history-toolbar {
  align-items: center;
}

.order-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 10px;
}

.order-product-card {
  min-height: 150px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 1px 2px rgb(23 32 51 / 4%);
}

.order-product-card.selected {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary), var(--shadow-soft);
}

.quantity-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qty-stepper {
  display: grid;
  grid-template-columns: 38px 74px 38px;
  align-items: center;
  gap: 6px;
}

.qty-stepper input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  padding: 7px 8px;
  text-align: center;
}

.frequent-chip {
  min-height: 32px;
}

.delivery-date-preview {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.delivery-date-preview span {
  font-weight: 850;
}

.delivery-date-preview small {
  color: var(--muted);
}

.delivery-calendar-field {
  gap: 8px;
}

.date-picker-button {
  min-height: 58px;
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.date-picker-button:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

.date-picker-button span {
  font-weight: 850;
}

.date-picker-button small {
  color: var(--muted);
}

.period-date-button {
  width: auto;
  min-width: 190px;
}

.calendar-modal {
  width: min(430px, 100%);
}

.calendar-head {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.calendar-head strong {
  text-align: center;
  font-size: 17px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
  text-align: center;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

.calendar-day:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.calendar-day.outside {
  color: var(--muted);
  opacity: .55;
}

.calendar-day.today {
  border-color: var(--primary);
}

.calendar-day.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.order-summary-lines {
  margin-top: 14px;
}

.line-builder {
  display: grid;
  gap: 10px;
}

.line-inputs {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 80px 112px;
  gap: 10px;
}

.summary-list {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.summary-row,
.draft-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 18px;
  gap: 14px;
}

.summary-row span {
  color: var(--muted);
  font-size: 14px;
}

.summary-row strong {
  text-align: right;
}

.line-controls {
  display: grid;
  grid-template-columns: 120px 140px auto;
  gap: 10px;
  align-items: end;
}

.line-controls .field {
  margin: 0;
}

.prep-progress {
  min-width: 112px;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.prep-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
}

.preparation-list-page,
.preparation-detail-page,
.preparation-complete-page {
  display: grid;
  gap: 14px;
}

.preparation-order-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.prep-items-list {
  overflow: hidden;
}

.prep-detail-actions {
  display: flex;
  justify-content: center;
  padding-top: 14px;
}

.prep-detail-actions .button {
  min-width: min(100%, 260px);
}

.prep-line {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.prep-line-main {
  position: relative;
  z-index: 1;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: inherit;
  padding: 13px;
  transition: transform .18s ease, background-color .18s ease;
}

.prep-line-info {
  min-width: 0;
  display: flex;
  align-items: center;
}

.prep-line-info .row-title {
  margin-bottom: 0;
}

.prep-line-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.prep-line-qty {
  min-width: 52px;
  text-align: right;
  font-size: 24px;
  line-height: 1;
}

.order-recap-line {
  gap: 8px;
}

.order-recap-line-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.order-recap-line-head strong:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.order-line-qty {
  flex: 0 0 auto;
  min-width: 48px;
  text-align: right;
  font-size: 22px;
  line-height: 1;
}

.prep-line.checked .prep-line-main {
  background: color-mix(in srgb, var(--green-soft) 72%, var(--surface));
}

.prep-line.swiped .prep-line-main {
  transform: translateX(-112px);
}

.prep-check {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
}

.prep-check svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prep-check.active {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.prep-check:disabled {
  cursor: wait;
  opacity: .7;
}

.prep-delete-action {
  position: absolute;
  inset: 0 -112px 0 auto;
  width: 112px;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #ffffff;
  cursor: pointer;
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transition: right .18s ease, opacity .18s ease;
}

.prep-line.swiped .prep-delete-action {
  right: 0;
  opacity: 1;
  pointer-events: auto;
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: center;
}

.check-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--primary);
}

.toast-root {
  position: fixed;
  z-index: 60;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 12px 14px;
}

@media (max-width: 900px), (orientation: portrait) and (max-width: 1180px) {
  .main-layout {
    display: block;
  }

  .side-nav {
    position: fixed;
    inset: auto max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    z-index: 30;
    height: auto;
    border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
    border-radius: 24px;
    padding: 7px;
    box-shadow: 0 18px 50px rgb(23 32 51 / 18%);
  }

  .nav-brand,
  .nav-footer {
    display: none;
  }

  .nav-list {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 3px;
  }

  .nav-item {
    min-height: 64px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 34px auto;
    justify-items: center;
    gap: 3px;
    border-radius: 18px;
    padding: 6px 4px;
    font-size: 11px;
    text-align: center;
  }

  .nav-item:hover {
    transform: none;
  }

  .nav-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: transparent;
  }

  .nav-icon svg {
    width: 21px;
    height: 21px;
  }

  .nav-label {
    max-width: 100%;
    font-size: 11px;
    line-height: 1.1;
  }

  .nav-count {
    position: absolute;
    top: 6px;
    right: calc(50% - 28px);
    min-width: 18px;
    padding: 1px 5px;
    font-size: 10px;
  }

  .content {
    max-width: 100%;
    padding: calc(76px + env(safe-area-inset-top)) clamp(14px, 3vw, 26px) calc(108px + env(safe-area-inset-bottom));
  }

  .floating-tools {
    top: 10px;
    right: 10px;
    left: 10px;
    justify-content: flex-end;
  }

  .theme-toggle,
  .sync-pill {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 12px;
  }

  .topbar,
  .list-row,
  .product-row,
  .accounting-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .actions .button {
    flex: 1 1 auto;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .grid.kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-head.horizontal {
    grid-template-columns: 1fr;
  }

  .accounting-amount {
    justify-items: stretch;
    text-align: left;
  }

  .form-grid,
  .category-create-form,
  .detail-grid,
  .detail-page-head,
  .flow-head,
  .line-inputs,
  .line-controls,
  .inline-field,
  .product-main-grid,
  .check-row {
    grid-template-columns: 1fr;
  }

  .flow-head > .button,
  .detail-page-head > .button,
  .flow-head > .actions {
    justify-self: start;
  }

  .quantity-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .product-side,
  .product-actions {
    justify-content: flex-end;
    justify-self: end;
  }

  .product-price {
    min-width: 0;
    text-align: right;
  }
}

@media (max-width: 1260px) {
  .grid.two .list-row {
    grid-template-columns: 1fr;
  }

  .grid.two .list-row > .actions {
    justify-content: flex-start;
  }

  .grid.two .prep-progress {
    width: 100%;
  }

  .product-side,
  .product-actions {
    justify-content: flex-end;
    justify-self: end;
  }

  .product-price {
    text-align: right;
  }
}

@media (max-width: 640px) {
  .side-nav {
    overflow-x: auto;
  }

  .nav-list {
    min-width: 620px;
  }

  .grid.kpis,
  .export-grid {
    grid-template-columns: 1fr;
  }

  .theme-toggle,
  .sync-pill {
    max-width: 50vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (orientation: landscape) and (min-width: 901px) and (max-height: 820px) {
  .side-nav {
    padding: 12px;
    gap: 12px;
  }

  .nav-item {
    min-height: 50px;
  }

  .content {
    padding-top: 64px;
  }
}

.dashboard-prep-row,
.grid.two .dashboard-prep-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.dashboard-prep-link {
  width: 44px;
  height: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--primary-strong);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.dashboard-prep-link svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.dashboard-prep-link:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateX(2px);
}

.dashboard-prep-link:disabled {
  cursor: not-allowed;
  opacity: .58;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
