:root {
  --green: #0f7a4b;
  --leaf: #37a46b;
  --primary: #2563eb;
  --primary-dark: #0f2a4a;
  --navy: #0b1f3a;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --soft: #eef6ff;
  --amber: #b76b1d;
  --red: #b93f3f;
  --blue: #2563eb;
  --shadow: 0 10px 28px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; font-family: Arial, "Segoe UI", sans-serif; }
button {
  border: 0;
  min-height: 38px;
  background: var(--green);
  color: #fff;
  padding: 9px 13px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}
button:hover { filter: brightness(.96); }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}
label { display: grid; gap: 5px; color: var(--muted); font-weight: 750; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 510px) 1fr;
  background: #fff;
}
.login-panel {
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}
.brand-row {
  display: grid;
  justify-items: start;
  gap: 14px;
}
.mobile-fruits { display: none; }
.brand-row img {
  width: min(260px, 76vw);
  height: auto;
  max-height: 132px;
  object-fit: contain;
  object-position: left center;
  background: transparent;
}
.brand-row h1 { margin: 0; font-size: 32px; line-height: 1.05; }
.login-copy { color: var(--muted); line-height: 1.5; margin: 24px 0; }
.login-form, .settings-form, .order-form { display: grid; gap: 12px; }
.message { min-height: 20px; color: var(--red); margin: 0; }
.demo-users { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; color: var(--muted); }
.demo-users button { background: var(--soft); color: var(--green); padding: 7px 10px; min-height: 32px; }
.login-art {
  position: relative;
  background: #fff url("/assets/login-frutas.jpg") center/contain no-repeat;
}
.fresh-card {
  position: absolute;
  right: 36px;
  bottom: 36px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 8px;
  padding: 18px;
  min-width: 190px;
  display: none;
  gap: 4px;
  box-shadow: var(--shadow);
}
.fresh-card strong { font-size: 28px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  grid-template-rows: 1fr;
  background: var(--bg);
}
.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
  min-height: 100vh;
  padding: 18px 14px;
  background: linear-gradient(180deg, #11284a, #07192f);
  border-bottom: 0;
  color: #fff;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.sidebar-brand strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand span { display: block; color: #b8c7dc; font-size: 12px; margin-top: 2px; }
.sidebar nav {
  display: grid;
  gap: 7px;
  justify-content: stretch;
  overflow-x: visible;
  scrollbar-width: none;
  width: 100%;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  background: transparent;
  color: #d7e3f4;
  border: 1px solid transparent;
  padding: 8px 10px;
  white-space: nowrap;
  justify-content: flex-start;
}
.nav-btn span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  color: #dbeafe;
  font-size: 12px;
}
.nav-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: rgba(255,255,255,.16);
}
.nav-btn.active span { background: rgba(255,255,255,.18); color: #fff; }
.ghost-btn {
  width: 100%;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.24);
}
.workspace { min-width: 0; }
.topbar {
  min-height: 78px;
  padding: 18px 26px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
#userBadge {
  background: #eef6ff;
  color: var(--primary);
  padding: 8px 10px;
  border-radius: 8px;
  font-weight: 900;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-text-btn { background: var(--primary); }

.quick-order-strip {
  margin: 0 26px 14px;
  padding: 14px 16px;
  border: 1px solid #cfe1d5;
  border-left: 5px solid var(--green);
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}
.quick-order-strip span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.primary-action { background: var(--primary); color: #fff; white-space: nowrap; }

.view { padding: 0 26px 28px; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.metric-grid article, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric-grid article {
  padding: 11px 12px;
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 3px;
}
.metric-grid span { color: var(--muted); font-size: 12px; font-weight: 800; }
.metric-grid strong { font-size: 19px; overflow-wrap: anywhere; }
.metric-grid small { color: var(--green); font-weight: 800; }
.clickable-metric {
  cursor: pointer;
  border-color: rgba(15, 122, 75, .32) !important;
  background: linear-gradient(180deg, #fff, #f7fbf8) !important;
}
.clickable-metric:active { transform: translateY(1px); }
.split-grid {
  display: grid;
  grid-template-columns: 1.35fr .8fr;
  gap: 14px;
}
.panel { padding: 16px; box-shadow: var(--shadow); }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h2 { margin: 0; font-size: 19px; }
.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.follow-panel { margin-top: 14px; }
.follow-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 9px;
}
.follow-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.follow-card div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.follow-card span,
.follow-card small { color: var(--muted); }
.follow-actions {
  display: grid;
  gap: 6px;
}
.follow-actions a,
.follow-actions button {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #e9f3ed;
  color: var(--green);
  text-decoration: none;
  font-weight: 900;
  text-align: center;
}
.status-board, .flow-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}
.status-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  padding: 12px;
  border-radius: 8px;
  background: #fbfdfb;
}
.status-card strong { display: block; font-size: 22px; margin-top: 4px; }
.list { display: grid; gap: 8px; }
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.orders-list {
  display: grid;
  gap: 8px;
}
.billing-workspace {
  display: grid;
  gap: 12px;
}
.billing-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.billing-title h2 { margin: 0; font-size: 24px; }
.billing-title p { margin: 3px 0 0; color: var(--muted); }
.billing-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.billing-stat {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px 16px 14px 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  position: relative;
  box-shadow: var(--shadow);
}
.billing-stat::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 21px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green);
}
.billing-stat.blue::before { background: #2563eb; }
.billing-stat.green::before { background: #16a34a; }
.billing-stat.purple::before { background: #7c3aed; }
.billing-stat.orange::before { background: #f59e0b; }
.billing-stat span { color: var(--muted); font-weight: 800; }
.billing-stat strong { font-size: 20px; }
.billing-stat small { color: var(--muted); }
.billing-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
}
.billing-sidebar, .billing-main {
  display: grid;
  gap: 12px;
  align-content: start;
}
.billing-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  box-shadow: var(--shadow);
}
.billing-card h3 { margin: 0 0 10px; font-size: 15px; }
.billing-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px;
  gap: 8px;
}
.orders-table-wrap {
  overflow: auto;
  margin: 8px -13px -13px;
}
.orders-table {
  min-width: 860px;
  border-collapse: collapse;
}
.orders-table th {
  background: #f5f7f9;
}
.orders-table tr { cursor: pointer; }
.orders-table tbody tr.selected { background: #eef6ff; }
.orders-table td, .orders-table th {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
}
.order-link { color: #2563eb; }
.table-actions {
  display: flex;
  gap: 6px;
}
.table-actions button, .order-side-actions button {
  min-height: 32px;
  padding: 6px 10px;
  background: #2563eb;
}
.table-actions .success, .order-side-actions .success { background: #16a34a; }
.order-side-actions .danger { background: var(--red); }
.mobile-order-actions-row { display: none; }
.mobile-order-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}
.mobile-order-actions button {
  min-height: 36px;
  padding: 7px 9px;
  background: var(--primary);
}
.mobile-order-actions .success { background: #16a34a; }
.billing-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr) minmax(220px, .6fr);
  gap: 12px;
}
.client-profile {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.client-avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8eef5;
  color: var(--green);
  font-weight: 900;
  font-size: 22px;
}
.client-profile div:last-child { display: grid; gap: 3px; }
.client-profile span, .billing-card p { color: var(--muted); }
.client-actions, .quick-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.client-actions button, .quick-action-grid button {
  min-height: 38px;
  background: #2563eb;
}
.client-actions button:last-child { background: #16a34a; }
.quick-action-grid button {
  display: grid;
  place-items: center;
  background: #eef6ff;
  color: #2563eb;
}
.quick-action-grid span { font-size: 11px; color: var(--ink); }
.summary-lines { display: grid; gap: 8px; }
.summary-lines span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}
.summary-lines strong { color: var(--ink); }
.order-detail-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.mini-lines {
  display: grid;
  gap: 4px;
}
.mini-lines div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 86px;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.mini-lines b, .mini-lines strong { text-align: right; }
.mini-total {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding-top: 8px;
}
.mini-total strong { color: #2563eb; font-size: 18px; }
.receipt-box {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 900;
}
.copy-status, .invoice-copies {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 9px;
}
.copy-status span,
.invoice-copies article {
  padding: 7px;
  border-radius: 8px;
  background: #e9f3ed;
  color: var(--green);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}
.invoice-copies article {
  display: grid;
  gap: 3px;
}
.invoice-copies strong { font-size: 11px; color: var(--ink); }
.order-side-actions { display: grid; gap: 8px; }
.order-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #fff;
}
.order-main {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(170px, .9fr) auto;
  gap: 12px;
  align-items: center;
}
.order-main h3 { margin: 0; font-size: 16px; }
.order-main p { margin: 2px 0; font-weight: 800; }
.order-mini-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.order-payment {
  margin: 2px 0;
  font-size: 13px;
}
.order-right {
  display: grid;
  justify-items: end;
  gap: 5px;
}
.order-right strong { font-size: 16px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e9f3ed;
  color: var(--green);
  font-weight: 900;
  font-size: 11px;
}
.badge.warn { background: #fff2dd; color: var(--amber); }
.badge.blue { background: #e8f2fb; color: var(--blue); }
.badge.red { background: #fae9e9; color: var(--red); }
.order-mobile-line {
  display: none;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  padding: 7px 8px;
  background: #f5f8f5;
  border-radius: 8px;
}
.order-mobile-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.order-actions button {
  min-height: 30px;
  padding: 5px 9px;
  background: #e9f3ed;
  color: var(--green);
}
.order-actions .ghost-action {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

@media (min-width: 721px) {
  .order-card {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 76px;
  }
  .order-actions {
    align-self: center;
    justify-content: flex-end;
    min-width: 210px;
  }
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 11px;
}
.product-card, .customer-card, .role-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.product-image {
  position: relative;
  background: linear-gradient(135deg, #eef5ef, #fff);
  border: 0;
  padding: 0;
  width: 100%;
  cursor: pointer;
}
.product-image img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.product-body { padding: 11px; }
.product-body h3, .customer-card h3 { margin: 0 0 7px; font-size: 15px; }
.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.product-meta { display: flex; justify-content: space-between; color: var(--muted); margin-top: 9px; gap: 8px; }
.product-stock {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
  padding: 7px 8px;
  background: #f5f8f5;
  border-radius: 8px;
  font-size: 12px;
}
.product-stock strong { color: var(--green); }
.profit-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}
.profit-line strong {
  color: var(--green);
}
.product-actions {
  justify-content: end;
  margin-top: 9px;
}
.product-actions .icon-btn {
  width: 34px;
  min-width: 34px;
  min-height: 34px;
}

.product-form {
  display: grid;
  grid-template-columns: 74px 110px 1.2fr .9fr .9fr 82px 90px 96px 90px minmax(170px, 1fr) 42px 42px 42px 44px 44px;
  gap: 8px;
  margin-bottom: 13px;
}
.product-form button { min-width: 38px; }
.product-preview-btn {
  width: 74px;
  height: 74px;
  min-height: 74px;
  padding: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--green);
}
.product-preview-btn img {
  width: 100%;
  height: 50px;
  object-fit: cover;
  background: #eef5ef;
}
.product-preview-btn span {
  font-size: 10px;
  font-weight: 900;
  padding: 2px;
}
.media-btn {
  min-height: 38px;
  width: 42px;
  min-width: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: #f5faf6;
  cursor: pointer;
  font-weight: 900;
  padding: 0 8px;
  text-align: center;
  font-size: 12px;
}
.media-btn svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}
.media-btn input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
}
.customer-catalog-panel {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  box-shadow: 0 8px 22px rgba(18, 42, 30, .06);
}
.customer-catalog-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}
.customer-invoices-head { margin-top: 14px; }
.customer-invoices-list {
  display: grid;
  gap: 8px;
}
.customer-invoice-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 54px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.customer-invoice-row span { display: grid; gap: 2px; min-width: 0; }
.customer-invoice-row small { color: var(--muted); }
.customer-invoice-row button {
  min-height: 32px;
  padding: 6px 9px;
  background: #e9f3ed;
  color: var(--green);
}
.customer-price-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 44px 110px;
  gap: 9px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.customer-product-image {
  border: 0;
  padding: 0;
  background: transparent;
  min-height: auto;
  width: 48px;
  height: 48px;
  cursor: pointer;
}
.customer-product-image img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef5ef;
}
.customer-price-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.customer-price-row small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.customer-price-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  justify-self: center;
}
.customer-price-row input[type="number"] { padding: 8px; }
.scan-dialog section {
  padding: 15px;
  display: grid;
  gap: 10px;
}
.scan-dialog video {
  width: min(520px, 86vw);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: #000;
}
.module-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 13px;
}
.module-strip button {
  min-height: 74px;
  display: grid;
  justify-items: start;
  gap: 4px;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.module-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.warehouse-products {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.warehouse-products-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
}
.warehouse-products-list article {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.warehouse-products-list span { display: grid; gap: 2px; }
.warehouse-products-list small { color: var(--muted); }
.warehouse-products-list strong { color: var(--green); }

.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.customer-card {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.customer-card p { margin: 4px 0; }
.access-line {
  font-size: 13px;
  color: var(--green);
}
.row-actions {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
  align-content: start;
}
.icon-btn {
  width: 38px;
  min-width: 38px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #e9f3ed;
  color: var(--green);
  border: 1px solid #cfe1d5;
}
.icon-btn.danger, .danger {
  background: #fae9e9;
  color: var(--red);
  border-color: #efcaca;
}
.inline-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr 140px 1.15fr 130px 130px 44px 44px;
  gap: 8px;
  margin-bottom: 13px;
}
.inline-form button { min-width: 38px; }

.role-form { display: grid; gap: 12px; }
.permission-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 8px;
}
.permission-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  color: var(--ink);
  font-weight: 650;
}
.role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.role-card { padding: 12px; }
.role-card h3 { margin: 0; }

