:root {
  --ink: #5b4338;
  --muted: #96786e;
  --line: rgba(202, 143, 118, .28);
  --line-strong: rgba(202, 143, 118, .46);
  --paper: #fff2ec;
  --panel: rgba(255, 247, 242, .82);
  --panel-solid: #fff8f4;
  --panel-soft: rgba(255, 247, 242, .7);
  --aurora: #83dceb;
  --aurora-dark: #45aec2;
  --action: #45aec2;
  --action-soft: rgba(131, 220, 235, .2);
  --sky: #8bdff0;
  --petal: #eda887;
  --sun: #b2765e;
  --mint: #8ee8aa;
  --shadow-sm: 0 12px 30px rgba(128, 93, 77, .12);
  --shadow-lg: 0 28px 80px rgba(128, 93, 77, .2);
  --radius: 10px;
}

* { box-sizing: border-box; }

html {
  background: #fff2ec;
  overscroll-behavior-y: auto;
}

html[data-theme="dark"] {
  background: #17353a;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(139, 223, 240, .34), transparent 36%),
    radial-gradient(circle at 78% 92%, rgba(142, 232, 170, .34), transparent 34%),
    linear-gradient(135deg, #fff7f2 0%, #fff0e8 58%, #e0f8f4 100%);
}

body[data-theme="dark"] {
  --ink: #f4fbf8;
  --muted: #b8d1ca;
  --line: rgba(137, 224, 238, .24);
  --line-strong: rgba(137, 224, 238, .42);
  --paper: #17353a;
  --panel: rgba(24, 68, 74, .78);
  --panel-solid: #1d535a;
  --panel-soft: rgba(40, 89, 91, .7);
  --aurora: #8bdff0;
  --aurora-dark: #3597a8;
  --action: #d6a073;
  --action-soft: rgba(214, 160, 115, .18);
  --sky: #6ecfe2;
  --petal: #f0aa89;
  --sun: #f0aa89;
  --mint: #8fe8b0;
  --shadow-sm: 0 12px 30px rgba(10, 42, 47, .24);
  --shadow-lg: 0 28px 80px rgba(10, 42, 47, .34);
  background:
    radial-gradient(circle at 18% 0%, rgba(139, 223, 240, .22), transparent 36%),
    radial-gradient(circle at 82% 92%, rgba(143, 232, 176, .18), transparent 34%),
    linear-gradient(135deg, #21484d 0%, #17353a 58%, #203f35 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, rgba(69, 174, 194, .08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(69, 174, 194, .055) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.95), transparent 75%);
}

button, input, select, textarea { font: inherit; }

button {
  border: 0;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--aurora), var(--aurora-dark));
  box-shadow: 0 1px 0 rgba(255,255,255,.45) inset, 0 12px 28px rgba(69, 174, 194, .24);
  font-weight: 750;
}

button:hover { filter: brightness(.97); }
button:disabled { opacity: .45; cursor: not-allowed; }
.hidden { display: none !important; }

html[data-session="cached"] #gate {
  display: none !important;
}

html[data-session="cached"] #shop.hidden {
  display: grid !important;
}

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

.gate-panel {
  width: min(520px, 100%);
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 247, 242, .86);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

body[data-theme="dark"] .gate-panel,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .toolbar,
body[data-theme="dark"] .status-strip,
body[data-theme="dark"] .item-card,
body[data-theme="dark"] .cart-drawer,
body[data-theme="dark"] .modal-card {
  background: var(--panel-solid);
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .sidebar-card,
body[data-theme="dark"] .cart-line,
body[data-theme="dark"] .slot-preview {
  background: var(--panel-soft);
}

.brand-mark, .brand-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(139, 223, 240, .38), rgba(255, 247, 242, .88));
}

body[data-theme="dark"] .brand-mark,
body[data-theme="dark"] .brand-icon,
body[data-theme="dark"] .item-thumb,
body[data-theme="dark"] .modal-media {
  background: linear-gradient(135deg, rgba(139, 223, 240, .24), rgba(143, 232, 176, .13));
}

