:root {
  --bg: #fff9ec;
  --ink: #251b35;
  --muted: #6f6679;
  --surface: #fffefb;
  --surface-soft: #fff1b9;
  --line: rgba(37, 27, 53, 0.13);
  --pink: #f85f96;
  --yellow: #ffc64a;
  --cyan: #38bddf;
  --green: #249b71;
  --red: #e84d60;
  --blue: #5267df;
  --shadow: 0 4px 0 rgba(37, 27, 53, 0.08), 0 14px 30px rgba(37, 27, 53, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 249, 236, 0.98), rgba(255, 224, 235, 0.72) 48%, rgba(216, 246, 250, 0.78)),
    var(--bg);
  color: var(--ink);
  font-family:
    "Microsoft JhengHei",
    "PingFang TC",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.26) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.24) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px 14px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 24px;
  border: 3px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: rgba(255, 254, 251, 0.96);
  box-shadow: var(--shadow);
}

.brand-logo {
  display: block;
  flex: 0 0 auto;
  aspect-ratio: 1;
  border: 3px solid #d4a72c;
  border-radius: 16px;
  background: #111;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 6px 0 rgba(36, 26, 52, 0.14);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.product-reward-description-field {
  grid-column: span 2;
}

.product-reward-switch {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 12px;
  padding: 8px 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  cursor: pointer;
}

.product-reward-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.product-reward-switch-track {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 26px;
  border-radius: 13px;
  background: #d8d4de;
  transition: background 160ms ease;
}

.product-reward-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(36, 26, 52, 0.22);
  transition: transform 160ms ease;
}

.product-reward-switch input:checked + .product-reward-switch-track {
  background: var(--green);
}

.product-reward-switch input:checked + .product-reward-switch-track::after {
  transform: translateX(20px);
}

.product-reward-switch input:focus-visible + .product-reward-switch-track {
  outline: 3px solid rgba(72, 199, 232, 0.45);
  outline-offset: 2px;
}

.product-reward-switch-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.product-reward-switch-copy strong {
  font-size: 14px;
}

.product-reward-switch-copy small,
.product-reward-image-field > small {
  color: var(--muted);
  font-size: 12px;
}

.product-reward-image-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: stretch;
}

.product-reward-image-controls button {
  min-height: 48px;
  white-space: nowrap;
}

.product-image-remove {
  color: var(--red);
}

