:root {
  --ink: #1a1214;
  --muted: #7a6469;
  --line: #eadfe2;
  --bg: #f8f3f2;
  --surface: #ffffff;
  --rose: #b76e79;
  --rose-deep: #8f4e58;
  --blush: #f3e4e6;
  --green: #1f7a45;
  --green-bg: #e7f6ee;
  --yellow: #9a6b00;
  --yellow-bg: #fff4d6;
  --orange: #b85a12;
  --orange-bg: #ffedd9;
  --red: #a11d2f;
  --red-bg: #fde8ec;
  --black-bg: #222;
  --shadow: 0 10px 30px rgba(26, 18, 20, 0.06);
  --radius: 16px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 500px at 10% -10%, #f7e9eb 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #efe4df 0%, transparent 45%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  padding-bottom: calc(72px + var(--safe-bottom));
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.app-shell { max-width: 1100px; margin: 0 auto; padding: 16px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(248, 243, 242, 0.88);
  border-bottom: 1px solid var(--line);
  margin: -16px -16px 18px;
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}
.brand span { display: block; font-family: var(--font-body); font-size: 0.68rem; font-weight: 600; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; margin-top: 2px; }
.user-chip { font-size: 0.82rem; color: var(--muted); text-align: right; }
.user-chip strong { display: block; color: var(--ink); }
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-brand { min-width: 0; }
.topbar-brand span { display: none; }
.nav-more-btn {
  flex: 0 0 auto;
  min-width: 84px; height: 44px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--ink); color: #fff; font-size: 0.92rem; font-weight: 700;
  line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--shadow); padding: 0 12px;
}
.nav-more-icon {
  width: 18px; height: 12px; position: relative; display: inline-block;
}
.nav-more-icon::before, .nav-more-icon::after {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: currentColor; border-radius: 2px;
}
.nav-more-icon::before { top: 0; box-shadow: 0 5px 0 currentColor; }
.nav-more-icon::after { bottom: 0; }
.nav-more-btn:active { transform: scale(0.97); }
.nav-close-btn {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 1.1rem; font-weight: 700; cursor: pointer;
}

.mobile-nav-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(26, 18, 20, 0.5);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}
.mobile-nav-backdrop.is-open {
  opacity: 1; visibility: visible; pointer-events: auto;
}
.mobile-nav-sheet {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 210;
  width: min(88vw, 360px);
  background: #fff;
  border-right: 1px solid var(--line);
  box-shadow: 12px 0 40px rgba(26,18,20,.2);
  display: flex; flex-direction: column;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-105%);
  transition: transform .22s ease;
  visibility: hidden;
}
.mobile-nav-sheet.is-open {
  transform: translateX(0);
  visibility: visible;
}
.mobile-nav-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.mobile-nav-links {
  overflow: auto; -webkit-overflow-scrolling: touch; flex: 1;
  display: flex; flex-direction: column; gap: 2px; padding-bottom: 24px;
}
.mobile-nav-links a {
  display: block; padding: 13px 14px; border-radius: 12px; font-weight: 600; color: var(--ink);
}
.mobile-nav-links a:hover, .mobile-nav-links a.active { background: var(--blush); color: var(--rose-deep); }
.mobile-nav-links .group {
  margin-top: 12px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 700; padding: 8px 12px 4px;
}
body.nav-open { overflow: hidden; }

