/* CookieRun Service UI system */
:root {
  --app-bg: #f5f7fb;
  --app-ink: #172033;
  --app-muted: #667085;
  --app-soft: #eef2f7;
  --app-line: #d9e1ec;
  --app-surface: #ffffff;
  --app-surface-strong: #fff8f2;
  --brand: #e11d48;
  --brand-strong: #be123c;
  --accent: #f59e0b;
  --mint: #0f9f8f;
  --sky: #2563eb;
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, .10);
  --shadow-card: 0 10px 28px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-body {
  min-height: 100vh;
  color: var(--app-ink);
  background-color: var(--app-bg);
  background-image:
    linear-gradient(rgba(225, 29, 72, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 159, 143, .032) 1px, transparent 1px),
    linear-gradient(180deg, #ffffff 0%, #f5f7fb 42%, #f0f6f3 100%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
}

.app-shell {
  min-height: calc(100vh - 156px);
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(217, 225, 236, .9);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 30px rgba(15, 23, 42, .06);
}

.brand-link,
.nav-link,
.user-chip,
.balance-chip,
.icon-button,
.btn-primary,
.btn-secondary,
.btn-ghost,
.status-badge {
  display: inline-flex;
  align-items: center;
}

.brand-link {
  gap: .65rem;
  min-width: 0;
  color: #111827;
  font-weight: 800;
}

.brand-mark {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(225, 29, 72, .22);
  border-radius: .5rem;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 10px 24px rgba(225, 29, 72, .22);
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link {
  gap: .45rem;
  min-height: 2.45rem;
  padding: .55rem .75rem;
  border-radius: .5rem;
  color: #475467;
  font-size: .92rem;
  font-weight: 700;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-link:hover {
  color: var(--brand-strong);
  background: #fff1f2;
}

.nav-link.is-active {
  color: var(--brand-strong);
  background: #fff1f2;
  box-shadow: inset 0 0 0 1px rgba(225, 29, 72, .12);
}

.nav-link.is-admin {
  color: #92400e;
  background: #fffbeb;
}

.user-chip,
.balance-chip {
  gap: .4rem;
  min-height: 2.3rem;
  padding: .45rem .7rem;
  border: 1px solid var(--app-line);
  border-radius: .5rem;
  background: #ffffff;
  color: #475467;
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
}

.balance-chip {
  border-color: rgba(225, 29, 72, .18);
  color: var(--brand-strong);
  background: #fff1f2;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mobile-nav-panel {
  display: none;
  border-top: 1px solid var(--app-line);
  background: rgba(255, 255, 255, .98);
}

.mobile-nav-panel.is-open {
  display: block;
}

.icon {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  stroke-width: 2.1;
}

.icon-sm {
  width: .9rem;
  height: .9rem;
}

.icon-lg {
  width: 1.25rem;
  height: 1.25rem;
}

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  justify-content: center;
  border: 1px solid var(--app-line);
  border-radius: .5rem;
  color: #344054;
  background: #ffffff;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.icon-button:hover {
  color: var(--brand-strong);
  border-color: rgba(225, 29, 72, .26);
  background: #fff1f2;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .45rem;
  color: var(--brand-strong);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.page-title {
  color: #111827;
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.05;
  font-weight: 900;
}

.section-title {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #111827;
  font-size: 1.2rem;
  font-weight: 850;
}

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

.app-card,
.metric-card,
.feature-card,
.auth-card,
.table-card {
  border: 1px solid rgba(217, 225, 236, .96);
  border-radius: .5rem;
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-card);
}

.app-card,
.auth-card {
  padding: 1.25rem;
}

.metric-card {
  display: grid;
  min-height: 8.5rem;
  gap: .75rem;
  padding: 1rem;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.metric-label {
  color: var(--app-muted);
  font-size: .85rem;
  font-weight: 700;
}

.metric-value {
  color: #111827;
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  line-height: 1;
  font-weight: 900;
}

.metric-icon {
  display: inline-flex;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  color: var(--brand-strong);
  background: #fff1f2;
}

.metric-icon.mint {
  color: #04786f;
  background: #e6fffb;
}

.metric-icon.amber {
  color: #92400e;
  background: #fffbeb;
}

.metric-icon.sky {
  color: #1d4ed8;
  background: #eff6ff;
}

.feature-card {
  padding: 1.1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--app-line);
}

.btn-primary,
.btn-secondary,
.btn-ghost {
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  border-radius: .5rem;
  padding: .68rem 1rem;
  font-weight: 800;
  line-height: 1.1;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
}

.btn-primary {
  border: 0;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 12px 24px rgba(225, 29, 72, .22);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(225, 29, 72, .28);
}

.btn-secondary {
  border: 1px solid rgba(225, 29, 72, .22);
  color: var(--brand-strong);
  background: #fff1f2;
}

.btn-secondary:hover {
  border-color: rgba(225, 29, 72, .36);
  background: #ffe4e6;
}

.btn-ghost {
  border: 1px solid var(--app-line);
  color: #344054;
  background: #ffffff;
}

.btn-ghost:hover {
  color: #111827;
  border-color: #c9d3e2;
  background: #f8fafc;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .9rem 1rem;
  border-radius: .5rem;
  font-weight: 650;
}

.alert-error {
  border: 1px solid #fecdd3;
  color: #9f1239;
  background: #fff1f2;
}

.alert-success {
  border: 1px solid #bbf7d0;
  color: #166534;
  background: #f0fdf4;
}

.notice {
  border: 1px solid #fde68a;
  border-radius: .5rem;
  color: #78350f;
  background: #fffbeb;
}

.progress-track {
  width: 100%;
  height: .9rem;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand) 0%, var(--accent) 48%, var(--mint) 100%);
  background-size: 200% 100%;
  animation: progress-shift 3s linear infinite;
}

