:root {
  --app-bg: #0a0a0c;
  --surface-1: #111114;
  --surface-2: #16161c;
  --surface-3: #1d1d26;

  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);

  --text-main: #f5f5f7;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;

  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-soft: rgba(245, 158, 11, 0.12);

  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at 0% 0%, rgba(245, 158, 11, 0.09), transparent 36%),
    radial-gradient(circle at 100% 100%, rgba(16, 185, 129, 0.05), transparent 42%),
    var(--app-bg);
  color: var(--text-main);
  font-family: "Poppins", sans-serif;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.bg-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(86px);
  opacity: 0.14;
  z-index: 0;
}

.bg-orb-a {
  width: 300px;
  height: 300px;
  top: -140px;
  left: -120px;
  background: rgba(245, 158, 11, 0.5);
}

.bg-orb-b {
  width: 340px;
  height: 340px;
  right: -130px;
  bottom: -170px;
  background: rgba(16, 185, 129, 0.34);
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.spin {
  animation: spin 0.9s linear infinite;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(10, 10, 12, 0.78);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.36);
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "Belleza", cursive;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.4px;
}

.brand-mark-lg {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  font-size: 1.35rem;
}

.brand-text {
  min-width: 0;
}

.brand-eyebrow {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand-title {
  margin: 1px 0 0;
  font-family: "Belleza", cursive;
  font-size: clamp(1.12rem, 4.2vw, 2.2rem);
  line-height: 1.05;
  color: #fff;
}

.topbar-actions {
  width: 100%;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 6px;
}

.btn {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-main);
  padding: 0 10px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.14s ease;
}

.btn:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: #20202a;
}

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

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

.btn-label {
  white-space: nowrap;
}

.btn-primary {
  background: #1b2636;
  border-color: #2d4b74;
}

.btn-primary:hover {
  background: #22334d;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line);
}

.btn-danger {
  color: #fda4af;
  background: #281217;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: #35171f;
}

.btn-accent {
  color: #221403;
  border-color: rgba(251, 191, 36, 0.45);
  background: linear-gradient(145deg, var(--accent), var(--accent-hover));
}

.btn-accent:hover {
  filter: brightness(1.03);
}

.btn-lg {
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

.btn-inline {
  height: 34px;
  font-size: 0.76rem;
  padding: 0 10px;
  text-decoration: none;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 10px 34px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.02), transparent 52%), var(--surface-1);
  box-shadow: var(--shadow-md);
  padding: 12px;
}

.toolbar {
  margin-top: 6px;
}

.toolbar-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
}

.field label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field-control {
  position: relative;
}

.field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-subtle);
}

select,
input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 0 12px;
  background: var(--surface-2);
  color: var(--text-main);
  font: inherit;
  outline: none;
}

.field-control select {
  padding-left: 36px;
}

select:focus,
input:focus {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.tabs {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
}

.tab-btn {
  height: 38px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--text-main);
  background: var(--accent-soft);
  border-color: rgba(245, 158, 11, 0.42);
}

.stats-band {
  margin-top: 14px;
  display: grid;
  gap: 18px;
}

.stats-group {
  display: grid;
  gap: 10px;
}

.section-label {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.cards {
  display: grid;
  gap: 10px;
}

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

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

.balancing-summary {
  margin-bottom: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-sm);
  padding: 12px;
  min-width: 0;
}

.card-stat-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.card-stat-value {
  margin-top: 8px;
  display: block;
  color: #fff;
  font-size: 1.18rem;
  line-height: 1.1;
  font-weight: 700;
}

.card-status {
  padding: 14px;
}

.card-success {
  border-left: 3px solid var(--ok);
  background: linear-gradient(150deg, var(--ok-soft), transparent 52%), var(--surface-2);
}

.card-warning {
  border-left: 3px solid var(--warn);
  background: linear-gradient(150deg, var(--warn-soft), transparent 52%), var(--surface-2);
}

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

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

.card-value {
  margin: 8px 0 0;
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 700;
}

.card-hint {
  margin: 8px 0 0;
  font-size: 0.73rem;
  color: var(--text-muted);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-head-compact {
  margin-bottom: 8px;
}

.panel-title {
  margin: 0;
  font-family: "Belleza", cursive;
  font-size: 1.18rem;
  color: #fff;
}

.panel-title-sm {
  font-size: 1.02rem;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.pill {
  height: 28px;
  border-radius: var(--r-pill);
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--line-strong);
}

.pill-muted {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
}

.table-panel {
  margin-top: 14px;
}

.table-panel-inner {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(0, 0, 0, 0.16);
  padding: 10px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-1);
}

.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #2a2a35;
  border-radius: 999px;
}

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

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 0.78rem;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #d1d5db;
  background: var(--surface-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.66rem;
}

.data-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.012);
}

.data-table tbody tr:nth-child(even) {
  background: rgba(17, 185, 129, 0.07);
}

.data-table tbody tr:hover td {
  background: rgba(245, 158, 11, 0.07);
}

.data-table tbody tr[data-record-index] {
  cursor: pointer;
}

.c-time,
.bal-order-time,
.c-paid,
.c-fee,
.c-base,
.bal-amount {
  font-variant-numeric: tabular-nums;
}

