:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-2: #eef7f5;
  --text: #17212b;
  --muted: #607080;
  --line: #d8e1e8;
  --brand: #0f766e;
  --brand-2: #075985;
  --ok: #15803d;
  --warn: #b45309;
  --danger: #b91c1c;
  --shadow: 0 18px 45px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: rgba(245, 247, 251, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-title {
  margin: 0;
  font-size: 17px;
  line-height: 1.1;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.role-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tab-button,
.ghost-button,
.primary-button,
.danger-button,
.mini-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  transition:
    transform 140ms ease,
    background 140ms ease,
    color 140ms ease,
    border-color 140ms ease;
}

.tab-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--muted);
}

.tab-button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.primary-button {
  background: var(--brand);
  color: white;
  font-weight: 700;
}

.ghost-button {
  background: white;
  border: 1px solid var(--line);
  color: var(--text);
}

.danger-button {
  background: #fee2e2;
  color: var(--danger);
  font-weight: 700;
}

.mini-button {
  min-height: 30px;
  padding: 0 10px;
  background: #e7f4f2;
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.tab-button:hover,
.mini-button:hover {
  transform: translateY(-1px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 32px) 40px;
}

.main-pane,
.side-pane,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.main-pane {
  min-width: 0;
  padding: 18px;
}

.side-pane {
  align-self: start;
  position: sticky;
  top: 86px;
  padding: 16px;
}

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

.page-head h2,
.panel h3,
.side-pane h3 {
  margin: 0;
}

.page-head p,
.panel p,
.side-pane p {
  color: var(--muted);
}

.page-head p {
  margin: 6px 0 0;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, white 0%, #f8fbfc 100%);
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

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

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

.search-input,
.field,
.select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--text);
  padding: 0 12px;
}

.search-input {
  flex: 1 1 260px;
}

.select {
  width: auto;
}

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

.product-card,
.order-card,
.shop-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.product-visual {
  display: grid;
  min-height: 138px;
  place-items: center;
  background:
    radial-gradient(circle at 20% 15%, rgba(15, 118, 110, 0.16), transparent 28%),
    linear-gradient(135deg, #e7f4f2, #edf6ff);
}

.product-visual span {
  display: grid;
  width: 90px;
  height: 90px;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: white;
  color: var(--brand);
  font-size: 32px;
  font-weight: 900;
}

.product-body,
.order-card,
.shop-card {
  padding: 14px;
}

.product-body h3,
.order-card h3,
.shop-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

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

.line {
  height: 1px;
  margin: 12px 0;
  background: var(--line);
}

.price-row,
.split-row,
.cart-row,
.order-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.price-row strong {
  font-size: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #edf6ff;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ok {
  background: #dcfce7;
  color: var(--ok);
}

.badge.warn {
  background: #fef3c7;
  color: var(--warn);
}

.badge.danger {
  background: #fee2e2;
  color: var(--danger);
}

.cart-list,
.order-list {
  display: grid;
  gap: 10px;
}

.cart-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qty-control button {
  width: 30px;
  background: white;
}

.qty-control span {
  display: grid;
  min-width: 34px;
  place-items: center;
  border-inline: 1px solid var(--line);
}

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

.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.checkout-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.order-card {
  display: grid;
  gap: 10px;
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  background: #102a2a;
  color: white;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  animation: lift 180ms ease;
}

@keyframes lift {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .side-pane {
    position: static;
  }

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

@media (max-width: 720px) {
  .topbar,
  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .role-tabs {
    justify-content: flex-start;
  }

  .status-strip,
  .grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .main-pane,
  .side-pane {
    padding: 14px;
  }

  .select {
    width: 100%;
  }
}
