:root {
  --ink: #3b2414;
  --muted: #6f5136;
  --surface: #fffaf1;
  --surface-strong: #fff2dc;
  --cream: #fff7e8;
  --honey: #d8892e;
  --honey-dark: #a85f19;
  --brown: #4a2a15;
  --line: #dfb978;
  --green: #2f7a47;
  --orange: #b86b16;
  --red: #b44336;
  --shadow: 0 16px 40px rgba(74, 42, 21, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fff7e8 0%, #fffaf1 48%, #fff2dc 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

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

a {
  color: inherit;
}

.app {
  min-height: 100vh;
  padding-bottom: 74px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: rgba(255, 250, 241, 0.95);
  border-bottom: 1px solid rgba(168, 95, 25, 0.16);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid #f3d49c;
}

.brand-title {
  display: grid;
  gap: 0;
}

.brand-title strong {
  font-size: 1.08rem;
  line-height: 1;
}

.brand-title span {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav,
.admin-tabs,
.bottom-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav {
  flex-wrap: wrap;
  justify-content: center;
}

.nav button,
.admin-tabs button,
.bottom-nav button,
.ghost-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  padding: 9px 12px;
  font-weight: 700;
}

.nav button.active,
.nav button:hover,
.admin-tabs button.active,
.bottom-nav button.active,
.ghost-btn:hover {
  background: var(--surface-strong);
  border-color: var(--line);
}

.hamburger {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 900;
}

.mobile-menu {
  display: none;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.mobile-menu.open {
  display: grid;
  gap: 8px;
}

.mobile-menu button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
  font-weight: 800;
}

.main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
  gap: 28px;
  align-items: center;
  min-height: 520px;
  padding: clamp(22px, 5vw, 56px);
  border: 1px solid rgba(216, 137, 46, 0.25);
  border-radius: 28px;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 219, 155, 0.85), transparent 28%),
    linear-gradient(135deg, #fffaf1 0%, #fff2dc 100%);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--honey-dark);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.08;
  margin: 0;
}

h1 {
  max-width: 640px;
  font-size: clamp(2.4rem, 7vw, 5.3rem);
}

h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.7rem);
}

h3 {
  font-size: 1.12rem;
}

p {
  color: var(--muted);
  margin: 0;
}

.lead {
  max-width: 590px;
  margin-top: 16px;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.compact-actions {
  margin-top: 0;
}

.btn,
.secondary-btn,
.danger-btn,
.success-btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 900;
  min-height: 44px;
}

.btn {
  background: var(--honey);
  color: #fff;
  box-shadow: 0 10px 22px rgba(216, 137, 46, 0.25);
}

.btn:hover {
  background: var(--honey-dark);
}

.secondary-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-btn {
  background: #ffe5df;
  color: var(--red);
}

.success-btn {
  background: #e7f4e9;
  color: var(--green);
}

.hero-card {
  display: grid;
  gap: 12px;
}

.hero-logo {
  width: min(100%, 360px);
  aspect-ratio: 1;
  margin: 0 auto;
  object-fit: cover;
  border-radius: 38px;
  box-shadow: 0 18px 40px rgba(74, 42, 21, 0.18);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.mini-stat,
.card,
.form-card,
.summary-card,
.table-card,
.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(74, 42, 21, 0.08);
}

.mini-stat {
  padding: 12px;
}

.mini-stat strong {
  display: block;
  color: var(--ink);
}

.section {
  margin-top: 30px;
}

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

.grid,
.product-grid,
.summary-grid {
  display: grid;
  gap: 14px;
}

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

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

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

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

.card,
.form-card,
.summary-card,
.table-card {
  padding: 16px;
}

.product-card {
  overflow: hidden;
}

.product-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #fff2dc, #ffe6b8);
  color: var(--brown);
  font-size: 3.4rem;
}

.product-art.has-image {
  background: #fff;
}

.product-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

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

.product-admin-card {
  display: grid;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(74, 42, 21, 0.08);
}

.compact-art {
  aspect-ratio: 16 / 9;
  font-size: 2.4rem;
}

.product-admin-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.product-admin-card .button-row {
  margin: 0;
  padding: 0 14px 14px;
}

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

.chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f5ead8;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.chip.in,
.chip.completed,
.chip.confirmed,
.chip.paid {
  background: #e7f4e9;
  color: var(--green);
}

.chip.low,
.chip.pending,
.chip.preparing {
  background: #fff0d8;
  color: var(--orange);
}

.chip.out,
.chip.cancelled,
.chip.rejected {
  background: #ffe5df;
  color: var(--red);
}

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.qty button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 900;
}

.qty span,
.qty input {
  width: 42px;
  border: 0;
  text-align: center;
  color: var(--ink);
  background: #fff;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-weight: 800;
}

.optional-text {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

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

.full {
  grid-column: 1 / -1;
}

.panel-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  text-align: center;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
  font-weight: 900;
}

.tabs button.active {
  background: var(--surface-strong);
}

.admin-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-login {
  min-height: calc(100vh - 150px);
  display: grid;
  place-items: center;
}

