:root {
  color-scheme: light;
  --bg: #f5f2ee;
  --bg-soft: #fff6ef;
  --ink: #1e1a17;
  --muted: #6f655b;
  --primary: #e45f2b;
  --primary-dark: #c94f20;
  --border: #eadfd2;
  --border-strong: #e5c8b1;
  --surface: #ffffffd8;
  --surface-soft: #fff9f2;
  --shadow: 0 25px 60px rgba(36, 22, 9, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 4%, #ffefd9 0%, transparent 32%),
    radial-gradient(circle at 90% -2%, #ffe9d6 0%, transparent 34%),
    radial-gradient(circle at 44% 118%, #f5ece2 0%, #f0e7dc 57%, #ebe2d7 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(31, 25, 20, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.55;
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  width: min(360px, 70vw);
  aspect-ratio: 1;
  left: -120px;
  bottom: -150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(228, 95, 43, 0.18), transparent 66%);
  filter: blur(8px);
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(940px, calc(100% - 24px));
  margin: 18px auto 44px;
  display: grid;
  gap: 16px;
}

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

h1,
h2 {
  font-family: "Spectral", serif;
}

h1 {
  font-size: clamp(1.95rem, 2.8vw, 2.7rem);
}

h2 {
  font-size: clamp(1.3rem, 1.9vw, 1.8rem);
}

.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, #ffffff, #fff7ef 50%, #fffaf6 100%);
  box-shadow: var(--shadow);
  padding: 24px;
}

.hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

.language-switch select {
  border: 1px solid var(--border);
  border-radius: 999px;
  min-height: 32px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.hero::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  top: -116px;
  right: -78px;
  background: radial-gradient(circle, rgba(228, 95, 43, 0.22), transparent 62%);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.subhead {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.status {
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  padding: 11px 13px;
  background: #fff8f2;
  color: #715840;
  box-shadow: 0 10px 24px rgba(71, 37, 17, 0.04);
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 20px;
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: #2f251d;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fffefc;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input::placeholder {
  color: #8c7a69;
}

input:focus-visible,
button:focus-visible {
  outline: 0;
  border-color: #e2ac84;
  box-shadow: 0 0 0 3px rgba(228, 95, 43, 0.18);
}

.actions {
  display: flex;
  gap: 8px;
}

.btn {
  border: 1px solid #e8ccb3;
  border-radius: 999px;
  padding: 9px 16px;
  background: #fffdf9;
  color: #8f3f1b;
  cursor: pointer;
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: #e0b998;
  box-shadow: 0 10px 20px rgba(105, 51, 22, 0.08);
}

.btn.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
}

.portal-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.muted {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.4;
}

.cards {
  display: grid;
  gap: 11px;
}

#latestConsultation {
  margin-top: 14px;
}

.consultation-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 14px;
  display: grid;
  gap: 9px;
}

.consultation-card::after {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  right: -48px;
  top: -48px;
  background: radial-gradient(circle, rgba(228, 95, 43, 0.12), transparent 68%);
  pointer-events: none;
}

.consultation-card h3 {
  font-size: 1rem;
}

.consultation-summary {
  white-space: pre-wrap;
  line-height: 1.5;
}

.badge {
  width: fit-content;
  border-radius: 999px;
  background: #ffe5cf;
  color: #8f3f1b;
  font-size: 12px;
  padding: 4px 8px;
  font-weight: 700;
}

.history {
  margin-top: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: #fffaf6;
  padding: 9px 10px;
}

.history > summary {
  position: relative;
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  padding-right: 20px;
}

.history > summary::-webkit-details-marker {
  display: none;
}

.history > summary::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 42%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #947b67;
  border-bottom: 2px solid #947b67;
  transform: rotate(45deg) translateY(-50%);
  transition: transform 180ms ease;
}

.history[open] > summary::after {
  transform: rotate(225deg) translateY(-50%);
  top: 56%;
}

.history-list {
  margin-top: 10px;
}

.legal-footer {
  margin-top: 12px;
}

.legal-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid #e3d4c6;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.9);
  color: #6f655b;
  font-size: 0.84rem;
  text-decoration: none;
}

.legal-link::before {
  content: "🛡";
  font-size: 0.75rem;
  line-height: 1;
}

.legal-link:visited,
.legal-link:hover,
.legal-link:active {
  color: #6f655b;
  text-decoration: none;
}

.legal-link:hover {
  border-color: #d8c5b4;
  background: #fff4e9;
}

@media (max-width: 720px) {
  .shell {
    width: min(100%, calc(100% - 14px));
    margin: 10px auto 24px;
    gap: 10px;
  }

  .hero,
  .card {
    padding: 14px;
  }

  .portal-header {
    flex-direction: column;
    align-items: stretch;
  }

  input,
  button {
    font-size: 16px;
  }

  .btn {
    width: 100%;
    min-height: 44px;
  }
}
