/* B2B NELLAS — unified stylesheet */

:root {
  --cream-50:  #FDFBF7;
  --cream-100: #F7EFDF;
  --cream-200: #F3EBDB;
  --sand-50:   #FBF7F2;
  --sand-100:  #F0E6D2;
  --brand-50:  #FFF2E5;
  --brand-100: #FFE1C6;
  --brand-200: #FFC393;
  --brand-300: #FBA267;
  --brand-500: #F57722;
  --brand-600: #E25F10;
  --brand-700: #B94A0C;
  --blush-50:  #FCEFEF;
  --mint-50:   #E8F3EC;
  --mint-700:  #2E7D57;
  --sky-50:    #E9F1F7;
  --sky-700:   #265F86;
  --red-50:    #FBEAEA;
  --red-700:   #A12B2B;
  --ink-800:   #1C1B18;
  --ink-700:   #2B2925;
  --ink-500:   #5C5850;
  --ink-400:   #847F73;
  --ink-300:   #A7A195;
  --ink-200:   #CFC9BA;
  --shadow-sm: 0 1px 2px rgba(28,27,24,0.04);
  --shadow-md: 0 4px 18px rgba(28,27,24,0.06);
  --radius:    16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--cream-50);
  color: var(--ink-700);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select, button { font-family: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─ Topbar ─ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(253, 251, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--cream-200);
}
.topbar-inner { display: flex; align-items: center; gap: 20px; padding: 14px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink-800); }
.brand.center { justify-content: center; width: 100%; margin-bottom: 16px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-300));
  box-shadow: var(--shadow-sm);
}
.brand-name { display: flex; align-items: baseline; gap: 6px; letter-spacing: 0.02em; }
.brand-name .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--brand-700); }
.brand-name .sub { font-size: 12px; color: var(--ink-400); font-weight: 500; }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topnav a {
  padding: 8px 12px; border-radius: 10px; font-size: 14px; color: var(--ink-500);
}
.topnav a:hover { color: var(--ink-800); background: var(--cream-100); }
.topnav a.active { background: var(--brand-50); color: var(--brand-700); }
.cart-link { position: relative; }
.cart-badge {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px;
  background: var(--brand-500); color: white; border-radius: 10px;
  font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}
.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user .who { font-size: 13px; color: var(--ink-500); }

/* ─ Main + footer ─ */
.main { padding: 24px 0 48px; min-height: calc(100vh - 140px); }
.footer {
  border-top: 1px solid var(--cream-200);
  color: var(--ink-400); font-size: 12px; padding: 18px 0;
}
.footer .sep { margin: 0 6px; color: var(--ink-200); }

/* ─ Layout helpers ─ */
.stack { display: flex; flex-direction: column; }
.stack.gap-md { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 880px) { .grid-2 { grid-template-columns: 2fr 1fr; } }
.mt { margin-top: 20px; }
.inline { display: inline; margin: 0; padding: 0; }
.inline-actions { display: flex; align-items: center; gap: 8px; }
.sep { margin: 0 6px; color: var(--ink-200); }
.r { text-align: right; }
.center { text-align: center; }
.muted { color: var(--ink-400); }
.strong { font-weight: 600; }
.ink { color: var(--ink-800); }
.brand { color: var(--brand-700); }
.sm { font-size: 12px; }
.dot { color: var(--ink-200); }
.strike { text-decoration: line-through; color: var(--ink-300); margin-right: 4px; }

/* ─ Page head ─ */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 20px;
}
.eyebrow {
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--brand-700);
}
.page-title {
  font-size: 28px; line-height: 1.15; margin: 4px 0 0; color: var(--ink-800);
  letter-spacing: -0.01em; font-weight: 600;
}
.page-desc { margin: 6px 0 0; color: var(--ink-500); max-width: 560px; }