.brand-mark {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
}

.brand-mark img, .brand-icon img { width: 42px; height: 42px; object-fit: contain; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.eyebrow {
  margin: 20px 0 6px;
  color: var(--aurora);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 850;
  letter-spacing: 0;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(30px, 4vw, 42px); line-height: 1.02; }
h2 { margin-bottom: 8px; font-size: 24px; line-height: 1.15; }

.gate-copy, .muted, .form-note, small { color: var(--muted); }

.access-form label, .toolbar label, .field {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 8px;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255, 250, 247, .9);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(69, 174, 194, .66);
  box-shadow: 0 0 0 3px rgba(131, 220, 235, .24);
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 21px;
  height: 21px;
  color: var(--muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-box input {
  padding-left: 46px;
  padding-right: 42px;
}

.clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-size: 25px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(-50%);
}

.clear-search:hover {
  color: var(--ink);
  filter: none;
}

.form-note { margin: 12px 0 0; font-size: 13px; }
.error-note {
  min-height: 18px;
  color: #9f4638;
  font-weight: 750;
}

.error-note:not(:empty) {
  padding: 10px 12px;
  border: 1px solid rgba(159, 70, 56, .28);
  border-radius: 8px;
  background: rgba(255, 224, 215, .55);
}

body[data-theme="dark"] .error-note:not(:empty) {
  color: #ffd3c9;
  border-color: rgba(255, 160, 135, .28);
  background: rgba(117, 55, 47, .34);
}

.shop {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 247, 242, .82);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  min-width: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 6px 14px;
  border-bottom: 1px solid var(--line);
}

.brand-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.sidebar-brand strong { display: block; font-size: 18px; line-height: 1.05; }
.sidebar-brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; font-weight: 800; }

.sidebar-section {
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  min-width: 0;
}

.sidebar-section p {
  margin: 0 0 8px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.category-rail {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.category-rail button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  min-height: 36px;
  padding: 0 10px;
  font-size: 14px;
}

.category-rail button:hover {
  background: var(--action-soft);
  filter: none;
}

.category-rail button.active {
  color: var(--action);
  background: var(--action-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--action) 32%, transparent);
}

.sidebar-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 247, .64);
}

.sidebar-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-card strong {
  display: block;
  font-size: 14px;
}

.shop-main {
  min-width: 0;
}

.toolbar, .status-strip, .editing-notice {
  width: min(1500px, 100%);
  margin: 0 auto 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.cart-button {
  min-width: 138px;
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #83dceb, #45aec2);
}

.theme-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  align-self: end;
  display: inline-grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 250, 247, .7);
  box-shadow: inset 0 0 0 1px var(--line);
}

body[data-theme="dark"] .theme-button {
  background: rgba(40, 89, 91, .68);
}

.user-menu {
  position: relative;
  align-self: end;
}

.toolbar-user {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 250, 247, .7);
  box-shadow: inset 0 0 0 1px transparent;
  font-size: 14px;
  font-weight: 850;
  white-space: nowrap;
}

body[data-theme="dark"] .toolbar-user {
  background: rgba(40, 89, 91, .68);
}

.toolbar-user svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.user-menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow-sm);
}

.user-menu-popover button {
  width: 100%;
  justify-content: flex-start;
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.user-menu-popover button:hover {
  background: var(--action-soft);
  filter: none;
}

.theme-button svg,
.cart-button svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

body[data-theme="dark"] .theme-icon-moon,
.theme-icon-sun {
  display: none;
}

body[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.cart-button span {
  display: inline-block;
  color: #fff8f4;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  gap: 14px;
  padding: 14px;
  position: sticky;
  top: 14px;
  z-index: 20;
}

.status-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: rgba(255, 247, 242, .66);
}

.editing-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 96px;
  z-index: 19;
  min-height: 56px;
  padding: 8px 14px;
  border-color: color-mix(in srgb, var(--sun) 36%, transparent);
  color: var(--ink);
  background: color-mix(in srgb, var(--sun) 14%, var(--panel-solid));
}

