:root {
  --bg: #0f1419;
  --surface: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --shadow: 0 0 20px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --status-0: #eab308;
  --status-1: #3b82f6;
  --status-2: #22c55e;
  --status-3: #9ca3af;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1e2a3a 0%, transparent 50%),
    radial-gradient(900px 500px at 100% 0%, #162032 0%, transparent 45%), var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.header {
  border-bottom: 1px solid var(--border);
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 1rem;
}

.title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 0.75rem;
}

.muted {
  font-size: 0.8125rem;
  color: var(--muted);
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--text);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.25rem;
}

.state {
  text-align: center;
  padding: 2rem 1rem;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--muted);
}

.state-error {
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, 0.15);
  color: #fecaca;
  font-weight: 600;
}

.state-loading {
  border-style: solid;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%;
  align-items: start;
}

@media (max-width: 1100px) {
  .card-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 800px) {
  .card-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .card-list {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  color: var(--text);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 4px solid var(--status-accent, var(--muted));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.card.card--new {
  animation: cardIn 0.45s ease;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card[data-status="0"] {
  --status-accent: var(--status-0);
}
.card[data-status="1"] {
  --status-accent: var(--status-1);
}
.card[data-status="2"] {
  --status-accent: var(--status-2);
}
.card[data-status="3"] {
  --status-accent: var(--status-3);
}

.card-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.card-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  width: 100%;
}

.status {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--status-accent) 28%, #0f172a);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--status-accent) 50%, transparent);
  align-self: flex-start;
}

.card-body {
  font-size: 0.9rem;
}

.card-body .line {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  margin: 0 0 0.85rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}

.card-body .line:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.card-body .line--pay .js-pay-line {
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
}

.card-body b {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mono {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.btn {
  flex: 1 1 calc(33.333% - 0.45rem);
  min-width: 5.5rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease, opacity 0.12s;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.06);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-ready {
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  color: #eff6ff;
  border-color: rgba(96, 165, 250, 0.5);
}

.btn-onway {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #1c1917;
  border-color: rgba(251, 191, 36, 0.45);
}

.btn-delivered {
  background: linear-gradient(180deg, #4ade80 0%, #16a34a 100%);
  color: #052e16;
  border-color: rgba(34, 197, 94, 0.45);
}

.btn--passive {
  filter: grayscale(0.35);
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.96);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  max-width: min(90vw, 360px);
  text-align: center;
}

@media (max-width: 520px) {
  .card-actions {
    flex-direction: column;
  }

  .btn {
    flex: 1 1 auto;
    width: 100%;
  }
}