.product-reward-image-preview {
  display: grid;
  width: 100%;
  min-height: 112px;
  margin-top: 8px;
  place-items: center;
  overflow: hidden;
  border: 2px dashed rgba(36, 26, 52, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.product-reward-image-preview img {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #fff;
}

body.rewards-mode {
  background: #fff9ef;
}

body.rewards-mode::before {
  background:
    linear-gradient(90deg, rgba(36, 26, 52, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(36, 26, 52, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
}

.rewards-page {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 56px;
}

.rewards-header {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  padding: 20px 22px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff1bd;
  box-shadow: 0 7px 0 rgba(36, 26, 52, 0.07);
}

.rewards-brand {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.rewards-brand img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 3px solid #c79d34;
  border-radius: 8px;
  object-fit: cover;
  background: #111;
}

.rewards-heading {
  max-width: 860px;
}

.rewards-heading .eyebrow {
  color: var(--green);
  font-weight: 900;
}

#rewardsVersion {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.72rem;
}

.rewards-heading h1 {
  margin: 4px 0 10px;
  font-size: 2.7rem;
  line-height: 1.08;
}

.rewards-heading p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.75;
}

.rewards-toolbar {
  position: sticky;
  z-index: 4;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0 12px;
  background: rgba(255, 249, 239, 0.96);
}

.rewards-search {
  flex: 1 1 460px;
  max-width: 620px;
}

.rewards-search input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 2px solid rgba(36, 26, 52, 0.16);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.rewards-search input:focus {
  border-color: var(--green);
  outline: 3px solid rgba(33, 167, 119, 0.16);
}

.rewards-filters {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.rewards-filters button {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(36, 26, 52, 0.15);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.rewards-filters button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.rewards-status {
  min-height: 24px;
  margin: 4px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

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

.reward-product-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-width: 0;
  overflow: hidden;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(36, 26, 52, 0.07);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.reward-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 9px 0 rgba(36, 26, 52, 0.08);
}

.reward-product-image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f3efe6;
}

.reward-product-image img,
.reward-detail-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reward-product-content {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 16px;
}

.reward-category {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 5px;
  background: #fff0bb;
  color: #71500b;
  font-size: 0.76rem;
  font-weight: 900;
}

.reward-category-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.reward-category-points {
  background: #dff5ee;
  color: #116f51;
}

.reward-category-card {
  background: #e7efff;
  color: #3659b5;
}

.reward-category-gift_99 {
  background: #fff0bb;
  color: #71500b;
}

.reward-category-lucky_gift {
  background: #e5f4d5;
  color: #38651f;
}

.reward-category-premium_gift {
  background: #ffe2eb;
  color: #a42957;
}

.reward-category-purchase {
  background: #dff5ee;
  color: #116f51;
}

.reward-product-content h2,
.reward-detail-body h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
}

.reward-product-content p,
.reward-detail-body > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.reward-product-content p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.reward-prices {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.reward-prices strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.reward-prices span {
  color: var(--green);
  font-size: 0.9rem;
  font-weight: 900;
}

.reward-product-actions {
  padding: 0 16px 16px;
}

.reward-commerce-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.reward-commerce-actions.has-purchase {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reward-detail-button,
.reward-redeem-button,
.reward-purchase-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.reward-detail-button {
  border: 2px solid rgba(36, 26, 52, 0.14);
  background: #fff;
  color: var(--ink);
}

.reward-card-detail-button {
  min-height: 32px;
  width: fit-content;
  margin: 8px 16px 0;
  padding: 4px 9px;
  font-size: 0.76rem;
}

.reward-redeem-button {
  border: 2px solid #17885f;
  background: var(--green);
  color: #fff;
}

.reward-purchase-button {
  border: 2px solid #d69217;
  background: #ffc548;
  color: #2f2106;
}

.reward-redeem-button:disabled,
.reward-purchase-button:disabled {
  cursor: not-allowed;
  border-color: #c8c4cc;
  background: #d8d5dc;
  color: #69636f;
}

.reward-detail-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 22px 70px rgba(36, 26, 52, 0.3);
}

.reward-detail-dialog::backdrop {
  background: rgba(20, 14, 28, 0.62);
}

.reward-dialog-close {
  position: sticky;
  z-index: 2;
  top: 10px;
  float: right;
  width: 40px;
  min-height: 40px;
  margin: 10px 10px -50px 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  box-shadow: 0 3px 12px rgba(36, 26, 52, 0.18);
}

#rewardDetailContent {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.1fr);
}

.reward-detail-image {
  min-height: 420px;
  background: #f3efe6;
}

.reward-detail-body {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 34px 28px;
}

.reward-detail-commerce {
  margin-top: 4px;
}

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

@media (max-width: 620px) {
  .product-reward-description-field {
    grid-column: span 1;
  }

  .rewards-page {
    width: min(100% - 20px, 560px);
    padding: 10px 0 34px;
  }

  .rewards-header {
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 12px;
  }

  .rewards-brand {
    font-size: 0.82rem;
  }

  .rewards-heading h1 {
    margin-top: 2px;
    font-size: 1.72rem;
  }

  .rewards-heading p:last-child {
    font-size: 0.84rem;
    line-height: 1.55;
  }

  .rewards-toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px 0 8px;
  }

  .rewards-search {
    flex-basis: auto;
    max-width: none;
  }

  .rewards-filters {
    width: 100%;
    overflow-x: auto;
    padding: 0 0 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .rewards-filters::-webkit-scrollbar {
    display: none;
  }

  .rewards-filters button {
    min-height: 40px;
    padding: 0 14px;
    scroll-snap-align: start;
  }

  .rewards-grid {
    grid-template-columns: 1fr;
  }

  .reward-product-card {
    grid-template-columns: 116px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
  }

  .reward-product-image {
    grid-row: 1;
    aspect-ratio: 1;
    margin: 12px 0 0 12px;
    border-radius: 6px;
  }

  .reward-card-detail-button {
    grid-column: 1;
    grid-row: 2;
    align-self: start;
    margin: 7px 0 0 12px;
  }

  .reward-product-content {
    grid-column: 2;
    grid-row: 1 / span 2;
    gap: 6px;
    padding: 12px 12px 8px;
  }

  .reward-product-content h2 {
    font-size: 1.04rem;
  }

  .reward-product-content p {
    -webkit-line-clamp: 2;
    font-size: 0.86rem;
  }

  .reward-product-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    padding: 10px 12px 12px;
  }

  .reward-detail-button,
  .reward-redeem-button,
  .reward-purchase-button {
    min-height: 42px;
  }

  .reward-card-detail-button {
    min-height: 32px;
  }

  #rewardDetailContent {
    grid-template-columns: 1fr;
  }

  .reward-detail-image {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .reward-detail-body {
    padding: 22px 18px 24px;
  }
}

.login-brand,
.topbar-brand {
  display: flex;
  align-items: center;
}

.login-brand {
  gap: 16px;
  margin-bottom: 20px;
}

.login-brand > div,
.topbar-brand > div {
  min-width: 0;
}

.login-brand .eyebrow {
  margin-bottom: 8px;
}

.login-panel h1 {
  margin-bottom: 0;
}

.login-brand h1 {
  font-size: 1.85rem;
}

.login-logo {
  width: 108px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form .primary-button {
  width: 100%;
  min-height: 50px;
}

.login-message {
  min-height: 24px;
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 900;
}

.current-user-badge {
  padding: 9px 13px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.app-shell {
  width: calc(100% - 16px);
  max-width: none;
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar,
.panel-heading,
.topbar-actions,
.table-tools,
.panel-actions,
.form-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 254, 251, 0.88);
  box-shadow: 0 4px 0 rgba(37, 27, 53, 0.06);
}

.topbar-brand {
  gap: 14px;
}

.topbar-brand h1 {
  font-size: 2.5rem;
}

.topbar-logo {
  width: 74px;
  border-radius: 12px;
}

.eyebrow {
  width: fit-content;
  margin: 0 0 8px;
  padding: 7px 12px;
  border: 2px solid rgba(36, 26, 52, 0.12);
  border-radius: 999px;
  background: #fff;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 5px 0 rgba(36, 26, 52, 0.08);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 3.4rem;
  line-height: 1;
  text-shadow: 0 5px 0 rgba(255, 200, 71, 0.5);
}

h2 {
  font-size: 1.3rem;
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 4px 0 rgba(37, 27, 53, 0.06);
}

.tab-button,
.primary-button,
.secondary-button,
.ghost-button,
.database-nav-button,
.icon-button {
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 999px;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.tab-button {
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.tab-button.active {
  background: var(--ink);
  color: #fffef8;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.18);
}

.subtabs,
.history-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: var(--surface-soft);
}

.history-filters {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.history-currency-filters {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 5px;
  margin: 0;
  padding: 4px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 10px;
  background: #fff;
}

.history-heading-left {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.history-direction-filter {
  min-height: 34px;
  padding: 5px 11px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.history-direction-filter.active {
  border-color: var(--pink);
  background: #fff1f6;
  color: var(--ink);
}

.subtab-button,
.history-filter {
  min-height: 44px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.subtab-button.active,
.history-filter.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 0 rgba(36, 26, 52, 0.08);
}

.operation-view {
  display: none;
}

.operation-view.active {
  display: block;
}

.operation-heading {
  min-height: 52px;
}

.operation-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.order-workspace {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.order-queue {
  min-width: 0;
  padding-right: 18px;
  border-right: 2px solid rgba(36, 26, 52, 0.1);
}

.order-editor {
  min-width: 0;
}

.order-section-heading {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.order-section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.order-section-heading span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 900;
}

.order-section-heading .order-selection-feedback {
  min-height: 20px;
  color: var(--green);
  text-align: right;
}

.order-editor-heading {
  align-items: end;
}

.order-editor-title {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.order-editor-heading .order-selection-feedback {
  text-align: left;
}

.order-gift-serial-field {
  width: min(280px, 58%);
  min-width: 180px;
}

.order-gift-serial-field input {
  height: 42px;
  min-height: 42px;
}

.order-card-list {
  display: grid;
  gap: 10px;
  max-height: 720px;
  overflow: auto;
  padding-right: 4px;
}

.order-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(36, 26, 52, 0.06);
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}

.order-card:hover,
.order-card:focus-visible {
  border-color: rgba(82, 103, 233, 0.48);
  outline: none;
  transform: translateY(-1px);
}

.order-card.cancelled {
  opacity: 0.65;
}

.order-card-header,
.order-card-footer,
.order-card-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.order-card-header,
.order-card-footer {
  justify-content: space-between;
}

.order-card-summary {
  justify-content: space-between;
  flex-wrap: wrap;
}

.order-card-summary strong {
  font-size: 1.35rem;
}

.order-card-customer,
.order-card-missing {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.order-card-missing {
  color: var(--red);
}

.order-card-status-select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 2px solid rgba(36, 26, 52, 0.12);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.order-mode-toggles {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.order-mode-toggles label {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
  cursor: pointer;
}

.order-mode-toggles label:has(input:checked) {
  border-color: rgba(82, 103, 233, 0.5);
  background: #eef1ff;
}

.order-mode-toggles input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--blue);
  box-shadow: none;
}

.order-card-status-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.order-card-quick-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 2px solid rgba(82, 103, 233, 0.16);
  border-radius: 8px;
  background: #f7f8ff;
  cursor: default;
}

.order-card-quick-editor label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.order-card-quick-editor input,
.order-card-quick-editor select {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 2px solid rgba(36, 26, 52, 0.12);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.order-card-quick-editor .secondary-button {
  grid-column: 1 / -1;
  justify-self: end;
}

.order-status-button {
  min-width: 76px;
  min-height: 42px;
  padding: 7px 14px;
  border: 2px solid rgba(36, 26, 52, 0.12);
  border-radius: 8px;
  background: #fff3c3;
  color: var(--ink);
  font-weight: 900;
}

.order-status-button:disabled {
  cursor: default;
  opacity: 0.65;
}

.order-entry-form {
  align-items: start;
}

.order-entry-form .order-calculation-band,
.order-form-actions,
.order-transfer-fee-row {
  grid-column: 1 / -1;
}

.order-entry-form > .field,
.order-entry-form > .special-rate-wrap,
.order-transfer-fee-row > .field {
  min-width: 0;
  align-self: start;
}

.order-entry-form > .field input,
.order-entry-form > .field select,
.order-transfer-fee-row input,
.order-transfer-fee-row select {
  height: 48px;
  min-height: 48px;
}

.order-transfer-fee-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 0.55fr);
  gap: 12px;
  align-items: start;
}

.bank-fee-source-hint[data-source="manual"] {
  color: var(--blue);
}

#bankFeeInput[data-source="manual"] {
  border-color: rgba(82, 103, 233, 0.55);
  background: #f7f8ff;
}

#bankFeeInput:invalid {
  border-color: var(--red);
}

.order-form-actions {
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.trade-amount-field input {
  border-color: rgba(36, 26, 52, 0.16);
}

.trade-amount-field .amount-stepper {
  position: relative;
  display: block;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.trade-amount-field .amount-stepper input {
  width: 100%;
  padding-right: 44px;
  appearance: textfield;
}

.trade-amount-field .amount-stepper input::-webkit-inner-spin-button,
.trade-amount-field .amount-stepper input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.trade-amount-field .amount-stepper-buttons {
  position: absolute;
  top: 5px;
  right: 6px;
  bottom: 5px;
  display: grid;
  width: 28px;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 2px;
}

.trade-amount-field .amount-stepper-buttons button {
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: rgba(36, 26, 52, 0.08);
  color: var(--ink);
  font-size: 0.58rem;
  line-height: 1;
  box-shadow: none;
}

.trade-amount-field .amount-stepper-buttons button:hover {
  background: rgba(82, 103, 233, 0.16);
}

.buy-amount-field input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 95, 148, 0.16), inset 0 -3px 0 rgba(36, 26, 52, 0.04);
}

.sell-amount-field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(33, 167, 119, 0.16), inset 0 -3px 0 rgba(36, 26, 52, 0.04);
}

.order-calculation-band strong {
  font-size: 1.25rem;
}

.cashback-copy-button {
  min-height: 30px;
  margin-top: 8px;
  padding: 4px 11px;
  font-size: 0.78rem;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.08);
}

.history-table {
  min-width: 1700px;
}

.history-last-five {
  min-width: 92px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.history-column-filters th {
  padding: 8px;
  background: #fffaf0;
}

.history-column-filters input,
.history-column-filters select {
  width: 100%;
  min-width: 112px;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid rgba(36, 26, 52, 0.16);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.history-column-filters select {
  padding-right: 38px !important;
}

.history-column-filters input:focus,
.history-column-filters select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(72, 199, 232, 0.16);
}

.history-date-range {
  display: grid;
  grid-template-columns: minmax(132px, 1fr) auto minmax(132px, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 300px;
}

.history-date-range span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.history-detail {
  max-width: 420px;
  white-space: normal;
  line-height: 1.45;
}

.history-status {
  color: var(--green);
  font-weight: 900;
}

.handover-dialog {
  width: min(1180px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 3px solid rgba(36, 26, 52, 0.14);
  border-radius: 8px;
  background: #fffef8;
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(36, 26, 52, 0.28);
}

.handover-dialog::backdrop {
  background: rgba(36, 26, 52, 0.56);
}

.handover-shell {
  max-height: calc(100dvh - 34px);
  overflow: auto;
  padding: 22px;
}

.handover-header,
.handover-section-heading,
.handover-history-header,
.handover-history-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.handover-header {
  position: sticky;
  z-index: 4;
  top: -22px;
  margin: -22px -22px 16px;
  padding: 18px 22px;
  border-bottom: 2px solid rgba(36, 26, 52, 0.1);
  background: rgba(255, 254, 248, 0.98);
}

.handover-header h2,
.handover-section-heading h3 {
  margin: 0;
}

.handover-current {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-left: 5px solid var(--blue);
  background: #f3f5ff;
  line-height: 1.55;
  font-weight: 800;
}

.handover-current.awaiting {
  border-left-color: var(--yellow);
  background: #fff6d9;
}

.handover-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.handover-account-section {
  min-width: 0;
}

.handover-section-heading {
  min-height: 38px;
  margin-bottom: 10px;
}

.handover-section-heading span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.handover-account-list,
.handover-history-list {
  display: grid;
  gap: 8px;
}

.handover-account-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(160px, 1fr) minmax(145px, 0.85fr);
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 10px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
}

.handover-account-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 900;
}

.handover-balance-input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 10px 12px;
  border: 2px solid rgba(36, 26, 52, 0.14);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: var(--ink);
}

.handover-balance-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(72, 199, 232, 0.18);
}

.handover-account-result {
  min-height: 24px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: right;
}

.handover-account-result.matched {
  color: var(--green);
}

.handover-account-result.shortage,
.handover-account-result.overage {
  color: var(--red);
}

.handover-form-message,
.handover-actions {
  grid-column: 1 / -1;
}

.handover-form-message {
  min-height: 24px;
  margin: 0;
  color: var(--red);
  font-weight: 900;
}

.handover-actions {
  justify-content: flex-end;
}

.handover-history,
.handover-detail {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 2px solid rgba(36, 26, 52, 0.1);
}

.handover-history-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(240px, 1.4fr) minmax(210px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
}

.handover-history-row p,
.handover-history-row strong {
  margin: 0;
}

.handover-history-row p {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.55;
}

.handover-status-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f0f2ff;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
}