/* ─ Cards ─ */
.card {
  background: white; border: 1px solid var(--cream-200); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.card-title { margin: 0 0 12px; font-size: 16px; font-weight: 600; color: var(--ink-800); }
.card-head .card-title { margin: 0; }
.empty { text-align: center; padding: 32px 20px; }
.empty.pad { padding: 40px 20px; }
.empty-title { font-size: 18px; font-weight: 600; color: var(--ink-800); margin-bottom: 6px; }
.empty-desc { color: var(--ink-500); margin: 0 0 16px; }

/* ─ Badges ─ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 999px;
  letter-spacing: 0.02em;
}
.badge-brand { background: var(--brand-50); color: var(--brand-700); }
.badge-sand  { background: var(--sand-50); color: var(--ink-500); border: 1px solid var(--sand-100); }
.badge-mint  { background: var(--mint-50); color: var(--mint-700); }
.badge-sky   { background: var(--sky-50); color: var(--sky-700); }
.badge-red   { background: var(--red-50); color: var(--red-700); }

/* ─ Buttons ─ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 11px; font-weight: 500; font-size: 14px;
  border: 1px solid transparent; transition: all 120ms ease;
  text-decoration: none; color: var(--ink-700); background: transparent;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--brand-500); color: white;
  box-shadow: 0 1px 0 rgba(255,255,255,0.3) inset, var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-600); }
.btn-soft { background: var(--brand-50); color: var(--brand-700); }
.btn-soft:hover { background: var(--brand-100); }
.btn-ghost { background: transparent; color: var(--ink-500); }
.btn-ghost:hover { background: var(--cream-100); color: var(--ink-800); }
.linkish { background: transparent; border: 0; padding: 0; color: var(--brand-700); cursor: pointer; }
.linkish:hover { text-decoration: underline; }

/* ─ Forms ─ */
.form .field, .field { display: block; margin-bottom: 12px; }
.field > .label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-500); margin-bottom: 5px; }
.field .hint { display: block; font-size: 12px; color: var(--ink-400); margin-top: 4px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="url"], .field input[type="file"], .field input[type="number"],
.field textarea, .field select,
input[type="text"].discount-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--cream-200);
  border-radius: 11px; background: white; font-size: 14px; color: var(--ink-800);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand-300);
  box-shadow: 0 0 0 3px var(--brand-50);
}
textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; color: var(--ink-700); cursor: pointer; }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* ─ Product rows (shop) ─ */
.product { padding: 0; overflow: hidden; }
.product .product-media { position: relative; background: var(--cream-100); aspect-ratio: 4/3; }
.product .product-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.product .product-media-empty { display: grid; place-items: center; height: 100%; color: var(--ink-300); font-size: 24px; }
.product-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 760px) {
  .product { display: grid; grid-template-columns: 280px 1fr; }
}
.product-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.product-name { margin: 0; font-size: 18px; font-weight: 600; color: var(--ink-800); letter-spacing: -0.01em; }
.product-desc { margin: 4px 0 0; font-size: 14px; color: var(--ink-500); max-width: 60ch; }
.product-prices { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 14px; }
.price-block { color: var(--ink-400); display: inline-flex; align-items: baseline; gap: 4px; }

.qty-table-wrap { overflow: hidden; border: 1px solid var(--cream-200); border-radius: 12px; }
.qty-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.qty-table thead { background: var(--sand-50); }
.qty-table th {
  text-align: left; padding: 10px 12px;
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-400);
}
.qty-table th.r { text-align: right; }
.qty-table td { padding: 10px 12px; border-top: 1px solid var(--cream-200); vertical-align: middle; color: var(--ink-500); }
.qty-table tr.has-qty td { background: color-mix(in srgb, var(--brand-50) 50%, white); }
.qty-table td.line-total { color: var(--ink-800); font-weight: 600; }

.size-chip {
  display: inline-flex; align-items: center;
  border: 1px solid var(--cream-200); background: white;
  padding: 4px 9px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-700);
}
.size-chip.sm { padding: 2px 7px; font-size: 12px; }

.qty-controls { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.qty-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--cream-200); background: white; color: var(--ink-500);
  border-radius: 9px; font-size: 16px; line-height: 1;
}
.qty-btn:hover { border-color: var(--brand-200); color: var(--brand-700); }
.qty-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.qty-input {
  width: 72px; height: 34px; border: 1px solid var(--cream-200); border-radius: 9px;
  text-align: center; font-size: 14px; background: white;
}

.product-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.summary { color: var(--ink-500); }

/* ─ Discount card (shop head) ─ */
.discount-card {
  display: inline-flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--brand-50) 75%, white);
  border: 1px solid var(--brand-100); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow-sm);
}

/* ─ Cart ─ */
.cart-line {
  display: grid; grid-template-columns: 56px 1fr auto auto;
  align-items: center; gap: 14px; padding: 14px 0;
}
.cart-thumb { width: 56px; height: 56px; background: var(--cream-100); border-radius: 10px; overflow: hidden; }
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-body { min-width: 0; }
.cart-line-total { text-align: right; }
.cart-line-total .linkish { font-size: 12px; }
.divide > * + * { border-top: 1px solid var(--cream-200); }

.cart-summary { display: flex; flex-direction: column; gap: 12px; }
.summary-list { display: grid; gap: 6px; margin: 0; padding: 0; }
.summary-list > div { display: flex; justify-content: space-between; font-size: 14px; }
.summary-list dt { margin: 0; color: var(--ink-500); }
.summary-list dd { margin: 0; font-weight: 500; color: var(--ink-800); }
.summary-list .total { padding-top: 8px; border-top: 1px solid var(--cream-200); font-size: 16px; }
.summary-list .total dt { color: var(--ink-800); font-weight: 600; }
.summary-list .total dd { color: var(--brand-600); font-weight: 700; }
.summary-list .brand dt, .summary-list .brand dd { color: var(--brand-700); }

.note-block {
  margin-top: 14px; padding: 14px; border: 1px solid var(--cream-200); border-radius: 12px;
  background: var(--sand-50);
}
.note-block p { margin: 4px 0 0; white-space: pre-wrap; color: var(--ink-700); font-size: 14px; }

