:root {
  --ink: #14110f;
  --ink-soft: #3c342f;
  --muted: #7a716a;
  --paper: #f4efe8;
  --paper-2: #ebe4d8;
  --card: #fbf8f3;
  --line: #e2d8cc;
  --line-strong: #cfc3b4;
  --wine: #7a1d2c;
  --wine-deep: #4c101b;
  --garnet: #9b2335;
  --gold: #b0894a;
  --gold-soft: #d4bc8b;
  --ok: #2f6b4f;
  --warn: #9a6700;
  --sidebar: 272px;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(40, 22, 16, 0.07);
  --shadow-soft: 0 1px 0 rgba(255, 255, 255, 0.65) inset, 0 12px 28px rgba(40, 22, 16, 0.06);
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Outfit", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(176, 137, 74, 0.14), transparent 55%),
    radial-gradient(800px 380px at 100% 0%, rgba(122, 29, 44, 0.08), transparent 50%),
    linear-gradient(180deg, #f7f2ea 0%, var(--paper) 40%, #efe8de 100%);
  letter-spacing: 0.01em;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--wine); }
code {
  font-size: .86em;
  background: rgba(176, 137, 74, 0.12);
  padding: 1px 6px;
  border-radius: 6px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Login */
#loginScreen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  position: relative;
  z-index: 1;
  background:
    linear-gradient(115deg, rgba(20, 12, 14, 0.55), rgba(20, 12, 14, 0.2)),
    radial-gradient(1200px 600px at 20% 20%, rgba(176, 137, 74, 0.28), transparent 50%),
    #1a1214;
}
.login-shell {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(212, 188, 139, 0.28);
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.35);
  background: #0f0c0c;
}
.login-hero {
  padding: 48px 40px;
  color: #f6efe6;
  background:
    linear-gradient(180deg, rgba(122, 29, 44, 0.35), rgba(15, 12, 12, 0.2)),
    repeating-linear-gradient(-45deg, transparent 0 18px, rgba(212, 188, 139, 0.04) 18px 19px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 420px;
}
.login-hero .eyebrow { color: var(--gold-soft); }
.login-hero h1 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: .95;
  letter-spacing: -0.03em;
}
.login-hero p {
  margin: 0;
  max-width: 28ch;
  color: rgba(246, 239, 230, 0.72);
  line-height: 1.55;
  font-size: .95rem;
}
.login-card {
  background: var(--card);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-card h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
  color: var(--wine-deep);
}
.login-card > p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.5;
}

#appShell { display: none; min-height: 100vh; position: relative; z-index: 1; }
#appShell.on { display: flex; }

.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background:
    linear-gradient(180deg, #1c1614 0%, #141110 55%, #100e0d 100%);
  color: #f4ece4;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(212, 188, 139, 0.14);
}
.brand {
  padding: 26px 22px 18px;
  border-bottom: 1px solid rgba(212, 188, 139, 0.12);
}
.brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: linear-gradient(145deg, var(--gold-soft), var(--gold));
  color: #2a1b0c;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
}
.brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand small {
  display: block;
  margin-top: 7px;
  color: rgba(244, 236, 228, 0.55);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.nav {
  padding: 14px 12px 10px;
  overflow: auto;
  flex: 1;
}
.nav-label {
  margin: 14px 10px 6px;
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(212, 188, 139, 0.55);
}
.nav-label:first-child { margin-top: 2px; }
.nav button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 500;
  font-size: .86rem;
  color: rgba(244, 236, 228, 0.78);
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 11px;
  margin-bottom: 2px;
  transition: background .18s ease, color .18s ease;
}
.nav button:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav button.active {
  background: linear-gradient(90deg, rgba(176, 137, 74, 0.2), rgba(122, 29, 44, 0.18));
  color: #f8efe4;
  box-shadow: inset 0 0 0 1px rgba(212, 188, 139, 0.22);
}
.nav .ico {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-grid;
  place-items: center;
  opacity: .9;
  flex-shrink: 0;
}
.nav .ico svg { width: 16px; height: 16px; display: block; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-foot {
  padding: 14px 14px 18px;
  border-top: 1px solid rgba(212, 188, 139, 0.12);
  display: grid;
  gap: 8px;
}
.sidebar-foot .btn-ghost {
  background: transparent;
  border-color: rgba(212, 188, 139, 0.22);
  color: rgba(244, 236, 228, 0.82);
}
.sidebar-foot .btn-ghost:hover { background: rgba(255,255,255,.04); }
.dev-credit {
  margin: 8px 0 0;
  text-align: center;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(244, 236, 228, 0.42);
}
.dev-credit a { color: var(--gold-soft); text-decoration: none; font-weight: 600; }
.dev-credit a:hover { text-decoration: underline; }

.main {
  flex: 1;
  min-width: 0;
  padding: 32px clamp(18px, 3vw, 42px) 72px;
}
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3vw, 2.45rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--wine-deep);
}
.topbar .lead {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .92rem;
  max-width: 640px;
  line-height: 1.5;
  font-weight: 400;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.7);
  border: 1px solid var(--line);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.status-pill.ok { color: var(--ok); border-color: rgba(47, 107, 79, 0.28); background: #f3f8f5; }
.status-pill.warn { color: var(--wine); }

.section { display: none; }
.section.visible { display: block; animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), var(--wine));
}
.stat span {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.stat b {
  display: block;
  margin-top: 10px;
  font-family: var(--serif);
  font-size: 2.05rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--wine-deep);
  line-height: 1;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 16px;
}
.card h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.card .sub { margin: -6px 0 14px; color: var(--muted); font-size: .88rem; line-height: 1.5; }

