/* ==========================================================================
   Doctor portal — app.drscribe.co
   Same tokens as the marketing site; this surface trades display type for
   density, but keeps the elevation, the hairlines and the motion language.
   ========================================================================== */

body.portal {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--canvas);
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.por-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, #fff 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
}

.por-head .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
}

.por-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.028em;
  color: var(--ink);
  text-decoration: none;
}

.por-brand img {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.por-head .spacer {
  margin-left: auto;
}

.por-who {
  font-size: var(--fs-sm);
  color: var(--ink-3);
  max-width: 22ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.por-main {
  flex: 1;
  display: flex;
  align-items: center;
  padding-block: clamp(28px, 4vw, 48px) clamp(56px, 7vw, 88px);
}

.por-main > .wrap {
  width: 100%;
}

.por-head .wrap.por-wrap {
  max-width: 1080px;
}

/* ── Auth shell ─────────────────────────────────────────────────────────── */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  max-width: 1020px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: 0 2px 6px rgba(10, 43, 41, 0.05), 0 48px 90px -48px rgba(10, 43, 41, 0.42);
  overflow: hidden;
  animation: auth-in 0.7s var(--ease-out) both;
}

@keyframes auth-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.994);
  }
}

.auth-aside {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: clamp(28px, 3.4vw, 44px);
  background:
    radial-gradient(90% 70% at 88% 0%, rgba(78, 155, 140, 0.34), transparent 62%),
    linear-gradient(168deg, var(--brand-800), var(--brand-950));
  color: #fff;
  overflow: hidden;
}

.auth-aside::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 47%;
  translate: -50% -50%;
  width: 290px;
  height: 290px;
  background: url("/shared-assets/brand/logo-white-256.png") center / contain no-repeat;
  opacity: 0.06;
  pointer-events: none;
}

.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.auth-aside > * {
  position: relative;
  z-index: 1;
}

.auth-mark {
  width: 58px;
  height: 58px;
  padding: 9px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 28px -14px rgba(0, 0, 0, 0.7);
  object-fit: contain;
}

.auth-aside h2 {
  font-size: clamp(1.32rem, 2vw, 1.62rem);
  letter-spacing: -0.032em;
  line-height: 1.18;
  color: #fff;
  max-width: 18ch;
}

.auth-aside > p {
  font-size: 0.925rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.76);
  max-width: 34ch;
}

.auth-points {
  list-style: none;
  margin-top: auto;
  display: grid;
  gap: 13px;
  font-size: 0.895rem;
  color: rgba(255, 255, 255, 0.86);
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.auth-points li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.auth-points svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: #7fdfc0;
}

.auth-form {
  padding: clamp(28px, 3.4vw, 46px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form > h1 {
  font-size: clamp(1.5rem, 2.2vw, 1.85rem);
  letter-spacing: -0.035em;
}

.auth-form .sub {
  margin-top: 8px;
  font-size: 0.94rem;
  color: var(--ink-3);
  max-width: 42ch;
}

.auth-form form {
  margin-top: 26px;
  display: grid;
  gap: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-actions {
  margin-top: 8px;
}

.form-actions .btn {
  width: 100%;
}

.form-note {
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.5;
}

.form-note + .form-note {
  margin-top: 8px;
}

.auth-legal {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
  font-size: 0.8rem;
  color: var(--ink-3);
  line-height: 1.5;
}

/* Password reveal */
.pw {
  position: relative;
}

.pw input {
  padding-right: 52px !important;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out);
}

.pw-toggle:hover {
  color: var(--brand-700);
  background: var(--brand-50);
}

.pw-toggle svg {
  width: 18px;
  height: 18px;
}

/* ── Account dashboard ──────────────────────────────────────────────────── */
.por-wrap {
  max-width: 1080px;
}

.por-hello {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.por-hello h1 {
  font-size: clamp(1.5rem, 2.4vw, 1.95rem);
  letter-spacing: -0.038em;
}

.por-hello p {
  margin-top: 6px;
  font-size: 0.94rem;
  color: var(--ink-3);
}

.por-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--r-pill);
  background: var(--ok-bg);
  border: 1px solid color-mix(in srgb, var(--ok) 20%, transparent);
  color: var(--ok);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.por-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  position: relative;
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1), var(--sh-inset);
  overflow: hidden;
}

