/* Admin panel */

/* ---------- sign in ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(420px, 100%);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-card .brand {
  justify-content: center;
}
.login-card .brand img {
  height: 44px;
  max-width: 220px;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 800;
  text-align: center;
}
.login-card p {
  margin: 0;
  text-align: center;
}

/* ---------- shell ---------- */

.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  gap: 0;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px;
  display: flex;
}
.sidebar-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 14px;
  border-radius: 20px;
  overflow-y: auto;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}
.side-brand img {
  height: 32px;
  max-width: 150px;
  object-fit: contain;
}
.side-brand .brand-name {
  font-size: 20px;
}
.side-brand .brand-tag {
  display: block;
  font-size: 10.5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 13px;
  color: var(--text-2);
  font-weight: 550;
  font-size: 14.5px;
  text-decoration: none !important;
  border: 1px solid transparent;
}
.nav-item:hover {
  color: var(--heading);
  background: var(--glass-strong);
}
.nav-item[aria-current="page"] {
  color: var(--blue);
  background: var(--glass-strong);
  border-color: var(--glass-border);
  box-shadow: 0 8px 20px -14px rgba(26, 111, 232, 0.6);
}
.nav-item .count {
  margin-left: auto;
}
.side-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.side-foot button.nav-item {
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.content {
  min-width: 0;
  padding: 28px 32px 60px 16px;
}
.mobile-bar {
  display: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h1 {
  font-size: 30px;
  font-weight: 800;
  margin-top: 6px;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--text-2);
}
.head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.spacer {
  flex: 1;
}

/* ---------- segmented tabs & toolbar ---------- */

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: 13px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  max-width: 100%;
  overflow-x: auto;
}
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 0;
  background: none;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.segmented button[aria-selected="true"],
.segmented button[aria-pressed="true"] {
  background: var(--glass-strong);
  color: var(--heading);
  box-shadow: 0 6px 16px -10px rgba(40, 30, 20, 0.5);
}
.segmented .badge {
  padding: 1px 8px;
  font-size: 11.5px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px;
  border-radius: 20px;
}
.search {
  position: relative;
  flex: 1 1 260px;
}
.search .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}
.search .input {
  padding-left: 42px;
  min-height: 44px;
}
.toolbar .select {
  width: auto;
  min-width: 160px;
  min-height: 44px;
  flex: 0 1 200px;
}

/* ---------- tables ---------- */

.table-wrap {
  overflow: hidden;
  padding: 6px;
}
table.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.table td {
  padding: 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table tbody tr.clickable {
  cursor: pointer;
}
.table tbody tr.clickable:hover td {
  background: var(--glass-strong);
}
.table tbody tr.clickable:hover td:first-child {
  border-radius: 12px 0 0 12px;
}
.table tbody tr.clickable:hover td:last-child {
  border-radius: 0 12px 12px 0;
}
.table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cell-main {
  font-weight: 600;
  color: var(--heading);
}
.cell-sub {
  font-size: 12.5px;
  color: var(--text-3);
}
.order-link {
  font-weight: 700;
  color: var(--blue);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 14px;
}

.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-2);
}
.empty .tile {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 6px;
  font-size: 13.5px;
  color: var(--text-2);
}

/* mobile cards instead of table */
.order-cards {
  display: none;
  flex-direction: column;
  gap: 10px;
}
.order-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 16px;
  border-radius: 18px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  border: 1px solid var(--glass-border);
}
.order-card .badges {
  grid-column: 1 / -1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

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

.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 18, 15, 0.32);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.drawer {
  position: fixed;
  top: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 61;
  width: min(580px, calc(100vw - 20px));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  backdrop-filter: blur(28px) saturate(150%);
  animation: slide-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes slide-in {
  from {
    transform: translateX(40px);
    opacity: 0;
  }
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--hairline);
}
.drawer-head h2 {
  font-size: 22px;
  font-weight: 800;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.drawer-section h3 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}