label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
label.inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 14px 6px 0;
  color: var(--ink-soft);
  font-size: .86rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
input[type="text"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fffdf9;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 137, 74, 0.18);
}
textarea { min-height: 96px; resize: vertical; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 150px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 12px;
  border: 0;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--garnet), var(--wine-deep));
  color: #fff8f2;
  box-shadow: 0 10px 20px rgba(76, 16, 27, 0.22);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost {
  background: #fffdf9;
  border: 1px solid var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger {
  background: #fbf3f1;
  border: 1px solid #edd3d4;
  color: var(--wine);
}
.btn-sm { padding: 7px 11px; font-size: .8rem; border-radius: 10px; letter-spacing: .02em; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hint { color: var(--muted); font-size: .8rem; line-height: 1.45; margin-top: 6px; }

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f1e8;
  margin-bottom: 6px;
}
.check-grid label.inline { margin: 0; }
.cat-tree {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.cat-tree .cat-parent-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.cat-tree .cat-children {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 2px 0 6px 22px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(176, 137, 74, 0.08);
}
.gallery-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.gallery-item {
  width: 96px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  position: relative;
}
.gallery-item img { width: 96px; height: 96px; object-fit: cover; display: block; }
.gallery-item .btn { width: 100%; border-radius: 0; }
.banner-preview {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-top: 8px;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  background: var(--ink);
  color: #f8efe4;
  padding: 13px 16px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
  max-width: min(420px, calc(100vw - 32px));
  font-size: .88rem;
  font-weight: 500;
  border: 1px solid rgba(212, 188, 139, 0.25);
}
.toast.on { display: block; animation: fade .2s ease; }
.toast.err { background: var(--wine-deep); }
.toast.ok { background: #1e4334; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 13px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  font-size: .66rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 600;
}
tbody tr:hover td { background: rgba(176, 137, 74, 0.06); }
.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 10px; background: #eee; box-shadow: 0 0 0 1px var(--line); }
.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(122, 29, 44, 0.08);
  color: var(--wine);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 1px 2px 1px 0;
}
.kw-grid, .kw-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.kw-chip {
  border: 1px solid var(--line-strong);
  background: #fffdf9;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
}
.kw-chip.on {
  border-color: var(--gold);
  background: rgba(176, 137, 74, 0.12);
  color: var(--wine-deep);
}
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf9;
}
.table-wrap table { margin: 0; }
.table-wrap th { padding-left: 14px; }
.table-wrap td { padding-left: 14px; }
.table-wrap th:last-child, .table-wrap td:last-child { padding-right: 14px; }

.var-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  background: #f7f1e8;
}
.var-block h3 {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
}
.choice-line {
  display: grid;
  grid-template-columns: minmax(160px, 1.5fr) 72px minmax(80px, 110px) minmax(140px, 1.3fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}
.choice-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  min-width: 0;
  font-size: .66rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.choice-field input { font-weight: 500; color: var(--ink); letter-spacing: 0; text-transform: none; }
.choice-extra { grid-column: 1 / -1; max-width: 320px; }
.price-field { min-width: 220px !important; flex: 0 0 240px !important; }
.price-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  min-width: 220px;
}
.price-input span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #efe6d8;
  font-weight: 700;
  color: var(--ink);
  border-right: 1px solid var(--line);
}
.price-input input {
  border: 0 !important;
  border-radius: 0 !important;
  background: #fff !important;
  min-width: 140px;
  width: 100%;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .02em;
}
.choice-field input[type="color"] {
  height: 42px;
  min-width: 52px;
  padding: 4px 6px;
  cursor: pointer;
}
.choice-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  padding-bottom: 2px;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 460px;
  overflow: auto;
  margin-top: 10px;
}
.trend-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f1e8;
}
.img-upload-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.img-upload-row input[type="url"] { flex: 1; min-width: 180px; }
.preview {
  width: 72px; height: 72px; object-fit: cover; border-radius: 12px; background: #eee; border: 1px solid var(--line);
}
.hidden { display: none !important; }
details.advanced {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #f7f1e8;
}
details.advanced summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-soft);
  font-size: .86rem;
  letter-spacing: .04em;
}

.site-footer {
  margin-top: auto;
  padding: 12px 18px 16px;
  text-align: center;
  font-size: .82rem;
  font-weight: 500;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.92);
}
.site-footer a { color: var(--wine); text-decoration: none; font-weight: 700; }
.site-footer a:hover { text-decoration: underline; }
.order-detail {
  margin: 0;
  word-break: break-word;
  font-size: .88rem;
  line-height: 1.5;
  background: #f7f1e8;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.od-h {
  margin: 16px 0 8px;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--wine);
  font-weight: 700;
}
.od-h:first-child { margin-top: 0; }
.od-row { margin: 0 0 6px; }
.od-row span { color: var(--muted); display: inline-block; min-width: 120px; }
.od-shot {
  display: block;
  max-width: 100%;
  max-height: 420px;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin: 8px 0 10px;
  background: #fff;
}
.od-items { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 6px 0 10px; }
.od-items th, .od-items td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.od-items td:last-child, .od-items th:last-child { text-align: right; }
select.order-status {
  max-width: 160px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

@media (max-width: 900px) {
  #appShell.on { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .nav { display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
  .nav-label { display: none; }
  .nav button { white-space: nowrap; border-radius: 999px; width: auto; }
  .choice-line { grid-template-columns: 1fr 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { min-height: 220px; padding: 32px 28px; }
}