.editing-notice span {
  font-weight: 850;
}

.editing-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.editing-notice button {
  min-height: 38px;
  color: var(--ink);
  background: rgba(255, 250, 247, .7);
  box-shadow: inset 0 0 0 1px var(--line);
}

.editing-notice #saveEditing {
  color: #fff8f4;
  background: linear-gradient(135deg, #83dceb, #45aec2);
  box-shadow: 0 12px 28px rgba(69, 174, 194, .18);
}

.shop.is-editing .cart-button {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sun) 28%, transparent), 0 12px 28px rgba(69, 174, 194, .24);
}

.app-notice {
  width: min(1500px, 100%);
  margin: 0 auto 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, #c85f55 36%, transparent);
  border-radius: var(--radius);
  color: #8a3f37;
  background: color-mix(in srgb, #f6b8ad 22%, var(--panel-solid));
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

.status-strip span { font-weight: 850; }

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.pagination button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--action);
  background: var(--action-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--action) 24%, transparent);
}

.pagination-bottom {
  width: min(1500px, 100%);
  margin: 0 auto 32px;
  justify-content: center;
}

.meter {
  height: 8px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(91, 67, 56, .12);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--sky), var(--petal));
}

.catalog-grid {
  width: min(1500px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 12px;
  padding-bottom: 18px;
}

.item-card {
  min-height: 172px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 247, .8);
  box-shadow: 0 10px 28px rgba(128, 93, 77, .12);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.item-card:hover {
  transform: translateY(-2px);
  border-color: rgba(69, 174, 194, .42);
  box-shadow: 0 18px 44px rgba(128, 93, 77, .18);
}

.item-card header {
  display: flex;
  gap: 10px;
  align-items: center;
}

.item-thumb {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(139, 223, 240, .26), rgba(255, 247, 242, .72));
}

.item-thumb img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.item-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.item-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 6px;
}

.badge {
  border: 1px solid color-mix(in srgb, var(--action) 24%, transparent);
  border-radius: 999px;
  background: var(--action-soft);
  color: var(--action);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.item-action {
  width: 100%;
  color: var(--action);
  background: var(--action-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--action) 24%, transparent);
}

.cart-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(430px, 100vw);
  z-index: 40;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-left: 1px solid var(--line);
  background: rgba(255, 247, 242, .96);
  box-shadow: var(--shadow-lg);
  transform: translateX(105%);
  transition: transform .2s ease;
  backdrop-filter: blur(18px);
}

.cart-drawer.open { transform: translateX(0); }

.drawer-head, .drawer-footer {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.drawer-footer { border-top: 1px solid var(--line); border-bottom: 0; }
.drawer-head span { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }

.icon-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 50%;
  color: var(--ink);
  background: rgba(131, 220, 235, .22);
  box-shadow: none;
  font-size: 24px;
}

.secondary {
  color: var(--ink);
  background: rgba(131, 220, 235, .22);
  box-shadow: none;
}

.cart-items {
  overflow: auto;
  padding: 12px;
}

.cart-line {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: rgba(255, 250, 247, .72);
}

.cart-line strong { display: block; overflow-wrap: anywhere; }
.cart-line span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }

.line-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.line-actions input { max-width: 92px; }

.line-actions button {
  min-height: 36px;
  padding: 0 8px;
  color: var(--sun);
  background: transparent;
  box-shadow: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(91, 67, 56, .28);
}

.modal-card {
  width: min(780px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: grid;
  grid-template-columns: 250px 1fr;
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 247, 242, .96);
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.modal-media {
  min-height: 330px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(139, 223, 240, .24), rgba(142, 232, 170, .14));
  border-right: 1px solid var(--line);
}

.modal-media img {
  width: 168px;
  height: 168px;
  object-fit: contain;
}

