:root {
  color-scheme: dark;
  --ink: #f3efe6;
  --muted: #b0a99a;
  --faint: #7a7468;
  --bg: #0c0e14;
  --panel: #161a24;
  --panel-2: #1c2230;
  --line: rgba(243, 239, 230, 0.1);
  --gold: #f0b74a;
  --gold-2: #c88820;
  --gold-soft: rgba(240, 183, 74, 0.18);
  --danger: #ff7a7a;
  --ok: #74d4a0;
  --warn: #f0b74a;
  --display: "Fraunces", Georgia, serif;
  --sans: "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body.is-app #loginView,
body.is-login #appView {
  display: none !important;
}

body.is-login #loginView,
body.is-app #appView {
  display: grid !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: var(--sans);
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 183, 74, 0.35) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(240, 183, 74, 0.28);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(240, 183, 74, 0.48);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

.stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(160deg, #0b0d13 0%, #121722 48%, #0a0c11 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.72;
  animation: drift 16s ease-in-out infinite alternate;
}

.orb-a {
  width: 52vw;
  height: 52vw;
  top: -18%;
  left: -14%;
  background: radial-gradient(circle, rgba(240, 183, 74, 0.34), transparent 68%);
}

.orb-b {
  width: 38vw;
  height: 38vw;
  top: 18%;
  right: -12%;
  background: radial-gradient(circle, rgba(88, 120, 200, 0.24), transparent 70%);
  animation-delay: -5s;
}

.orb-c {
  width: 42vw;
  height: 34vw;
  bottom: -16%;
  left: 28%;
  background: radial-gradient(circle, rgba(240, 140, 70, 0.14), transparent 70%);
  animation-delay: -9s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(2%, 3%, 0) scale(1.05); }
}

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

.shell {
  width: min(980px, calc(100% - 28px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.login-shell {
  width: min(400px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.login-card,
.order {
  background: rgba(22, 26, 36, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  backdrop-filter: blur(18px);
}

.login-card {
  width: 100%;
  padding: 30px 28px 26px;
  display: grid;
  gap: 0;
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 1px 0 rgba(240, 183, 74, 0.08) inset;
  animation: enter 0.55s ease both;
}

.login-brand {
  margin-bottom: 26px;
}

.login-actions {
  display: grid;
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid rgba(243, 239, 230, 0.08);
}

.login-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  box-shadow:
    0 0 0 1px rgba(255, 229, 154, 0.25),
    0 8px 24px rgba(240, 183, 74, 0.28),
    0 0 36px rgba(240, 183, 74, 0.22);
  flex-shrink: 0;
}

.login-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  background: linear-gradient(180deg, #fff8ea 0%, #f3efe6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.login-brand span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  margin-top: 4px;
  letter-spacing: 0.01em;
}

.brand span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 3px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  line-height: 1;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #1a1204;
}

.btn.sso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  height: 52px;
  min-height: 52px;
  padding: 0 20px;
  line-height: 1;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffe08a 0%, #f0b74a 45%, #c88820 100%);
  color: #1a1204;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  box-shadow:
    0 16px 36px rgba(200, 136, 32, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 -1px 0 rgba(120, 70, 10, 0.2) inset;
}

.btn.sso:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow:
    0 18px 40px rgba(200, 136, 32, 0.4),
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 -1px 0 rgba(120, 70, 10, 0.2) inset;
}

.btn.sso:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.login-note {
  margin: 0 auto;
  max-width: 16.5rem;
  text-align: center;
  color: #6f695e;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: 0.01em;
}

.login-card .error {
  margin-bottom: 14px;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  border-color: rgba(240, 183, 74, 0.35);
  background: rgba(240, 183, 74, 0.06);
}

.btn.ok {
  background: rgba(116, 212, 160, 0.16);
  color: var(--ok);
  border: 1px solid rgba(116, 212, 160, 0.28);
}

.btn.warn {
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid rgba(240, 183, 74, 0.35);
}

.btn.danger {
  background: rgba(255, 122, 122, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 122, 122, 0.28);
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.password-box {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.password-box summary {
  cursor: pointer;
  color: var(--faint);
  font-size: 0.86rem;
  margin-bottom: 12px;
  list-style: none;
}

.password-box summary::-webkit-details-marker { display: none; }

.password-box form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.field input {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  padding: 0 14px;
  font: inherit;
}

.field input:focus {
  outline: none;
  border-color: rgba(240, 183, 74, 0.55);
  box-shadow: 0 0 0 4px var(--gold-soft);
}

.error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 122, 122, 0.1);
  border: 1px solid rgba(255, 122, 122, 0.28);
  color: var(--danger);
  font-size: 0.9rem;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  animation: enter 0.45s ease both;
}

.top .brand img {
  border-radius: 9px;
  box-shadow: 0 0 20px rgba(240, 183, 74, 0.28);
}

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

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(22, 26, 36, 0.65);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  border-color: rgba(240, 183, 74, 0.3);
  color: var(--ink);
}

.chip.active {
  color: #1a1204;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  border-color: transparent;
  font-weight: 600;
}

.meta {
  color: var(--faint);
  font-size: 0.85rem;
  margin: 0 0 12px;
}

.orders {
  display: grid;
  gap: 12px;
}

.order {
  padding: 16px 16px 14px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.order:hover {
  border-color: rgba(240, 183, 74, 0.22);
}

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

.order-id {
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--faint);
  word-break: break-all;
}

.amount {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.badge.paid {
  color: var(--ok);
  border-color: rgba(116, 212, 160, 0.35);
  background: rgba(116, 212, 160, 0.1);
}

.badge.await {
  color: var(--warn);
  border-color: rgba(240, 183, 74, 0.35);
  background: var(--gold-soft);
}

.badge.done {
  color: var(--ok);
  border-color: rgba(116, 212, 160, 0.35);
  background: rgba(116, 212, 160, 0.1);
}

.badge.bad {
  color: var(--danger);
  border-color: rgba(255, 122, 122, 0.35);
  background: rgba(255, 122, 122, 0.1);
}

.grid {
  display: grid;
  gap: 4px 16px;
  grid-template-columns: auto 1fr;
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.grid dt {
  color: var(--faint);
}

.grid dd {
  margin: 0;
  word-break: break-word;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.actions .btn {
  height: 40px;
  min-height: 40px;
  padding: 0 14px;
  line-height: 1;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 12px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(22, 26, 36, 0.45);
}

@media (max-width: 640px) {
  .top {
    flex-direction: column;
    align-items: stretch;
  }
  .top-actions {
    width: 100%;
  }
  .top-actions .btn {
    flex: 1;
  }
  .login-brand strong {
    font-size: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .login-card, .top { animation: none; }
  .btn.sso:hover { transform: none; }
}