/* ─ Rows (orders list, admin lists) ─ */
.row-link {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px; gap: 12px;
}
.row-link:hover { background: var(--cream-100); }
.row-meta { display: flex; align-items: center; gap: 12px; }

.admin-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 4px;
}
.admin-row .grow { flex: 1; min-width: 0; }
.admin-row .thumb {
  width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: var(--cream-100);
  display: grid; place-items: center; color: var(--ink-300);
}
.admin-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.avatar {
  width: 40px; height: 40px; border-radius: 999px; background: var(--cream-100); color: var(--brand-700);
  display: grid; place-items: center; font-weight: 600; flex-shrink: 0;
}
.discount-editor {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 8px; border: 1px solid var(--cream-200); border-radius: 12px; background: white;
}
.discount-editor .eyebrow { color: var(--ink-400); }
.discount-input { width: 58px; height: 30px; padding: 4px 6px; text-align: center; }

/* ─ Stats (dashboard) ─ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.stat {
  display: block; padding: 18px; background: white; border: 1px solid var(--cream-200);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.stat:hover { border-color: var(--brand-200); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--brand-700); }
.stat-value { font-size: 28px; font-weight: 600; color: var(--ink-800); margin: 4px 0; }
.stat-value .stat-sub { font-size: 16px; color: var(--ink-300); font-weight: 500; }
.stat-sub { color: var(--ink-500); font-size: 13px; }

/* ─ Tabs ─ */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tab { padding: 7px 12px; border-radius: 999px; background: white; border: 1px solid var(--cream-200); color: var(--ink-500); font-size: 13px; }
.tab:hover { color: var(--ink-800); }
.tab.active { background: var(--brand-500); color: white; border-color: var(--brand-500); }

/* ─ Variants editor ─ */
.variants { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.variant-row {
  display: grid; grid-template-columns: 1fr 120px auto; gap: 10px; align-items: end;
}
.variant-row label { font-size: 12px; color: var(--ink-500); }
.variant-row input { width: 100%; padding: 9px 10px; border: 1px solid var(--cream-200); border-radius: 9px; }
.thumb-lg { width: 100%; aspect-ratio: 4/3; background: var(--cream-100); border-radius: 12px; overflow: hidden; margin-bottom: 12px; }
.thumb-lg img { width: 100%; height: 100%; object-fit: cover; }

/* ─ Modal ─ */
.modal[hidden] { display: none; }
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(28,27,24,0.35); backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative; z-index: 1;
  width: 100%; max-width: 520px; background: white;
  border-radius: var(--radius); box-shadow: 0 20px 60px rgba(28,27,24,0.25);
  overflow: hidden; display: flex; flex-direction: column;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--cream-200); }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; background: var(--sand-50); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: transparent; border: 0; font-size: 24px; line-height: 1; color: var(--ink-400); }

/* ─ Order items (detail) ─ */
.order-items { display: flex; flex-direction: column; }
.order-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--cream-200); }
.order-item:first-child { border-top: 0; }
.order-item-main .strong { margin-bottom: 2px; }

/* ─ Status form (admin order detail) ─ */
.status-form { display: flex; flex-wrap: wrap; gap: 6px; }

/* ─ Flash / toast ─ */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.flash {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: 12px; font-size: 14px;
  border: 1px solid transparent;
}
.flash-success { background: var(--mint-50); color: var(--mint-700); border-color: #B9D9C4; }
.flash-error   { background: var(--red-50);  color: var(--red-700);  border-color: #E6C1C1; }
.flash-info    { background: var(--sky-50);  color: var(--sky-700);  border-color: #C4D7E4; }
.flash-close   { background: transparent; border: 0; color: inherit; font-size: 18px; line-height: 1; }

/* ─ Auth ─ */
.app-body.auth { background: linear-gradient(180deg, var(--cream-50), var(--sand-50)); min-height: 100vh; }
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 60px 20px; }
.auth-card { background: white; border: 1px solid var(--cream-200); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-md); }
.auth-title { margin: 0; font-size: 22px; font-weight: 600; color: var(--ink-800); text-align: center; }
.auth-hint { text-align: center; color: var(--ink-500); margin: 6px 0 18px; font-size: 14px; }
.auth-sub { text-align: center; color: var(--ink-400); font-size: 12px; margin-top: 16px; }

/* ─ Small screens ─ */
@media (max-width: 640px) {
  .topbar-user .who { display: none; }
  .page-title { font-size: 24px; }
  .cart-line { grid-template-columns: 48px 1fr; grid-auto-flow: row; }
  .cart-line-total { grid-column: 2 / 3; text-align: right; }
  .cart-qty { grid-column: 2 / 3; }
  .variant-row { grid-template-columns: 1fr 1fr; }
  .variant-row .variant-remove { grid-column: 1 / -1; justify-self: end; }
  .field-row { grid-template-columns: 1fr; }
}
