:root {
  --bg: #f6f2eb;
  --card: #fffaf3;
  --ink: #1f2933;
  --muted: #667085;
  --line: #e6d8c7;
  --accent: #8b5e34;
  --accent-dark: #5f3d20;
  --danger: #b42318;
  --ok: #067647;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  padding: 0.7rem 1rem;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

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

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost:hover {
  background: #f0e4d5;
}

.hidden {
  display: none !important;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem clamp(1rem, 3vw, 3rem);
  background: #191510;
  color: #fff7ed;
}

.admin-header {
  background: linear-gradient(135deg, #0f3d4c, #1f6f78);
  color: #effcff;
}

.admin-header .eyebrow {
  color: #9ee7d7;
}

.shop-header h1,
.shop-header p {
  margin: 0;
}

.shop-header h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.shop-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.shop-header a,
.nav-tab {
  color: #fff7ed;
  text-decoration: none;
}

.nav-tab {
  position: relative;
  background: transparent;
  border: 1px solid rgba(255, 247, 237, 0.32);
}

.nav-tab.active {
  background: #fff7ed;
  color: #191510;
}

.nav-tab.has-items::after {
  content: "";
  position: absolute;
  width: 0.65rem;
  height: 0.65rem;
  top: -0.2rem;
  right: -0.2rem;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 2px #191510;
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f7c873;
  font-weight: 700;
}

.shop-layout {
  width: min(1440px, calc(100% - 2rem));
  margin: 1rem auto 4rem;
  display: grid;
  gap: 1rem;
}

.narrow-layout {
  width: min(640px, calc(100% - 2rem));
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(1rem, 2vw, 1.5rem);
  box-shadow: 0 18px 50px rgba(31, 41, 51, 0.08);
}

.hero,
.section-title,
.admin-actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.admin-main-tabs {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
}

.admin-subsection {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.admin-subsection h3 {
  margin-bottom: 0;
}

.product-admin-card {
  gap: 1rem;
}

.product-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.hero h2,
.section-title h2 {
  margin-top: 0;
}

.toolbar,
.compact-form,
.upload-form,
.form-actions,
.tabs {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input,
.toolbar select,
.compact-form input,
.upload-form input,
.order-form input,
.account-password-form input,
.qty input,
.line-control input,
.line-control select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: white;
}

.toolbar input {
  min-width: min(24rem, 100%);
}

.login-card {
  display: grid;
  gap: 0.75rem;
}

.status-chip,
.status {
  border-radius: 999px;
  background: #efe3d3;
  color: var(--accent-dark);
  padding: 0.45rem 0.75rem;
  display: inline-flex;
  width: fit-content;
}

.status.error {
  background: #fee4e2;
  color: var(--danger);
}

.status.success {
  background: #dcfae6;
  color: var(--ok);
}

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

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.product-grid.list {
  grid-template-columns: 1fr;
}

.product-card,
.admin-card,
.cart-line {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.product-grid.list .product-card {
  grid-template-columns: 1.5fr 0.8fr 1.1fr;
  align-items: center;
}

.product-title {
  display: grid;
  gap: 0.25rem;
}

.product-title h3,
.admin-card h3 {
  margin: 0;
}

.meta,
.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.price-row,
.qty,
.line-control {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.qty label,
.line-control label {
  display: grid;
  gap: 0.25rem;
  min-width: 7rem;
}

.qty input,
.line-control input {
  width: 7rem;
}

.order-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.order-form h3,
.form-actions {
  grid-column: 1 / -1;
}

.order-form label {
  display: grid;
  gap: 0.35rem;
}

.account-password-form {
  display: grid;
  gap: 0.75rem;
}

.account-password-form h3 {
  margin-bottom: 0;
}

.cart-lines,
.admin-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.shop-page {
  display: none;
}

.shop-page.active {
  display: block;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.pagination-controls select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: white;
}

.cart-line {
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
}

.tabs {
  margin: 1rem 0;
}

.tab {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.tab.active {
  background: var(--accent);
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.admin-card header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.payment-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffaf3;
  padding: 1rem;
}

.copy-row {
  display: grid;
  gap: 0.25rem;
  margin: 0.55rem 0;
}

.copy-field {
  cursor: copy;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  background: white;
}

.admin-lines {
  width: 100%;
  border-collapse: collapse;
}

.admin-lines th,
.admin-lines td {
  border-top: 1px solid var(--line);
  padding: 0.55rem;
  text-align: left;
  vertical-align: top;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.timeline div {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fffaf3;
  display: grid;
  gap: 0.25rem;
}

.timeline span {
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .shop-header,
  .product-grid.list .product-card,
  .cart-line {
    grid-template-columns: 1fr;
    display: grid;
  }
}