@keyframes progress-shift {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: .65rem .8rem;
  border: 1px solid #ccd6e3;
  border-radius: .5rem;
  color: #111827;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input[type="file"] {
  cursor: pointer;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(225, 29, 72, .65);
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .12);
}

label {
  color: #344054;
  font-weight: 700;
}

.choice-card {
  display: block;
  height: 100%;
  cursor: pointer;
  border: 1px solid #d9e1ec;
  border-radius: .5rem;
  background: #ffffff;
  padding: 1rem;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}

.choice-card:hover {
  border-color: rgba(225, 29, 72, .32);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .08);
}

.choice-card:has(input:checked) {
  border-color: rgba(225, 29, 72, .65);
  background: #fff8f2;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .10);
}

.table-card {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 680px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .92rem;
}

.data-table thead {
  color: #667085;
  background: #f8fafc;
}

.data-table th,
.data-table td {
  padding: .78rem .9rem;
  text-align: left;
  vertical-align: middle;
}

.data-table tbody tr + tr td,
.data-table tbody tr:first-child td {
  border-top: 1px solid #eef2f7;
}

.data-table tbody tr:hover {
  background: #fff8f2;
}

.status-badge {
  gap: .35rem;
  min-height: 1.7rem;
  padding: .28rem .62rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-warn {
  color: #92400e;
  background: #fef3c7;
}

.status-info {
  color: #1d4ed8;
  background: #dbeafe;
}

.status-success {
  color: #166534;
  background: #dcfce7;
}

.status-danger {
  color: #9f1239;
  background: #ffe4e6;
}

.status-neutral {
  color: #475467;
  background: #eef2f7;
}

.status-refund {
  color: #04786f;
  background: #ccfbf1;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  border-radius: .5rem;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(255, 248, 242, .96)),
    linear-gradient(135deg, rgba(225, 29, 72, .10), rgba(15, 159, 143, .10));
  box-shadow: var(--shadow-soft);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.mini-step {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}

.mini-step-icon {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: .5rem;
  color: var(--brand-strong);
  background: #fff1f2;
}

.empty-state {
  padding: 2.4rem 1rem;
  color: var(--app-muted);
  text-align: center;
}

.topup-flow {
  display: grid;
  max-width: 42rem;
  gap: 1rem;
  margin-inline: auto;
}

.topup-bank-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #cde8df;
  border-radius: .5rem;
  background:
    linear-gradient(135deg, rgba(236, 253, 245, .95), rgba(255, 255, 255, .96) 48%, rgba(255, 241, 242, .78)),
    #ffffff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .10);
}

.topup-bank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1rem .7rem;
  color: #111827;
  background: transparent;
}

.bank-head-kicker {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #047857;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.bank-head-title {
  margin-top: .15rem;
  color: #111827;
  font-size: 1.35rem;
  font-weight: 950;
}

.bank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  padding: .25rem .7rem;
  border: 1px solid rgba(4, 120, 87, .18);
  border-radius: .5rem;
  color: #047857;
  background: #ecfff6;
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.topup-bank-grid {
  display: grid;
  grid-template-columns: .9fr 1.35fr;
  gap: .75rem;
  padding: 0 1rem 1rem;
}

.topup-bank-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-width: 0;
  padding: .95rem;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: .5rem;
  background: rgba(255, 255, 255, .84);
}

.topup-bank-row + .topup-bank-row {
  border-top: 1px solid rgba(148, 163, 184, .28);
}

.topup-bank-row.is-number {
  border-color: rgba(225, 29, 72, .16);
  background: rgba(255, 248, 242, .9);
}

.bank-row-icon {
  display: inline-flex;
  width: 2.25rem;
  height: 2.25rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid #9af2cb;
  border-radius: .5rem;
  color: #047857;
  background: #eafff5;
}

