/* Vitrimax admin hub — MaxAuthor-like dark shell */
:root {
  --hub-bg: #0b1220;
  --hub-sidebar: #080e18;
  --hub-panel: #121a28;
  --hub-panel-2: #0f1624;
  --hub-line: rgba(148, 163, 184, 0.12);
  --hub-line-strong: rgba(148, 163, 184, 0.2);
  --hub-text: #e8eef7;
  --hub-muted: #8b9bb4;
  --hub-green: #22c55e;
  --hub-green-deep: #16a34a;
  --hub-green-soft: rgba(34, 197, 94, 0.14);
  --hub-blue: #3b82f6;
  --hub-blue-soft: rgba(59, 130, 246, 0.16);
  --hub-purple: #7c3aed;
  --hub-danger: #f87171;
  --hub-radius: 14px;
  --hub-sidebar-w: 268px;
  --font: Manrope, system-ui, sans-serif;
  --display: Syne, Manrope, sans-serif;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

body.hub-body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--hub-text);
  background: var(--hub-bg);
  line-height: 1.45;
}

/* ---- Gate ---- */
.gate {
  max-width: 420px;
  margin: 18vh auto 0;
  text-align: center;
  display: grid;
  gap: .9rem;
  justify-items: center;
  padding: 1.5rem;
}
.gate h1 {
  font-family: var(--display);
  letter-spacing: -.04em;
  margin: 0;
  font-size: 2rem;
}
.gate p { color: var(--hub-muted); margin: 0; }
.gate .hint { font-size: .9rem; }

/* ---- Shell ---- */
.hub {
  display: grid;
  grid-template-columns: var(--hub-sidebar-w) 1fr;
  min-height: 100vh;
}
.hub-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--hub-sidebar);
  border-right: 1px solid var(--hub-line);
  padding: 1rem .85rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
  overflow: auto;
  z-index: 40;
}
.hub-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: var(--hub-text);
  padding: .35rem .45rem;
}
.hub-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1a2a1f, #0f1a14);
  border: 1px solid rgba(34, 197, 94, 0.35);
  display: grid;
  place-items: center;
  color: var(--hub-green);
  flex-shrink: 0;
}
.hub-brand-mark svg { width: 20px; height: 20px; }
.hub-brand-text {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -.03em;
  font-size: 1.05rem;
}
.hub-brand-sub {
  display: block;
  font-family: var(--font);
  font-weight: 500;
  font-size: .72rem;
  color: var(--hub-muted);
  letter-spacing: 0;
}

.hub-search {
  position: relative;
}
.hub-search input {
  width: 100%;
  background: var(--hub-panel);
  border: 1px solid var(--hub-line);
  border-radius: 10px;
  color: var(--hub-text);
  padding: .55rem .7rem .55rem 2.1rem;
  font: inherit;
  font-size: .88rem;
}
.hub-search input::placeholder { color: var(--hub-muted); }
.hub-search-ico {
  position: absolute;
  left: .7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--hub-muted);
  pointer-events: none;
  font-size: .85rem;
}

.hub-nav { display: grid; gap: 1rem; }
.hub-nav-group { display: grid; gap: .2rem; }
.hub-nav-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--hub-muted);
  padding: .35rem .55rem;
}
.hub-nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: #c5d0e0;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  text-align: left;
  padding: .55rem .65rem;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
}
.hub-nav-item:hover { background: rgba(255,255,255,.04); color: #fff; }
.hub-nav-item.active {
  background: var(--hub-blue-soft);
  color: #fff;
}
.hub-nav-item.active .nav-ico { color: var(--hub-green); }
.nav-ico {
  width: 1.15rem;
  text-align: center;
  color: var(--hub-muted);
  flex-shrink: 0;
}
.nav-badge {
  margin-left: auto;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: var(--hub-green);
  color: #052e16;
  font-size: .72rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}
.nav-badge.empty { display: none; }

.hub-sidebar-foot {
  margin-top: auto;
  padding: .75rem .55rem 0;
  border-top: 1px solid var(--hub-line);
  font-size: .8rem;
  color: var(--hub-muted);
}
.hub-sidebar-foot a { color: var(--hub-green); text-decoration: none; font-weight: 600; }

/* ---- Main ---- */
.hub-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.hub-topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--hub-line);
  background: rgba(8, 14, 24, 0.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.hub-menu-btn {
  display: none;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  border: 1px solid var(--hub-line);
  background: var(--hub-panel);
  color: var(--hub-text);
  cursor: pointer;
  font-size: 1.1rem;
}
.hub-top-title {
  font-weight: 700;
  font-size: .98rem;
}
.hub-top-spacer { flex: 1; }
.hub-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .75rem;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  border: 0;
  cursor: default;
}
.hub-pill.plan {
  background: rgba(124, 58, 237, 0.22);
  color: #ddd6fe;
}
.hub-pill.ghost {
  background: transparent;
  border: 1px solid var(--hub-line);
  color: var(--hub-muted);
}

.hub-content {
  padding: 1.25rem 1.35rem 2.5rem;
  width: min(1100px, 100%);
  margin: 0 auto;
}

