:root {
  --bg: #0f0d16;
  --panel: #191624;
  --panel-2: #231e31;
  --text: #f6f3ff;
  --muted: #aaa3bb;
  --accent: #b76cff;
  --accent-2: #7148ff;
  --success: #37d89b;
  --warning: #ffbd59;
  --danger: #ff657f;
  --line: rgba(255, 255, 255, .09);
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% -10%, rgba(113, 72, 255, .24), transparent 34rem),
    radial-gradient(circle at 95% 5%, rgba(183, 108, 255, .16), transparent 30rem),
    var(--bg);
  min-height: 100vh;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.danger { color: var(--danger); }
.success { color: var(--success); }

.shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 0 18px 100px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  margin: 0 -18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(15, 13, 22, .84);
  backdrop-filter: blur(18px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: .08em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 28px rgba(113, 72, 255, .38);
}
.brand-mark-logo {
  overflow: hidden;
  border: 1px solid rgba(203, 157, 255, .24);
  background-color: #160d25;
  background-image: url("/assets/triva-logo.jpg");
  background-repeat: no-repeat;
  background-position: 50% 44%;
  background-size: 176px auto;
}
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn, .ghost-btn, .primary-btn, .danger-btn {
  min-height: 42px;
  border-radius: 13px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel);
  padding: 9px 14px;
  transition: .18s ease;
}
.icon-btn:hover, .ghost-btn:hover { background: var(--panel-2); transform: translateY(-1px); }
.primary-btn {
  border: none;
  font-weight: 750;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(113, 72, 255, .25);
}
.primary-btn:hover { filter: brightness(1.09); transform: translateY(-1px); }
.primary-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.danger-btn { color: white; border-color: rgba(255,101,127,.3); background: rgba(255,101,127,.13); }
.wide { width: 100%; }
.badge {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  padding: 0 7px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  color: white;
  background: var(--accent-2);
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 20px;
  padding: 34px 0 24px;
}
.hero-card {
  position: relative;
  display: grid;
  align-items: center;
  overflow: hidden;
  min-height: 240px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    linear-gradient(120deg, rgba(183,108,255,.26), rgba(113,72,255,.04)),
    var(--panel);
  box-shadow: var(--shadow);
}
.hero-card::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  right: -70px;
  bottom: -110px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), var(--accent-2) 55%, transparent 70%);
  filter: blur(18px);
  opacity: .46;
}
.hero-copy { position: relative; z-index: 2; max-width: 720px; }
.hero-kicker, .eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: #d7b7ff;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.hero h1 {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0 0 12px;
  font-size: clamp(34px, 6vw, 62px);
  line-height: .98;
  letter-spacing: -.04em;
}
.hero p { position: relative; z-index: 1; max-width: 570px; color: #cdc5dc; font-size: 17px; }
.hero-note {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 240px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
}
.hero-note strong { font-size: 22px; }
.hero-note .big-icon { font-size: 58px; }

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}
.search, input, textarea, select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--panel);
  outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(183,108,255,.12); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 18px; scrollbar-width: none; }
