@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 400;
  src: url("https://fonts.shopifycdn.com/assistant/assistant_n4.9120912a469cad1cc292572851508ca49d12e768.woff2")
    format("woff2");
}

@font-face {
  font-family: "Assistant";
  font-style: normal;
  font-weight: 700;
  src: url("https://fonts.shopifycdn.com/assistant/assistant_n7.bf44452348ec8b8efa3aa3068825305886b1c83c.woff2")
    format("woff2");
}

:root {
  color-scheme: light;
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-strong: #fbfbfb;
  --ink: #121212;
  --muted: #6f6f6f;
  --line: #dedede;
  --brand: #f04747;
  --brand-dark: #121212;
  --brand-soft: #fff1f1;
  --mint: #087a5a;
  --mint-soft: #e8f6f1;
  --coral: #f04747;
  --coral-soft: #fff1f1;
  --sky: #316eb8;
  --sky-soft: #edf5ff;
  --amber: #d59a25;
  --amber-soft: #fff5d8;
  --shadow: 0 12px 34px rgba(18, 18, 18, 0.06);
  --radius: 4px;
  --sidebar-width: 272px;
  font-family:
    Assistant, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  background: #f7f7f7;
}

.auth-card {
  width: min(100%, 460px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: block;
  width: 148px;
  margin-bottom: 30px;
}

.auth-card h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.08;
}

.auth-copy,
.auth-message {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.auth-copy {
  margin: 12px 0 24px;
}

.auth-message {
  min-height: 22px;
  margin: 16px 0 0;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-error {
  min-height: 16px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.field-error:empty {
  display: none;
}

.text-input.field-invalid {
  border-color: var(--brand);
  background: #fff8f8;
}

.text-input.field-invalid:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.application-form {
  margin-top: 4px;
}

.code-input {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
  text-align: center;
}

.textarea-input {
  min-height: 104px;
  padding-top: 10px;
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

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

.brand-copy strong,
.brand-copy span {
  display: block;
}

.brand-logo {
  display: block;
  width: 128px;
  max-width: 100%;
  height: auto;
}

.brand-copy {
  display: none;
}

.brand-copy strong {
  font-size: 16px;
}

.brand-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid #cfe8df;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--mint-soft), #fff8f0);
  color: #0f7d61;
  font-weight: 800;
}

.creator-mode [data-admin-only] {
  display: none !important;
}

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

.nav-item,
.ghost-button,
.icon-button,
.primary-button,
.secondary-button,
.filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.nav-item {
  justify-content: flex-start;
  width: 100%;
  padding: 0 12px;
  background: transparent;
  color: #475563;
}

.nav-item:hover,
.nav-item.active {
  border-color: #ffd0d0;
  background: var(--brand-soft);
  color: var(--brand);
}

.icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.status-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-heading,
.panel-heading,
.code-row,
.share-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.topbar h1,
.section-heading h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 32px;
  line-height: 1.1;
}

.page-subtitle {
  max-width: 520px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.select-label,
.field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.select,
.text-input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

.select {
  min-width: 180px;
  padding: 0 12px;
}

.text-input {
  width: 100%;
  padding: 0 12px;
}

.text-input:focus,
.select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 22px;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.pill {
  background: var(--brand-soft);
  color: var(--brand);
}

.status-pending {
  background: var(--amber-soft);
  color: #865d00;
}

.status-approved {
  background: var(--mint-soft);
  color: #0f6854;
}

.status-paid {
  background: var(--sky-soft);
  color: #1d609d;
}

.status-voided,
.status-declined {
  background: var(--coral-soft);
  color: #a23328;
}

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

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 118px;
  padding: 18px;
}

.stat-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.stat-card em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.admin-grid {
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 0.8fr);
}

.panel {
  padding: 18px;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel h3 {
  font-size: 18px;
}

.primary-button {
  padding: 0 14px;
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.primary-button:hover {
  border-color: var(--brand-dark);
  background: var(--brand-dark);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.secondary-button {
  padding: 0 14px;
  border-color: #121212;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.secondary-button:hover {
  background: #121212;
  color: #fff;
}

.ghost-button,
.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: #52606d;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.text-button:hover {
  color: var(--brand);
}

.sidebar-logout {
  justify-content: flex-start;
  width: 100%;
}

.code-row {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.code-row > div {
  flex: 1;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.code-row span,
.balance-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.code-row strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
  letter-spacing: 0;
}

.field-label {
  display: block;
  margin-bottom: 8px;
}

.share-row {
  gap: 8px;
}

.qr-wrap {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid #ffd0d0;
  border-radius: var(--radius);
  background: #fffafa;
}

.qr-wrap strong,
.rule-box strong {
  display: block;
  margin-bottom: 6px;
}

.qr-wrap p,
.rule-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.qr-image {
  display: block;
  width: 104px;
  height: 104px;
  padding: 6px;
  border: 1px solid #ffd0d0;
  border-radius: var(--radius);
  background: #fff;
}

.qr-download {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

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

.balance-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

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

.balance-item strong {
  font-size: 20px;
}

.rule-box {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #fde0d9;
  border-radius: var(--radius);
  background: var(--coral-soft);
}

.table-panel {
  padding-bottom: 8px;
}

.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-button {
  min-height: 34px;
  padding: 0 11px;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.filter-button.active {
  border-color: #ffd0d0;
  background: var(--brand-soft);
  color: var(--brand);
}

.table-scroll {
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

a {
  color: var(--ink);
}

.table-input {
  min-width: 132px;
  min-height: 34px;
  font-weight: 700;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.form-button {
  align-self: end;
}

.partner-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.partner-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.partner-row strong,
.partner-row span {
  display: block;
}

.partner-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid #cfe8df;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--ink);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.application-embed {
  background: transparent;
}

.application-embed .auth-view {
  display: block;
  min-height: auto;
  padding: 0;
  background: transparent;
}

.application-embed .auth-card {
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.application-embed .auth-logo,
.application-embed #application-back {
  display: none;
}

.application-embed .auth-card h1 {
  font-size: 28px;
}

.application-embed .auth-copy {
  margin-bottom: 20px;
}

.application-embed .auth-message:not(:empty) {
  min-height: 0;
  padding: 12px 14px;
  border: 1px solid #ffd0d0;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--ink);
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .sidebar-note {
    margin-top: 0;
  }

  .stat-grid,
  .content-grid,
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .panel-heading,
  .code-row,
  .share-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .nav-stack,
  .stat-grid,
  .content-grid,
  .admin-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    display: grid;
  }

  .select {
    width: 100%;
  }

  .qr-wrap {
    grid-template-columns: 1fr;
  }

  .qr-image {
    width: 112px;
    height: 112px;
  }
}