.ops-settings {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.settings-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  padding: 16px;
}
.settings-block .full,
.ops-settings .full { grid-column: 1 / -1; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 11px;
  margin-bottom: 2px;
}
.section-head h2 { margin: 0 0 5px; }
.section-head p { margin: 0; color: var(--muted); }
.logo-settings {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 150px 170px;
  gap: 12px;
  align-items: center;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.logo-preview-box {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.logo-preview-box img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
}
.check-row {
  align-items: center;
  display: flex;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 54px;
  background: #fff;
}
.check-row input { width: auto; }
.print-box {
  display: grid;
  gap: 8px;
  background: #10261b;
  color: #fff;
  border-radius: 8px;
  padding: 13px;
  margin-bottom: 14px;
}
.print-box span { color: #cbd9d0; }
.settings-shortcuts {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 14px;
}
.settings-shortcuts button {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  color: var(--ink);
  display: grid;
  gap: 5px;
  justify-items: start;
  min-height: 84px;
  padding: 14px;
  text-align: left;
  box-shadow: var(--shadow);
}
.settings-shortcuts strong { font-size: 18px; }
.settings-shortcuts span { color: var(--muted); font-weight: 600; }
.terminal-admin {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.terminal-limit-label {
  background: #fff2dd;
  border: 1px solid #ffd093;
  border-radius: 8px;
  color: #794600;
  font-weight: 900;
  padding: 9px 12px;
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}
th {
  background: #edf4ef;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
td small { color: var(--muted); }

dialog {
  border: 0;
  border-radius: 8px;
  width: min(840px, calc(100vw - 18px));
  padding: 0;
}
dialog::backdrop { background: rgba(16, 32, 26, .56); }
.order-form, .order-detail { padding: 15px; }
.payment-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px;
}
.order-items {
  display: grid;
  gap: 7px;
  max-height: min(460px, 52vh);
  overflow: auto;
  padding-right: 2px;
}
.order-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 84px 88px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
}
.order-line input { padding: 8px; }
.order-total {
  display: flex;
  justify-content: space-between;
  padding: 11px;
  background: #e9f3ed;
  border-radius: 8px;
}
.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.detail-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 5px;
}
.detail-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.detail-items, .detail-events { display: grid; gap: 8px; }
.detail-items h3, .detail-events h3 { margin: 8px 0 0; }
.detail-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 92px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.detail-line span { display: grid; gap: 2px; }
.detail-line small, .detail-events small { color: var(--muted); }
.detail-line strong, .detail-line b { text-align: right; }
.detail-events p {
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid var(--green);
  background: #f8fbf8;
  border-radius: 8px;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
.detail-actions .ghost-action,
.detail-actions a.ghost-action {
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: #fff;
  text-decoration: none;
  font-weight: 900;
}
.invoice-view {
  padding: 15px;
  display: grid;
  gap: 10px;
}
.invoice-head {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}
.invoice-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.invoice-meta article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  display: grid;
  gap: 4px;
}
.invoice-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.invoice-lines {
  display: grid;
  gap: 6px;
}
.invoice-lines div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 96px;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.invoice-lines span { display: grid; gap: 2px; }
.invoice-lines small { color: var(--muted); }
.invoice-lines strong,
.invoice-lines b { text-align: right; }
.invoice-total {
  display: flex;
  justify-content: space-between;
  padding: 11px;
  border-radius: 8px;
  background: #e9f3ed;
}
.image-preview-dialog {
  padding: 12px;
  display: grid;
  gap: 10px;
}
.image-preview-dialog img {
  max-width: min(860px, 90vw);
  max-height: 78vh;
  object-fit: contain;
}
.floating-action {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: none;
  width: 54px;
  height: 54px;
  min-height: 54px;
  border-radius: 50%;
  padding: 0;
  font-size: 25px;
  box-shadow: 0 10px 26px rgba(15, 122, 75, .28);
}

@media (max-width: 1020px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .sidebar {
    min-height: auto;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand logout"
      "nav nav";
    grid-template-rows: auto auto;
    background: rgba(255,255,255,.96);
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding: 12px 18px;
  }
  .sidebar-brand { grid-area: brand; }
  .sidebar-brand span { color: var(--muted); }
  .sidebar nav { grid-area: nav; justify-content: flex-start; }
  .ghost-btn { grid-area: logout; color: var(--primary); border-color: var(--line); width: auto; }
  .nav-btn { color: var(--muted); }
  .nav-btn span { background: var(--soft); color: var(--primary); }
  .nav-btn.active { background: #eef6ff; color: var(--primary); border-color: #bfdbfe; }
  .nav-btn.active span { background: #dbeafe; color: var(--primary); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
  .inline-form, .product-form, .settings-block { grid-template-columns: 1fr 1fr; }
  .logo-settings { grid-template-columns: 100px 1fr; }
}

@media (max-width: 720px) {
  body { padding-bottom: 78px; }
  .login-screen { grid-template-columns: 1fr; }
  .login-panel { padding: 24px; min-height: 62vh; }
  .brand-row {
    grid-template-columns: minmax(104px, 132px) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }
  .brand-row img {
    width: min(132px, 36vw);
    max-height: 112px;
  }
  .mobile-fruits {
    display: block;
    width: 100%;
    max-width: 210px;
    justify-self: end;
  }
  .mobile-fruits img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: contain;
    object-position: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .brand-row > div { grid-column: 1 / -1; }
  .brand-row > .mobile-fruits { grid-column: auto; }
  .brand-row h1 { font-size: 27px; }
  .login-art { display: none; }

  .sidebar {
    position: static;
    grid-template-columns: 1fr auto;
    padding: 10px 14px;
    backdrop-filter: none;
  }
  .sidebar nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 35;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(70px, 1fr);
    gap: 6px;
    overflow-x: auto;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow);
  }
  .nav-btn {
    min-height: 50px;
    display: grid;
    justify-items: center;
    gap: 3px;
    padding: 5px;
    font-size: 11px;
  }
  .nav-btn span { width: 23px; height: 23px; }
  .topbar {
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }
  .topbar h1 { font-size: 25px; }
  .top-actions { width: 100%; justify-content: space-between; }
  #userBadge { max-width: 52vw; }
  .quick-order-strip {
    margin: 0 14px 12px;
    align-items: stretch;
    flex-direction: column;
  }
  .view { padding: 0 14px 20px; }
  .billing-title {
    align-items: stretch;
    flex-direction: column;
  }
  .billing-title h2 { font-size: 22px; }
  .billing-stats { grid-template-columns: 1fr 1fr; }
  .billing-stat {
    min-height: 76px;
    padding: 10px 10px 10px 54px;
  }
  .billing-stat::before {
    left: 10px;
    top: 18px;
    width: 32px;
    height: 32px;
  }
  .billing-stat strong { font-size: 16px; }
  .billing-layout { grid-template-columns: 1fr; }
  .billing-sidebar { grid-template-columns: 1fr; }
  .billing-filters { grid-template-columns: 1fr; width: 100%; }
  .billing-bottom-grid { grid-template-columns: 1fr; }
  .orders-table {
    min-width: 0;
    width: 100%;
  }
  .orders-table thead { display: none; }
  .orders-table tbody,
  .orders-table tr,
  .orders-table td {
    display: block;
  }
  .orders-table tr {
    margin: 0 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
  }
  .orders-table tr.mobile-order-actions-row {
    display: block;
    margin-top: -8px;
    border-top: 0;
    background: #f8fbff;
  }
  .orders-table tr.mobile-order-actions-row td {
    display: block;
    grid-template-columns: 1fr;
  }
  .orders-table tr.mobile-order-actions-row td::before { content: none; }
  .billing-bottom-grid #selectedOrderActions { display: none; }
  .orders-table td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
  }
  .orders-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .orders-table td:last-child { border-bottom: 0; }
  .table-actions { justify-content: end; }
  .mini-lines div { grid-template-columns: minmax(0, 1fr) 42px 82px; }
  .copy-status, .invoice-copies { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-grid article { min-height: 68px; padding: 10px; }
  .metric-grid strong { font-size: 17px; }
  .panel { padding: 12px; }
  .order-main {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .order-main > div:nth-child(2) { display: none; }
  .order-right {
    grid-template-columns: 1fr;
    justify-items: start;
    justify-content: end;
  }
  .order-mobile-line { display: flex; }
  .order-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .order-actions button {
    width: 100%;
    min-height: 36px;
  }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .product-card {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    align-items: stretch;
    min-height: 112px;
  }
  .product-image {
    height: 100%;
    min-height: 112px;
    background: #eef5ef;
  }
  .product-image img {
    height: 100%;
    aspect-ratio: auto;
    object-fit: cover;
  }
  .product-body {
    padding: 9px;
    display: grid;
    gap: 5px;
  }
  .product-body h3 {
    margin: 0;
    font-size: 14px;
    line-height: 1.15;
  }
  .product-tags {
    gap: 4px;
    max-height: 24px;
    overflow: hidden;
  }
  .product-tags .badge {
    padding: 3px 6px;
    font-size: 10px;
  }
  .product-meta {
    margin-top: 0;
    font-size: 13px;
  }
  .product-meta strong { font-size: 15px; }
  .product-stock {
    margin: 0;
    padding: 5px 7px;
    font-size: 12px;
  }
  .product-body small.muted {
    font-size: 12px;
    line-height: 1.25;
  }
  .product-actions {
    position: static;
    justify-content: end;
    margin-top: 0;
  }
  .product-actions .icon-btn {
    width: 32px;
    min-width: 32px;
    min-height: 32px;
  }
  .customer-grid { grid-template-columns: 1fr; }
  .customer-card { grid-template-columns: 1fr auto; }
  .inline-form, .product-form, .settings-block, .logo-settings, .settings-shortcuts { grid-template-columns: 1fr; }
  .product-form {
    grid-template-columns: 72px 1fr 1fr 1fr;
  }
  .product-form input[name="id"],
  .product-form input[name="name"],
  .product-form input[name="category"],
  .product-form input[name="provider"],
  .product-form input[name="unit"],
  .product-form input[name="costPrice"],
  .product-form input[name="basePrice"],
  .product-form input[name="stock"],
  .product-form input[name="image"] {
    grid-column: 1 / -1;
  }
  .product-form input[name="sku"] { grid-column: 2 / -1; }
  .product-preview-btn {
    grid-row: span 2;
    width: 72px;
    height: 72px;
    min-height: 72px;
  }
  .media-btn {
    width: auto;
    min-width: 0;
    min-height: 42px;
  }
  .customer-price-row {
    grid-template-columns: 42px minmax(0, 1fr) 38px 92px;
    gap: 7px;
  }
  .customer-product-image,
  .customer-product-image img {
    width: 42px;
    height: 42px;
  }
  .invoice-meta { grid-template-columns: 1fr 1fr; }
  .invoice-lines div { grid-template-columns: minmax(0, 1fr) 40px 82px; }
  .detail-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .module-strip { grid-template-columns: 1fr 1fr; }
  .payment-grid { grid-template-columns: 1fr; }
  .detail-summary { grid-template-columns: 1fr 1fr; }
  .detail-line { grid-template-columns: minmax(0, 1fr) 42px 86px; }
  .warehouse-products-list { grid-template-columns: 1fr; }
  .follow-list { grid-template-columns: 1fr; }
  .follow-card { grid-template-columns: 1fr; }
  .follow-actions { grid-template-columns: 1fr 1fr; }
  .terminal-admin { padding: 12px; }
  table { min-width: 0; }
  thead { display: none; }
  tr {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
  }
  td {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 4px;
    padding: 9px 10px;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }
  .order-line { grid-template-columns: 1fr 76px; }
  .order-line strong { grid-column: 1 / -1; }
  .floating-action { right: 18px; bottom: 88px; }
  .floating-action:not(.hidden) { display: grid; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .sidebar-brand img { width: 42px; height: 42px; }
  .sidebar-brand span { display: none; }
  .ghost-btn { min-width: 62px; }
}