.handover-status-pill.failed {
  background: #fff0f2;
  color: var(--red);
}

.handover-status-pill.synced {
  background: #eaf8f2;
  color: var(--green);
}

.handover-detail-content,
.handover-detail-group {
  display: grid;
  gap: 10px;
}

.handover-detail-group + .handover-detail-group {
  margin-top: 18px;
}

.handover-detail-table {
  min-width: 980px;
}

.handover-detail-table td,
.handover-detail-table th {
  padding: 10px 12px;
  font-size: 0.8rem;
}

.tab-panel {
  display: none;
  min-height: 620px;
  padding: 18px;
  border: 3px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: rgba(255, 254, 251, 0.94);
  box-shadow: var(--shadow);
}

.tab-panel.active {
  display: block;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.table-tools {
  gap: 8px;
}

.table-tools input,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 2px solid rgba(36, 26, 52, 0.12);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 14px;
  outline: none;
  box-shadow: inset 0 -2px 0 rgba(36, 26, 52, 0.035);
}

.handover-account-row.used-today {
  border-color: rgba(82, 103, 223, 0.48);
  background: #f1f4ff;
  box-shadow: inset 5px 0 0 var(--blue), 0 3px 0 rgba(37, 27, 53, 0.05);
}

.handover-account-row.unused-today {
  border-color: rgba(36, 26, 52, 0.08);
  background: #faf9f6;
}

.handover-account-row.unused-today .handover-account-name small {
  background: #ece9e2;
  color: var(--muted);
}

.handover-current-balance {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 2px solid rgba(36, 26, 52, 0.08);
  border-radius: 8px;
  background: #f3f1eb;
  color: var(--ink);
  font-weight: 900;
}

.handover-account-name {
  display: grid;
  gap: 4px;
}

.handover-account-name small {
  width: fit-content;
  padding: 3px 6px;
  border-radius: 5px;
  background: #dfe5ff;
  color: #3349ad;
  font-size: 0.68rem;
}

.handover-no-account {
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 2px dashed rgba(37, 27, 53, 0.13);
  border-radius: 8px;
  background: #faf9f6;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.field input[readonly],
.field textarea[readonly] {
  background: #f7f4ec;
  color: var(--muted);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background-color: #ebe7de;
  color: rgba(36, 26, 52, 0.48);
  cursor: not-allowed;
}

select:not([multiple]) {
  appearance: none;
  padding-right: 48px !important;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #241a34 50%),
    linear-gradient(135deg, #241a34 50%, transparent 50%),
    linear-gradient(to bottom, rgba(36, 26, 52, 0.1), rgba(36, 26, 52, 0.1));
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 14px) calc(50% - 2px),
    calc(100% - 42px) 50%;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 1px 24px;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

select:not([multiple]):hover:not(:disabled) {
  border-color: rgba(82, 103, 233, 0.42);
  background-color: #fffdf5;
}

select:not([multiple]):focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(72, 199, 232, 0.18), inset 0 -3px 0 rgba(36, 26, 52, 0.04);
}

select:not([multiple]):disabled {
  background-color: #ebe7de;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(36, 26, 52, 0.4) 50%),
    linear-gradient(135deg, rgba(36, 26, 52, 0.4) 50%, transparent 50%),
    linear-gradient(to bottom, rgba(36, 26, 52, 0.08), rgba(36, 26, 52, 0.08));
}

select option {
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.table-tools input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(72, 199, 232, 0.18), inset 0 -3px 0 rgba(36, 26, 52, 0.04);
}

.rate-calculator {
  display: grid;
  gap: 18px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 20px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: 0 8px 0 rgba(36, 26, 52, 0.06);
}

.rate-calculator-heading h3 {
  margin: 5px 0 0;
  font-size: 1.35rem;
}

.tool-kicker {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
}

.rate-calculator-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(160px, 0.7fr);
  gap: 12px;
}

.rate-calculator-results {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  overflow: hidden;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
}

.rate-calculator-results article {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 112px;
  padding: 18px;
  border-right: 1px solid rgba(36, 26, 52, 0.1);
}

.rate-calculator-results article:last-child {
  border-right: 0;
}

.rate-calculator-results span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.rate-calculator-results strong {
  overflow-wrap: anywhere;
  font-size: 1.5rem;
}

.rate-calculator-results .rate-result-primary strong {
  color: var(--green);
  font-size: 2rem;
}

.rate-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: end;
}

.rate-copy-field textarea {
  min-height: 76px;
  resize: none;
  line-height: 1.5;
}

.rate-copy-row > button {
  min-height: 48px;
  margin-bottom: 1px;
}

.table-wrap {
  position: relative;
  overflow: auto;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 24px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1e6bd;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  background: #fff3c3;
}