.metric .label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.metric .label svg {
  width: 14px;
  height: 14px;
  color: var(--brand-500);
}

.metric .value {
  margin-top: 12px;
  font-size: clamp(1.7rem, 2.6vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.042em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.metric .value small {
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink-3);
}

.metric .foot {
  margin-top: 9px;
  font-size: 0.855rem;
  color: var(--ink-3);
  line-height: 1.4;
}

.meter {
  margin-top: 14px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-600), var(--brand-400));
  transition: width 0.7s var(--ease-out);
}

.metric-hero {
  background:
    radial-gradient(90% 130% at 100% 0%, rgba(78, 155, 140, 0.14), transparent 60%),
    var(--surface);
}

/* ── Panel & tabs ───────────────────────────────────────────────────────── */
.por-panel {
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--sh-1), var(--sh-inset);
  overflow: hidden;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.tab {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease-out), background-color var(--dur-2) var(--ease-out),
    box-shadow var(--dur-2) var(--ease-out);
}

.tab:hover {
  color: var(--brand-700);
  background: color-mix(in srgb, var(--brand-800) 5%, transparent);
}

.tab.is-active {
  background: var(--surface);
  color: var(--brand-800);
  box-shadow: var(--sh-1);
}

.tab-panel {
  padding: clamp(20px, 2.6vw, 30px);
  animation: panel-in var(--dur-3) var(--ease-out) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.panel-title {
  font-size: 1.02rem;
  letter-spacing: -0.022em;
}

.panel-sub {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--ink-3);
  line-height: 1.5;
  max-width: 60ch;
}

.cols {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
}

/* Requests list */
.request-list {
  list-style: none;
  display: grid;
  margin-top: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
}

.request-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line-2);
  font-size: 0.9rem;
  background: var(--surface);
}

.request-item:last-child {
  border-bottom: 0;
}

.request-item .kind {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  height: fit-content;
  margin-top: 1px;
}

.request-item .kind.trial {
  background: var(--info-bg);
  color: var(--info);
}

.request-item .kind.support {
  background: var(--danger-bg);
  color: var(--danger);
}

.request-item .kind.topup {
  background: var(--ok-bg);
  color: var(--ok);
}

.request-item .body {
  min-width: 0;
}

.request-item .body strong {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.request-item .body span {
  display: block;
  margin-top: 2px;
  font-size: 0.83rem;
  color: var(--ink-3);
}

.empty {
  padding: 26px 18px;
  text-align: center;
  color: var(--ink-3);
  font-size: 0.9rem;
  list-style: none;
}

/* Account details: a compact two-column key/value table. dt/dd alternate in
   the DOM, so a two-column grid lines them up automatically. */
.details {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px 16px;
  align-items: baseline;
}

.details .dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

.details .dd {
  margin: 0;
  font-weight: 600;
  font-size: 0.94rem;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

/* Forms inside panels */
.panel-form {
  display: grid;
  gap: 14px;
}

.panel-form h3 {
  font-size: 1.02rem;
  letter-spacing: -0.022em;
}

.divider-block {
  height: 1px;
  background: var(--line);
  margin-block: 30px;
}

/* Download cards */
.download-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}

.download-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  transition: border-color var(--dur-3) var(--ease-out), box-shadow var(--dur-3) var(--ease-out),
    background-color var(--dur-3) var(--ease-out);
}

.download-card.is-current {
  border-color: var(--brand-400);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400) 14%, transparent), var(--sh-2);
}

.download-card.is-current::after {
  content: "Votre système";
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-600);
}

.download-card h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
}

.download-card h3 svg {
  width: 18px;
  height: 18px;
  color: var(--brand-700);
}

.download-card p {
  font-size: 0.86rem;
  color: var(--ink-3);
}

.download-card .btn {
  margin-top: 6px;
  justify-self: start;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .por-main {
    align-items: flex-start;
  }

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

  .auth-aside {
    display: none;
  }

  .metrics,
  .cols,
  .download-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .por-who {
    display: none;
  }

  .por-head .wrap {
    gap: 8px;
  }
}
