:root {
  --red: #9f1225;
  --red-2: #c92b3b;
  --red-dark: #5f0714;
  --gold: #d6a844;
  --gold-soft: #f7df9a;
  --white: #fffaf0;
  --paper: rgba(255, 250, 240, 0.84);
  --ink: #241116;
  --muted: #74564f;
  --line: rgba(95, 7, 20, 0.16);
  --shadow: 0 24px 70px rgba(95, 7, 20, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 8%, rgba(214, 168, 68, 0.32), transparent 26rem),
    radial-gradient(circle at 88% 12%, rgba(159, 18, 37, 0.2), transparent 25rem),
    linear-gradient(135deg, #fffaf0 0%, #f8ead5 46%, #ecd2bf 100%);
  overflow-x: hidden;
}

#ambientCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.48;
  pointer-events: none;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 32px;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.58fr);
  gap: 36px;
  min-height: calc(100vh - 64px);
  align-items: stretch;
}

.brand-panel,
.login-card,
.panel,
.metric,
.module-card,
.timeline-panel,
.check-panel,
.sidebar,
.topbar {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 590px;
  padding: clamp(34px, 5vw, 76px);
  border-radius: 8px;
  overflow: hidden;
}

.brand-panel::before,
.brand-panel::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(214, 168, 68, 0.38);
  transform: rotate(-11deg) skewX(-8deg);
}

.brand-panel::before {
  inset: 9%;
}

.brand-panel::after {
  inset: 20% 4% 18% 44%;
  background: rgba(159, 18, 37, 0.04);
}

.hero-logo {
  width: 112px;
  height: 112px;
  margin-bottom: auto;
  filter: drop-shadow(0 18px 34px rgba(95, 7, 20, 0.24));
}

.login-logo {
  width: 76px;
  height: 76px;
}

.eyebrow {
  margin: 24px 0 8px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 800px;
  margin-bottom: 18px;
  font-size: clamp(3.2rem, 8.4vw, 7.5rem);
  line-height: 0.88;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.85rem, 4vw, 3rem);
}

h3 {
  margin-bottom: 16px;
  font-size: 1.06rem;
}

.lead {
  max-width: 720px;
  color: #4a2520;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  line-height: 1.5;
}

.promise-grid,
.demo-access,
.status-stack,
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.promise-grid {
  margin-top: 34px;
}

.promise-grid span,
.status-pill {
  border: 1px solid rgba(214, 168, 68, 0.58);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.58);
  color: #522016;
  font-size: 0.86rem;
  font-weight: 800;
}

.status-pill.gold {
  background: rgba(247, 223, 154, 0.52);
}

.login-card {
  align-self: center;
  display: grid;
  gap: 20px;
  padding: 30px;
  border-radius: 8px;
}

.login-card p {
  color: var(--muted);
  line-height: 1.45;
}

label {
  display: grid;
  gap: 8px;
  color: #572922;
  font-size: 0.9rem;
  font-weight: 850;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(214, 168, 68, 0.18);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 52px;
}

.icon-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: rgba(159, 18, 37, 0.08);
  cursor: pointer;
  transform: translateY(-50%);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--red-dark);
}

.primary-action,
.secondary-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--red-2) 55%, var(--gold));
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
}

.secondary-action {
  color: var(--red-dark);
  border: 1px solid rgba(214, 168, 68, 0.62);
  background: linear-gradient(135deg, #fff, var(--gold-soft));
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 850;
}

.demo-access {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  color: var(--muted);
  font-size: 0.84rem;
}

.demo-access strong {
  width: 100%;
  color: var(--ink);
}

.app-screen {
  display: grid;
  grid-template-columns: 278px minmax(0, 1fr);
  gap: 30px;
  min-height: calc(100vh - 64px);
}

.sidebar {
  position: sticky;
  top: 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: calc(100vh - 64px);
  padding: 20px;
  border-radius: 8px;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mini img {
  width: 52px;
  height: 52px;
}

.brand-mini small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

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

.nav-btn,
.ghost-action {
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 850;
}

.nav-btn {
  text-align: left;
}

.nav-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red-dark), var(--red));
}

.ghost-action {
  margin-top: auto;
  color: var(--red);
  background: rgba(159, 18, 37, 0.07);
}

.workspace {
  display: grid;
  align-content: start;
  gap: 30px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  padding: 24px;
  border-radius: 8px;
}

.topbar .eyebrow {
  margin-top: 0;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 30px;
}

.metric-grid,
.module-grid,
.two-column,
.requirements-grid,
.admin-grid,
.report-layout {
  display: grid;
  gap: 28px;
}

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

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

.module-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-column,
.requirements-grid,
.admin-grid,
.report-layout {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric,
.module-card,
.timeline-panel,
.panel,
.check-panel {
  border-radius: 8px;
  padding: 22px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
}

.metric strong {
  display: block;
  margin-top: 10px;
  color: var(--red-dark);
  font-size: clamp(1.45rem, 3vw, 2rem);
}

.module-card {
  min-height: 178px;
  line-height: 1.45;
}

.module-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--gold));
  font-size: 0.78rem;
  font-weight: 900;
}

.panel {
  display: grid;
  gap: 16px;
}

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

.timeline span,
.integration-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.62);
  font-weight: 800;
}

.credential-panel {
  align-content: start;
}

#credentialCanvas {
  width: 100%;
  max-width: 760px;
  border: 1px solid rgba(214, 168, 68, 0.38);
  border-radius: 8px;
  background: #fff;
}

.check-panel {
  display: grid;
  gap: 12px;
}

.check-panel label {
  grid-template-columns: 18px 1fr;
  align-items: center;
  font-weight: 750;
}

.order-list,
.audit-list,
.integration-grid {
  display: grid;
  gap: 12px;
}

.order-item,
.audit-item {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.64);
}

.order-item strong {
  color: var(--red-dark);
}

.tag {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 10px;
  color: #fff;
  background: var(--red);
  font-size: 0.74rem;
  font-weight: 900;
}

.tag.low {
  background: #28744f;
}

.tag.medium {
  background: #b87916;
}

.tag.high {
  background: #a80d20;
}

.result-box,
.report-card {
  min-height: 116px;
  border: 1px dashed rgba(159, 18, 37, 0.3);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

.congestion-bars {
  display: grid;
  gap: 12px;
}

.congestion-bars div {
  display: grid;
  gap: 7px;
}

.congestion-bars b {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--red));
}

.admin-only {
  display: none;
}

.is-admin .admin-only {
  display: block;
}

@media (max-width: 1120px) {
  .metric-grid,
  .module-grid,
  .module-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .shell {
    padding: 14px;
  }

  .login-screen,
  .app-screen,
  .two-column,
  .requirements-grid,
  .admin-grid,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: 460px;
  }

  .app-screen {
    padding-bottom: 92px;
  }

  .sidebar {
    position: fixed;
    z-index: 4;
    inset: auto 10px 10px;
    display: grid;
    height: auto;
    padding: 10px;
  }

  .brand-mini,
  .ghost-action {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
    gap: 7px;
  }

  .nav-btn {
    min-height: 44px;
    padding: 8px 4px;
    text-align: center;
    font-size: clamp(0.68rem, 2.8vw, 0.82rem);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .module-grid,
  .module-grid.compact,
  .timeline {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 3.05rem;
  }

  .brand-panel,
  .login-card,
  .panel,
  .metric,
  .module-card,
  .timeline-panel,
  .check-panel,
  .topbar {
    padding: 17px;
  }

  .promise-grid span,
  .demo-access span {
    width: 100%;
  }
}