.bank-row-label {
  color: #0f766e;
  font-size: .78rem;
  font-weight: 900;
}

.bank-row-value {
  color: #111827;
  font-size: 1rem;
  font-weight: 900;
  word-break: break-word;
}

.copy-account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 2rem;
  flex: 0 0 auto;
  padding: .35rem .65rem;
  border: 1px solid rgba(225, 29, 72, .22);
  border-radius: .5rem;
  color: var(--brand-strong);
  background: #fff1f2;
  font-size: .82rem;
  font-weight: 900;
}

.topup-stepper {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: start;
  gap: .55rem;
  padding: .85rem;
  border: 1px solid #d9e1ec;
  border-radius: .5rem;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

.topup-step {
  display: grid;
  justify-items: center;
  gap: .32rem;
  color: #44403c;
  text-align: center;
  font-size: .78rem;
  line-height: 1.2;
  padding: .35rem .25rem;
}

.topup-step span {
  display: inline-flex;
  min-width: 2.25rem;
  height: 1.85rem;
  padding: 0 .45rem;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9e1ec;
  border-radius: .5rem;
  color: #059669;
  background: #f8fafc;
  font-weight: 950;
}

.topup-step strong {
  font-weight: 900;
}

.topup-step small {
  color: #78716c;
  font-weight: 800;
}

.topup-step.is-done span,
.topup-step.is-active span {
  border-color: rgba(225, 29, 72, .20);
  color: var(--brand-strong);
  background: #fff1f2;
}

.step-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: .45rem;
  color: #a8a29e;
}

.topup-badges {
  display: grid;
  grid-template-columns: 1fr;
  gap: .65rem;
}

.topup-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.45rem;
  padding: .55rem .75rem;
  border-radius: .5rem;
  font-size: .85rem;
  font-weight: 900;
  text-align: center;
}

.badge-free {
  border: 1px solid #9af2cb;
  color: #047857;
  background: linear-gradient(135deg, #ecfff6, #ffffff);
}

.badge-min {
  border: 1px solid #facc15;
  color: #b45309;
  background: linear-gradient(135deg, #fffbeb, #ffffff);
}

.topup-upload-form {
  display: block;
}

.slip-upload-box {
  display: flex;
  min-height: 6.1rem;
  align-items: center;
  gap: 1rem;
  padding: 1.15rem;
  border: 1.5px dashed #cbd5e1;
  border-radius: .5rem;
  color: #111827;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .96), rgba(248, 250, 252, .96)),
    #ffffff;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.slip-upload-box:hover {
  border-color: rgba(225, 29, 72, .36);
  background: #fffafb;
  box-shadow: 0 12px 24px rgba(15, 23, 42, .06);
}

.upload-icon {
  display: inline-flex;
  width: 3rem;
  height: 3rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid #9af2cb;
  border-radius: .5rem;
  color: var(--brand-strong);
  background: #fff1f2;
}

.upload-copy {
  display: grid;
  min-width: 0;
  gap: .2rem;
}

.upload-copy strong {
  color: #111827;
  font-size: 1.05rem;
  font-weight: 950;
}

.upload-copy small {
  color: #9ca3af;
  font-weight: 750;
}

.topup-balance-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border: 1px solid #d9e1ec;
  border-radius: .5rem;
  background: linear-gradient(135deg, #ffffff, #fbfffd);
}

.topup-balance-strip span {
  display: block;
  color: #667085;
  font-size: .8rem;
  font-weight: 800;
}

.topup-balance-strip strong {
  color: var(--brand-strong);
  font-size: 1.15rem;
  font-weight: 950;
}

.topup-balance-strip a {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--brand-strong);
  font-size: .86rem;
  font-weight: 900;
  white-space: nowrap;
}

.footer {
  border-top: 1px solid rgba(217, 225, 236, .9);
  color: #667085;
  background: rgba(255, 255, 255, .75);
}

@media (max-width: 767px) {
  .page-head {
    display: block;
  }

  .page-title {
    font-size: 2rem;
  }

  .app-card,
  .auth-card {
    padding: 1rem;
  }

  .metric-card {
    min-height: auto;
  }

  .data-table {
    min-width: 720px;
  }

  .topup-flow {
    max-width: 100%;
  }

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

  .topup-stepper {
    grid-template-columns: 1fr;
    gap: .25rem;
    padding: .8rem .55rem;
  }

  .step-arrow {
    display: none;
  }

  .topup-step {
    justify-items: start;
    grid-template-columns: auto 1fr;
    column-gap: .75rem;
    font-size: .72rem;
    text-align: left;
  }

  .topup-step span {
    min-width: 2.1rem;
    width: auto;
    height: 1.75rem;
    grid-row: span 2;
  }

  .topup-badges {
    grid-template-columns: 1fr;
  }

  .topup-balance-strip {
    align-items: flex-start;
    flex-direction: column;
  }
}