td {
  font-size: 0.95rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.empty-state {
  display: none;
  padding: 42px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state.visible {
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 58px;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(36, 26, 52, 0.08);
}

.badge.buy {
  background: #ffe1e7;
  color: var(--red);
}

.badge.sell {
  background: #dcfff0;
  color: var(--green);
}

.badge.income {
  background: #dcfff0;
  color: var(--green);
}

.badge.expense {
  background: #ffe1e7;
  color: var(--red);
}

.coin-negative {
  color: var(--red);
  font-weight: 900;
}

.coin-positive {
  color: var(--green);
  font-weight: 900;
}

.entry-form,
.customer-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.match-top-row,
.match-row {
  display: grid;
  gap: 10px;
  align-items: start;
}

.match-top-row {
  grid-column: 1 / -1;
  grid-template-columns: minmax(180px, 0.7fr) minmax(220px, 0.9fr) minmax(190px, 0.72fr) minmax(320px, 1.25fr);
}

.match-row {
  grid-column: 1 / -1;
  grid-template-columns: minmax(240px, 0.75fr) minmax(260px, 0.85fr) minmax(360px, 1.35fr);
}

.match-top-row > .field,
.match-row > .field {
  min-width: 0;
  grid-template-rows: 18px 48px 20px;
  gap: 5px;
  align-content: start;
  align-self: start;
}

.match-top-row > .field > span:first-child,
.match-row > .field > span:first-child {
  min-height: 18px;
  line-height: 1.2;
}

.match-top-row > .field input,
.match-top-row > .field select,
.match-row > .field input,
.match-row > .field select {
  height: 48px;
  min-height: 48px;
}

.storage-account-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.restock-form {
  grid-template-columns: minmax(220px, 0.9fr) minmax(280px, 1.1fr) minmax(110px, 0.45fr) minmax(150px, 0.65fr);
  align-items: end;
}

.product-card-attributes {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff8d9;
}

.card-redemption-form {
  grid-template-columns: minmax(210px, 1fr) minmax(260px, 1.15fr) minmax(96px, 0.45fr) minmax(145px, 0.62fr);
  align-items: end;
}

.card-held-funds-field {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 6px;
  background: #fff4bf;
  font-weight: 900;
}

.card-held-funds-field input {
  width: 19px;
  min-height: 19px;
  accent-color: var(--green);
}

#cardCounterpartyHint.valid {
  color: var(--green);
}

#cardCounterpartyHint.invalid {
  color: var(--red);
}

.bank-ledger-form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
}

.bank-ledger-date-field {
  grid-column: span 2;
}

.bank-ledger-category-field {
  grid-column: span 3;
}

.bank-ledger-counterparty-field {
  grid-column: span 4;
}

.bank-ledger-amount-field {
  grid-column: span 3;
}

.bank-ledger-bank-field {
  grid-column: span 4;
}

.bank-ledger-method-field {
  grid-column: span 3;
}

.bank-ledger-note-field {
  grid-column: span 5;
}

#bankLedgerCounterpartyHint {
  min-height: 18px;
  color: var(--muted);
  font-weight: 900;
}

#bankLedgerCounterpartyHint.matched {
  color: var(--green);
}

.bank-ledger-form .bank-ledger-preview {
  grid-column: span 9;
}

.bank-ledger-form .bank-ledger-actions {
  grid-column: span 3;
  align-self: stretch;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.bank-ledger-list-heading {
  margin-top: 26px;
}

.bank-ledger-table-wrap {
  margin-top: 0;
}

.bank-ledger-table {
  min-width: 1120px;
}

.bank-ledger-note {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-ledger-row-actions,
.history-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.bank-ledger-row-actions .ghost-button,
.history-row-actions .ghost-button {
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 12px;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.08);
}

.gift-credential-panel {
  display: grid;
  grid-column: 1 / -1;
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(36, 26, 52, 0.06);
}

.gift-credential-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
}

.gift-credential-list {
  display: grid;
  gap: 10px;
}

.gift-import-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) max-content minmax(110px, max-content);
  gap: 10px;
  align-items: end;
}

.gift-import-status {
  align-self: center;
  color: var(--muted);
  font-weight: 900;
}

.gift-credential-row {
  display: grid;
  grid-template-columns: 72px minmax(180px, 1fr) minmax(180px, 1fr);
  gap: 10px;
  align-items: end;
}

.gift-credential-row strong {
  align-self: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.gift-stock-preview {
  grid-column: span 2;
}

.gift-stock-preview textarea {
  min-height: 74px;
  resize: vertical;
  line-height: 1.45;
}

.payment-method-field {
  display: grid;
  grid-column: span 2;
  gap: 8px;
  min-height: 76px;
  padding: 10px 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 18px;
  background: #fff;
}

.payment-method-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.payment-method-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 14px;
  color: var(--ink);
  font-weight: 900;
}

.payment-method-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--blue);
  box-shadow: none;
}

.product-form {
  grid-template-columns: minmax(110px, 0.38fr) minmax(140px, 0.5fr) minmax(220px, 1fr) repeat(3, minmax(125px, 0.48fr));
  align-items: end;
}

.product-catalog-list {
  margin-bottom: 18px;
}

.product-editor-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fffef9;
}

.product-editor-search {
  width: min(720px, 100%);
}

.restock-product-picker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(300px, 1.4fr) minmax(180px, 0.6fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff8d9;
}

.restock-card-filters:not([hidden]) {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.product-payment-field {
  grid-column: span 2;
}

.product-card {
  grid-template-columns: minmax(0, 1.15fr) minmax(150px, 0.55fr) minmax(180px, 0.7fr) auto;
}

.product-detail {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.vip-checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 11px 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.vip-checkbox-field input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--blue);
}

.restock-form .form-actions,
.card-redemption-form .form-actions {
  grid-column: auto;
  align-self: end;
  white-space: nowrap;
}

.card-note-field,
.card-copy-field {
  grid-column: span 2;
}

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

.central-checkbox-field {
  border-color: rgba(36, 155, 113, 0.24);
  background: #eef9f3;
}

.central-checkbox-field input {
  accent-color: var(--green);
}

.card-copy-field textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.5;
}

.card-redemption-copy-button {
  justify-self: start;
}

.restock-row-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.card-section-title {
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.card-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.card-section-heading .card-section-title {
  margin: 0;
}

.card-section-title span {
  margin-left: 6px;
  color: var(--ink);
}

.card-section-toggle {
  min-height: 36px;
  padding: 7px 12px;
}

#inventoryHistoryButton.active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.card-inventory-history {
  padding: 10px;
  border: 2px dashed rgba(36, 26, 52, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.46);
}

.card-inventory-grid,
.card-history-list {
  display: grid;
  gap: 10px;
}

.card-inventory-row {
  display: grid;
  grid-template-columns: minmax(76px, 0.45fr) minmax(220px, 1.2fr) minmax(180px, 0.9fr) repeat(5, minmax(92px, 0.55fr));
  gap: 10px;
  align-items: center;
  min-height: 62px;
  padding: 12px 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(36, 26, 52, 0.06);
}

.card-history-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.45fr) minmax(220px, 1fr) minmax(180px, 0.8fr) minmax(160px, 0.75fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 12px 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(36, 26, 52, 0.06);
}

.card-inventory-row strong,
.card-inventory-row span,
.card-history-row strong,
.card-history-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.card-inventory-row span,
.card-history-row span {
  color: var(--muted);
}

.card-stock-empty {
  color: var(--red) !important;
}

.storage-account-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, 170px) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 6px 0 rgba(36, 26, 52, 0.06);
}

.storage-account-form > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.storage-account-form strong {
  font-size: 0.98rem;
}

.storage-account-form > div span {
  color: var(--muted);
  font-weight: 900;
}

.account-mini-stats {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.4;
}

.bank-account-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: start;
}

.bank-account-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  min-height: 300px;
  padding: 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(36, 26, 52, 0.06);
}

.bank-account-tile-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
}

.bank-account-tile-heading > strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-account-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 38px;
  padding: 6px 9px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 900;
}

.special-bank-account-card {
  border-color: rgba(78, 109, 230, 0.24);
  background: #f4f7ff;
}

.special-bank-account-card .bank-account-code {
  background: #dfe8ff;
  color: #3653b7;
}

.customer-ledger-bank-account-card {
  border-color: rgba(35, 173, 125, 0.26);
  background: #f1fbf6;
}

.customer-ledger-bank-account-card .bank-account-code {
  background: #d9f3e6;
  color: #167854;
}

.bank-account-tile-balance {
  color: var(--ink);
  font-size: 1.35rem;
}