.page-head {
  margin-bottom: 1.1rem;
}
.page-head h1 {
  font-family: var(--display);
  font-size: clamp(1.55rem, 3vw, 1.95rem);
  letter-spacing: -.04em;
  margin: 0 0 .35rem;
}
.page-head p {
  margin: 0;
  color: var(--hub-muted);
  max-width: 52ch;
}

/* ---- Cards ---- */
.hub-card {
  background: var(--hub-panel);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius);
  padding: 1.05rem 1.15rem;
  margin-bottom: 1rem;
}
.hub-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem .9rem;
  margin-bottom: .85rem;
}
.hub-card-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.status-tag {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.status-tag.live {
  background: var(--hub-green-soft);
  color: var(--hub-green);
}
.hub-card-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .2rem;
  align-items: center;
  color: var(--hub-muted);
  font-size: .82rem;
  font-weight: 600;
  margin-bottom: .35rem;
}
.flow-steps .sep { opacity: .45; margin: 0 .15rem; }
.flow-steps .done { color: var(--hub-green); }
.flow-steps .now { color: #fff; }

/* ---- Checklist ---- */
.checklist-title {
  font-weight: 700;
  margin: 0 0 .75rem;
  font-size: .98rem;
}
.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .35rem;
}
.checklist-item {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: .65rem;
  align-items: center;
  padding: .55rem .35rem;
  border-radius: 10px;
}
.checklist-item:hover { background: rgba(255,255,255,.03); }
.checklist-num {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: .75rem;
  font-weight: 800;
  background: rgba(255,255,255,.06);
  color: var(--hub-muted);
}
.checklist-item.ok .checklist-num {
  background: var(--hub-green-soft);
  color: var(--hub-green);
}
.checklist-item.ok .checklist-label { color: var(--hub-muted); text-decoration: line-through; }
.checklist-label { font-size: .92rem; font-weight: 600; }
.checklist-action {
  min-height: 2rem;
  padding: .35rem .75rem;
  border-radius: 8px;
  border: 1px solid var(--hub-line-strong);
  background: transparent;
  color: var(--hub-text);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}
.checklist-action:hover { border-color: var(--hub-green); color: var(--hub-green); }
.checklist-item.ok .checklist-action {
  border-color: transparent;
  color: var(--hub-green);
  cursor: default;
}

.btn-publish {
  width: 100%;
  margin-top: .9rem;
  min-height: 2.85rem;
  border: 0;
  border-radius: 10px;
  background: var(--hub-green);
  color: #052e16;
  font: inherit;
  font-weight: 800;
  font-size: .95rem;
  cursor: pointer;
}
.btn-publish:hover { background: #4ade80; }
.btn-publish:disabled {
  opacity: .45;
  cursor: not-allowed;
  background: #1f3d2a;
  color: #86efac;
}

/* ---- Sub tabs ---- */
.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 1.15rem 0 .9rem;
  padding: .3rem;
  background: var(--hub-panel-2);
  border: 1px solid var(--hub-line);
  border-radius: 12px;
  width: fit-content;
  max-width: 100%;
}
.sub-tab {
  border: 0;
  background: transparent;
  color: var(--hub-muted);
  font: inherit;
  font-weight: 700;
  font-size: .88rem;
  padding: .5rem .95rem;
  border-radius: 9px;
  cursor: pointer;
}
.sub-tab:hover { color: #fff; }
.sub-tab.active {
  background: var(--hub-green);
  color: #052e16;
}

.section-block { margin-bottom: 1.25rem; }
.section-block h3 {
  margin: 0 0 .45rem;
  font-size: 1rem;
}
.section-block .lead {
  color: var(--hub-muted);
  font-size: .9rem;
  margin: 0 0 .85rem;
}

.muted, .hint, .msg { color: var(--hub-muted); font-size: .9rem; }
.msg { margin: .5rem 0 0; }
code {
  font-size: .78rem;
  word-break: break-all;
  color: #a7f3d0;
  background: rgba(34, 197, 94, 0.08);
  padding: .1rem .35rem;
  border-radius: 4px;
}

label {
  display: grid;
  gap: .35rem;
  margin-bottom: .75rem;
  font-weight: 600;
  font-size: .88rem;
  color: #cbd5e1;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--hub-line-strong);
  border-radius: 10px;
  padding: .7rem .8rem;
  font: inherit;
  background: #0a111c;
  color: var(--hub-text);
}
input:focus, textarea:focus, select:focus {
  outline: 1px solid rgba(34, 197, 94, 0.45);
  border-color: rgba(34, 197, 94, 0.35);
}
.row { display: flex; align-items: center; gap: .4rem; }
.prefix { color: var(--hub-muted); font-weight: 600; }
.color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 600;
  cursor: pointer;
  grid-template-columns: none;
}
.toggle input { width: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: .55rem 1rem;
  border-radius: 10px;
  border: 0;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
}
.btn.primary { background: var(--hub-green); color: #052e16; }
.btn.primary:hover { background: #4ade80; }
.btn.ghost {
  background: transparent;
  color: var(--hub-text);
  box-shadow: inset 0 0 0 1px var(--hub-line-strong);
}
.btn.ghost:hover { border-color: var(--hub-green); color: var(--hub-green); box-shadow: inset 0 0 0 1px var(--hub-green); }
.btn.danger {
  background: transparent;
  color: var(--hub-danger);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.35);
}
.btn.sm { min-height: 2.1rem; padding: .35rem .7rem; font-size: .82rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .35rem; }

.add-form { display: grid; gap: .55rem; margin-bottom: 1rem; }
@media (min-width: 720px) {
  .add-form { grid-template-columns: 2fr 1fr 1.4fr auto; }
  .cats-form { grid-template-columns: 1fr auto; }
}

.list { display: grid; gap: .55rem; }
.item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: .75rem;
  align-items: center;
  padding: .65rem;
  border-radius: 12px;
  background: #0a111c;
  border: 1px solid var(--hub-line);
}
.item.cat-item { grid-template-columns: 1fr auto; }
.item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  background: #152033;
}
.item .meta b { display: block; }
.item .price { color: var(--hub-green); font-weight: 700; margin-top: .15rem; }
.photo-input { margin-top: .4rem; font-size: .78rem; }