.chip {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 30px;
  color: var(--muted);
  background: transparent;
}
.chip.active { color: white; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 12px 0 16px; }
.section-title h2 { margin: 0; font-size: 25px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 9px 28px rgba(0,0,0,.12);
  transition: .2s ease;
}
.product-card:hover { transform: translateY(-3px); border-color: rgba(183,108,255,.28); }
.product-image {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  background: linear-gradient(145deg, #2b2637, #17141f);
}
.product-body { display: flex; flex: 1; flex-direction: column; padding: 15px; }
.product-brand { color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.product-name { margin: 7px 0 12px; line-height: 1.28; font-weight: 650; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; }
.price { font-size: 20px; font-weight: 900; white-space: nowrap; }
.stock { color: var(--success); font-size: 12px; }
.stock.out { color: var(--danger); }
.add-btn {
  display: grid;
  flex: 0 0 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 14px;
  color: white;
  font-size: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.add-btn:disabled { opacity: .35; cursor: not-allowed; }
.empty {
  grid-column: 1 / -1;
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 22px;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 14px;
  display: none;
  width: min(440px, calc(100% - 24px));
  transform: translateX(-50%);
  grid-template-columns: repeat(3, 1fr);
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: rgba(25,22,36,.94);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.bottom-nav button { border: 0; padding: 9px; color: var(--muted); background: transparent; border-radius: 14px; }
.bottom-nav button.active { color: white; background: var(--panel-2); }

.drawer, .modal {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: stretch end;
  background: rgba(4, 3, 8, .68);
  backdrop-filter: blur(5px);
}
.drawer-panel {
  width: min(460px, 100%);
  height: 100%;
  overflow: auto;
  padding: 22px;
  background: var(--bg);
  border-left: 1px solid var(--line);
}
.modal { place-items: center; padding: 16px; }
.modal-card {
  width: min(620px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.modal-card.modal-wide { width: min(980px, 100%); }
.modal-head, .drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.modal-head h2, .drawer-head h2 { margin: 0; }
.close-btn { border: 0; color: var(--muted); background: transparent; font-size: 27px; }
.cart-item { display: grid; grid-template-columns: 66px 1fr auto; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 66px; height: 66px; border-radius: 14px; object-fit: cover; background: var(--panel); }
.qty { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty button { width: 29px; height: 29px; border: 1px solid var(--line); border-radius: 9px; color: white; background: var(--panel-2); }
.cart-total { display: flex; justify-content: space-between; padding: 20px 0; font-size: 21px; font-weight: 900; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 13px; }
.order-card, .panel {
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.order-row { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.status { display: inline-flex; padding: 6px 10px; border-radius: 20px; color: #e7dcff; background: rgba(183,108,255,.13); font-size: 12px; }
.status-muted { color: var(--muted); background: rgba(255,255,255,.06); }
.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 92px;
  width: min(460px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #282238;
  box-shadow: var(--shadow);
  text-align: center;
}

/* Admin */
.admin-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 15px; border-right: 1px solid var(--line); background: #12101a; }
.sidebar .brand { padding: 0 10px 24px; }
.nav-list { display: grid; gap: 5px; }
.nav-list button { width: 100%; padding: 11px 13px; border: 0; border-radius: 12px; text-align: left; color: var(--muted); background: transparent; }
.nav-list button:hover, .nav-list button.active { color: white; background: var(--panel-2); }
.admin-main { min-width: 0; padding: 28px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 25px; }
.admin-head h1 { margin: 0; font-size: 29px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.metric small { color: var(--muted); }
.metric strong { display: block; margin-top: 8px; font-size: 25px; }
.table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.actions button { min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; color: white; background: var(--panel-2); }
.actions .primary-btn { border: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.actions button:disabled, .product-actions button:disabled { opacity: .45; cursor: not-allowed; }
.table-check {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  box-shadow: none;
}
.products-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
}
.products-toolbar p { max-width: 720px; margin: 0; }
.products-toolbar .eyebrow { margin-bottom: 7px; }
.product-actions { justify-content: flex-end; }
.inventory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.inventory-summary > div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--panel);
}
.inventory-summary small { display: block; color: var(--muted); }
.inventory-summary strong { display: block; margin-top: 5px; font-size: 19px; }
.inventory-summary.compact { margin: 0 0 14px; }
.inventory-summary.compact > div { background: rgba(255,255,255,.025); }
.import-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 18px;
}
.import-step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}
.import-step > span {
  display: grid;
  flex: 0 0 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  font-weight: 850;
  background: rgba(183,108,255,.17);
}
.import-step b, .import-step small { display: block; }
.import-step small { margin-top: 3px; color: var(--muted); line-height: 1.3; }
.import-actions { margin: 16px 0; }
.import-result {
  margin-top: 16px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}
.import-ok { border-color: rgba(55,216,155,.3); }
.import-error { border-color: rgba(255,101,127,.3); }
.import-table { max-height: 330px; border-radius: 13px; }
.import-table table { white-space: normal; }
.import-table td:nth-child(1) { width: 72px; }
.import-table td:nth-child(2) { min-width: 130px; }
.import-table td:nth-child(3) { min-width: 210px; }
.bulk-photo-list {
  display: grid;
  gap: 10px;
  max-height: 55vh;
  overflow: auto;
  padding-right: 3px;
}
.bulk-photo-row {
  display: grid;
  grid-template-columns: 64px minmax(180px, 1fr) minmax(220px, 1fr) 110px;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255,255,255,.025);
}
.bulk-photo-row img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--panel-2);
}
.bulk-photo-row b, .bulk-photo-row small { display: block; }
.bulk-photo-row small { margin-top: 4px; color: var(--muted); }
.bulk-photo-row input { min-height: 42px; padding: 8px; }
.bulk-photo-row em { color: var(--muted); font-size: 12px; font-style: normal; }
.bulk-progress {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
}
.brand-admin-list { display: grid; gap: 8px; margin-top: 16px; }
.brand-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255,255,255,.025);
}
.brand-admin-row b, .brand-admin-row small { display: block; }
.brand-admin-row small { margin-top: 3px; color: var(--muted); }
.referral-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 24px;
}
.referral-box code {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #d7b7ff;
  background: rgba(255,255,255,.025);
}
.referral-box button {
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: white;
  background: var(--panel-2);
}
.login-screen { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; padding: 18px; background: var(--bg); }
.login-card { width: min(420px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); }
.login-card h1 { margin-top: 0; }

@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 78px minmax(0,1fr); }
  .sidebar { padding: 18px 8px; }
  .sidebar .brand span:last-child, .nav-list button span { display: none; }
  .sidebar .brand { justify-content: center; padding: 0 0 18px; }
  .nav-list button { text-align: center; font-size: 20px; }
  .products-toolbar { align-items: flex-start; flex-direction: column; }
  .product-actions { justify-content: flex-start; }
  .inventory-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .shell { padding-inline: 13px; }
  .topbar { margin-inline: -13px; }
  .hero { grid-template-columns: 1fr; padding-top: 18px; }
  .hero-card { min-height: 250px; padding: 25px; }
  .hero h1 { font-size: clamp(34px, 10vw, 48px); }
  .hero-note { display: none; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-body { padding: 12px; }
  .product-name { font-size: 14px; }
  .price { font-size: 17px; }
  .header-actions .ghost-btn { display: none; }
  .bottom-nav { display: grid; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .admin-layout { display: block; }
  .sidebar { position: fixed; z-index: 80; inset: auto 10px 10px; width: auto; height: auto; padding: 6px; border: 1px solid var(--line); border-radius: 18px; }
  .sidebar .brand { display: none; }
  .nav-list { grid-auto-flow: column; grid-auto-columns: 1fr; overflow-x: auto; }
  .nav-list button { min-width: 50px; padding: 10px; }
  .admin-main { padding: 18px 12px 95px; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric { padding: 14px; }
  .metric strong { font-size: 20px; }
  .import-guide { grid-template-columns: 1fr; }
  .product-actions { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .product-actions button { width: 100%; }
  .bulk-photo-row { grid-template-columns: 54px 1fr; }
  .bulk-photo-row img { width: 54px; height: 54px; }
  .bulk-photo-row input, .bulk-photo-row em { grid-column: 1 / -1; }
  .referral-box { align-items: stretch; flex-direction: column; }
}