.bank-account-tile-institution,
.bank-account-tile-number {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bank-account-tile-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.bank-account-limit-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.bank-account-limit-summary .limit-warning {
  color: var(--red);
}

.bank-account-daily-limits {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.bank-account-daily-limits span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(37, 27, 53, 0.09);
  border-radius: 6px;
  background: rgba(255, 249, 236, 0.72);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.bank-account-daily-limits b {
  color: var(--ink);
  font-size: 0.72rem;
}

.bank-account-card .form-actions {
  align-self: end;
  justify-content: flex-end;
  margin-top: auto;
}

.customer-ledger-account-balances {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.customer-ledger-account-balances summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 900;
}

.customer-ledger-row-list {
  display: grid;
  gap: 4px;
  max-height: 132px;
  overflow: auto;
  padding-right: 4px;
}

.customer-ledger-row-list > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 6px;
  background: #f7f8ff;
  color: var(--ink) !important;
  font-size: 0.78rem;
}

.customer-ledger-row-list b,
.customer-ledger-row-list em {
  min-width: 0;
  overflow-wrap: anywhere;
  font-style: normal;
}

.customer-ledger-row-list em {
  flex: 0 0 auto;
  font-weight: 900;
}

.customer-ledger-empty {
  color: var(--muted) !important;
}

.compact-actions {
  align-items: center;
  justify-content: flex-end;
}

.field {
  position: relative;
  display: grid;
  gap: 7px;
}

.field:focus-within {
  z-index: 90;
}

.field small {
  min-height: 18px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 900;
}

.bank-fee-hint {
  color: var(--red) !important;
}

.customer-ledger-balance-hint {
  color: var(--muted) !important;
  white-space: pre-line;
}

.customer-ledger-balance-hint.has-balance {
  color: var(--green) !important;
}

.customer-ledger-balance-hint.zero-balance {
  color: var(--red) !important;
}

.account-verify-hint.success {
  color: var(--green) !important;
}

.account-verify-hint.fail {
  color: var(--red) !important;
}

.suggestion-list {
  position: absolute;
  top: calc(100% - 6px);
  left: 0;
  right: 0;
  z-index: 80;
  display: grid;
  gap: 6px;
  max-height: min(360px, 58vh);
  overflow: auto;
  padding: 8px;
  border: 2px solid rgba(36, 26, 52, 0.12);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 0 rgba(36, 26, 52, 0.06);
}

.suggestion-list[hidden] {
  display: none;
}

.suggestion-list button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: #fff3c3;
  color: var(--ink);
  text-align: left;
}

.suggestion-list button strong {
  min-width: 38px;
}

.suggestion-list button span {
  color: var(--ink);
  font-size: 0.9rem;
}

.suggestion-list button[aria-selected="true"] {
  background: #eefcff;
  box-shadow: inset 4px 0 0 var(--cyan);
}

.suggestion-empty {
  margin: 0;
  padding: 11px 14px;
  color: var(--red);
  font-size: 0.88rem;
  font-weight: 900;
}

.field span,
.calculation-band span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.calculation-band,
.entry-form .primary-button,
.form-actions {
  grid-column: 1 / -1;
}

.special-rate-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  align-items: start;
}

.special-rate-heading {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.special-rate-wrap > .ghost-button {
  width: 100%;
  min-height: 48px;
}

.special-rate-panel {
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 20px;
  background: #fff3c3;
}

.calculation-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 22px;
  background: #fff3c3;
}

.calculation-band > div {
  min-height: 82px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
}

.calculation-band strong {
  display: block;
  margin-top: 7px;
  font-size: 1.55rem;
  line-height: 1.05;
  word-break: break-word;
}

.calculation-band small {
  display: block;
  min-height: 20px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.calculation-band small span {
  display: block;
  margin-top: 3px;
}

.primary-button {
  background: var(--yellow);
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 3px 0 #d99a1e;
}

.secondary-button {
  padding: 0 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(47, 59, 148, 0.5);
}

.ghost-button,
.icon-button {
  padding: 0 14px;
  border-color: rgba(36, 26, 52, 0.12);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.08);
}

.icon-button {
  min-width: 40px;
  min-height: 38px;
  padding: 0;
}

.danger {
  color: var(--red);
}

button:hover {
  transform: translateY(-2px);
}

button:active {
  transform: translateY(1px);
  box-shadow: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.database-workspace {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.database-sidebar {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 10px;
}

.database-nav-button {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 66px;
  padding: 12px;
  border-color: rgba(36, 26, 52, 0.12);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.06);
}

.database-nav-button strong {
  font-size: 0.92rem;
  line-height: 1.2;
}

.database-nav-button span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.3;
}

.database-nav-button.active {
  background: var(--ink);
  color: #fffef8;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.18);
}

.database-nav-button.active span {
  color: rgba(255, 254, 248, 0.76);
}

.database-content {
  min-width: 0;
}

.database-view {
  display: none;
  min-width: 0;
}

.database-view.active {
  display: block;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 104px;
  padding: 16px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.06);
}

.metric.metric-wide {
  grid-column: 1 / -1;
}

.metric strong {
  display: block;
  margin-top: 14px;
  font-size: 1.85rem;
  line-height: 1;
  word-break: break-word;
}

.customer-list-shell {
  margin-top: 16px;
  overflow: auto;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 7px 0 rgba(36, 26, 52, 0.06);
}

.customer-form-panel {
  margin-bottom: 16px;
  padding: 14px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 22px;
  background: #fff3c3;
  box-shadow: 0 7px 0 rgba(36, 26, 52, 0.06);
}

.suggestion-list button small {
  margin-left: auto;
  color: inherit;
  font-size: 0.7rem;
  font-weight: 900;
}

.suggestion-list button.central-customer-option {
  background: #e5f6ed;
  box-shadow: inset 4px 0 0 var(--green);
}

.suggestion-list button.central-customer-option[aria-selected="true"] {
  background: #d4f0e2;
  box-shadow: inset 4px 0 0 #167854;
}

#customerQuery.central-customer-selected {
  border-color: rgba(36, 155, 113, 0.58);
  background: #e8f7ef;
  box-shadow: 0 0 0 4px rgba(36, 155, 113, 0.12);
}

.revenue-heading > div,
.revenue-section-heading > div {
  min-width: 0;
}

.revenue-heading p,
.revenue-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.revenue-definition-badge {
  padding: 7px 10px;
  border: 1px solid rgba(36, 26, 52, 0.12);
  border-radius: 7px;
  background: #f2eff4;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.revenue-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.revenue-summary {
  min-height: 132px;
  padding: 18px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 7px 0 rgba(36, 26, 52, 0.06);
}

.revenue-summary::before {
  content: "";
  display: block;
  width: 38px;
  height: 5px;
  margin-bottom: 18px;
  border-radius: 3px;
  background: var(--yellow);
}

.revenue-summary-buy::before {
  background: var(--green);
}

.revenue-summary-sell::before {
  background: var(--pink);
}

.revenue-summary > span,
.revenue-summary small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.revenue-summary strong {
  display: block;
  margin: 8px 0 7px;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
  word-break: break-word;
}

.revenue-summary-pending strong {
  color: var(--muted);
}

.revenue-chart-section,
.revenue-ranking-panel {
  margin-top: 16px;
  padding: 18px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 7px 0 rgba(36, 26, 52, 0.06);
}

.revenue-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.revenue-section-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.revenue-section-heading > span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-align: right;
}

.revenue-chart-scroll {
  overflow-x: auto;
  padding-bottom: 5px;
}

.revenue-daily-chart {
  display: grid;
  grid-template-columns: repeat(31, minmax(22px, 1fr));
  align-items: end;
  gap: 5px;
  min-width: 900px;
  height: 260px;
  padding: 18px 10px 8px;
  border: 1px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background:
    repeating-linear-gradient(to top, transparent 0 51px, rgba(36, 26, 52, 0.07) 51px 52px),
    #fffdf7;
}

.revenue-day-column {
  display: grid;
  grid-template-rows: 18px minmax(0, 1fr) 20px;
  align-items: end;
  height: 100%;
  min-width: 0;
}

.revenue-day-value,
.revenue-day-label {
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-align: center;
}

.revenue-day-bar {
  width: 100%;
  height: var(--preview-height);
  min-height: 16px;
  border: 1px dashed rgba(82, 103, 233, 0.5);
  border-radius: 4px 4px 0 0;
  background: repeating-linear-gradient(135deg, rgba(82, 103, 233, 0.18) 0 5px, rgba(72, 199, 232, 0.12) 5px 10px);
}

.revenue-ranking-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.revenue-ranking-panel {
  min-width: 0;
}

.revenue-ranking-list {
  display: grid;
  gap: 10px;
}

.revenue-ranking-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.revenue-rank-number {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
}

.revenue-ranking-row:first-child .revenue-rank-number {
  background: var(--yellow);
}

.revenue-rank-content {
  min-width: 0;
}

.revenue-rank-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.78rem;
}

.revenue-rank-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.revenue-rank-title span {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 900;
}

.revenue-rank-track {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #ece8ef;
}

.revenue-rank-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
}

.revenue-ranking-panel:nth-child(2) .revenue-rank-track span {
  background: linear-gradient(90deg, var(--pink), var(--yellow));
}