.modal-body { padding: 28px; }
.field { margin: 18px 0 0; }

.variation-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.quantity-row {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 14px;
  align-items: end;
  margin-top: 12px;
}

.slot-preview {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 247, .7);
  display: flex;
  align-items: center;
}

.slot-preview span { display: block; color: var(--muted); font-size: 13px; }
#addToCart { width: 100%; margin-top: 18px; }
.order-card { grid-template-columns: 1fr; }
.history-card {
  grid-template-columns: 1fr;
  width: min(760px, 100%);
}

.privacy-card {
  grid-template-columns: 1fr;
  width: min(680px, 100%);
}

.privacy-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.privacy-list section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 247, .68);
}

.privacy-list h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.privacy-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-order {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 247, .72);
}

.history-order header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.history-order header strong,
.history-order header span {
  display: block;
}

.history-order header span,
.history-order p,
.history-order li {
  color: var(--muted);
  font-size: 13px;
}

.history-order ol {
  margin: 10px 0 0;
  padding-left: 22px;
}

.history-expiration {
  color: var(--sun) !important;
  font-weight: 750;
}

.status-pill {
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--status-color) 28%, transparent);
  border-radius: 999px;
  color: var(--status-color) !important;
  background: color-mix(in srgb, var(--status-color) 14%, transparent);
  font-weight: 850;
}

.status-pendente {
  --status-color: #b88722;
}

.status-cancelado {
  --status-color: #c85f55;
}

.status-retirado {
  --status-color: #3d9f72;
}

.status-expirado {
  --status-color: #98745b;
}

body[data-theme="dark"] .status-pendente {
  --status-color: #f2c86d;
}

body[data-theme="dark"] .status-cancelado {
  --status-color: #ff9b8f;
}

body[data-theme="dark"] .status-retirado {
  --status-color: #8fe8b0;
}

body[data-theme="dark"] .status-expirado {
  --status-color: #dfb893;
}

.history-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.danger-button {
  color: #fff8f4;
  background: linear-gradient(135deg, #db7d71, #b94d43);
  box-shadow: 0 12px 28px rgba(185, 77, 67, .18);
}

.danger-button:hover {
  filter: brightness(.98);
}

.scroll-top-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 35;
  width: 52px;
  height: 52px;
  min-height: 52px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 999px;
  color: #fffaf4;
  background: linear-gradient(135deg, var(--aurora), var(--aurora-dark));
  box-shadow: 0 16px 34px rgba(69, 174, 194, .28), inset 0 1px 0 rgba(255,255,255,.46);
  transition: opacity .18s ease, transform .18s ease, filter .18s ease;
}

.scroll-top-button.hidden {
  display: grid !important;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(.94);
}

.scroll-top-button svg {
  width: 26px;
  height: 26px;
}

.scroll-top-button:hover {
  transform: translateY(-2px);
}