.bottom-nav-menu {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 0.68rem; font-weight: 700; color: var(--muted); padding: 6px 2px;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.bottom-nav-menu .ico { font-size: 1.15rem; line-height: 1; }
.bottom-nav-menu:hover, .bottom-nav-menu:focus { color: var(--ink); }

@media (min-width: 980px) {
  .nav-more-btn, .mobile-nav-backdrop, .mobile-nav-sheet, .bottom-nav-menu { display: none !important; }
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0 0 8px; }
h1 { font-size: clamp(1.8rem, 4vw, 2.3rem); }
h2 { font-size: 1.45rem; }
.subtitle { color: var(--muted); margin: 0 0 18px; }

.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr 1fr; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  body { padding-bottom: 24px; }
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.kpi .label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.kpi .value { font-size: 1.25rem; font-weight: 700; margin-top: 6px; }
.kpi.accent { background: linear-gradient(145deg, #1a1214, #3a2428); color: #fff; border: 0; }
.kpi.accent .label { color: rgba(255,255,255,.7); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; cursor: pointer; text-align: center;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-rose { background: var(--rose); color: #fff; }
.btn-soft { background: var(--blush); color: var(--rose-deep); }
.btn-outline { background: transparent; border-color: var(--line); }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { min-height: 40px; padding: 8px 12px; font-size: 0.9rem; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 6px; color: #4d3b3f; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; border: 1px solid #e2d4d7; border-radius: 12px;
  padding: 12px 14px; background: #fff;
}
.field textarea { min-height: 100px; resize: vertical; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  background: #eee; color: #444;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-black { background: var(--black-bg); color: #fff; }
.badge-muted { background: #eee; color: #666; }

.flash {
  padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 600;
}
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.tab {
  white-space: nowrap; padding: 10px 14px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-weight: 700; font-size: 0.86rem;
}
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.96); border-top: 1px solid var(--line);
  padding: 8px 6px calc(8px + var(--safe-bottom));
  backdrop-filter: blur(10px);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 0.68rem; font-weight: 700; color: var(--muted); padding: 6px 2px;
}
.bottom-nav a.active, .bottom-nav a:hover { color: var(--ink); }
.bottom-nav .ico { font-size: 1.15rem; line-height: 1; }

.side-nav { display: none; }
@media (min-width: 980px) {
  .app-shell { display: grid; grid-template-columns: 240px 1fr; gap: 18px; max-width: 1280px; padding: 24px; }
  .side-nav {
    display: block; position: sticky; top: 24px; align-self: start;
    background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
    padding: 18px; box-shadow: var(--shadow); max-height: calc(100vh - 48px); overflow: auto;
  }
  .side-nav .brand { margin-bottom: 18px; }
  .side-nav a {
    display: block; padding: 11px 12px; border-radius: 10px; font-weight: 600; color: #513f43; margin-bottom: 2px;
  }
  .side-nav a:hover, .side-nav a.active { background: var(--blush); color: var(--rose-deep); }
  .side-nav .group { margin-top: 14px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; padding: 0 12px 6px; }
  .main-wrap .topbar { display: none; }
  .bottom-nav { display: none; }
  body { padding-bottom: 24px; }
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 16px 18px; border-left: 2px solid var(--line);
}
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--rose);
}
.timeline .meta { font-size: 0.78rem; color: var(--muted); }
.timeline .title { font-weight: 700; margin: 2px 0; }

.stock-matrix { width: 100%; font-size: 0.85rem; }
.stock-matrix th, .stock-matrix td { text-align: center; }
.stock-matrix input { width: 64px; min-height: 40px; text-align: center; padding: 6px; }

.wizard-steps { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.wizard-steps span {
  min-width: 84px; text-align: center; padding: 8px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); font-size: 0.75rem; font-weight: 700; color: var(--muted);
}
.wizard-steps span.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.cart-item {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.muted { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chart-box { position: relative; height: 240px; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }

.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 420px at 50% 0%, #fff8f1 0%, transparent 55%),
    linear-gradient(180deg, #f7f0e8, #ebe1d6);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fffaf5; border-radius: 18px; padding: 28px;
  box-shadow: 0 24px 60px rgba(60,42,34,.12); border: 1px solid #d9cfc4;
}
.auth-card h1 { font-size: 2.6rem; margin-bottom: 4px; }
.auth-card .tag { letter-spacing: 0.18em; text-transform: uppercase; font-size: 0.72rem; color: var(--rose); font-weight: 700; margin-bottom: 18px; }
.auth-logo { width: min(280px, 100%); height: auto; display: block; margin: 0 auto 8px; }
.auth-motto {
  text-align: center; font-family: "Cormorant Garamond", Georgia, serif;
  font-style: italic; color: #5a4338; margin: 0 0 8px; font-size: 1.15rem;
}
.auth-card-brand .subtitle { text-align: center; }
.brand-with-logo {
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}
.brand-with-logo img { height: 42px; width: auto; display: block; object-fit: contain; }
.brand-with-logo span {
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 700;
}
.topbar .brand-with-logo { margin: 0; }
.topbar .brand-with-logo img { height: 36px; }

.photo-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
@media (min-width: 760px) {
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.photo-card {
  position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff;
}
.photo-card.is-cover { border-color: var(--rose); box-shadow: 0 0 0 2px rgba(183,110,121,.2); }
.photo-card img { width: 100%; aspect-ratio: 4/5; object-fit: cover; display: block; background: #f3e4e6; }
.photo-cover-tag {
  position: absolute; top: 8px; left: 8px; background: var(--ink); color: #fff;
  font-size: .68rem; font-weight: 700; padding: 4px 8px; border-radius: 999px;
}
.photo-actions {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; justify-content: space-between;
}
.product-thumb {
  width: 44px; height: 56px; border-radius: 8px; object-fit: cover; background: #f3e4e6; vertical-align: middle; margin-right: 8px;
}
.product-tabs .tab[disabled] { opacity: .45; cursor: not-allowed; }