.box {
  padding: 16px;
  border-radius: 13px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.kv {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px 12px;
  font-size: 14px;
  margin: 0;
}
.kv dt {
  color: var(--text-3);
}
.kv dd {
  margin: 0;
  color: var(--heading);
  overflow-wrap: anywhere;
}
.items-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.items-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.mini-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: linear-gradient(160deg, #e6e6e6, #c9c9cb);
  display: grid;
  place-items: center;
  color: #8d8f96;
}
.mini-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 11px;
}
.mini-thumb .q {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.totals-mini {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--hairline);
  font-size: 14px;
}
.totals-mini .strong {
  font-weight: 800;
  color: var(--heading);
  font-size: 16px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.timeline li {
  position: relative;
  padding: 0 0 16px 26px;
  font-size: 13.5px;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}
.timeline li::after {
  content: "";
  position: absolute;
  left: 9.5px;
  top: 20px;
  bottom: 2px;
  width: 1px;
  background: var(--hairline);
}
.timeline li:last-child::after {
  display: none;
}
.timeline .t-title {
  font-weight: 600;
  color: var(--heading);
}
.timeline .t-meta {
  color: var(--text-3);
  font-size: 12.5px;
}
.timeline .t-msg {
  color: var(--text-2);
  overflow-wrap: anywhere;
}

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

/* ---------- reports ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.stat {
  padding: 20px 22px;
}
.stat .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.stat .label .icon {
  color: var(--blue);
}
.stat .value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}
.panel {
  padding: 22px;
}
.panel h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 220px;
  padding-top: 10px;
  border-bottom: 1px solid var(--hairline);
}
.bar-col {
  flex: 1;
  min-width: 6px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}
.bar {
  width: 100%;
  max-width: 44px;
  min-height: 3px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--blue), #6f9be0);
}
.bar-col:hover .bar,
.bar-col:focus-visible .bar {
  background: linear-gradient(180deg, var(--blue-600), var(--blue));
}
.bar-tip {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 10px;
  background: #1f2430;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 2;
}
.bar-col:hover .bar-tip,
.bar-col:focus-visible .bar-tip {
  opacity: 1;
}
.bar-axis {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  padding-top: 8px;
}

.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.hbar-row .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 6px;
}
.hbar-row .top strong {
  color: var(--heading);
}
.hbar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--hairline);
  overflow: hidden;
}
.hbar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--sage));
}

.funnel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.funnel-step {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 90px;
  gap: 16px;
  align-items: center;
}
.funnel-step .name {
  font-weight: 600;
  color: var(--heading);
}
.funnel-step .conv {
  font-size: 12.5px;
  color: var(--text-3);
}
.funnel-step .bar-h {
  height: 38px;
  border-radius: 12px;
  background: var(--hairline);
  overflow: hidden;
}
.funnel-step .bar-h div {
  height: 100%;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--blue), #6f9be0);
  display: flex;
  align-items: center;
  padding-left: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  min-width: 36px;
}
.funnel-step .pct {
  text-align: right;
  font-weight: 700;
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

/* ---------- settings ---------- */

.settings-section {
  padding: 24px;
}
.settings-section > .head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.settings-section h2 {
  font-size: 18px;
  font-weight: 700;
}
.settings-section .head p {
  margin: 4px 0 0;
  font-size: 13.5px;
  color: var(--text-2);
}
.method-card {
  padding: 16px;
  border-radius: 13px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
}
.method-card + .method-card {
  margin-top: 12px;
}
.code {
  position: relative;
  margin: 0;
  padding: 14px 52px 14px 16px;
  border-radius: 14px;
  background: #171b22;
  color: #dbe4f3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
}
.code .copy {
  position: absolute;
  top: 8px;
  right: 8px;
  color: #a9b4c6;
}
.code .copy:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.secret {
  display: flex;
  gap: 8px;
  align-items: center;
}
.secret .input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}
.save-bar {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 20px;
  border-radius: 20px;
}
.test-result {
  margin-top: 14px;
}
.test-result pre {
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.store-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.store-card .logo {
  height: 44px;
  display: flex;
  align-items: center;
}
.store-card .logo img {
  max-height: 40px;
  max-width: 180px;
  object-fit: contain;
}
.nav-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 8px;
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .funnel-step {
    grid-template-columns: 150px minmax(0, 1fr) 70px;
  }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
    padding: 10px;
  }
  .sidebar .sidebar-inner {
    background: var(--glass-strong);
  }
  .app.menu-open .sidebar {
    transform: none;
  }
  .mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 8px;
    z-index: 30;
    margin: 8px 12px 0;
    padding: 8px 10px 8px 8px;
    border-radius: 20px;
  }
  .mobile-bar .brand img {
    height: 26px;
  }
  .mobile-bar .brand-name {
    font-size: 18px;
  }
  .content {
    padding: 18px 12px 60px;
  }
  .page-head h1 {
    font-size: 25px;
  }
  .table-wrap.orders-table {
    display: none;
  }
  .order-cards {
    display: flex;
  }
  .stats {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .stat .value {
    font-size: 26px;
  }
  .funnel-step {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
  }
  .funnel-step .bar-h {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .kv {
    grid-template-columns: 110px minmax(0, 1fr);
  }
  .drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 92vh;
    border-radius: 26px 26px 0 0;
    animation-name: slide-up;
  }
  @keyframes slide-up {
    from {
      transform: translateY(40px);
      opacity: 0;
    }
  }
  .toolbar .select {
    flex: 1 1 140px;
  }
  .settings-section {
    padding: 18px;
  }
  .nav-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .nav-row .input:nth-child(2) {
    grid-column: 1;
  }
  .table-scroll {
    overflow-x: auto;
  }
}

/* Mobile header matches the store's see-through bar */
.mobile-bar.glass {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.62);
  -webkit-backdrop-filter: blur(3px) saturate(120%);
  backdrop-filter: blur(3px) saturate(120%);
}
:root[data-theme="dark"] .mobile-bar.glass {
  background: rgba(30, 34, 42, 0.45);
  border-color: rgba(255, 255, 255, 0.08);
}
/* The logo is navy on transparent: lift it a little on dark backgrounds */
:root[data-theme="dark"] .brand img {
  filter: brightness(1.6) saturate(1.1);
}