.t-right,
.c-paid,
.c-fee,
.c-base,
.bal-amount {
  text-align: right !important;
}

.t-center,
.c-status,
.bal-no,
.bal-diff {
  text-align: center !important;
}

.balancing-table {
  min-width: 1100px;
}

.balancing-table td {
  white-space: normal;
  word-break: break-word;
}

.balancing-table .bal-no {
  min-width: 52px;
}

.balancing-table .bal-order-time {
  min-width: 122px;
}

.balancing-table .bal-customer {
  min-width: 136px;
}

.balancing-table .bal-amount {
  min-width: 110px;
}

.balancing-table .bal-bca-data {
  min-width: 220px;
  font-size: 0.75rem;
  color: #e5e7eb;
}

.balancing-table .bal-status {
  min-width: 128px;
}

.balancing-table .bal-diff {
  min-width: 96px;
}

.balancing-table .bal-reason {
  min-width: 220px;
}

.balancing-table .bal-action-cell {
  min-width: 164px;
}

.action-bar {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.02);
  padding: 12px;
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.action-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.bal-actions {
  display: grid;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulseDot 1.8s infinite;
}

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.25); }
  70% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.badge-ok {
  color: #7cf0c1;
  background: var(--ok-soft);
  border-color: rgba(16, 185, 129, 0.34);
}

.badge-warn {
  color: #facc73;
  background: var(--warn-soft);
  border-color: rgba(245, 158, 11, 0.34);
}

.badge-danger {
  color: #fda4af;
  background: var(--danger-soft);
  border-color: rgba(239, 68, 68, 0.34);
}

.terminal-block {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #0a1016;
  overflow: hidden;
}

.terminal-head {
  min-height: 36px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #101824;
}

.terminal-dots {
  display: inline-flex;
  gap: 6px;
}

.terminal-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.terminal-dots span:nth-child(1) { background: #ef4444; }
.terminal-dots span:nth-child(2) { background: #f59e0b; }
.terminal-dots span:nth-child(3) { background: #10b981; }

.terminal-title {
  font-size: 0.76rem;
  color: #cbd5e1;
  font-weight: 600;
}

.terminal-note {
  font-size: 0.68rem;
  color: var(--text-subtle);
}

.terminal-body {
  margin: 0;
  min-height: 130px;
  max-height: 280px;
  overflow: auto;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  color: #dcfce7;
}

.screenshots-block {
  margin-top: 12px;
}

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

.shot-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  text-decoration: none;
}

.shot-item img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.shot-meta {
  display: block;
  padding: 6px 8px;
  color: var(--text-muted);
  font-size: 0.66rem;
}

.shot-empty {
  margin: 0;
  grid-column: 1 / -1;
  color: var(--text-muted);
  font-size: 0.74rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  margin: 2.5vh auto;
  width: min(94vw, 980px);
  max-height: 95vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface-1);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.18s ease-out;
}

.modal-card-sm {
  width: min(94vw, 460px);
}

.modal-card-md {
  width: min(95vw, 980px);
}

.modal-card-lg {
  width: min(97vw, 1280px);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.98) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.modal-body {
  padding: 16px;
}

.modal-title {
  margin: 0;
  font-family: "Belleza", cursive;
  font-size: 1.28rem;
  color: #fff;
}

.modal-subtitle {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

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

.form-stack {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.form-field label {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-error {
  margin: 8px 0 0;
  min-height: 18px;
  color: #fda4af;
  font-size: 0.76rem;
}

.detail-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.detail-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  padding: 9px 10px;
  display: grid;
  grid-template-columns: minmax(96px, 35%) 1fr;
  gap: 8px;
}

.detail-row .k {
  color: var(--text-muted);
  font-size: 0.74rem;
}

.detail-row .v {
  text-align: right;
  font-size: 0.84rem;
  color: #fff;
  word-break: break-word;
}

.proof-wrap {
  margin-top: 12px;
}

.proof-wrap img,
.proof-preview-frame img {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #000;
}

.proof-preview-frame {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #000;
  padding: 8px;
}

@media (min-width: 640px) {
  .container {
    padding: 14px 12px 36px;
  }

  .topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
  }

  .topbar-actions {
    width: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .btn {
    height: 40px;
  }

  .toolbar-row {
    grid-template-columns: minmax(250px, 1fr) auto;
    align-items: end;
  }

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

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

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

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

  .bal-actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    max-width: 900px;
  }

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

@media (min-width: 1024px) {
  .container {
    max-width: 1400px;
    padding: 18px 16px 40px;
  }

  .panel {
    padding: 20px;
  }

  .toolbar-row {
    grid-template-columns: minmax(280px, 360px) 1fr;
    align-items: center;
  }

  .meta {
    text-align: right;
    justify-self: end;
    max-width: 680px;
  }

  .data-table {
    min-width: 0;
  }

  .balancing-table {
    min-width: 0;
  }

  .balancing-table .bal-bca-data {
    min-width: 250px;
  }

  .balancing-table .bal-reason {
    min-width: 260px;
  }

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

  .shot-item img {
    height: 156px;
  }
}

@media (min-width: 1440px) {
  .container {
    padding-left: 24px;
    padding-right: 24px;
  }

  .topbar-inner {
    padding-left: 24px;
    padding-right: 24px;
  }
}
