:root {
  --orange: #ff7500;
  --orange-deep: #e06000;
  --orange-soft: #fff1e6;
  --ink: #1a120c;
  --muted: #6b5e54;
  --line: #eadfd4;
  --surface: #ffffff;
  --bg: #f7f1eb;
  --ok: #0f7a45;
  --ok-soft: #e6f7ee;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(80, 40, 10, 0.08);
  font-family: Sora, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 12% -10%, rgba(255, 117, 0, 0.22), transparent 42%),
    radial-gradient(circle at 100% 0%, rgba(255, 180, 100, 0.18), transparent 36%),
    linear-gradient(180deg, #fff8f1 0%, var(--bg) 38%, #f3ebe3 100%);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(255, 117, 0, 0.12);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand img {
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(255, 117, 0, 0.28);
}

.brand-text {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--orange);
  text-transform: lowercase;
}

.topbar-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.shell {
  width: min(920px, calc(100% - 28px));
  margin: 22px auto 28px;
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(255, 117, 0, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 14px;
}

.hero {
  background:
    linear-gradient(145deg, #fff 0%, #fff7ef 55%, #ffe8d2 100%);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange-deep);
}

.hero-title {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-sub,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.amount-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

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

.amount-block {
  border-radius: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.amount-block.focus {
  background: var(--orange);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 24px rgba(255, 117, 0, 0.35);
}

.amount-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.amount-value {
  display: block;
  margin-top: 6px;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  tabular-nums: true;
  font-variant-numeric: tabular-nums;
}

.amount-value.sm {
  font-size: 1.25rem;
}

.amount-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  opacity: 0.9;
}

.retention-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--orange-soft);
  color: #7a3d00;
  font-size: 0.84rem;
  line-height: 1.45;
}

.breakdown {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.88rem;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.breakdown-row:last-child {
  border-bottom: 0;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.upload-grid {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.upload-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 14px;
  border: 1.5px dashed #d9b89a;
  background: #fffaf5;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-card:hover {
  border-color: var(--orange);
}

.upload-card.done {
  border-style: solid;
  border-color: #8fd0ad;
  background: var(--ok-soft);
}

.upload-card.busy {
  opacity: 0.7;
  pointer-events: none;
}

.upload-kind {
  font-weight: 700;
  font-size: 0.92rem;
}

.upload-status {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.upload-card.done .upload-status {
  color: var(--ok);
}

.upload-name {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.pay-form,
.gate-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(255, 117, 0, 0.35);
  border-color: var(--orange);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 8px 18px rgba(255, 117, 0, 0.28);
}

.btn.primary:hover {
  background: var(--orange-deep);
}

.btn.outline {
  background: #fff;
  color: var(--orange-deep);
  border: 1px solid rgba(255, 117, 0, 0.35);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.form-error,
.hint {
  min-height: 1.2em;
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
}

.state {
  text-align: center;
  padding: 36px 22px;
}

.state-logo {
  margin-bottom: 12px;
  border-radius: 14px;
}

.state-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 800;
}

.state-text {
  margin: 0 auto;
  max-width: 34ch;
  color: var(--muted);
}

.badge {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 800;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 3px solid #f0d4b8;
  border-top-color: var(--orange);
  animation: spin 0.8s linear infinite;
}

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

.batch-list {
  display: grid;
  gap: 6px;
  margin-top: 4px;
}

.batch-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 12px;
  text-align: left;
  border: 1px solid rgba(255, 117, 0, 0.14);
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.batch-card:hover {
  border-color: rgba(255, 117, 0, 0.4);
}

.batch-card strong {
  display: block;
  font-size: 0.86rem;
  line-height: 1.25;
}

.batch-card .meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.batch-card .ves {
  color: var(--orange-deep);
  font-weight: 800;
  font-size: 0.86rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

@media (min-width: 520px) {
  .kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kpi {
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.kpi strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.kpi span {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange-deep);
  font-size: 0.78rem;
  font-weight: 800;
  flex-shrink: 0;
}

.section-panel {
  padding: 10px 12px;
}

.section-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  padding: 4px 2px;
  margin: 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.section-toggle-text h2 {
  margin: 0;
  font-size: 0.95rem;
}

.section-toggle-text .muted {
  margin: 2px 0 0;
  font-size: 0.75rem;
}

.section-toggle .chev {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--orange-soft);
  position: relative;
  flex-shrink: 0;
}

.section-toggle .chev::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-right: 2px solid var(--orange-deep);
  border-bottom: 2px solid var(--orange-deep);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.section-panel.collapsed .section-toggle .chev::before {
  transform: rotate(-45deg);
  top: 7px;
}

.section-panel.collapsed .section-body {
  display: none;
}

.section-body {
  margin-top: 8px;
}

.order-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

@media (min-width: 720px) {
  .order-list {
    grid-template-columns: 1fr 1fr;
  }

  .order-list .order-row:nth-child(odd) {
    border-right: 1px solid var(--line);
  }
}

.order-row {
  display: block;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.order-list .order-row:last-child {
  border-bottom: 0;
}

@media (min-width: 720px) {
  .order-list .order-row:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

.order-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  min-height: 36px;
}

.order-row-main strong {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-row-main .amt {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--orange-deep);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.order-row-main .row-chev {
  width: 14px;
  height: 14px;
  position: relative;
  opacity: 0.55;
}

.order-row-main .row-chev::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(45deg);
  transition: transform 0.12s ease;
}

.order-row.open .order-row-main .row-chev::before {
  transform: rotate(-135deg);
  top: 5px;
}

.order-row-detail {
  display: none;
  padding: 0 10px 8px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.order-row.open .order-row-detail {
  display: block;
}

.order-row.open {
  background: #fff7f0;
}

.empty-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-chip {
  display: inline-block;
  margin: 16px 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange-deep);
  font-weight: 700;
  font-size: 0.9rem;
}

.back-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  margin: 0 0 10px;
  padding: 0;
  cursor: pointer;
}

.footer {
  text-align: center;
  padding: 8px 16px 28px;
  color: var(--muted);
  font-size: 0.78rem;
}