.admin-login .form-card {
  width: min(100%, 460px);
  display: grid;
  gap: 14px;
}

.admin-sidebar {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 18px;
  background: var(--brown);
  color: #fff7e8;
}

.admin-sidebar strong,
.admin-sidebar p {
  color: #fff;
}

.admin-sidebar button {
  border: 1px solid rgba(255, 247, 232, 0.24);
  border-radius: 12px;
  background: transparent;
  color: #fff7e8;
  padding: 10px 12px;
  text-align: left;
  font-weight: 800;
}

.admin-sidebar button.active,
.admin-sidebar button:hover {
  background: rgba(255, 247, 232, 0.14);
}

.admin-tabs {
  display: none;
  overflow-x: auto;
  padding-bottom: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #efd8b2;
  padding: 10px 8px;
  color: var(--ink);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--brown);
  font-size: 0.82rem;
}

.table-scroll {
  overflow-x: auto;
}

.compact-orders-card {
  padding: 0;
  overflow: hidden;
}

.orders-table {
  min-width: 980px;
  font-size: 0.92rem;
}

.orders-table th,
.orders-table td {
  padding: 10px 12px;
  vertical-align: middle;
}

.orders-table tbody tr:hover {
  background: #fff8ea;
}

.table-select {
  width: auto;
  min-width: 132px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff;
}

.compact-btn {
  min-height: 34px;
  padding: 7px 12px;
}

.expense-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.direct-order-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px minmax(160px, 220px) 110px auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.direct-order-toolbar input,
.direct-order-toolbar select {
  width: 100%;
}

.direct-order-toolbar .secondary-btn {
  min-width: 128px;
  white-space: nowrap;
}

.expenses-summary {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: stretch;
}

.expense-month-bar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 120px auto;
  gap: 10px;
  align-items: end;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.expense-month-bar input,
.expense-month-bar select {
  width: 100%;
}

.expense-month-bar .secondary-btn {
  min-width: 128px;
  white-space: nowrap;
}

.expenses-table {
  min-width: 860px;
}

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

.load-row {
  display: flex;
  justify-content: center;
  padding: 14px;
}

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

.compact-empty {
  padding: 14px;
}

.expense-modal {
  width: min(860px, 100%);
}

.expense-items {
  display: grid;
  gap: 10px;
}

.expense-items-head,
.expense-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 210px) auto;
  gap: 10px;
  align-items: end;
}

.expense-items-head {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.receipt-preview-box {
  display: grid;
  grid-template-columns: minmax(170px, 260px) 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.receipt-preview,
.receipt-full-preview {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.receipt-preview {
  height: 180px;
  object-fit: contain;
}

iframe.receipt-preview {
  object-fit: initial;
}

.receipt-modal {
  width: min(900px, 100%);
}

.receipt-full-preview {
  height: min(70vh, 680px);
  object-fit: contain;
}

.chart-bars {
  display: grid;
  gap: 10px;
}

.bar {
  display: grid;
  grid-template-columns: 120px 1fr 50px;
  gap: 8px;
  align-items: center;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #f2dec0;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--honey);
}

.footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 18px;
  padding: 18px;
  border-top: 1px solid rgba(168, 95, 25, 0.2);
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 30;
  display: none;
  justify-content: space-around;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 241, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  display: grid;
  gap: 2px;
  min-width: 54px;
  padding: 8px 6px;
  font-size: 0.74rem;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 90px;
  z-index: 40;
  max-width: 340px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--brown);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(59, 36, 20, 0.42);
}

.modal {
  width: min(720px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.order-detail-modal {
  width: min(820px, 100%);
}

.proof-box {
  display: grid;
  grid-template-columns: minmax(160px, 260px) 1fr;
  gap: 14px;
  align-items: center;
}

.proof-preview {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.proof-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 10px;
  text-decoration: none;
}

.image-preview {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
}

.image-preview img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  display: block;
  border-radius: 10px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .nav {
    display: none;
  }

  .hamburger {
    display: inline-grid;
    place-items: center;
  }

  .hero,
  .panel-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .product-grid,
  .product-admin-grid,
  .grid.three,
  .summary-grid,
  .expenses-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-sidebar {
    display: none;
  }

  .admin-tabs {
    display: flex;
  }

  .bottom-nav {
    display: flex;
  }
}

@media (max-width: 640px) {
  .main {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .brand img {
    width: 40px;
    height: 40px;
  }

  .hero {
    min-height: auto;
    padding: 20px;
    border-radius: 20px;
  }

  .stat-strip,
  .product-grid,
  .product-admin-grid,
  .grid.two,
  .grid.three,
  .summary-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .section-head,
  .price-row,
  .cart-row,
  .order-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .bar {
    grid-template-columns: 88px 1fr 42px;
  }

  .expense-toolbar,
  .direct-order-toolbar,
  .expense-item-row,
  .expense-month-bar,
  .receipt-preview-box {
    grid-template-columns: 1fr;
  }

  .proof-box {
    grid-template-columns: 1fr;
  }
}