.channel-steps {
  margin: .5rem 0 .75rem 1.1rem;
  color: var(--hub-muted);
  font-size: .9rem;
}
.channel-box {
  padding: .85rem;
  border-radius: 12px;
  background: #0a111c;
  border: 1px dashed var(--hub-line-strong);
}
.channel-box.bound {
  border-style: solid;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.06);
}

.delivery-editor { margin: .5rem 0 1rem; }
.delivery-editor .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .5rem;
}
.delivery-editor h3 { margin: 0; font-size: .95rem; }
.delivery-opts { display: grid; gap: .5rem; }
.delivery-opt-row {
  display: grid;
  grid-template-columns: auto 1fr 5.5rem;
  gap: .45rem;
  align-items: center;
}
.delivery-opt-row input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }

.pay-box {
  margin: 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--hub-line);
}
.pay-box h3 { margin: 0 0 .45rem; font-size: 1rem; }

.share-box {
  margin-top: 1rem;
  padding: .85rem;
  border-radius: 12px;
  background: #0a111c;
  border: 1px solid var(--hub-line);
  font-size: .88rem;
  display: grid;
  gap: .35rem;
}
.share-box a { color: var(--hub-green); word-break: break-all; }

/* ---- Orders ---- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
  margin-bottom: 1rem;
}
@media (min-width: 720px) {
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
}
.kpi {
  background: var(--hub-panel);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius);
  padding: .85rem 1rem;
}
.kpi-val {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.03em;
}
.kpi-label { color: var(--hub-muted); font-size: .8rem; margin-top: .15rem; }

.order-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .9rem;
}
.cat-chip {
  border: 1px solid var(--hub-line);
  background: transparent;
  color: var(--hub-muted);
  border-radius: 999px;
  padding: .35rem .75rem;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
}
.cat-chip.active {
  background: var(--hub-green-soft);
  border-color: transparent;
  color: var(--hub-green);
}

.orders-list { display: grid; gap: .75rem; }
.order-card {
  background: var(--hub-panel);
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius);
  padding: 1rem;
}
.order-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .35rem;
}
.order-status {
  display: inline-block;
  margin-left: .45rem;
  font-size: .72rem;
  font-weight: 800;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  vertical-align: middle;
}
.status-new { background: rgba(251, 191, 36, 0.16); color: #fbbf24; }
.status-paid, .status-done { background: var(--hub-green-soft); color: var(--hub-green); }
.status-cancelled { background: rgba(248, 113, 113, 0.14); color: #f87171; }
.status-shipped, .status-packing { background: rgba(59, 130, 246, 0.16); color: #60a5fa; }
.order-pay-badge {
  display: inline-block;
  margin-left: .35rem;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .15rem .45rem;
  border-radius: 999px;
  background: var(--hub-green-soft);
  color: var(--hub-green);
}
.order-meta { font-size: .85rem; margin-bottom: .35rem; }
.order-lines { font-size: .92rem; margin-bottom: .55rem; }
.order-actions {
  display: grid;
  gap: .55rem;
}
@media (min-width: 640px) {
  .order-actions {
    grid-template-columns: 1.2fr 1.4fr auto;
    align-items: end;
  }
}
.order-actions label { margin-bottom: 0; }
.order-actions select,
.order-actions input { min-height: 2.5rem; }

.preview-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--hub-line);
  border-radius: var(--hub-radius);
  background: #fff;
}

/* ---- Mobile ---- */
.hub-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 35;
}
@media (max-width: 900px) {
  .hub { grid-template-columns: 1fr; }
  .hub-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(288px, 88vw);
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 12px 0 40px rgba(0,0,0,.4);
  }
  body.sidebar-open .hub-sidebar { transform: none; }
  body.sidebar-open .hub-backdrop { display: block; }
  .hub-menu-btn { display: inline-grid; place-items: center; }
  .hub-content { padding: 1rem 1rem 2rem; }
  .hub-pill.plan span { display: none; }
}