.revenue-ranking-panel:nth-child(3) .revenue-rank-track span {
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.return-data-heading {
  align-items: end;
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(110deg, #fff4c9, #f3f6ff 58%, #e9f8f1);
}

.return-data-heading h2 {
  margin-bottom: 4px;
}

.return-data-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.return-customer-search {
  width: min(460px, 100%);
}

.return-data-summary {
  display: grid;
  gap: 12px;
}

.return-profile-summary {
  display: flex;
  min-height: 112px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 2px solid var(--line);
  border-left-width: 8px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 0 rgba(37, 27, 53, 0.06);
}

.return-profile-summary span,
.return-window-card span,
.return-window-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.return-profile-summary h3 {
  margin: 5px 0 0;
  font-size: 1.35rem;
}

.return-profile-summary > div:last-child {
  display: grid;
  gap: 3px;
  text-align: right;
}

.return-profile-summary > div:last-child strong {
  font-size: 2rem;
}

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

.return-window-card {
  display: grid;
  min-width: 0;
  min-height: 158px;
  gap: 12px;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(37, 27, 53, 0.05);
}

.return-window-card header,
.return-window-values {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.return-window-card header strong {
  font-size: 1.35rem;
}

.return-window-values span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.return-window-values b {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.return-average-card {
  grid-column: span 2;
  background: #f5f7ff;
}

.return-risk-low {
  border-color: rgba(36, 155, 113, 0.48) !important;
  background: #e8f7ef !important;
}

.return-risk-medium {
  border-color: rgba(223, 160, 22, 0.5) !important;
  background: #fff5cf !important;
}

.return-risk-high {
  border-color: rgba(232, 77, 96, 0.5) !important;
  background: #fff0f2 !important;
}

#customerQuery.return-risk-low {
  box-shadow: 0 0 0 4px rgba(36, 155, 113, 0.12);
}

#customerQuery.return-risk-medium {
  box-shadow: 0 0 0 4px rgba(223, 160, 22, 0.13);
}

#customerQuery.return-risk-high {
  box-shadow: 0 0 0 4px rgba(232, 77, 96, 0.13);
}

.field .customer-risk-heading {
  display: flex;
  min-height: 22px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customer-return-risk-hint {
  display: inline-flex;
  min-width: 0;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.customer-return-risk-hint[hidden] {
  display: none;
}

.customer-return-risk-hint.risk-low {
  border-color: rgba(36, 155, 113, 0.28);
  background: #e8f7ef;
  color: #176b50;
}

.customer-return-risk-hint.risk-medium {
  border-color: rgba(223, 160, 22, 0.32);
  background: #fff5cf;
  color: #805c0d;
}

.customer-return-risk-hint.risk-high {
  border-color: rgba(232, 77, 96, 0.3);
  background: #fff0f2;
  color: #a3273a;
}

.revenue-rank-content small,
.revenue-ranking-empty {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.revenue-ranking-empty {
  min-height: 90px;
  display: grid;
  place-items: center;
  text-align: center;
}

.order-entry-form,
.card-redemption-form,
.bank-ledger-form {
  width: 100%;
  max-width: 1480px;
  margin-inline: auto;
}

.customer-profile-form,
.customer-bank-link-form,
.customer-game-link-form,
.product-form,
.restock-form {
  width: 100%;
  max-width: 1480px;
  margin-right: auto;
  margin-left: auto;
}

.customer-profile-form {
  grid-template-columns: repeat(4, minmax(170px, 1fr));
}

.customer-bank-link-form,
.customer-game-link-form {
  grid-template-columns: minmax(120px, 0.48fr) minmax(240px, 0.82fr) minmax(300px, 1fr) max-content;
  align-items: start;
}

.customer-bank-link-form > .field,
.customer-game-link-form > .field,
.customer-bank-account-row > .field {
  grid-template-rows: 18px 48px minmax(18px, auto);
  gap: 5px;
  align-content: start;
  align-self: start;
}

.customer-bank-link-form > .field input,
.customer-game-link-form > .field input,
.customer-game-link-form > .field select,
.customer-bank-account-row > .field input {
  height: 48px;
  min-height: 48px;
}

.customer-bank-link-form .form-actions,
.customer-game-link-form .form-actions {
  grid-column: auto;
  align-self: start;
  justify-content: flex-end;
  flex-wrap: nowrap;
  padding-top: 23px;
  white-space: nowrap;
}

.customer-bank-account-list {
  display: grid;
  gap: 8px;
}

.customer-bank-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff8d8;
}

.customer-bank-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-bank-editor-header strong {
  color: var(--ink);
  font-size: 1rem;
}

.customer-bank-editor-header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.customer-bank-account-row {
  display: grid;
  grid-template-columns: minmax(76px, 96px) minmax(240px, 0.95fr) minmax(300px, 1.1fr) minmax(72px, auto);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
}

.bank-row-tag {
  align-self: center;
  min-height: 36px;
  padding: 9px 10px;
  border-radius: 999px;
  background: #fff3c3;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
  align-self: start;
  margin-top: 23px;
}

.bank-row-placeholder {
  min-width: 72px;
}

.customer-bank-account-row .ghost-button {
  min-height: 48px;
  padding: 0 16px;
}

.customer-row-list {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.user-form {
  grid-template-columns: minmax(160px, 0.7fr) minmax(180px, 0.8fr) minmax(220px, 1fr) minmax(150px, 0.55fr);
}

.user-account-list {
  display: grid;
  gap: 10px;
}

.user-account-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.65fr) minmax(170px, 0.75fr) minmax(135px, 0.5fr) minmax(105px, 0.4fr) minmax(210px, 0.9fr) max-content;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #fff;
}

.user-account-identity {
  display: grid;
  gap: 5px;
  align-self: center;
}

.user-account-identity span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.user-active-field {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.user-account-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.customer-game-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 8px;
  background: #f4f7ff;
}

.customer-game-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-game-editor-header strong {
  color: var(--ink);
  font-size: 1rem;
}

.customer-game-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-game-editor-toggle {
  width: 42px;
  height: 42px;
  border: 2px solid rgba(36, 26, 52, 0.12);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(36, 26, 52, 0.1);
}

.customer-game-editor-toggle span[aria-hidden="true"] {
  display: inline-block;
  transition: transform 160ms ease;
}

.customer-game-editor-toggle.expanded span[aria-hidden="true"] {
  transform: rotate(180deg);
}

.customer-game-editor-content {
  display: grid;
  gap: 8px;
}

.customer-game-editor-content[hidden] {
  display: none;
}

.customer-game-profile-list {
  display: grid;
  gap: 8px;
}

.customer-game-profile-row {
  display: grid;
  grid-template-columns: minmax(70px, 86px) minmax(180px, 0.7fr) minmax(260px, 1.3fr) minmax(72px, auto);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 2px solid rgba(78, 109, 230, 0.13);
  border-radius: 8px;
  background: #fff;
}

.customer-game-profile-row > .field {
  grid-template-rows: 18px 48px;
  gap: 5px;
}

.customer-game-profile-row select,
.customer-game-profile-row input {
  height: 48px;
  min-height: 48px;
}

.customer-game-profile-row .ghost-button {
  min-height: 48px;
  margin-top: 23px;
}

.game-row-tag {
  align-self: start;
  margin-top: 23px;
  padding: 9px 10px;
  border-radius: 999px;
  background: #dfe8ff;
  color: #3653b7;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.game-row-placeholder {
  min-width: 72px;
}

.user-permission-editor {
  display: grid;
  grid-column: 1 / -1;
  gap: 8px;
  margin: 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid rgba(36, 26, 52, 0.1);
}

.user-permission-editor legend {
  padding: 0 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.user-permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 14px;
}

.user-permission-grid label {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
}

.user-permission-grid input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 18px;
  accent-color: var(--blue);
  box-shadow: none;
}

.user-permission-editor small {
  min-height: 18px;
  color: var(--muted);
  font-weight: 800;
}

.bank-account-form-grid {
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  align-items: end;
}

.bank-account-bank-code-field #bankAccountBankHint {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  min-height: 0;
  line-height: 1.25;
}

.bank-account-form-grid .form-actions {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.data-import-tool {
  display: grid;
  gap: 16px;
  width: min(1320px, 100%);
  margin: 22px auto 0;
  padding-top: 22px;
  border-top: 2px solid rgba(36, 26, 52, 0.1);
}

.data-import-heading,
.data-import-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.data-import-heading h3 {
  margin: 5px 0 0;
  font-size: 1.35rem;
}

.data-import-safety {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.data-import-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 320px));
  gap: 12px;
}

.data-import-text-field textarea {
  min-height: 220px;
  resize: vertical;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.5;
}

.data-import-file-field {
  max-width: 680px;
}

.data-import-file-field input[type="file"] {
  min-height: 48px;
  padding: 8px 10px;
  background: #fff;
}

.data-import-file-field input[type="file"]::file-selector-button {
  min-height: 32px;
  margin-right: 10px;
  padding: 5px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.data-import-actions p {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.data-import-preview {
  overflow: auto;
  border: 2px solid rgba(36, 26, 52, 0.1);
  border-radius: 12px;
  background: #fff;
}

.data-import-preview table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.data-import-preview th,
.data-import-preview td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(36, 26, 52, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 0.8rem;
}

.data-import-preview th {
  position: sticky;
  top: 0;
  background: #fff3c3;
  color: var(--muted);
}

.data-import-preview .import-row-error {
  background: #fff1f2;
}

.inventory-batch-fix {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(140px, 0.7fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 2px solid rgba(64, 93, 230, 0.16);
  border-radius: 12px;
  background: #f4f7ff;
}

.inventory-batch-fix > div {
  display: grid;
  gap: 4px;
  align-self: center;
}

.inventory-batch-fix small {
  color: var(--muted);
}

.data-import-issue-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px;
  border-bottom: 1px solid rgba(36, 26, 52, 0.08);
  background: #fff8ed;
}

.data-import-issue-summary span {
  padding: 5px 8px;
  border-radius: 7px;
  background: #fff;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
}

.data-import-result {
  display: grid;
  gap: 3px;
  min-width: 160px;
}

.data-import-result strong {
  color: var(--green);
}

.data-import-result .has-error {
  color: var(--red);
}

@media (max-width: 1400px) {
  .inventory-batch-fix {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
  }

  .inventory-batch-fix > div {
    grid-column: 1 / -1;
  }

  .revenue-ranking-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .revenue-ranking-employees {
    grid-column: 1 / -1;
  }

  .bank-account-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bank-account-form-grid .form-actions {
    grid-column: 1 / -1;
  }

  .user-account-row {
    grid-template-columns: minmax(150px, 0.65fr) minmax(170px, 0.75fr) minmax(135px, 0.5fr) minmax(105px, 0.4fr) minmax(210px, 0.9fr);
  }

  .user-account-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

.customer-record {
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(37, 27, 53, 0.05);
}

.customer-row {
  display: grid;
  grid-template-columns: 38px 92px minmax(110px, 0.8fr) 132px 132px minmax(180px, 1.2fr) minmax(150px, 0.8fr) 112px 126px;
  gap: 9px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  background: #fff;
}

.customer-row-header {
  position: sticky;
  top: 0;
  z-index: 1;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #fff1b9;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: none;
}

.customer-row strong,
.customer-row > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.customer-row > span {
  color: var(--muted);
  font-size: 0.86rem;
}

.customer-expand-toggle {
  display: grid;
  width: 34px;
  min-height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}

.customer-expand-toggle > span:first-child {
  font-size: 1.2rem;
  transition: transform 150ms ease;
}

.customer-expand-toggle[aria-expanded="true"] > span:first-child {
  transform: rotate(180deg);
}

.customer-badges {
  display: flex;
  min-width: 0;
  gap: 5px;
  flex-wrap: wrap;
}

.customer-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.72rem !important;
  line-height: 1;
}

.customer-badge.vip {
  background: #fff0c7;
  color: #8a5b00;
}

.customer-badge.central {
  background: #dff4e9;
  color: #116c4b;
}

.customer-badge.neutral {
  background: #f0edf2;
  color: var(--muted);
}

.customer-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.customer-row-actions .ghost-button {
  min-height: 34px;
  padding: 0 9px;
}

.customer-record-details {
  display: grid;
  gap: 12px;
  padding: 14px 16px 16px 59px;
  border-top: 1px solid var(--line);
  background: #fffdf8;
}

.customer-detail-section {
  display: grid;
  gap: 7px;
}

.customer-detail-section h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.84rem;
}

.customer-detail-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 7px;
}

.customer-detail-item {
  display: grid;
  grid-template-columns: auto minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
}

.customer-detail-item strong {
  color: var(--ink);
}

.customer-detail-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.customer-detail-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 10;
  max-width: min(420px, calc(100% - 32px));
  transform: translate(-50%, 18px);
  padding: 13px 18px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .revenue-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .revenue-summary-pending {
    grid-column: 1 / -1;
  }

  .handover-form {
    grid-template-columns: 1fr;
  }

  .handover-history-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-workspace {
    grid-template-columns: 1fr;
  }

  .order-queue {
    padding-right: 0;
    padding-bottom: 18px;
    border-right: 0;
    border-bottom: 2px solid rgba(36, 26, 52, 0.1);
  }

  .database-workspace,
  .entry-form,
  .customer-form,
  .match-top-row,
  .match-row,
  .special-rate-wrap,
  .calculation-band {
    grid-template-columns: 1fr;
  }

  .order-transfer-fee-row {
    grid-template-columns: minmax(0, 1fr) minmax(118px, 0.55fr);
  }

  .database-sidebar {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .storage-account-form {
    grid-template-columns: 1fr;
  }

  .restock-form,
  .product-form,
  .card-redemption-form,
  .card-inventory-row,
  .card-history-row {
    grid-template-columns: 1fr;
  }

  .restock-product-picker,
  .restock-card-filters:not([hidden]) {
    grid-template-columns: 1fr;
  }

  .bank-ledger-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bank-ledger-form > .field {
    grid-column: span 1;
  }

  .bank-ledger-counterparty-field,
  .bank-ledger-note-field,
  .bank-ledger-form .bank-ledger-preview,
  .bank-ledger-form .bank-ledger-actions {
    grid-column: 1 / -1;
  }

  .restock-form .form-actions,
  .card-redemption-form .form-actions,
  .card-note-field,
  .card-copy-field,
  .gift-stock-preview,
  .payment-method-field,
  .product-payment-field {
    grid-column: 1 / -1;
  }

  .gift-credential-row {
    grid-template-columns: 1fr;
  }

  .gift-import-row {
    grid-template-columns: 1fr;
  }

  .customer-profile-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .customer-bank-link-form,
  .customer-game-link-form {
    grid-template-columns: 1fr;
  }

  .customer-bank-link-form .form-actions,
  .customer-game-link-form .form-actions {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .customer-bank-account-row {
    grid-template-columns: 1fr;
  }

  .customer-game-profile-row {
    grid-template-columns: 1fr;
  }

  .bank-row-placeholder,
  .game-row-placeholder {
    display: none;
  }

  .bank-row-tag,
  .game-row-tag,
  .customer-game-profile-row .ghost-button {
    margin-top: 0;
  }

  .bank-account-card,
  .product-card,
  .user-account-row,
  .user-form {
    grid-template-columns: 1fr;
  }

  .order-editor-heading {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .order-mode-toggles {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .order-mode-toggles label {
    flex: 1 1 0;
    justify-content: center;
  }

  .order-card-quick-editor {
    grid-template-columns: 1fr;
  }

  .bank-account-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-account-actions {
    flex-wrap: wrap;
  }

  .rate-calculator-results {
    grid-template-columns: 1fr;
  }

  .rate-calculator-results article {
    min-height: 92px;
    border-right: 0;
    border-bottom: 1px solid rgba(36, 26, 52, 0.1);
  }

  .rate-calculator-results article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 720px) {
  .product-card-attributes,
  .inventory-batch-fix {
    grid-template-columns: 1fr;
  }

  .revenue-heading,
  .revenue-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .revenue-definition-badge,
  .revenue-section-heading > span {
    align-self: flex-start;
    text-align: left;
  }

  .revenue-summary-grid,
  .revenue-ranking-grid {
    grid-template-columns: 1fr;
  }

  .revenue-summary-pending,
  .revenue-ranking-employees {
    grid-column: auto;
  }

  .revenue-chart-section,
  .revenue-ranking-panel {
    padding: 14px;
  }

  .revenue-daily-chart {
    min-width: 820px;
  }

  .product-reward-image-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .product-reward-image-controls input {
    grid-column: 1 / -1;
  }

  .product-reward-image-controls button {
    width: 100%;
  }

  .customer-profile-form {
    grid-template-columns: 1fr;
  }

  .order-gift-serial-field {
    width: min(230px, 64%);
    min-width: 150px;
  }

  .app-shell {
    width: calc(100% - 12px);
    padding-top: 16px;
  }

  h1 {
    font-size: 2.45rem;
  }

  .login-brand {
    gap: 12px;
  }

  .login-logo {
    width: 84px;
    border-radius: 12px;
  }

  .login-brand h1 {
    font-size: 1.65rem;
  }

  .topbar-brand {
    width: 100%;
    gap: 12px;
  }

  .order-gift-serial-field {
    width: 100%;
  }

  .topbar-brand h1 {
    font-size: 1.85rem;
  }

  .topbar-logo {
    width: 64px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tabs {
    grid-template-columns: 1fr;
    border-radius: 22px;
  }

  .subtabs,
  .history-filters {
    grid-template-columns: 1fr;
  }

  .bank-ledger-form {
    grid-template-columns: 1fr;
  }

  .bank-ledger-form > .field,
  .bank-ledger-counterparty-field,
  .bank-ledger-note-field,
  .bank-ledger-form .bank-ledger-preview,
  .bank-ledger-form .bank-ledger-actions {
    grid-column: 1;
  }

  .rate-calculator {
    padding: 14px;
  }

  .rate-calculator-fields,
  .rate-copy-row {
    grid-template-columns: 1fr;
  }

  .rate-copy-row > button {
    width: 100%;
  }

  .tab-panel {
    padding: 14px;
    border-radius: 8px;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .history-panel-heading {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .history-panel-heading .table-tools {
    margin-left: auto;
  }

  .data-import-controls {
    grid-template-columns: 1fr;
  }

  .data-import-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .data-import-actions .form-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .history-panel-heading .table-tools {
    width: 100%;
    margin-left: 0;
  }

  .bank-account-form-grid {
    grid-template-columns: 1fr;
  }

  .data-import-actions .form-actions {
    grid-template-columns: 1fr;
  }

  .handover-dialog {
    width: 100%;
    max-width: none;
    max-height: 100dvh;
    border: 0;
  }

  .handover-shell {
    max-height: 100dvh;
    padding: 14px;
  }

  .handover-header {
    top: -14px;
    margin: -14px -14px 14px;
    padding: 14px;
  }

  .handover-account-row,
  .handover-history-row {
    grid-template-columns: 1fr;
  }

  .handover-account-result {
    text-align: left;
  }

  .handover-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .database-sidebar {
    grid-template-columns: 1fr;
  }

  .customer-row-list {
    min-width: 0;
  }

  .customer-row-header {
    display: none;
  }

  .customer-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 6px 10px;
  }

  .customer-row > :nth-child(2),
  .customer-row > :nth-child(3) {
    grid-column: 2;
  }

  .customer-row > :nth-child(4),
  .customer-row > :nth-child(5),
  .customer-row > :nth-child(6),
  .customer-row > :nth-child(8) {
    grid-column: 2 / -1;
  }

  .customer-row > :nth-child(7) {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .customer-row > :nth-child(9) {
    grid-column: 2 / -1;
    justify-content: flex-start;
  }

  .customer-expand-toggle {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .customer-record-details {
    padding: 12px;
  }

  .customer-detail-items,
  .customer-detail-item {
    grid-template-columns: 1fr;
  }

  .bank-account-daily-limits,
  .customer-status-fields {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 900px;
  }
}

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

@media (max-width: 620px) {
  .return-data-heading,
  .return-profile-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .return-customer-search {
    width: 100%;
  }

  .return-profile-summary > div:last-child {
    text-align: left;
  }

  .return-window-grid {
    grid-template-columns: 1fr;
  }

  .return-average-card {
    grid-column: auto;
  }
}

body.registration-mode {
  background: #f7f5f0;
}

body.registration-mode::before {
  background:
    linear-gradient(90deg, rgba(37, 27, 53, 0.025) 1px, transparent 1px),
    linear-gradient(0deg, rgba(37, 27, 53, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
}

.registration-page {
  width: min(860px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 60px;
}

.registration-header {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff1bd;
  box-shadow: 0 7px 0 rgba(37, 27, 53, 0.07);
}

.registration-header img {
  display: block;
  width: 104px;
  aspect-ratio: 1;
  border: 3px solid #c79d34;
  border-radius: 8px;
  background: #111;
  object-fit: cover;
}

.registration-header h1 {
  margin: 4px 0 8px;
  font-size: 2.25rem;
  line-height: 1.12;
}

.registration-header p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.65;
}

.registration-form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.registration-honeypot {
  position: fixed !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
}

.registration-section {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 0 rgba(37, 27, 53, 0.055);
}

.registration-section-heading {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.registration-section-heading > span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.registration-section-heading h2,
.registration-section-heading p {
  margin: 0;
}

.registration-section-heading h2 {
  font-size: 1.2rem;
}

.registration-section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.55;
}

.registration-choice-grid,
.registration-checkbox-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.registration-choice-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.registration-choice-grid legend,
.registration-checkbox-group legend {
  grid-column: 1 / -1;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 900;
}

.registration-choice-grid label,
.registration-checkbox-group label,
.registration-agree-check {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.registration-choice-grid label:has(input:checked),
.registration-checkbox-group label:has(input:checked),
.registration-agree-check:has(input:checked) {
  border-color: var(--green);
  background: #e9f7f0;
}

.registration-choice-grid input,
.registration-checkbox-group input,
.registration-agree-check input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

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

.registration-field-wide {
  grid-column: 1 / -1;
}

.registration-conditional-field {
  max-width: 520px;
}

.registration-inline-message,
.registration-submit-message {
  margin: 0;
  color: var(--red);
  font-weight: 900;
}

.registration-document-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.registration-upload-card {
  position: relative;
  display: grid;
  min-height: 142px;
  align-content: center;
  gap: 8px;
  padding: 16px;
  overflow: hidden;
  border: 2px dashed rgba(37, 27, 53, 0.23);
  border-radius: 8px;
  background: #fffdf8;
  text-align: center;
  cursor: pointer;
}

.registration-upload-card:has(input:valid) {
  border-color: var(--green);
  background: #edf8f3;
}

.registration-upload-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.registration-upload-card span {
  min-height: 36px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.registration-upload-card em {
  width: fit-content;
  margin: 0 auto;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.registration-document-grid.is-deferred {
  opacity: 0.46;
}

.registration-document-grid.is-deferred .registration-upload-card {
  cursor: not-allowed;
}

.registration-document-defer {
  width: fit-content;
  margin-top: 12px;
  background: #f4f7ff;
}

.registration-document-defer-note {
  margin: 8px 2px 0;
  color: #405477;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.55;
}

.registration-agreement details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.registration-agreement summary {
  padding: 13px 15px;
  font-weight: 900;
  cursor: pointer;
}

.registration-agreement-copy {
  padding: 0 15px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.75;
}

.registration-agreement-copy p {
  margin: 8px 0 0;
}

.registration-submit {
  width: 100%;
  min-height: 54px;
}

.registration-submit-message.success {
  padding: 13px 15px;
  border: 2px solid rgba(36, 155, 113, 0.3);
  border-radius: 8px;
  background: #e9f7f0;
  color: #116c4b;
}

.customer-document-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #eef5ff;
}

.customer-document-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-document-editor-header span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.customer-document-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.customer-document-card {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.customer-document-card > div:first-child {
  display: grid;
  gap: 3px;
}

.customer-document-card [data-customer-document-status] {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.customer-document-card > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.customer-document-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.customer-document-actions .ghost-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  font-size: 0.76rem;
  cursor: pointer;
}

.customer-document-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.customer-document-summary button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

@media (max-width: 720px) {
  .registration-page {
    width: min(100% - 18px, 560px);
    padding-top: 9px;
  }

  .registration-header {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
    padding: 13px;
  }

  .registration-header img {
    width: 72px;
  }

  .registration-header h1 {
    font-size: 1.55rem;
  }

  .registration-header p:last-child {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .registration-section {
    gap: 13px;
    padding: 14px;
  }

  .registration-field-grid,
  .registration-choice-grid,
  .registration-choice-grid-three,
  .registration-checkbox-group,
  .registration-document-grid,
  .customer-document-grid,
  .customer-document-summary {
    grid-template-columns: 1fr;
  }

  .registration-field-wide {
    grid-column: auto;
  }

  .registration-upload-card {
    min-height: 104px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    text-align: left;
  }

  .registration-upload-card span {
    min-height: 0;
  }

  .registration-upload-card em {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .customer-document-editor-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
