:root {
  --ink: #172126;
  --muted: #64747b;
  --line: #dbe3e6;
  --paper: #fbfcfb;
  --panel: #ffffff;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --coral: #d95f45;
  --gold: #d59b2d;
  --green-soft: #e7f4ef;
  --gold-soft: #fff3d8;
  --coral-soft: #fae9e4;
  --shadow: 0 18px 55px rgba(20, 37, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #f4f8f7 0%, #fff8ef 52%, #f7f6fb 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: var(--teal);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.35rem;
}

h2 {
  margin-top: 6px;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}

h3 {
  font-size: 1.2rem;
}

.brand p,
.muted,
.summary-panel p {
  color: var(--muted);
}

.cart-shortcut {
  position: relative;
  display: grid;
  width: 52px;
  height: 48px;
  margin-left: auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--teal-dark);
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 34, 40, 0.08);
}

.cart-shortcut span {
  width: 26px;
  height: 22px;
  overflow: hidden;
  color: transparent;
  border: 3px solid currentColor;
  border-top: 0;
  border-radius: 2px 2px 5px 5px;
  transform: translateY(2px);
}

.cart-shortcut span::before {
  content: "";
  position: absolute;
  width: 25px;
  height: 12px;
  margin: -10px 0 0 -5px;
  border-top: 3px solid currentColor;
  border-left: 3px solid currentColor;
  transform: skewX(-18deg);
}

.cart-shortcut span::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 5px;
  margin: 22px 0 0 -2px;
  background:
    radial-gradient(circle at 4px 3px, currentColor 0 3px, transparent 3px),
    radial-gradient(circle at 20px 3px, currentColor 0 3px, transparent 3px);
}

.cart-shortcut strong {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  min-width: 24px;
  min-height: 24px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  font-size: 0.76rem;
  line-height: 1;
  background: var(--coral);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4f2;
}

.tab-button,
.ghost-button,
.primary-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  font-weight: 700;
}

.tab-button {
  position: relative;
  color: var(--muted);
  background: transparent;
}

.tab-button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 34, 40, 0.08);
}

.count-badge {
  display: inline-grid;
  min-width: 22px;
  min-height: 22px;
  margin-left: 6px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  background: var(--coral);
}

.summary-panel,
.basket,
.metric,
.notification,
.product-card,
.access-panel,
.retailer-card,
.seller-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 8px 28px rgba(20, 37, 43, 0.07);
}

.summary-panel {
  padding: 16px;
}

.summary-panel strong {
  display: block;
  margin: 6px 0;
  font-size: 1.55rem;
}

.label,
.eyebrow {
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

main {
  padding: 34px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-head,
.section-head,
.dialog-head,
.notification-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.retailer-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

label {
  display: grid;
  gap: 7px;
  color: #42545b;
  font-size: 0.88rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

input[readonly] {
  color: #4e6269;
  background: #eef4f2;
}

.access-panel,
.retailer-card,
.seller-panel {
  padding: 18px;
  margin-top: 20px;
}

.login-form,
.retailer-create-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
  margin: 16px 0 10px;
}

.retailer-create-form {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.retailer-card {
  display: grid;
  gap: 6px;
  border-color: rgba(15, 118, 110, 0.32);
  background: var(--green-soft);
}

.retailer-card.locked {
  border-color: rgba(217, 95, 69, 0.34);
  background: var(--coral-soft);
}

.catalog-tools {
  display: grid;
  grid-template-columns: minmax(220px, 380px) 1fr;
  align-items: end;
  gap: 14px;
  margin-bottom: 18px;
}

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

.filter-pill {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: #34464d;
  background: #fff;
  font-weight: 700;
}

.filter-pill.active {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.product-card {
  display: grid;
  gap: 12px;
  min-height: 138px;
  padding: 14px;
}

.product-card strong {
  line-height: 1.3;
}

.product-card small {
  color: var(--muted);
  font-weight: 700;
}

.quantity-row {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  gap: 8px;
  align-items: center;
}

.quantity-row button,
.icon-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
}

.qty {
  display: grid;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: var(--teal-dark);
  font-weight: 800;
  background: var(--green-soft);
}

.basket {
  margin-top: 22px;
  padding: 18px;
}

.basket-items {
  display: grid;
  gap: 9px;
  margin: 14px 0;
}

.basket-items.empty {
  color: var(--muted);
  min-height: 48px;
  align-items: center;
}

.basket-line,
.dialog-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f4f8f7;
}

.primary-button {
  width: 100%;
  color: #fff;
  background: var(--teal);
}

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

.primary-button:hover,
.ghost-button:hover,
.filter-pill:hover {
  transform: translateY(-1px);
}

button:disabled:hover {
  transform: none;
}

.ghost-button {
  padding: 0 15px;
  color: var(--teal-dark);
  border: 1px solid var(--line);
  background: #fff;
}

.danger {
  color: #b4412f;
}

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

.metric {
  padding: 18px;
}

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

.notifications {
  display: grid;
  gap: 12px;
}

.seller-panel {
  margin-bottom: 22px;
}

.retailer-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.retailer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.retailer-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.notification {
  padding: 16px;
}

.notification[data-reviewed="true"] {
  opacity: 0.68;
}

.notification button {
  color: #fff;
  background: var(--coral);
}

.notification-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
}

.status-chip {
  border-radius: 999px;
  padding: 4px 9px;
  color: #7b4f00;
  background: var(--gold-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.empty-state {
  padding: 36px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.58);
}

.empty-state.compact {
  padding: 18px;
}

dialog {
  width: min(640px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(16, 27, 31, 0.46);
}

.dialog-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  main {
    padding: 22px;
  }

  .retailer-form,
  .login-form,
  .retailer-create-form,
  .catalog-tools,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .page-head,
  .section-head,
  .dialog-head,
  .notification-head {
    align-items: flex-start;
    flex-direction: column;
  }

  h2 {
    font-size: 1.7rem;
  }
}
