:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #1d4ed8;
  --primary-dark: #183b8f;
  --success: #0f766e;
  --danger: #b42318;
  --warning: #b45309;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button,
a,
.drop-zone {
  cursor: pointer;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  padding: 0 18px;
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

button:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.22);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.secondary {
  background: #e8eef8;
  color: var(--primary-dark);
}

button.secondary:hover:not(:disabled) {
  background: #dbe7fb;
  box-shadow: none;
}

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

button.small {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
}

input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.28);
  outline-offset: 2px;
}

a {
  color: var(--primary);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.agent-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.agent-panel,
.login-card {
  width: min(100%, 560px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 44px);
}

.agent-panel h1,
.login-card h1,
.dashboard-header h1 {
  margin: 10px 0 12px;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.lede {
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 28px;
}

.topline {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

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

.quote-form {
  display: grid;
  gap: 14px;
}

.form-section,
.quote-summary {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-section h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.identity-grid label,
.settings-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.participant-list,
.hotel-list {
  display: grid;
  gap: 8px;
}

.participant-row,
.hotel-option,
.terms-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.participant-row input,
.hotel-option input,
.terms-line input {
  width: 18px;
  min-height: 18px;
}

.participant-row small,
.hotel-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.hotel-disabled {
  color: var(--muted);
  background: #f1f5f9;
}

.quote-summary {
  grid-template-columns: 1fr;
}

.quote-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 34px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.form-message {
  min-height: 24px;
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.form-message[data-type="success"] {
  color: var(--success);
}

.form-message[data-type="error"] {
  color: var(--danger);
}

.agent-footer {
  position: fixed;
  right: 24px;
  bottom: 18px;
}

.dashboard-body {
  background: #eef3f9;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 10px;
}

.dashboard {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.dashboard-header h1 {
  font-size: clamp(28px, 4vw, 42px);
}

.header-actions,
.actions-cell,
.table-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.refresh-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.metrics-grid,
.csv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

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

.settings-panel {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.accounting-box {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.accounting-box strong {
  color: var(--text);
}

.metric,
.drop-zone,
.payment-panel,
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric {
  padding: 16px;
}

.metric span,
.panel-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.drop-zone {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: var(--panel-soft);
  border-style: dashed;
}

.drop-zone.dragging {
  border-color: var(--primary);
  background: #eff6ff;
}

.drop-zone input {
  display: none;
}

.drop-title {
  font-weight: 800;
}

.payment-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

.payment-panel a {
  display: block;
  max-width: min(900px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  overflow: hidden;
}

.table-toolbar {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.table-toolbar input {
  max-width: 380px;
}

.table-toolbar select {
  max-width: 220px;
}

.responsive-table {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

th,
td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  background: #fbfdff;
}

tbody tr:hover {
  background: #f8fbff;
}

td strong,
.subtle {
  display: block;
}

.subtle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
  background: #edf2f7;
  color: #334155;
}

.badge-pending,
.badge-neutral {
  background: #edf2f7;
  color: #334155;
}

.badge-eligible,
.badge-paid {
  background: #dcfce7;
  color: #166534;
}

.badge-not_eligible {
  background: #fee2e2;
  color: #991b1b;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .dashboard {
    padding: 14px;
  }

  .dashboard-header,
  .payment-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions,
  .table-toolbar,
  .inline-form,
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .metrics-grid,
  .csv-grid,
  .identity-grid,
  .settings-panel {
    grid-template-columns: 1fr;
  }

  .accounting-box {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    white-space: normal;
  }

  .table-toolbar input,
  .table-toolbar select,
  .payment-panel a {
    max-width: 100%;
  }

  .agent-footer {
    position: static;
    margin-top: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
