:root {
  --bg: #e5ece7;
  --hero-start: #0ea5e9;
  --hero-end: #0f766e;
  --panel: #ffffff;
  --panel-border: #d7e1dc;
  --text: #0f172a;
  --muted: #5b6470;
  --accent: #0ea5e9;
  --accent-strong: #0f766e;
  --error: #dc2626;
  --success: #16a34a;
  --shadow: 0 25px 60px rgba(4, 13, 32, 0.16);
  --radius: 22px;
  --font: "Space Grotesk", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: radial-gradient(circle at 18% 20%, rgba(14, 165, 233, 0.08), transparent 32%),
    radial-gradient(circle at 82% 0%, rgba(15, 118, 110, 0.09), transparent 30%),
    linear-gradient(180deg, #f1f5f9, #e5ece7 50%, #e6efe9);
  color: var(--text);
  min-height: 100vh;
}

.page {
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: 56px 0 96px;
  display: grid;
  gap: 28px;
}

.hero {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.12), transparent 32%),
    linear-gradient(120deg, var(--hero-start), #0f8f99, var(--hero-end));
  border-radius: 30px;
  padding: 40px 44px;
  color: #f8fafc;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.hero__pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(32px, 4vw, 46px);
  margin: 0;
  letter-spacing: -0.02em;
}

.hero h1 span {
  display: block;
}

.hero p {
  margin: 0;
  color: rgba(248, 250, 252, 0.88);
  max-width: 720px;
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero__field {
  display: grid;
  gap: 6px;
  min-width: 260px;
  flex: 1 1 320px;
}

.hero__label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(248, 250, 252, 0.88);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel__header h2 {
  margin: 6px 0 6px;
  font-size: 26px;
}

.badge {
  padding: 10px 14px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--accent-strong);
  margin: 0;
}

.lede {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  max-width: 820px;
}

.form {
  display: grid;
  gap: 18px;
}

.table {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
}

.table__head,
.item-row {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr 0.9fr 0.7fr 60px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.table__head {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
  border-bottom: 1px solid var(--panel-border);
}

.table__body {
  display: grid;
  gap: 0;
}

.item-row {
  border-bottom: 1px solid var(--panel-border);
  background: #ffffff;
}

.item-row:last-child {
  border-bottom: none;
}

.select,
.input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid #d5dde4;
  background: #ffffff;
  color: var(--text);
  font-size: 15px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.select:focus,
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

.item-row button {
  border: none;
  background: transparent;
  color: #c2410c;
  font-weight: 700;
  cursor: pointer;
  padding: 10px;
  border-radius: 10px;
  transition: background 120ms ease, color 120ms ease;
}

.item-row button:hover {
  background: #fff1e6;
  color: #9a3412;
}

.code-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: #eef2ff;
  color: #312e81;
  font-weight: 700;
  font-size: 13px;
  border: 1px solid #cbd5e1;
  min-width: 120px;
}

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

.actions--between {
  justify-content: space-between;
}

.actions--end {
  justify-content: flex-end;
}

.right-actions {
  display: flex;
  gap: 12px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
  text-decoration: none;
  color: inherit;
}

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

.btn.primary {
  background: linear-gradient(120deg, var(--accent-strong), var(--accent));
  color: #f8fafc;
  box-shadow: 0 10px 30px rgba(15, 136, 156, 0.28);
}

.btn.ghost {
  background: transparent;
  border-color: #cbd5e1;
  color: var(--text);
}

.btn:hover {
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.15);
}

.status {
  min-height: 24px;
  font-weight: 700;
  font-size: 14px;
}

.status.pending {
  color: #64748b;
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--error);
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: color-mix(in srgb, var(--text) 55%, transparent);
  z-index: 999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal__card {
  width: min(1120px, 96vw);
  max-height: calc(100dvh - 32px);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  padding: 0;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 14px;
  border-bottom: 1px solid var(--panel-border);
}

.modal__card h3 {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  letter-spacing: -0.02em;
}

.modal__close {
  border: 1px solid #b9c8d6;
  border-radius: 16px;
  width: 46px;
  height: 46px;
  background: #e8eff5;
  color: #6b7280;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.modal__close:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}

.modal__text {
  margin: 0;
  padding: 18px 24px 0;
  color: var(--muted);
  font-size: clamp(18px, 2.2vw, 30px);
  font-weight: 600;
}

.modal__text--center {
  text-align: center;
}

.confirm-table {
  margin: 18px 24px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
}

.confirm-table__head,
.confirm-table__row {
  display: grid;
  grid-template-columns: 1.2fr 2fr 0.9fr 1.2fr;
  gap: 12px;
  padding: 14px 16px;
  align-items: center;
}

.confirm-table__head {
  background: #f1f5f9;
  border-bottom: 1px solid var(--panel-border);
  font-size: clamp(16px, 1.8vw, 24px);
  font-weight: 700;
}

.confirm-table__body {
  display: grid;
}

.confirm-table__row {
  font-size: clamp(15px, 1.7vw, 22px);
  border-bottom: 1px solid var(--panel-border);
}

.confirm-table__row:last-child {
  border-bottom: none;
}

.confirm-table__total {
  background: #f8fafc;
  font-weight: 700;
}

.confirm-table__total-label {
  grid-column: 1 / span 3;
}

.confirm-check {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text);
  font-weight: 500;
  margin: 0 24px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 18px 16px;
  font-size: clamp(16px, 2vw, 28px);
}

.confirm-check input {
  margin-top: 0;
  width: 24px;
  height: 24px;
  accent-color: var(--accent);
}

.modal__actions {
  padding: 16px 24px 22px;
}

.modal__actions .btn {
  min-width: 215px;
  font-size: clamp(16px, 1.9vw, 28px);
  padding: 15px 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 920px) {
  .modal {
    place-items: start center;
    padding: 10px;
  }

  .modal__card {
    width: min(1120px, 100%);
    max-height: calc(100dvh - 20px);
  }

  .table__head,
  .item-row {
    grid-template-columns: 1fr;
  }

  .item-row button {
    width: fit-content;
  }

  .actions--between {
    flex-direction: column;
    align-items: stretch;
  }

  .right-actions,
  .hero__actions {
    flex-direction: column;
    width: 100%;
  }

  .actions--end {
    align-items: stretch;
  }

  .modal__card h3 {
    font-size: 32px;
  }

  .modal__text {
    font-size: 18px;
  }

  .confirm-table__head,
  .confirm-table__row {
    grid-template-columns: 1fr;
    font-size: 16px;
  }

  .confirm-check {
    font-size: 18px;
    align-items: flex-start;
  }

  .modal__actions .btn {
    min-width: 0;
    width: 100%;
    font-size: 18px;
  }

  .hero__field {
    min-width: unset;
    width: 100%;
  }

  .btn,
  #add-row {
    width: 100%;
    text-align: center;
  }

  .code-pill {
    width: 100%;
  }
}
