:root {
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2: #fbfbfc;
  --line: #d8dbe2;
  --line-soft: #eceef2;
  --text: #101219;
  --muted: #6b7280;
  --dark: #15171d;
  --accent: #111318;
  --accent-2: #2563eb;
  --success: #0ea85f;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f6f7f9 0%, #eff1f4 100%);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }

/* FRONT POS */
.pos-app {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 380px;
  gap: 0;
  min-height: 100vh;
}

.nav-rail {
  border-right: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 18px 0;
}
.rail-logo,
.rail-btn {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  background: #fff;
  box-shadow: var(--shadow);
}
.rail-logo {
  background: #15171d;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
}
.rail-btn { color: #626b79; font-size: 1.45rem; }
.rail-btn-active,
.rail-btn:hover,
.rail-btn-link:hover { background: #f3f4f6; color: #111318; }
.rail-btn-link { margin-top: auto; }

.catalog-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
}
.catalog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
.brand-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: .14em;
}
.catalog-header h1 {
  margin: 0;
  line-height: .92;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.04em;
}
.order-badge {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: #111318;
  font-weight: 700;
}

.category-tabs {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}
.category-tabs::-webkit-scrollbar { height: 8px; }
.category-tabs::-webkit-scrollbar-thumb { background: #c8ccd4; border-radius: 999px; }
.tab-btn {
  flex: 0 0 auto;
  border: 1px solid #d1d5db;
  background: #f7f7f8;
  color: #5f6773;
  min-height: 42px;
  padding: 0 22px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tab-btn.is-active {
  background: #15171d;
  border-color: #15171d;
  color: #fff;
}

.products-scroll {
  min-height: 0;
  overflow: auto;
  padding-right: 10px;
  scrollbar-width: thin;
}
.products-scroll::-webkit-scrollbar { width: 10px; }
.products-scroll::-webkit-scrollbar-thumb { background: #b8bdc6; border-radius: 999px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  align-content: start;
}
.product-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 292px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.product-card:hover { transform: translateY(-2px); }
.product-media {
  height: 168px;
  padding: 12px;
}
.product-visual,
.product-visual-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  background: linear-gradient(135deg, #dfe6ee, #f3f4f6);
}
.product-visual-fallback {
  display: grid;
  place-items: center;
  color: #8791a1;
  font-weight: 700;
}
.product-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px 14px;
}
.product-category {
  margin: 0 0 6px;
  color: #7c8797;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.product-copy h3 {
  margin: 0 0 6px;
  font-size: 1.18rem;
  line-height: 1.05;
}
.product-description {
  margin: 0;
  color: #6b7280;
  line-height: 1.35;
  font-size: .95rem;
}
.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.product-footer strong {
  font-size: 1.15rem;
  font-weight: 900;
}
.add-pill {
  border: 0;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 14px;
  background: #15171d;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.add-pill:hover { opacity: .92; }
.add-pill:disabled { opacity: .6; }

.cart-panel-wrap {
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 0;
}
.cart-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.cart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.cart-header h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.9rem;
}
.cart-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 600;
}
.count-dot {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef0f4;
  color: #636b78;
  font-size: .9rem;
}
.icon-clear {
  border: 0;
  background: transparent;
  font-size: 1.3rem;
  color: #868e99;
  cursor: pointer;
}
.cart-items {
  flex: 1;
  overflow: auto;
  padding: 16px 18px;
  min-height: 0;
}
.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: #fff;
}
.cart-item-copy strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}
.cart-item-copy p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
}
.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f3f4f6;
  border-radius: 999px;
  padding: 5px;
}
.qty-controls button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 0;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  cursor: pointer;
  font-size: 1.15rem;
}
.qty-controls span { min-width: 20px; text-align: center; font-weight: 800; }
.empty-state {
  height: 100%;
  min-height: 240px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #c2c7d0;
  border: 2px dashed #e6e8ed;
  border-radius: 24px;
  background: #fafafb;
  padding: 20px;
}
.empty-state strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: #d0d4db;
}
.cart-bottom {
  border-top: 1px solid var(--line-soft);
  padding: 18px;
  background: #fff;
}
.total-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.total-box span {
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 900;
  font-size: 1rem;
}
.total-box strong {
  font-size: 2rem;
  font-weight: 900;
}
.payment-switch {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.payment-card {
  border: 1px solid var(--line);
  background: #f3f4f6;
  color: #8b93a0;
  min-height: 104px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
}
.payment-card.active {
  border-color: #15171d;
  background: #15171d;
  color: #fff;
}
.payment-icon { font-size: 1.6rem; }
.validate-btn {
  width: 100%;
  min-height: 60px;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #111318, #2b313d);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
}
.validate-btn:disabled { opacity: .6; }
.feedback {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  display: none;
  font-weight: 700;
}
.feedback.show { display: block; }
.feedback.success { background: #e7f8ef; color: #0f7a47; }
.feedback.error { background: #fff0f0; color: #b42318; }

.hidden-by-filter { display: none !important; }

/* ADMIN */
.admin-body,
.login-body {
  background: linear-gradient(180deg, #f6f7f9 0%, #eff1f4 100%);
  color: var(--text);
}
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}
.admin-sidebar {
  background: #15171d;
  color: #fff;
  padding: 24px;
}
.admin-sidebar h2 { margin-top: 0; font-size: 1.4rem; }
.admin-sidebar nav { display: grid; gap: 10px; }
.admin-sidebar a {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.06);
}
.admin-content { padding: 28px; }
.admin-content h1 { margin-top: 0; }
.admin-card,
.stat-card,
.login-card,
.table {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.admin-card,
.login-card { padding: 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { padding: 18px; }
.stat-card span { display: block; color: var(--muted); margin-bottom: 10px; }
.stat-card strong { font-size: 1.7rem; }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 10px 14px; border-radius: 999px; background: #f3f4f6; font-weight: 700; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.table th, .table td { padding: 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 12px; }
.thumb-placeholder { display: inline-grid; place-items: center; background: #f3f4f6; }
.admin-form { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.admin-form label { display: grid; gap: 8px; font-weight: 700; }
.admin-form input,
.admin-form select,
.admin-form textarea,
.login-form input {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.toggle-line { display: flex !important; align-items: center; gap: 10px; }
.btn { border: 0; cursor: pointer; }
.btn-primary,
.btn-small { background: #15171d; color: #fff; min-height: 48px; padding: 0 18px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; }
.image-preview-admin img { max-width: 220px; border-radius: 16px; }
.admin-hint { color: var(--muted); }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(100%, 460px); }
.login-form { display: grid; gap: 12px; }

@media (max-width: 1180px) {
  .pos-app {
    grid-template-columns: 68px minmax(0, 1fr);
  }
  .cart-panel-wrap {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .cart-panel {
    position: static;
    height: auto;
    min-height: 0;
  }
  .products-scroll {
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 820px) {
  .pos-app {
    grid-template-columns: 1fr;
  }
  .nav-rail {
    display: none;
  }
  .catalog-panel,
  .cart-panel-wrap { padding: 16px; }
  .catalog-panel { padding-bottom: 0; }
  .cart-panel-wrap { background: transparent; border-top: 0; }
  .cart-panel {
    height: auto;
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .catalog-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-sidebar { padding-bottom: 16px; }
  .grid-2, .stats-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr; }
  .payment-switch { grid-template-columns: 1fr; }
  .total-box strong { font-size: 1.7rem; }
}
