:root {
  --red: #d71920;
  --red-deep: #a80f15;
  --red-soft: #fff0f0;
  --ink: #18181b;
  --muted: #6f7279;
  --line: #e7e4e1;
  --paper: #fffdfb;
  --warm: #f4f0ec;
  --green: #18794e;
  --green-soft: #e9f7f0;
  --amber: #9a5a00;
  --amber-soft: #fff5df;
  --shadow: 0 24px 70px rgba(58, 34, 24, 0.12);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--warm);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(215, 25, 32, 0.08), transparent 34%),
    linear-gradient(145deg, #f7f3ef 0%, #efe9e3 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(4px);
  pointer-events: none;
}

.ambient-one {
  width: 320px;
  height: 320px;
  top: -120px;
  right: -80px;
  background: rgba(215, 25, 32, 0.09);
}

.ambient-two {
  width: 220px;
  height: 220px;
  bottom: 8%;
  left: -110px;
  background: rgba(24, 24, 27, 0.05);
}

.login-layout {
  width: min(1120px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  align-items: center;
  gap: clamp(48px, 8vw, 110px);
  padding: 56px 0;
}

.login-story h1,
.dashboard-heading h1 {
  margin: 10px 0 18px;
  font-size: clamp(2.4rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
  max-width: 800px;
}

.dashboard-heading h1 {
  font-size: clamp(2.2rem, 4vw, 4.2rem);
}

.lead {
  margin: 0;
  max-width: 620px;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  color: var(--muted);
  line-height: 1.65;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--red);
  box-shadow: 0 8px 22px rgba(215, 25, 32, 0.28);
  font-size: 1.35rem;
}

.brand-small .brand-mark {
  width: 36px;
  height: 36px;
  font-size: 1rem;
}

.eyebrow {
  margin: 40px 0 0;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.safety-note {
  margin-top: 34px;
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(24, 121, 78, 0.17);
  border-radius: 999px;
  color: var(--green);
  background: rgba(233, 247, 240, 0.75);
  font-size: 0.9rem;
  font-weight: 700;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(24, 121, 78, 0.12);
}

.login-card,
.panel {
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  background: rgba(255, 253, 251, 0.93);
  box-shadow: var(--shadow);
}

.login-card {
  padding: clamp(28px, 4vw, 46px);
}

.login-card .eyebrow {
  margin-top: 0;
}

.login-card h2,
.panel h2 {
  margin: 8px 0;
  font-size: 1.65rem;
  letter-spacing: -0.035em;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.form-stack {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 780;
  color: #343439;
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  min-height: 104px;
  padding-top: 12px;
  padding-bottom: 12px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(215, 25, 32, 0.09);
}

.button {
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  font-weight: 820;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-primary {
  color: white;
  background: var(--red);
  box-shadow: 0 10px 24px rgba(215, 25, 32, 0.2);
}

.button-primary:hover:not(:disabled) {
  background: var(--red-deep);
}

.button-dark {
  color: white;
  background: var(--ink);
}

.button-ghost {
  min-height: 40px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
}

.button-wide {
  width: 100%;
  margin-top: 4px;
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--red-deep);
  font-size: 0.84rem;
  font-weight: 650;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid rgba(231, 228, 225, 0.9);
  background: rgba(255, 253, 251, 0.9);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.account-menu {
  display: flex;
  align-items: center;
  gap: 18px;
}

.account-copy {
  display: grid;
  text-align: right;
}

.account-copy span {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: capitalize;
}

.mode-banner {
  width: min(1180px, calc(100% - 40px));
  margin: 18px auto 0;
  padding: 12px 16px;
  border: 1px solid #f0d9a7;
  border-radius: 14px;
  color: #765011;
  background: rgba(255, 245, 223, 0.92);
  font-size: 0.88rem;
}

.mode-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 4px 8px;
  border-radius: 7px;
  color: white;
  background: var(--amber);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mode-banner.mode-real {
  border-color: rgba(215, 25, 32, 0.28);
  color: var(--red-deep);
  background: rgba(255, 240, 240, 0.96);
}

.mode-banner.mode-real .mode-badge {
  background: var(--red);
}

.dashboard {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 90px;
}

.dashboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 36px;
}

.dashboard-heading .eyebrow {
  margin-top: 0;
}

.balance-grid,
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

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

.balance-card,
.metric-card {
  min-height: 176px;
  display: grid;
  align-content: space-between;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 251, 0.88);
}

.balance-primary {
  color: white;
  border-color: var(--red);
  background: linear-gradient(135deg, var(--red), #b90e15);
  box-shadow: 0 18px 45px rgba(215, 25, 32, 0.2);
}

.balance-card span,
.metric-card span {
  font-size: 0.82rem;
  font-weight: 760;
  opacity: 0.78;
}

.balance-card strong,
.metric-card strong {
  margin-top: 20px;
  font-size: clamp(2rem, 4vw, 3.25rem);
  letter-spacing: -0.06em;
}

.balance-card small {
  opacity: 0.7;
}

.panel {
  margin-top: 24px;
  padding: clamp(22px, 3vw, 34px);
  box-shadow: 0 14px 46px rgba(58, 34, 24, 0.07);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.panel-heading > div {
  display: flex;
  align-items: center;
  gap: 13px;
}

.panel-heading h2 {
  margin: 0;
}

.panel-heading p {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

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

.step-number {
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 0.78rem;
  font-weight: 900;
}

.phone-field {
  max-width: 420px;
  position: relative;
}

.phone-field input {
  padding-left: 74px;
  font-size: 1.1rem;
  font-weight: 760;
  letter-spacing: 0.04em;
}

.input-prefix {
  position: absolute;
  left: 14px;
  bottom: 15px;
  color: var(--muted);
  font-weight: 760;
}

.offer-heading {
  margin-top: 38px;
}

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

.offer-card {
  min-height: 166px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  background: white;
  text-align: left;
}

.offer-card:hover,
.offer-card[aria-pressed="true"] {
  border-color: var(--red);
  box-shadow: 0 10px 28px rgba(215, 25, 32, 0.09);
}

.offer-card[aria-pressed="true"] {
  background: var(--red-soft);
}

.offer-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 850;
}

.offer-validity {
  color: var(--muted);
  font-size: 0.82rem;
}

.offer-price {
  color: var(--red);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.order-submit-row {
  margin-top: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.order-submit-row > div {
  display: grid;
  gap: 5px;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-item {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.activity-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.status-pill {
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--amber);
  background: var(--amber-soft);
  font-size: 0.72rem;
  font-weight: 850;
}

.status-succeeded {
  color: var(--green);
  background: var(--green-soft);
}

.status-failed,
.status-cancelled {
  color: var(--red-deep);
  background: var(--red-soft);
}

.status-matched {
  color: var(--green);
  background: var(--green-soft);
}

.status-review,
.status-uncertain {
  color: var(--amber);
  background: var(--amber-soft);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.admin-grid .panel {
  margin-top: 0;
}

.control-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 18px;
  margin-top: 28px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}

.control-form-grid .control-note {
  grid-column: span 2;
}

.control-form-grid .form-error {
  align-self: center;
}

.subsection-heading {
  margin: 34px 0 14px;
}

.subsection-heading h3,
.control-card h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.reconciliation-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.reconciliation-summary article {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}

.reconciliation-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.reconciliation-summary strong {
  font-size: 1.35rem;
  letter-spacing: -0.035em;
}

.text-success {
  color: var(--green);
}

.text-warning {
  color: var(--amber);
}

.control-grid {
  margin-top: 0;
}

.control-card {
  margin-top: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 380px;
  padding: 15px 18px;
  border-radius: 14px;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  font-weight: 700;
}

@media (max-width: 880px) {
  .login-layout {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .login-story {
    padding-top: 30px;
  }

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

  .admin-grid {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 620px) {
  .login-layout,
  .dashboard,
  .mode-banner {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    height: auto;
    min-height: 70px;
    padding: 12px;
  }

  .brand-small > span:last-child,
  .account-copy {
    display: none;
  }

  .dashboard {
    padding-top: 38px;
  }

  .balance-grid,
  .metric-grid,
  .offer-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .order-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-heading p {
    text-align: left;
  }

  .order-submit-row .button {
    width: 100%;
  }

  .activity-item {
    grid-template-columns: 1fr 1fr;
  }

  .control-form-grid {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .control-form-grid .control-note {
    grid-column: auto;
  }
}

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

.intake-banner {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--amber);
  border-radius: 14px;
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 600;
}

.activity-detailed {
  grid-template-columns: 1fr;
  gap: 8px;
}

.activity-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr auto;
  align-items: center;
  gap: 16px;
}

.activity-status {
  margin: 0;
  font-size: 0.86rem;
}

.order-recap {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--red-soft);
}

.order-recap h3 {
  margin: 0 0 6px;
}

.recap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin: 16px 0 0;
}

.recap-grid dt {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.recap-grid dd {
  margin: 4px 0 0;
  font-weight: 700;
}

.recap-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.intake-status-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.intake-status-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.filters-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.filters-grid input,
.filters-grid select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
}

.filters-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filters-grid .form-error {
  grid-column: 1 / -1;
  margin: 0;
}

.surveillance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.surveillance-cell {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  display: grid;
  gap: 6px;
}

.surveillance-cell span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#surveillance-alerts .intake-banner {
  margin-top: 0;
  margin-bottom: 12px;
}