body[data-theme="dark"] .danger-button,
body[data-theme="dark"] .history-actions .danger-button,
body[data-theme="dark"] .confirm-actions .danger-button {
  color: #fff8f4;
  background: linear-gradient(135deg, #ff9f8f, #c95b4f);
  box-shadow: 0 12px 30px rgba(201, 91, 79, .26);
}

body[data-theme="dark"] .history-order {
  background: var(--panel-soft);
}

body[data-theme="dark"] .privacy-list section {
  background: var(--panel-soft);
}

.confirm-card {
  width: min(460px, 100%);
  grid-template-columns: 1fr;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

textarea#orderText {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.45;
}

body[data-theme="dark"] .gate-panel,
body[data-theme="dark"] .sidebar,
body[data-theme="dark"] .toolbar,
body[data-theme="dark"] .status-strip,
body[data-theme="dark"] .item-card,
body[data-theme="dark"] .cart-drawer,
body[data-theme="dark"] .modal-card {
  background: var(--panel-solid);
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .sidebar-card,
body[data-theme="dark"] .cart-line,
body[data-theme="dark"] .slot-preview {
  background: var(--panel-soft);
}

body[data-theme="dark"] .brand-mark,
body[data-theme="dark"] .brand-icon,
body[data-theme="dark"] .item-thumb,
body[data-theme="dark"] .modal-media {
  background: linear-gradient(135deg, rgba(139, 223, 240, .24), rgba(143, 232, 176, .13));
}

body[data-theme="dark"] .theme-button,
body[data-theme="dark"] .toolbar-user,
body[data-theme="dark"] .icon-button,
body[data-theme="dark"] .secondary {
  background: rgba(40, 89, 91, .68);
}

body[data-theme="dark"] .confirm-actions .secondary {
  color: #f8efe7;
  background: linear-gradient(135deg, #3f8d82, #2e6f69);
  box-shadow: inset 0 0 0 1px rgba(178, 239, 219, .42), 0 10px 24px rgba(18, 47, 46, .24);
}

body[data-theme="dark"] #decisionCancel {
  color: #fffaf2;
  background: linear-gradient(135deg, #58a99a, #347d75);
  box-shadow: inset 0 0 0 1px rgba(214, 255, 238, .5), 0 12px 28px rgba(14, 45, 43, .32);
}

body[data-theme="dark"] .badge,
body[data-theme="dark"] .item-action,
body[data-theme="dark"] .category-rail button:hover,
body[data-theme="dark"] .category-rail button.active {
  background: var(--action-soft);
}

body[data-theme="dark"] .editing-notice {
  background: color-mix(in srgb, var(--sun) 18%, var(--panel-solid));
}

body[data-theme="dark"] .editing-notice button {
  background: var(--panel-soft);
}

body[data-theme="dark"] .editing-notice #saveEditing {
  background: linear-gradient(135deg, #6ec9d6, #4f9aa5);
}

body[data-theme="dark"] .app-notice {
  color: #ffd7cc;
  background: color-mix(in srgb, #9b5148 22%, var(--panel-solid));
}

body[data-theme="dark"] .scroll-top-button {
  color: #fffaf2;
  background: linear-gradient(135deg, #d6a073, #9d6c55);
  border-color: rgba(255, 236, 216, .34);
  box-shadow: 0 18px 38px rgba(18, 47, 46, .34), inset 0 1px 0 rgba(255,255,255,.28);
}

@media (max-width: 980px) {
  .shop {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    grid-template-rows: auto auto auto;
  }

  .category-rail {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }

  .toolbar {
    top: 0;
  }
  .editing-notice {
    top: 86px;
  }
}

@media (max-width: 720px) {
  .gate-panel { padding: 24px; }
  .shop { padding: 10px; gap: 10px; }
  .sidebar {
    gap: 10px;
    padding: 10px;
  }
  .sidebar-brand {
    padding: 4px 4px 10px;
  }
  .sidebar-section {
    overflow: visible;
  }
  .sidebar-section p {
    padding: 0 4px;
  }
  .category-rail {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    width: 100%;
    max-width: 100%;
  }
  .category-rail button {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .sidebar-card {
    padding: 10px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  .toolbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
  .editing-notice {
    top: 126px;
    flex-direction: column;
    align-items: stretch;
  }
  .editing-actions {
    justify-content: stretch;
  }
  .editing-actions button {
    flex: 1;
  }
  .search-box { grid-column: 1 / -1; }
  .toolbar-user {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .cart-button {
    width: auto;
    min-width: 0;
    padding: 0 12px;
  }
  .scroll-top-button {
    right: 14px;
    bottom: 14px;
    width: 48px;
    height: 48px;
    min-height: 48px;
  }
  .cart-label { display: none !important; }
  .status-strip { align-items: stretch; flex-direction: column; }
  .pagination { justify-content: space-between; }
  .catalog-grid { grid-template-columns: 1fr; }
  .modal-card { grid-template-columns: 1fr; }
  .modal-media {
    min-height: 190px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .quantity-row, .code-row { grid-template-columns: 1fr; }
}
