:root {
  --bg-a: #f8fafc;
  --bg-b: #e2e8f0;
  --bg-c: #dbeafe;
  --text: #0f172a;
  --muted: #475569;
  --line: rgba(148, 163, 184, 0.45);
  --chip-bg: rgba(255, 255, 255, 0.66);
  --chip-text: #0f172a;
  --glass-bg: rgba(255, 255, 255, 0.45);
  --glass-popover-bg: rgba(255, 255, 255, 0.36);
  --panel-bg: rgba(255, 255, 255, 0.58);
  --modal-bg: rgba(255, 255, 255, 0.82);
  --accent: #16a34a;
}

html.theme-dark {
  --bg-a: #0a1222;
  --bg-b: #111c30;
  --bg-c: #1a2742;
  --text: #e5edf8;
  --muted: #b7c5db;
  --line: rgba(148, 163, 184, 0.35);
  --chip-bg: rgba(15, 23, 42, 0.58);
  --chip-text: #e2e8f0;
  --glass-bg: rgba(15, 23, 42, 0.42);
  --glass-popover-bg: rgba(15, 23, 42, 0.34);
  --panel-bg: rgba(15, 23, 42, 0.52);
  --modal-bg: rgba(15, 23, 42, 0.86);
  --accent: #22c55e;
}

body.app-bg {
  color: var(--text);
  min-height: 100dvh;
  background: radial-gradient(circle at 0% 0%, var(--bg-c) 0%, var(--bg-a) 45%, var(--bg-b) 100%);
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-a);
  background-image: radial-gradient(circle at 0% 0%, var(--bg-c) 0%, var(--bg-a) 45%, var(--bg-b) 100%);
  overscroll-behavior-y: none;
}

body.app-bg {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.nav-chip {
  border: 1px solid var(--line);
  background: var(--chip-bg);
  color: var(--chip-text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.menu-item {
  display: block;
  padding: 0.6rem 0.8rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: var(--glass-bg);
}

.menu-item:last-child {
  border-bottom: 0;
}

.sticky-ops {
  position: sticky;
  top: 0.45rem;
  z-index: 20;
}

.ops-shell {
  position: relative;
  border: 1px solid var(--line);
  background: var(--glass-bg);
  border-radius: 0.9rem;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.filter-popover {
  position: relative;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.24);
}

html.theme-dark .filter-popover {
  background: #0f172a;
}

.filter-popover::before {
  content: none;
}

.card-panel {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--panel-bg);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.full-btn-green {
  width: 100%;
  border-radius: 0.75rem;
  padding: 0.95rem 1rem;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.swipe-wrap {
  position: relative;
  overflow: hidden;
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: -164px;
  bottom: 0;
  width: 164px;
  display: flex;
  transition: right 0.18s ease;
  z-index: 0;
  pointer-events: none;
}

.swipe-actions form {
  flex: 1;
  display: flex;
}

.swipe-action {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
}

.swipe-action-amber {
  background: #d97706;
}

.swipe-action-red {
  background: #dc2626;
}

.swipe-track {
  position: relative;
  z-index: 2;
  background: transparent;
  transform: translateX(0);
  transition: transform 0.18s ease;
  touch-action: pan-y;
  border-radius: 1rem;
}

.swipe-wrap.open .swipe-track {
  transform: translateX(-164px);
}

.swipe-wrap.open .swipe-actions {
  right: 0;
  pointer-events: auto;
}

.modal-panel {
  border-radius: 1rem;
  background: var(--modal-bg);
  border: 1px solid var(--line);
  width: min(100%, 420px);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.retailer-themed,
.retailer-themed * {
  color: inherit;
}

.retailer-themed .text-slate-500,
.retailer-themed .text-slate-600,
.retailer-themed .text-slate-700,
.retailer-themed .text-slate-900 {
  color: inherit !important;
  opacity: 0.92;
}

/* Dark/light utility harmonization */
.text-slate-500,
.text-slate-600,
.text-slate-700,
.text-slate-900 {
  color: var(--muted) !important;
}

.font-semibold,
.font-bold,
.text-xl,
.text-2xl,
.text-3xl {
  color: var(--text);
}

.bg-white,
.bg-slate-50,
.bg-slate-100 {
  background: var(--panel-bg) !important;
}

.border {
  border-color: var(--line) !important;
}

input,
select,
textarea {
  background: var(--chip-bg) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

::placeholder {
  color: color-mix(in srgb, var(--muted) 82%, white 18%);
}
