﻿/* Medeuon DOCPOST — professional healthcare SaaS UI */
    :root {
      --ink: #0b1220;
      --muted: #5b6478;
      --line: #e4e8f1;
      --line-strong: #cfd6e4;
      --panel: #ffffff;
      --soft: #f4f6fb;
      --soft-2: #eef1f8;
      --brand: #1a1464;
      --brand-light: #2d2489;
      --brand-soft: #edeafd;
      --accent: #d92819;
      --accent-soft: #fff1ef;
      --whatsapp: #128c43;
      --whatsapp-dark: #0e6f35;
      --ocean: var(--brand);
      --ocean-dark: var(--brand);
      --navy: var(--brand);
      --danger: var(--accent);
      --success: var(--brand);
      --radius-sm: 10px;
      --radius: 14px;
      --radius-lg: 20px;
      --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
      --shadow: 0 16px 40px rgba(26, 20, 100, 0.1);
      --shadow-lg: 0 28px 60px rgba(26, 20, 100, 0.14);
      --transition: 180ms ease;
    }

    * {
      box-sizing: border-box;
    }

    html {
      background: #e9edf5;
      scroll-behavior: smooth;
    }

    body {
      margin: 0;
      min-height: 100vh;
      color: var(--ink);
      background:
        radial-gradient(circle at top right, rgba(26, 20, 100, 0.05), transparent 28%),
        linear-gradient(180deg, #ffffff 0, var(--soft) 260px, var(--soft-2) 100%);
      font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      letter-spacing: -0.01em;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
    }

    button,
    input,
    select {
      font: inherit;
    }

    button {
      cursor: pointer;
    }

    .app-shell {
      width: min(100%, 1240px);
      min-height: 100vh;
      margin: 0 auto;
      background: var(--soft);
      position: relative;
      overflow-x: hidden;
      box-shadow: var(--shadow-sm), 0 0 0 1px rgba(26, 20, 100, 0.05);
    }

    .screen {
      display: none;
      min-height: 100vh;
      padding: 18px clamp(14px, 3vw, 32px) 92px;
    }

    .screen.active {
      display: block;
    }

    /* Authentication guard: all protected views are unreachable until currentSession changes. */
    .auth-screen {
      display: none;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      padding: 28px 16px;
      background:
        radial-gradient(circle at 15% 20%, rgba(26, 20, 100, 0.12), transparent 34%),
        radial-gradient(circle at 85% 0%, rgba(217, 40, 25, 0.08), transparent 28%),
        linear-gradient(160deg, #ffffff 0%, #f7f8fd 55%, #eef1f8 100%);
    }

    .auth-layout {
      width: min(100%, 980px);
      display: grid;
      gap: 18px;
      align-items: stretch;
    }

    .auth-brand-panel {
      display: none;
      padding: 34px 30px;
      border-radius: var(--radius-lg);
      color: #fff;
      background: linear-gradient(145deg, var(--brand) 0%, #0d0838 100%);
      box-shadow: var(--shadow-lg);
      position: relative;
      overflow: hidden;
    }

    .auth-brand-panel::after {
      content: "";
      position: absolute;
      inset: auto -40px -60px auto;
      width: 220px;
      height: 220px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.08);
    }

    .auth-brand-logo {
      width: 148px;
      height: auto;
      display: block;
      margin-bottom: 22px;
      filter: brightness(1.08);
    }

    .auth-brand-eyebrow,
    .panel-eyebrow {
      margin: 0 0 10px;
      color: rgba(255, 255, 255, 0.72);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.12em;
      text-transform: uppercase;
    }

    .panel-eyebrow {
      color: var(--brand-light);
    }

    .auth-brand-title {
      margin: 0 0 12px;
      font-size: clamp(24px, 4vw, 34px);
      line-height: 1.12;
      font-weight: 800;
      max-width: 16ch;
    }

    .auth-brand-copy {
      margin: 0 0 18px;
      color: rgba(255, 255, 255, 0.82);
      font-size: 15px;
      line-height: 1.6;
      max-width: 38ch;
    }

    .auth-brand-list {
      margin: 0;
      padding: 0;
      list-style: none;
      display: grid;
      gap: 10px;
    }

    .auth-brand-list li {
      position: relative;
      padding-left: 22px;
      font-size: 14px;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.92);
    }

    .auth-brand-list li::before {
      content: "";
      position: absolute;
      left: 0;
      top: 8px;
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #ff6a5a;
      box-shadow: 0 0 0 4px rgba(255, 106, 90, 0.18);
    }

    .auth-screen.active {
      display: flex;
    }

    .header {
      display: none;
      width: min(100%, 1240px);
      min-height: 72px;
      padding: 12px clamp(14px, 3vw, 28px);
      align-items: center;
      gap: 14px;
      position: sticky;
      top: 0;
      z-index: 30;
      background: rgba(255, 255, 255, 0.88);
      border-bottom: 1px solid var(--line);
      backdrop-filter: blur(16px);
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    }

    .header.visible {
      display: flex;
    }

    .brand-mark {
      width: 98px;
      height: 38px;
      object-fit: contain;
      flex: 0 0 auto;
    }

    .header-copy {
      min-width: 0;
      flex: 1;
    }

    .header-title {
      margin: 0;
      font-size: 15px;
      font-weight: 800;
      line-height: 1.15;
      color: var(--brand);
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .header-subtitle {
      margin: 3px 0 0;
      font-size: 13px;
      color: var(--muted);
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .icon-button {
      width: 42px;
      height: 42px;
      display: inline-grid;
      place-items: center;
      flex: 0 0 auto;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      color: var(--ink);
      background: #fff;
      transition: background var(--transition), border-color var(--transition), transform var(--transition);
    }

    .icon-button:hover {
      background: var(--brand-soft);
      border-color: #d9d5ff;
      transform: translateY(-1px);
    }

    .icon-button svg {
      width: 20px;
      height: 20px;
      stroke: currentColor;
      stroke-width: 2;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    /* Role-aware dashboard navigation is injected from renderNavigation(). */
    .bottom-nav {
      display: none;
      width: min(100%, 1240px);
      min-height: 72px;
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
      padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
      position: fixed;
      left: 50%;
      bottom: 0;
      transform: translateX(-50%);
      z-index: 35;
      background: rgba(255, 255, 255, 0.94);
      border-top: 1px solid var(--line);
      backdrop-filter: blur(16px);
      box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.06);
    }

    .bottom-nav.visible {
      display: grid;
    }

    .nav-item {
      min-width: 0;
      height: 54px;
      display: grid;
      place-items: center;
      gap: 3px;
      border: 0;
      border-radius: var(--radius-sm);
      color: var(--muted);
      background: transparent;
      font-size: 11px;
      font-weight: 700;
      transition: background var(--transition), color var(--transition);
    }

    .nav-item.active {
      color: var(--brand);
      background: var(--brand-soft);
      box-shadow: inset 0 0 0 1px rgba(45, 36, 137, 0.08);
    }

    .nav-item svg {
      width: 21px;
      height: 21px;
      stroke: currentColor;
      stroke-width: 2;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow-sm);
    }

    .panel-card {
      padding: 18px;
    }

    .panel-header h2,
    .panel-card h2,
    .section-head h2 {
      letter-spacing: -0.02em;
    }

    .auth-card {
      width: 100%;
      max-width: 470px;
      margin: 0 auto;
      padding: 28px 22px 24px;
      border: 1px solid var(--line);
      box-shadow: var(--shadow);
    }

    .auth-card .panel-eyebrow {
      text-align: center;
    }

    .auth-logo {
      display: block;
      width: min(180px, 68vw);
      height: auto;
      margin: 0 auto 14px;
    }

    .title {
      margin: 0;
      font-size: 26px;
      line-height: 1.12;
      font-weight: 800;
      text-align: center;
      color: var(--ink);
      letter-spacing: -0.03em;
    }

    .lead {
      margin: 8px auto 18px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
      text-align: center;
      max-width: 310px;
    }

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

    .field {
      display: grid;
      gap: 5px;
    }

    .field label {
      color: #334155;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.02em;
    }

    .field input,
    .field select {
      width: 100%;
      min-height: 48px;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-sm);
      padding: 0 14px;
      color: var(--ink);
      background: #fff;
      outline: none;
      transition: border-color var(--transition), box-shadow var(--transition);
    }

    .field input::placeholder {
      color: #94a3b8;
    }

    .field input:focus,
    .field select:focus {
      border-color: var(--brand-light);
      box-shadow: 0 0 0 4px rgba(45, 36, 137, 0.12);
    }

    .form-grid {
      display: grid;
      gap: 12px;
    }

    .field-span-2 {
      grid-column: 1 / -1;
    }

    .file-drop {
      position: relative;
      min-height: 92px;
      display: grid;
      place-items: center;
      padding: 16px;
      border: 1px dashed #c5cedd;
      border-radius: var(--radius-sm);
      background: #fafbfe;
      text-align: center;
    }

    .file-drop.compact {
      min-height: 72px;
    }

    .file-drop input {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
    }

    .file-drop span {
      color: var(--muted);
      font-size: 13px;
      font-weight: 600;
      line-height: 1.45;
      pointer-events: none;
    }

    .button {
      min-height: 48px;
      width: 100%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      border: 0;
      border-radius: var(--radius-sm);
      color: #fff;
      background: linear-gradient(180deg, var(--brand-light) 0%, var(--brand) 100%);
      font-size: 14px;
      font-weight: 800;
      box-shadow: 0 10px 24px rgba(26, 20, 100, 0.22);
      transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
    }

    .button:hover,
    .nav-item:hover {
      transform: translateY(-1px);
    }

    .icon-button:hover {
      filter: none;
    }

    .button.success {
      background: linear-gradient(180deg, #e33a2c 0%, var(--accent) 100%);
      box-shadow: 0 10px 24px rgba(217, 40, 25, 0.2);
    }

    .button.whatsapp {
      background: linear-gradient(180deg, #15a052 0%, var(--whatsapp) 100%);
      box-shadow: 0 10px 24px rgba(18, 140, 67, 0.2);
      color: #fff;
    }

    .button.secondary {
      color: var(--ink);
      background: #fff;
      border: 1px solid var(--line-strong);
      box-shadow: none;
    }

    .button svg {
      width: 18px;
      height: 18px;
      stroke: currentColor;
      stroke-width: 2;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .message {
      display: none;
      padding: 10px;
      border-radius: var(--radius);
      font-size: 12px;
      font-weight: 700;
      line-height: 1.35;
    }

    .message.visible {
      display: block;
    }

    .message.error {
      color: #991b1b;
      background: #fee2e2;
      border: 1px solid #fecaca;
    }

    .message.ok {
      color: #14532d;
      background: #dcfce7;
      border: 1px solid #bbf7d0;
    }

    .section-head {
      display: flex;
      align-items: end;
      justify-content: space-between;
      gap: 10px;
      margin: 8px 0 12px;
    }

    .section-head h2 {
      margin: 0;
      font-size: clamp(22px, 3vw, 30px);
      line-height: 1.1;
      font-weight: 800;
      letter-spacing: -0.03em;
    }

    .section-head p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 14px;
      line-height: 1.45;
      font-weight: 500;
    }

    .page-intro {
      margin-bottom: 6px;
    }

    .page-intro .section-head {
      margin-top: 0;
    }

    .panel-header h2 {
      margin: 0;
      font-size: 20px;
      line-height: 1.15;
      font-weight: 800;
    }

    .panel-header p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
    }

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

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

    .metric {
      min-height: 96px;
      padding: 16px;
      border-radius: var(--radius);
      background: #fff;
      border: 1px solid var(--line);
      box-shadow: var(--shadow-sm);
      overflow: hidden;
    }

    .metric-primary {
      background: linear-gradient(145deg, var(--brand-light) 0%, var(--brand) 100%);
      border-color: transparent;
      color: #fff;
      box-shadow: var(--shadow);
    }

    .metric span {
      display: block;
      margin-bottom: 10px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .metric-primary span {
      color: rgba(255, 255, 255, 0.72);
    }

    .metric strong {
      display: block;
      font-size: 28px;
      line-height: 1;
      font-weight: 800;
      letter-spacing: -0.03em;
    }

    .specialty-row {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      padding: 12px 14px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: #fff;
      font-size: 13px;
      font-weight: 700;
    }

    .specialty-row small {
      display: block;
      margin-top: 4px;
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
    }

    .doctor-list {
      display: grid;
      gap: 8px;
    }

    .doctor-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 14px 16px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: #fff;
      transition: border-color var(--transition), box-shadow var(--transition);
    }

    .doctor-row:hover {
      border-color: #d9d5ff;
      box-shadow: var(--shadow-sm);
    }

    .doctor-row-main strong {
      display: block;
      font-size: 14px;
      font-weight: 800;
      margin-bottom: 4px;
    }

    .doctor-row small {
      display: block;
      color: var(--muted);
      font-size: 12px;
      font-weight: 500;
      line-height: 1.4;
      overflow-wrap: anywhere;
    }

    .specialty-pill {
      display: inline-flex;
      align-items: center;
      padding: 6px 10px;
      border-radius: 999px;
      background: var(--brand-soft);
      color: var(--brand);
      border: 1px solid #ddd7ff;
      font-size: 11px;
      font-weight: 800;
      white-space: nowrap;
    }

    .publisher {
      padding: 0;
    }

    .feed-controls {
      padding: 0;
    }

    .controls-toolbar {
      display: grid;
      gap: 10px;
    }

    .controls-toolbar-top,
    .template-section-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
    }

    .controls-hint {
      color: var(--muted);
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
    }

    .controls-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 12px;
      align-items: end;
    }

    .control-month {
      min-width: 0;
    }

    .control-photo {
      width: 88px;
      flex-shrink: 0;
      display: grid;
      gap: 5px;
      justify-items: center;
    }

    .control-month {
      min-width: 0;
    }

    .control-month input,
    .controls-row .field input {
      min-height: 44px;
    }

    .control-photo-label {
      color: #334155;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.02em;
    }

    .profile-upload-chip {
      display: grid;
      justify-items: center;
      gap: 4px;
      cursor: pointer;
      margin: 0;
    }

    .profile-upload-chip input {
      position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }

    .photo-chip {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      overflow: hidden;
      background: var(--brand-soft);
      border: 2px solid #ddd7ff;
      box-shadow: var(--shadow-sm);
      position: relative;
    }

    .photo-chip svg {
      width: 28px;
      height: 28px;
      fill: #9aa8bf;
    }

    .photo-chip img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }

    .photo-chip.has-photo {
      border-color: var(--brand-light);
    }

    .photo-chip-label {
      color: var(--brand);
      font-size: 11px;
      font-weight: 800;
      letter-spacing: 0.02em;
    }

    .template-section {
      display: grid;
      gap: 10px;
    }

    .template-section-head .panel-eyebrow {
      margin: 0;
    }

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

    .template-card {
      display: grid;
      grid-template-columns: 88px 1fr;
      gap: 12px;
      padding: 12px;
      border: 1px solid var(--line);
      border-radius: var(--radius-sm);
      background: #fff;
      text-align: left;
      transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    }

    .template-card:hover {
      transform: translateY(-1px);
      border-color: #d9d5ff;
      box-shadow: var(--shadow-sm);
    }

    .template-card.active {
      border-color: var(--brand-light);
      box-shadow: 0 0 0 4px rgba(45, 36, 137, 0.1);
      background: linear-gradient(180deg, #ffffff 0%, #faf9ff 100%);
    }

    .template-thumb {
      width: 88px;
      height: 104px;
      border-radius: 10px;
      overflow: hidden;
      background: #e8edf5;
      box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
    }

    .template-thumb img,
    .template-card img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .template-meta {
      display: grid;
      gap: 6px;
      align-content: center;
    }

    .template-card strong {
      display: block;
      font-size: 14px;
      font-weight: 800;
      color: var(--ink);
    }

    .template-card span {
      display: block;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.35;
      font-weight: 500;
    }

    .empty {
      padding: 16px;
      border: 1px dashed #b8c6d6;
      border-radius: var(--radius);
      color: var(--muted);
      background: #fff;
      font-size: 13px;
      line-height: 1.4;
      text-align: center;
    }

    .preview-shell {
      display: grid;
      place-items: center;
      padding: 12px 0;
      overflow: hidden;
    }

    /* Preview frames scale export-sized artwork down without changing the production DOM size. */
    .poster-frame {
      width: 100%;
      max-width: 520px;
      overflow: hidden;
      border-radius: var(--radius);
      background: #dbe3ee;
      box-shadow: var(--shadow-lg);
      transform: translateZ(0);
      border: 1px solid rgba(15, 23, 42, 0.06);
    }

    /* The poster is the 1000px high-fidelity production surface captured by html2canvas. */
    .production-poster {
      width: 1000px;
      background: #fff;
      transform-origin: top left;
      --poster-footer-bg: #ffffff;
      --poster-footer-text: #0f172a;
      --poster-footer-muted: #526477;
      --poster-footer-accent: var(--brand);
      --poster-footer-line: #e2e8f0;
      --poster-footer-soft: #eef7ff;
      --poster-footer-soft-line: #cfe8f9;
      --poster-portrait-bg: #e5eef5;
      --poster-portrait-ring: #ffffff;
      --poster-footer-shadow: none;
    }

    .poster-banner {
      width: 1000px;
      min-height: 800px;
      display: grid;
      place-items: center;
      overflow: hidden;
      background:
        linear-gradient(135deg, rgba(33, 22, 107, 0.1), rgba(226, 43, 26, 0.06)),
        #edf5fb;
    }

    .poster-banner img {
      width: 100%;
      height: auto;
      display: block;
    }

    .poster-placeholder {
      width: 760px;
      padding: 70px 50px;
      text-align: center;
      color: #54708a;
      border: 6px dashed #aac2d8;
      border-radius: 28px;
      font-size: 48px;
      font-weight: 850;
      line-height: 1.2;
    }

    .poster-footer {
      width: 1000px;
      height: 200px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 28px;
      padding: 26px 40px;
      color: var(--poster-footer-text);
      background: var(--poster-footer-bg);
      border-top: 1px solid var(--poster-footer-line);
      text-shadow: var(--poster-footer-shadow);
      overflow: hidden;
    }

    .doctor-strip {
      display: flex;
      align-items: center;
      gap: 24px;
      min-width: 0;
      max-width: 680px;
      flex: 1 1 auto;
    }

    .doctor-copy {
      min-width: 0;
      max-width: 500px;
      flex: 1 1 auto;
    }

    .portrait {
      width: 132px;
      height: 132px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      flex: 0 0 auto;
      overflow: hidden;
      background: var(--poster-portrait-bg);
      border: 5px solid var(--poster-portrait-ring);
      box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16);
    }

    .portrait img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }

    .portrait svg {
      width: 76px;
      height: 76px;
      fill: #a9b8c8;
    }

    .poster-name {
      margin: 0;
      font-size: 40px;
      line-height: 1.12;
      font-weight: 900;
      overflow-wrap: anywhere;
      word-break: normal;
    }

    .poster-clinic {
      margin: 6px 0 0;
      color: var(--poster-footer-muted);
      font-size: 23px;
      font-weight: 800;
      overflow-wrap: anywhere;
      line-height: 1.18;
      word-break: normal;
    }

    .phone-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      flex: 0 0 auto;
      min-width: 0;
      max-width: 285px;
      padding: 12px 20px;
      border-radius: 999px;
      background: var(--poster-footer-soft);
      border: 1px solid var(--poster-footer-soft-line);
      color: var(--poster-footer-accent);
      font-size: 23px;
      font-weight: 900;
      text-shadow: none;
    }

    .phone-badge svg {
      width: 26px;
      height: 26px;
      flex: 0 0 auto;
      stroke: currentColor;
      stroke-width: 2.4;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .phone-badge span {
      min-width: 0;
      line-height: 1.1;
      white-space: nowrap;
    }

    .card-frame {
      width: 100%;
      max-width: 390px;
      overflow: hidden;
      border-radius: var(--radius);
      box-shadow: var(--shadow-lg);
      background: #fff;
      border: 1px solid rgba(15, 23, 42, 0.06);
    }

    .digital-card {
      width: 900px;
      height: 540px;
      display: grid;
      grid-template-columns: 320px 1fr;
      color: var(--ink);
      background: #fff;
      transform-origin: top left;
      overflow: hidden;
    }

    .card-media {
      display: grid;
      place-items: center;
      padding: 34px;
      background: linear-gradient(160deg, #0f172a 0%, #14314d 100%);
    }

    .card-photo {
      width: 220px;
      height: 220px;
      border-radius: 50%;
      display: grid;
      place-items: center;
      overflow: hidden;
      background: #e2e8f0;
      border: 8px solid rgba(255, 255, 255, 0.85);
    }

    .card-photo img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: none;
    }

    .card-photo svg {
      width: 118px;
      height: 118px;
      fill: #a5b4c5;
    }

    .card-detail {
      padding: 42px 44px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 18px;
      position: relative;
    }

    .card-watermark {
      width: 190px;
      height: auto;
      object-fit: contain;
      margin-bottom: 8px;
    }

    .business-name {
      margin: 0;
      font-size: 42px;
      line-height: 1.05;
      font-weight: 950;
      overflow-wrap: anywhere;
    }

    .badge {
      width: fit-content;
      padding: 8px 14px;
      border-radius: 999px;
      color: var(--ocean-dark);
      background: #f1f0ff;
      border: 1px solid #d9d5ff;
      font-size: 20px;
      font-weight: 900;
    }

    .business-clinic {
      margin: 0;
      color: #334155;
      font-size: 25px;
      font-weight: 800;
    }

    .contact-list {
      display: grid;
      gap: 10px;
      margin-top: 4px;
      font-size: 20px;
      font-weight: 750;
      color: #475569;
    }

    .contact-list span {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
      overflow-wrap: anywhere;
    }

    .contact-list svg {
      width: 22px;
      height: 22px;
      flex: 0 0 auto;
      stroke: var(--ocean-dark);
      stroke-width: 2.3;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
    }

    .action-row {
      display: grid;
      gap: 10px;
      margin-top: 4px;
    }

    @media (min-width: 560px) {
      .action-row {
        grid-template-columns: 1fr 1fr;
      }

      .card-actions {
        max-width: 680px;
        margin: 0 auto;
      }
    }

    .workspace-grid {
      display: grid;
      gap: 14px;
    }

    /* Mobile: controls on top, preview, swipeable templates, actions */
    @media (max-width: 979px) {
      #doctorFeedView .workspace-grid {
        display: grid;
        grid-template-areas:
          "controls"
          "preview"
          "templates"
          "actions";
        gap: 12px;
      }

      #doctorFeedView .workspace-sidebar,
      #doctorFeedView .workspace-main {
        display: contents;
      }

      #doctorFeedView .feed-controls {
        grid-area: controls;
        position: sticky;
        top: 68px;
        z-index: 12;
        border-radius: var(--radius-sm);
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
      }

      #doctorFeedView .template-section {
        grid-area: templates;
      }

      #doctorFeedView .preview-panel {
        grid-area: preview;
      }

      #doctorFeedView .workspace-main > .action-row {
        grid-area: actions;
      }

      #doctorFeedView .feed-controls.panel-card {
        padding: 12px 14px;
      }

      #doctorFeedView .preview-panel.panel-card {
        padding: 14px;
      }

      #doctorFeedView .page-intro {
        margin-bottom: 0;
      }

      #doctorFeedView .page-intro .section-head {
        margin-top: 0;
        margin-bottom: 4px;
      }

      #doctorFeedView .page-intro .section-head h2 {
        font-size: 22px;
      }

      #doctorFeedView .template-list {
        display: flex;
        flex-direction: row;
        gap: 12px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 2px 10px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
      }

      #doctorFeedView .template-list::-webkit-scrollbar {
        height: 6px;
      }

      #doctorFeedView .template-list::-webkit-scrollbar-thumb {
        background: #c9d2e3;
        border-radius: 999px;
      }

      #doctorFeedView .template-card {
        flex: 0 0 min(82vw, 300px);
        grid-template-columns: 96px 1fr;
        scroll-snap-align: start;
        min-height: 118px;
      }

      #doctorFeedView .template-thumb {
        width: 96px;
        height: 112px;
      }

      #doctorFeedView .action-row {
        grid-template-columns: 1fr;
        margin-top: 0;
      }
    }

    .preview-panel .preview-shell {
      padding: 8px 0 0;
    }

    .admin-grid {
      display: grid;
      gap: 16px;
    }

    .card-workspace {
      max-width: 760px;
      margin: 0 auto;
    }

    .file-note {
      color: var(--muted);
      font-size: 11px;
      line-height: 1.35;
    }

    /* Off-screen staging keeps exports full-size while staying invisible to the user. */
    .hidden-export-area {
      position: fixed;
      left: -2000px;
      top: 0;
      width: 1000px;
      pointer-events: none;
      opacity: 1;
    }

    @media (min-width: 760px) {
      .auth-layout {
        grid-template-columns: 1.05fr 0.95fr;
        gap: 22px;
      }

      .auth-brand-panel {
        display: block;
      }

      .auth-card {
        max-width: none;
        margin: 0;
        align-self: center;
      }

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

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

      .screen {
        padding-bottom: 120px;
      }

      .header {
        min-height: 74px;
      }

      .brand-mark {
        width: 124px;
        height: 44px;
      }

      .header-title {
        font-size: 16px;
      }

      .header-subtitle {
        font-size: 12px;
      }

      .section-head {
        margin-top: 18px;
      }

      .section-head h2 {
        font-size: 26px;
      }

      .section-head p {
        font-size: 14px;
      }

      .auth-card {
        padding: 34px 30px 28px;
      }

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

      .poster-frame {
        max-width: 560px;
      }

      .card-frame {
        max-width: 560px;
      }
    }

    @media (min-width: 980px) {
      .workspace-grid {
        grid-template-columns: 360px minmax(0, 1fr);
        align-items: start;
      }

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

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

      .template-list {
        max-height: calc(100vh - 320px);
        overflow: auto;
        padding-right: 4px;
      }

      #doctorFeedView .controls-hint {
        display: none;
      }

      #doctorFeedView .feed-controls {
        position: static;
      }

      #cardView .stack {
        max-width: 760px;
        margin: 0 auto;
      }
    }

    @media (max-width: 350px) {
      .screen {
        padding-left: 10px;
        padding-right: 10px;
      }

      .auth-card {
        padding-left: 12px;
        padding-right: 12px;
      }

      .header {
        padding-left: 8px;
        padding-right: 8px;
      }

      .brand-mark {
        width: 84px;
      }

    }

    .auth-links {
      margin: 14px 0 0;
      text-align: center;
      font-size: 12px;
      color: var(--muted);
    }

    .auth-links a {
      color: var(--brand);
      font-weight: 700;
      text-decoration: none;
    }

    .auth-links span {
      margin: 0 6px;
      opacity: 0.5;
    }

    .app-footer {
      padding: 18px clamp(14px, 3vw, 32px) 100px;
      border-top: 1px solid var(--line);
      background: #fff;
      font-size: 11px;
      line-height: 1.5;
      color: var(--muted);
      text-align: center;
    }

    .app-footer p {
      margin: 0 0 8px;
    }

    .app-footer-links {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px 14px;
    }

    .app-footer-links a {
      color: var(--brand);
      font-weight: 700;
      text-decoration: none;
    }

    .app-footer-note {
      max-width: 520px;
      margin: 8px auto 0 !important;
      font-size: 10px;
    }

    .card-copyright {
      margin: 10px 0 0;
      color: #94a3b8;
      font-size: 16px;
      font-weight: 700;
    }

    .onboarding-overlay {
      display: none;
      position: fixed;
      inset: 0;
      z-index: 60;
      padding: 20px;
      background: rgba(15, 23, 42, 0.55);
      backdrop-filter: blur(6px);
      align-items: center;
      justify-content: center;
    }

    .onboarding-overlay.visible {
      display: flex;
    }

    .onboarding-card {
      width: min(100%, 480px);
      padding: 26px 22px;
      border: 1px solid var(--line);
      box-shadow: var(--shadow-lg);
    }

    .onboarding-card h2 {
      margin: 0 0 8px;
      font-size: 24px;
      font-weight: 800;
      color: var(--ink);
      letter-spacing: -0.02em;
    }

    .onboarding-card .lead {
      text-align: left;
      margin: 0 0 16px;
      max-width: none;
    }

    .onboarding-actions {
      display: grid;
      gap: 8px;
      margin-top: 12px;
    }

    /* Marketing / legal site pages */
    .site-page {
      min-height: 100vh;
      background:
        radial-gradient(circle at top right, rgba(26, 20, 100, 0.06), transparent 30%),
        linear-gradient(180deg, #ffffff 0, var(--soft) 320px, var(--soft-2) 100%);
    }

    .site-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 16px;
      width: min(100%, 1180px);
      margin: 0 auto;
      padding: 18px 24px;
      position: sticky;
      top: 0;
      z-index: 20;
      background: rgba(255, 255, 255, 0.9);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--line);
    }

    .site-brand img,
    .site-header img {
      width: 128px;
      height: auto;
      display: block;
    }

    .site-nav {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: flex-end;
      gap: 8px 18px;
      min-width: 0;
      font-size: 14px;
      font-weight: 700;
    }

    .site-nav a {
      color: var(--ink);
      text-decoration: none;
      white-space: nowrap;
      transition: color var(--transition);
    }

    .site-nav a:hover,
    .site-nav a.active {
      color: var(--brand);
    }

    .site-menu-toggle {
      display: none;
      width: 42px;
      height: 42px;
      padding: 0;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 5px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: #fff;
      color: var(--ink);
      cursor: pointer;
      box-shadow: var(--shadow-sm);
      transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    }

    .site-menu-toggle:hover {
      border-color: var(--line-strong);
      box-shadow: var(--shadow);
      transform: translateY(-1px);
    }

    .site-menu-toggle span {
      width: 18px;
      height: 2px;
      border-radius: 999px;
      background: currentColor;
      transition: transform var(--transition), opacity var(--transition);
    }

    .site-header.is-menu-open .site-menu-toggle span:nth-child(1) {
      transform: translateY(7px) rotate(45deg);
    }

    .site-header.is-menu-open .site-menu-toggle span:nth-child(2) {
      opacity: 0;
    }

    .site-header.is-menu-open .site-menu-toggle span:nth-child(3) {
      transform: translateY(-7px) rotate(-45deg);
    }

    .site-cta {
      display: none;
      min-height: 42px;
      padding: 0 16px;
      align-items: center;
      border-radius: 999px;
      background: var(--brand);
      color: #fff;
      font-size: 13px;
      font-weight: 800;
      text-decoration: none;
      box-shadow: 0 8px 20px rgba(26, 20, 100, 0.18);
    }

    .site-hero,
    .hero-premium {
      max-width: 1180px;
      margin: 0 auto;
      padding: 36px 24px 48px;
      display: grid;
      gap: 28px;
    }

    .site-hero h1,
    .hero-copy h1 {
      margin: 0;
      font-size: clamp(32px, 5vw, 52px);
      line-height: 1.05;
      font-weight: 800;
      color: var(--ink);
      letter-spacing: -0.04em;
      max-width: 14ch;
    }

    .hero-eyebrow {
      color: var(--brand-light);
    }

    .site-hero .lead,
    .hero-copy .lead {
      max-width: 56ch;
      margin: 14px 0 0;
      text-align: left;
      font-size: 17px;
      line-height: 1.65;
      font-weight: 500;
    }

    .hero-stats {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
      margin-top: 24px;
      max-width: 520px;
    }

    .hero-stats div {
      padding: 14px;
      border-radius: var(--radius-sm);
      background: #fff;
      border: 1px solid var(--line);
      box-shadow: var(--shadow-sm);
    }

    .hero-stats strong {
      display: block;
      font-size: 20px;
      font-weight: 800;
      color: var(--brand);
      margin-bottom: 4px;
    }

    .hero-stats span {
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }

    .hero-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
      margin-top: 22px;
    }

    .hero-actions a {
      min-height: 48px;
      padding: 0 20px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      font-size: 14px;
      font-weight: 800;
      text-decoration: none;
      transition: transform var(--transition), box-shadow var(--transition);
    }

    .hero-actions a:hover {
      transform: translateY(-1px);
    }

    .hero-actions .primary {
      color: #fff;
      background: linear-gradient(180deg, var(--brand-light) 0%, var(--brand) 100%);
      box-shadow: 0 12px 28px rgba(26, 20, 100, 0.22);
    }

    .hero-actions .secondary {
      color: var(--ink);
      background: #fff;
      border: 1px solid var(--line-strong);
    }

    .site-section {
      max-width: 1180px;
      margin: 0 auto;
      padding: 0 24px 44px;
    }

    .site-section h2 {
      margin: 0 0 18px;
      font-size: clamp(24px, 3vw, 34px);
      font-weight: 800;
      letter-spacing: -0.03em;
      color: var(--ink);
    }

    .feature-grid,
    .pricing-grid {
      display: grid;
      gap: 16px;
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .feature-card,
    .pricing-card,
    .legal-card {
      padding: 22px;
      border: 1px solid var(--line);
      border-radius: var(--radius);
      background: #fff;
      box-shadow: var(--shadow-sm);
      transition: transform var(--transition), box-shadow var(--transition);
    }

    .feature-card:hover,
    .pricing-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow);
    }

    .feature-icon {
      width: 42px;
      height: 42px;
      display: grid;
      place-items: center;
      margin-bottom: 14px;
      border-radius: 12px;
      background: var(--brand-soft);
      color: var(--brand);
      font-size: 12px;
      font-weight: 800;
    }

    .chip-row {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
    }

    .chip {
      padding: 10px 14px;
      border-radius: 999px;
      background: #fff;
      border: 1px solid var(--line);
      color: var(--ink);
      font-size: 13px;
      font-weight: 700;
      box-shadow: var(--shadow-sm);
    }

    .cta-band {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 18px;
      padding: 28px 24px;
      border-radius: var(--radius-lg);
      background: linear-gradient(135deg, var(--brand) 0%, #120c42 100%);
      color: #fff;
      box-shadow: var(--shadow-lg);
    }

    .cta-band h2 {
      margin: 0 0 8px;
      color: #fff;
      font-size: clamp(22px, 3vw, 30px);
    }

    .cta-band p {
      margin: 0;
      color: rgba(255, 255, 255, 0.82);
      font-size: 15px;
      line-height: 1.5;
    }

    .cta-band .primary {
      min-height: 48px;
      padding: 0 20px;
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      background: #fff;
      color: var(--brand);
      font-weight: 800;
      text-decoration: none;
      white-space: nowrap;
    }

    .feature-card h3,
    .pricing-card h3 {
      margin: 0 0 8px;
      font-size: 17px;
    }

    .feature-card p,
    .pricing-card p,
    .legal-card p,
    .legal-card li {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
      line-height: 1.5;
    }

    .pricing-card .price {
      margin: 8px 0 12px;
      font-size: 28px;
      font-weight: 900;
      color: var(--brand);
    }

    .pricing-card .price-number {
      visibility: hidden;
    }

    .pricing-card ul {
      margin: 0;
      padding-left: 18px;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.6;
    }

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

    .strategy-item {
      padding: 14px;
      border-left: 4px solid var(--accent);
      background: #fff;
      border-radius: 0 var(--radius) var(--radius) 0;
      border: 1px solid var(--line);
      border-left-width: 4px;
      border-left-color: var(--accent);
    }

    .strategy-item strong {
      display: block;
      margin-bottom: 4px;
    }

    .strategy-item span {
      color: var(--muted);
      font-size: 13px;
      line-height: 1.45;
    }

    .site-footer {
      max-width: 1100px;
      margin: 0 auto;
      padding: 24px 20px 40px;
      border-top: 1px solid var(--line);
      text-align: center;
      font-size: 12px;
      color: var(--muted);
      line-height: 1.55;
    }

    .site-footer .links {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 10px 16px;
      margin: 10px 0;
    }

    .site-footer a {
      color: var(--brand);
      font-weight: 700;
      text-decoration: none;
    }

    @media (min-width: 900px) {
      .site-cta {
        display: inline-flex;
      }

      .site-hero {
        grid-template-columns: 1.1fr 0.9fr;
        align-items: center;
      }

      .hero-premium {
        grid-template-columns: minmax(0, 1fr);
      }
    }

    @media (max-width: 767px) {
      .site-header {
        align-items: center;
        gap: 12px;
      }

      .site-header img {
        width: 116px;
      }

      .site-menu-toggle {
        display: inline-flex;
        margin-left: auto;
      }

      .site-nav {
        position: absolute;
        top: calc(100% + 8px);
        left: 16px;
        right: 16px;
        display: grid;
        gap: 4px;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.98);
        box-shadow: var(--shadow-lg);
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px) scale(0.98);
        transform-origin: top right;
        transition: opacity var(--transition), visibility var(--transition), transform var(--transition), max-height var(--transition);
      }

      .site-header.is-menu-open .site-nav {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        max-height: 360px;
        transform: translateY(0) scale(1);
      }

      .site-nav a {
        display: block;
        padding: 11px 12px;
        border-radius: 10px;
      }

      .site-nav a:hover,
      .site-nav a.active {
        background: var(--brand-soft);
      }
    }

    @media (max-width: 560px) {
      .site-header {
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
      }

      .site-nav {
        left: 12px;
        right: 12px;
        padding: 8px;
        font-size: 13px;
        line-height: 1.2;
      }

      .site-nav a {
        padding: 10px 12px;
      }
    }

    /* Final responsive navbar rules */
    .site-header {
      flex-wrap: nowrap;
    }

    .site-header .site-menu-toggle {
      display: none !important;
    }

    .site-header .site-nav {
      position: static;
      display: flex !important;
      align-items: center;
      justify-content: flex-end;
      width: auto;
      max-height: none;
      padding: 0;
      border: 0;
      background: transparent;
      box-shadow: none;
      overflow: visible;
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transform: none;
    }

    @media (max-width: 767px) {
      .site-header {
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 14px 16px;
      }

      .site-header img {
        width: 116px;
      }

      .site-header .site-menu-toggle {
        display: inline-flex !important;
        flex: 0 0 42px;
        margin-left: auto;
      }

      .site-header .site-nav {
        position: absolute;
        top: calc(100% + 8px);
        left: 12px;
        right: 12px;
        width: auto;
        display: none !important;
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: rgba(255, 255, 255, 0.98);
        box-shadow: var(--shadow-lg);
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-8px) scale(0.98);
      }

      .site-header.is-menu-open .site-nav {
        display: grid !important;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
        animation: siteMenuIn 180ms ease both;
      }

      .site-header .site-nav a {
        display: block;
        padding: 11px 12px;
        border-radius: 10px;
      }

      .site-header .site-cta {
        display: none !important;
      }
    }

    @keyframes siteMenuIn {
      from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }
