:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #10201c;
  --muted: #62726d;
  --line: #dce5e1;
  --accent: #0f8f72;
  --accent-dark: #0b725b;
  --warn: #a75f00;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body.checkout-page {
  background: #282a2e;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

button.secondary {
  background: #e8efec;
  color: var(--ink);
}

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

.checkout-shell {
  position: relative;
  isolation: isolate;
  align-items: start;
  padding: 28px 0 36px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 12%, rgba(92, 111, 255, 0.08), transparent 260px),
    #282a2e;
}

.checkout-shell::before,
.checkout-shell::after {
  content: "";
  position: fixed;
  z-index: 0;
  width: 470px;
  height: 760px;
  pointer-events: none;
  opacity: 0.52;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.11) 0 19px, transparent 20px) 0 0 / 68px 68px;
}

.checkout-shell::before {
  left: max(-110px, calc(50% - 760px));
  top: 170px;
}

.checkout-shell::after {
  right: max(-110px, calc(50% - 760px));
  top: 150px;
  transform: translateY(0);
}

.pay-panel,
.admin-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(10, 35, 29, 0.08);
}

.pay-panel {
  width: min(520px, 100%);
  padding: 28px;
}

.checkout-panel {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  min-height: min(690px, 100vh);
  padding: 0;
  overflow: hidden;
}

.order-panel {
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #10201c;
  color: white;
  font-weight: 900;
  font-size: 24px;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
  margin-bottom: 14px;
}

p {
  color: var(--muted);
  margin: 4px 0 0;
}

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

.form.compact {
  margin-top: 14px;
  gap: 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 700;
  color: #243a34;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fbfdfc;
  color: var(--ink);
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.quote {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.quote div,
.payment-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.quote div:last-child,
.payment-row:last-child {
  border-bottom: 0;
}

.quote span,
.payment-row span {
  color: var(--muted);
}

.result,
.payment-state {
  margin-top: 20px;
}

.checkout-panel .payment-state {
  margin-top: 0;
}

.address-box {
  word-break: break-all;
  background: #eef5f2;
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.address-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.address-section span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.qr {
  width: 224px;
  height: 224px;
  display: block;
  margin: 26px auto 24px;
}

.checkout-statusbar {
  color: white;
  background: linear-gradient(135deg, #6b3df4 0%, #3f72ea 100%);
  padding: 15px 18px 12px;
}

.checkout-brand-text {
  text-align: center;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  margin-bottom: 18px;
}

.checkout-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  font-weight: 800;
}

.order-status-line {
  text-align: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 800;
}

.checkout-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.checkout-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: white;
  border-radius: 50%;
  animation: checkout-spin 0.9s linear infinite;
}

#countdown {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

#countdown.danger {
  color: #ffd9d7;
}

.checkout-merchant {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 26px;
  box-shadow: 0 14px 28px rgba(16, 32, 28, 0.08);
}

.checkout-merchant span {
  color: var(--ink);
  font-weight: 800;
  text-transform: lowercase;
}

.checkout-merchant strong {
  font-size: 18px;
  text-align: right;
}

.checkout-body {
  padding: 28px 24px 24px;
  text-align: center;
}

.checkout-qr {
  width: 206px;
  height: 206px;
  display: block;
  margin: 0 auto 22px;
}

.checkout-instruction {
  color: #7587b6;
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 20px;
}

.checkout-instruction strong {
  color: var(--ink);
}

.checkout-address {
  color: #2c3330;
  font-weight: 900;
  line-height: 1.45;
  overflow-wrap: anywhere;
  margin: 0 auto 12px;
}

.checkout-network {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ff1d25;
  color: white;
  font-weight: 900;
  padding: 7px 18px;
  margin-bottom: 18px;
}

.checkout-copy-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 22px;
}

.checkout-copy-button {
  background: transparent;
  color: #4977ea;
  padding: 8px 4px;
  border-radius: 6px;
}

.checkout-copy-button:hover {
  background: #edf2ff;
  color: #315fd4;
}

.order-body {
  padding: 30px 26px 28px;
}

.order-heading {
  text-align: center;
  margin-bottom: 24px;
}

.order-heading h1 {
  font-size: 26px;
}

.order-heading p {
  font-weight: 800;
}

.order-form {
  display: grid;
  gap: 16px;
}

.order-form label {
  gap: 9px;
}

.order-form input {
  height: 52px;
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

.order-quote {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.order-quote div,
.order-result .payment-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.order-quote div:last-child,
.order-result .payment-row:last-child {
  border-bottom: 0;
}

.order-quote span,
.order-result span {
  color: var(--muted);
}

.order-form button {
  height: 48px;
}

.order-result {
  margin-top: 18px;
}

.order-result a {
  color: #4977ea;
  overflow-wrap: anywhere;
}

.checkout-meta {
  display: grid;
  gap: 0;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.checkout-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.checkout-meta span {
  color: var(--muted);
}

.copy-toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(16, 32, 28, 0.92);
  color: white;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 10px 28px rgba(16, 32, 28, 0.22);
}

@keyframes checkout-spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

.admin-shell {
  padding: 24px;
}

.admin-layout {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 18px;
}

.admin-sidebar,
.admin-content {
  min-width: 0;
  min-height: 0;
}

.admin-sidebar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 18px;
  box-shadow: 0 12px 32px rgba(10, 35, 29, 0.08);
}

.admin-content {
  padding-right: 4px;
}

.sidebar-brand h1 {
  font-size: 22px;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
}

.nav-button:hover,
.nav-button.active {
  background: #e8efec;
  color: var(--ink);
  border-color: var(--line);
}

.sidebar-logout {
  margin-top: 12px;
}

.content-header,
.section-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-card {
  padding: 18px;
  margin-bottom: 18px;
}

.admin-view {
  min-width: 0;
}

#login-card {
  width: min(420px, 100%);
  margin: 8vh auto 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(10, 35, 29, 0.08);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.metric-card strong {
  display: block;
  font-size: 30px;
  line-height: 1.1;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 1.2fr);
  gap: 18px;
}

.order-toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.order-toolbar-left h2 {
  margin-bottom: 0;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  padding: 8px 11px;
}

.filter-button.active {
  background: var(--ink);
  color: white;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pagination div {
  display: flex;
  gap: 8px;
}

.pagination button {
  padding: 8px 11px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

#orders-table {
  min-width: 1380px;
}

#addresses-table {
  min-width: 1520px;
}

#admins-table {
  min-width: 760px;
}

.compact-table table {
  min-width: 920px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
  font-size: 13px;
}

th {
  color: var(--muted);
  background: #f7faf9;
  position: sticky;
  top: 0;
}

.empty-cell {
  text-align: center;
  color: var(--muted);
  padding: 28px 10px;
}

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

.address-full {
  word-break: break-all;
  min-width: 280px;
}

.row-actions {
  min-width: 150px;
}

.row-actions button {
  padding: 7px 9px;
  margin: 0 6px 6px 0;
  white-space: nowrap;
}

.row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  background: #e8efec;
  color: var(--muted);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.pill {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e8efec;
  color: #243a34;
  font-size: 12px;
  font-weight: 700;
}

.pill.warn {
  background: #fff4df;
  color: var(--warn);
}

.pill.danger {
  background: #fee4e2;
  color: var(--danger);
}

pre {
  background: #0e1b18;
  color: #dce5e1;
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
  max-height: 260px;
}

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

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:first-child {
  padding-top: 0;
}

.setting-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.setting-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.setting-value {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.setting-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 5px;
}

.setting-actions {
  display: flex;
  justify-content: flex-end;
}

.setting-actions button,
.setting-editor-actions button {
  white-space: nowrap;
}

.setting-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.setting-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 18, 15, 0.44);
}

.modal-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(10, 35, 29, 0.24);
  padding: 20px;
}

.modal-card h2 {
  margin-bottom: 10px;
}

.modal-message {
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.paid-modal-card {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(360px, calc(100vw - 38px));
  text-align: center;
  border: 0;
  border-radius: 18px;
  padding: 26px 22px 20px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.paid-modal-card > * {
  position: relative;
}

#paid-modal-content {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 100%;
}

.paid-modal-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 86px;
  background: linear-gradient(135deg, rgba(107, 61, 244, 0.16), rgba(63, 114, 234, 0.18));
  pointer-events: none;
}

.paid-modal-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6b3df4, #2fcb96);
  color: white;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(63, 114, 234, 0.28);
}

.paid-modal-icon.small {
  width: 42px;
  height: 42px;
  font-size: 24px;
}

.paid-modal-card h2 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.15;
}

.paid-modal-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.receipt-header {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
}

.receipt-header h2 {
  font-size: 22px;
}

.receipt-header p {
  margin: 2px 0 0;
}

.receipt-amount {
  width: 100%;
  border-radius: 12px;
  background: #f2f6ff;
  color: #10201c;
  padding: 13px 12px;
  font-size: 20px;
  font-weight: 900;
}

.receipt-list {
  width: 100%;
  display: grid;
  border-top: 1px solid var(--line);
  margin-top: 2px;
}

.receipt-list div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.receipt-list span {
  color: var(--muted);
  font-size: 13px;
}

.receipt-list strong {
  min-width: 0;
  font-size: 13px;
  overflow-wrap: anywhere;
  text-align: right;
}

.paid-modal-card button {
  min-width: 150px;
  border-radius: 999px;
  background: linear-gradient(135deg, #6b3df4, #3f72ea);
  padding: 11px 18px;
  box-shadow: 0 10px 24px rgba(63, 114, 234, 0.24);
}

.paid-modal-card button:hover {
  background: linear-gradient(135deg, #5b31db, #3565d6);
}

#modal-input,
#modal-textarea {
  margin-top: 14px;
}

#modal-textarea {
  min-height: 108px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

@media (min-width: 901px) {
  .admin-shell {
    height: 100vh;
    overflow: hidden;
  }

  .admin-layout {
    height: calc(100vh - 48px);
    min-height: 0;
  }

  .admin-sidebar {
    height: 100%;
    overflow-y: auto;
  }

  .admin-content {
    height: 100%;
    overflow-y: auto;
  }
}

@media (max-width: 560px) {
  body.checkout-page {
    background: var(--panel);
  }

  .checkout-shell {
    display: block;
    min-height: 100vh;
    padding: 0;
    background: var(--panel);
    overflow: visible;
  }

  .checkout-shell::before,
  .checkout-shell::after {
    display: none;
  }

  .checkout-panel {
    width: 100%;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .order-panel {
    min-height: 100vh;
  }

  .checkout-statusbar {
    border-radius: 0;
  }

  .checkout-merchant {
    padding: 18px 18px 22px;
  }

  .checkout-body {
    padding: 24px 22px 24px;
  }

  .order-body {
    padding: 28px 22px 24px;
  }

  .checkout-qr {
    width: min(206px, 68vw);
    height: min(206px, 68vw);
  }
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
  }

  .admin-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    text-align: center;
  }

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

  .admin-grid,
  .inline-form,
  .content-header,
  .section-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .setting-row {
    grid-template-columns: 1fr;
  }

  .setting-actions {
    justify-content: flex-start;
  }
}
