/* EliteTools admin — standalone dark UI, independent of the storefront sheet. */

:root {
  --bg: #0b0d12;
  --surface: #141821;
  --surface-2: #1b202b;
  --line: #2a3140;
  --line-soft: #222836;
  --ink: #e8ecf4;
  --muted: #949eb3;
  --gold: #facc15;
  --gold-deep: #eab308;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1000px 600px at 80% -10%, rgba(250, 204, 21, 0.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 5px;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 9px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    opacity 0.15s ease,
    transform 0.08s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--gold);
  color: #12140c;
}

.btn--primary:hover:not(:disabled) {
  background: var(--gold-deep);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 0.85rem;
}

.btn--block {
  width: 100%;
}

.icon-danger {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.icon-danger:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ---------------------------------------------------------------- fields */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.field__label em {
  font-style: normal;
  font-weight: 400;
  opacity: 0.75;
}

.field__hint {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.45;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  outline: none;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

select {
  cursor: pointer;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.16);
}

input::placeholder,
textarea::placeholder {
  color: #5c6577;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 4px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

/* ---------------------------------------------------------------- login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login__card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.login__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.login__brand em {
  font-style: normal;
  color: var(--gold);
}

.login__title {
  margin: 6px 0 0;
  font-size: 1.35rem;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.login__sub {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.login__msg {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--danger);
}

.login__hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  line-height: 1.55;
}

.login__hint code {
  word-break: break-all;
}

.login__back {
  color: var(--muted);
  font-size: 0.84rem;
  text-decoration: none;
  text-align: center;
}

.login__back:hover {
  color: var(--ink);
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 20px;
  background: rgba(11, 13, 18, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar__brand em {
  font-style: normal;
  color: var(--gold);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar__meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-inline-end: 4px;
}

.topbar__meta.is-dirty {
  color: var(--gold);
  font-weight: 600;
}

/* ---------------------------------------------------------------- layout */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.panel__head h2 {
  margin: 0;
  font-size: 1rem;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.01em;
}

.panel__head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__body {
  padding: 18px;
}

.count {
  display: inline-block;
  margin-inline-start: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.search {
  width: 220px;
}

.empty {
  margin: 0;
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------- notices */
.notice {
  max-width: 1180px;
  margin: 16px auto 0;
  padding: 12px 16px;
  border-radius: 11px;
  font-size: 0.86rem;
  line-height: 1.55;
}

.notice--ok {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #86efac;
}

.drawer .notice {
  max-width: none;
  margin: 0 0 14px;
}

.ziina-flag {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.75;
}

.ziina-flag--ok {
  color: #4ade80;
  opacity: 1;
}

.ziina-flag--bad {
  color: #fca5a5;
  opacity: 1;
}

.orders td .btn--xs {
  margin-top: 6px;
}

button.linkish {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--gold);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.customer-history {
  white-space: normal;
}

.drawer h3 {
  margin: 18px 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}

.notice--warn {
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: #fde68a;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 11px;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.toast--ok {
  background: #16321f;
  border: 1px solid rgba(74, 222, 128, 0.5);
  color: #bbf7d0;
}

.toast--err {
  background: #3a1a1a;
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

/* ---------------------------------------------------------------- products */
.products {
  display: flex;
  flex-direction: column;
}

.product {
  border-bottom: 1px solid var(--line-soft);
}

.product:last-child {
  border-bottom: 0;
}

.product__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
}

.product__toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

.product__chev {
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.16s ease;
  flex: 0 0 12px;
}

.product__toggle[aria-expanded="true"] .product__chev {
  transform: rotate(90deg);
}

.product__logo {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #0a0a0a;
  font-size: 1rem;
}

.product__logo img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.product__title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.product__title strong {
  font-size: 0.94rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product__title small {
  color: var(--muted);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product__head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.product__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 4px 18px 22px;
  border-top: 1px dashed var(--line-soft);
  margin-top: 2px;
}

.product--new {
  animation: flash 1.1s ease;
}

@keyframes flash {
  from {
    background: rgba(250, 204, 21, 0.12);
  }
  to {
    background: transparent;
  }
}

/* ---------------------------------------------------------------- variants */
.variants-block {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 14px;
}

.variants-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.variants-block__head h3 {
  margin: 0;
  font-size: 0.9rem;
  font-family: "Space Grotesk", sans-serif;
}

.variants-head,
.variant-row {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.3fr 0.8fr 32px;
  gap: 8px;
  align-items: center;
}

.variants-head {
  padding: 0 2px 6px;
}

.variants-head span {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.variants {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid-2,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }

  .search {
    width: 100%;
  }

  .panel__head-actions {
    width: 100%;
  }

  .variants-head {
    display: none;
  }

  .variant-row {
    grid-template-columns: minmax(0, 1fr) 32px;
    grid-template-areas:
      "id remove"
      "label label"
      "labelar labelar"
      "price price";
    row-gap: 6px;
    padding: 10px;
    border: 1px solid var(--line-soft);
    border-radius: 9px;
  }

  .variant-row [data-v="id"] {
    grid-area: id;
  }
  .variant-row [data-v="label"] {
    grid-area: label;
  }
  .variant-row [data-v="label_ar"] {
    grid-area: labelar;
  }
  .variant-row [data-v="price"] {
    grid-area: price;
  }
  .variant-row [data-remove-variant] {
    grid-area: remove;
  }

  .topbar {
    padding: 10px 14px;
  }

  .topbar__actions {
    width: 100%;
  }

  .wrap {
    padding: 16px 14px 70px;
  }

  .product__head,
  .product__body {
    padding-inline: 14px;
  }
}

/* ==========================================================================
   Orders dashboard
   ========================================================================== */

.tabs {
  display: flex;
  gap: 4px;
  margin-inline: auto 0;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0.6;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tab:hover {
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.05);
}

.tab.is-active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.tab__count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 11px;
  font-weight: 700;
}

.tab__count[hidden] {
  display: none;
}

/* ----- Stat tiles ----- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

@media (max-width: 780px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stat {
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.stat strong {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.6;
}

/* An unshipped paid order is the one number that needs chasing. */
.stat--warn {
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(250, 204, 21, 0.08);
}

.stat--warn strong {
  color: #facc15;
}

/* ----- Orders table ----- */

.orders-scroll {
  overflow-x: auto;
}

.orders {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.orders th {
  text-align: start;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.5;
  border-bottom: 1px solid var(--line);
}

.orders td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.orders tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.orders .num {
  text-align: end;
}

.orders td small {
  display: block;
  font-size: 11px;
  opacity: 0.55;
}

.orders .items {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orders .items .gift {
  color: #4ade80;
  opacity: 0.9;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

.breakable {
  white-space: normal;
  word-break: break-all;
}

/* ----- Status pills ----- */

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill--paid {
  background: rgba(74, 222, 128, 0.16);
  color: #4ade80;
}

.pill--pending,
.pill--open {
  background: rgba(250, 204, 21, 0.16);
  color: #facc15;
}

.pill--answered,
.pill--resolved {
  background: rgba(74, 222, 128, 0.16);
  color: #4ade80;
}

.pill--closed {
  background: rgba(255, 255, 255, 0.1);
  color: #a3a3a3;
}

.pill--failed,
.pill--canceled {
  background: rgba(248, 113, 113, 0.16);
  color: #fca5a5;
}

.pill--test {
  margin-inline-start: 6px;
  background: rgba(255, 255, 255, 0.12);
  opacity: 0.8;
  font-size: 9.5px;
}

/* ----- Small controls ----- */

.select-sm {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: inherit;
  cursor: pointer;
}

.select-fulfil.is-delivered {
  border-color: rgba(74, 222, 128, 0.45);
  color: #4ade80;
}

.select-fulfil.is-refunded,
.select-fulfil.is-cancelled {
  border-color: rgba(248, 113, 113, 0.4);
  color: #fca5a5;
}

.btn--xs {
  padding: 5px 10px;
  font-size: 11.5px;
}

/* ----- Detail drawer ----- */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.drawer[hidden] {
  display: none;
}

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.drawer__panel {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  width: min(460px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-inline-start: 1px solid var(--line);
  box-shadow: -18px 0 50px rgba(0, 0, 0, 0.45);
}

.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer__head h2 {
  margin: 0;
  font-size: 17px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  letter-spacing: 0.03em;
}

.drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.drawer__body h3 {
  margin: 22px 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.5;
}

.kv {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 7px 14px;
  margin: 0;
  font-size: 13px;
}

.kv dt {
  opacity: 0.55;
}

.kv dd {
  margin: 0;
  min-width: 0;
}

.kv dd a {
  color: inherit;
}

.drawer-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.drawer-lines li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}

.drawer-lines small {
  display: block;
  font-size: 11px;
  opacity: 0.55;
}

.drawer__total {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 15px;
  font-weight: 700;
}

.drawer__actions {
  display: flex;
  gap: 8px;
  margin: 8px 0 14px;
}

.drawer__actions .btn {
  flex: 1;
}

#passwordForm .field {
  margin: 0 0 12px;
}
#passwordForm .btn {
  margin-top: 8px;
}

.type-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
  background: var(--surface-2);
}
.type-card__head {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}
.type-card__head input,
.type-card__head select {
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
.variants-head--dur {
  grid-template-columns: 1fr 1.2fr 1.2fr 0.8fr auto;
}
.admin-ticket {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface);
}
.admin-ticket header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.tk-thread { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.tk-msg {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 10px;
}
.tk-msg--admin { border-inline-start: 3px solid var(--gold); }
.tk-reply textarea {
  width: 100%;
  min-height: 70px;
  font: inherit;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.tk-reply__row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .type-card__head { grid-template-columns: 1fr; }
  .tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .tab {
    flex: 0 0 auto;
  }
  .orders th:nth-child(2),
  .orders td:nth-child(2) {
    display: none;
  }
  #customersView .orders th:nth-child(3),
  #customersView .orders td:nth-child(3),
  #customersView .orders th:nth-child(6),
  #customersView .orders td:nth-child(6) {
    display: none;
  }
  .drawer__panel {
    width: min(100%, 100vw);
  }
}
