/* Rodibio — desktop / web app layout (≥960px) */

@media (min-width: 960px) {
  html,
  body {
    overflow: hidden;
  }

  body {
    display: block;
    padding: 0;
    background:
      radial-gradient(1200px 600px at 0% 0%, rgba(189, 135, 131, 0.12), transparent 55%),
      radial-gradient(900px 500px at 100% 100%, rgba(170, 194, 175, 0.16), transparent 50%),
      #eef1ee;
  }

  #app {
    max-width: none;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
  }

  /* —— Role landing —— */
  #screen-role {
    padding: 48px;
    align-items: center;
  }

  #screen-role .brand {
    font-size: 3.4rem;
  }

  #screen-role .tagline {
    font-size: 1.15rem;
    margin-bottom: 40px;
    max-width: 420px;
  }

  #screen-role .role-btn {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
    padding: 22px 24px;
  }

  /* —— App shell: sidebar + main —— */
  .app-shell {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
    grid-template-rows: var(--header-h) minmax(0, 1fr);
    grid-template-areas:
      "nav head"
      "nav main";
    height: 100%;
    max-width: 1440px;
    margin: 0 auto;
    background: var(--bg);
    border-radius: 0;
    box-shadow: 0 0 0 1px rgba(44, 51, 48, 0.04);
  }

  .app-footer {
    grid-area: nav;
    position: relative;
    inset: auto;
    height: 100%;
    min-height: 0;
    width: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    padding: 20px 16px 20px;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.55);
    border-right: 1px solid rgba(44, 51, 48, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .sidebar-brand {
    display: block;
    padding: 8px 12px 18px;
  }

  .sidebar-brand .brand-mark {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }

  .sidebar-brand .brand-mark span {
    color: var(--rose);
  }

  .sidebar-brand small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.8rem;
  }

  .footer-dock,
  .footer-dock--wide {
    flex: 0 0 auto;
    flex-direction: column;
    max-width: none;
    width: 100%;
    border-radius: 18px;
    padding: 8px;
    gap: 4px;
    background: rgba(255, 255, 255, 0.8);
  }

  .tab {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
    font-weight: 600;
  }

  .tab .tab-icon {
    font-size: 1.15rem;
    width: 1.4rem;
    text-align: center;
  }

  .tab.active {
    background: var(--rose-soft);
    color: var(--rose);
  }

  .tab--demo {
    margin-top: 8px;
    border-style: dashed;
    justify-content: flex-start;
  }

  .tab--demo .tab-demo-label {
    font-size: 0.9rem;
    max-width: none;
    text-align: left;
    line-height: 1.2;
  }

  .tab--demo::after {
    content: "демо";
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rose);
    opacity: 0.75;
  }

  .footer-fab {
    width: 100%;
    height: auto;
    min-height: 52px;
    border-radius: 16px;
    flex-direction: row;
    gap: 10px;
    margin-top: auto;
    padding: 12px 16px;
    background: var(--rose);
    color: #fff;
    border: none;
    box-shadow: 0 10px 24px rgba(189, 135, 131, 0.28);
    font-size: 0.92rem;
    font-weight: 600;
  }

  .footer-fab .tab-icon {
    color: #fff;
    font-size: 1.25rem;
  }

  .app-header {
    grid-area: head;
    position: relative;
    pointer-events: auto;
    height: var(--header-h);
    padding: 0 28px;
    background: transparent;
  }

  .app-header.is-scrolled {
    background: rgba(247, 248, 246, 0.78);
  }

  .app-content {
    grid-area: main;
    padding: 8px 28px 32px;
    max-width: none;
  }

  .app-content.no-footer {
    padding: calc(var(--header-h) + 8px) 28px 32px;
  }

  .header-title {
    font-size: 1.2rem;
  }

  /* —— Content layouts —— */
  .desk-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 24px;
    align-items: start;
  }

  .desk-grid .section {
    margin-bottom: 0;
  }

  .desk-grid .section--wide {
    grid-column: 1 / -1;
  }

  .desk-grid .section--stats {
    grid-column: 1 / -1;
  }

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

  .stat {
    padding: 20px;
  }

  .stat .num {
    font-size: 1.9rem;
  }

  .patients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }

  .patients-grid .card-row {
    margin-bottom: 0;
    height: 100%;
  }

  .card-row:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(44, 51, 48, 0.08);
  }

  .btn:hover {
    filter: brightness(0.98);
  }

  .section-title {
    font-size: 1.05rem;
  }

  /* Patient / profile card: two columns */
  #patient-card-body,
  #specialist-body,
  #settings-body,
  #pt-content {
    max-width: 1100px;
  }

  .card-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 20px 28px;
    align-items: start;
  }

  .card-layout .card-layout__main,
  .card-layout .card-layout__side {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .hero {
    margin-bottom: 0;
  }

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

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

  .tracker-wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 40px 0;
  }

  .gestation-hero {
    font-size: 2.6rem;
  }

  /* —— Overlays as spacious centered panel —— */
  .screen.overlay {
    background: rgba(28, 32, 30, 0.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 28px;
  }

  .screen.overlay.active {
    display: flex;
    flex-direction: column;
  }

  .screen.overlay .subpage-header {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: min(960px, 100%);
    height: var(--header-h);
    border-radius: 20px 20px 0 0;
    padding: 0 20px;
    background: rgba(247, 248, 246, 0.95);
    pointer-events: auto;
    flex-shrink: 0;
    box-shadow: none;
  }

  .screen.overlay .app-content.no-footer {
    position: relative;
    margin: 0;
    width: min(960px, 100%);
    height: auto;
    max-height: min(820px, calc(100vh - 56px - var(--header-h)));
    border-radius: 0 0 20px 20px;
    box-shadow: 0 24px 64px rgba(28, 32, 30, 0.22);
    padding: 20px 28px 28px;
    background: var(--bg);
    flex: 0 1 auto;
  }

  .screen.overlay .subpage-header.is-scrolled {
    background: rgba(247, 248, 246, 0.95);
    box-shadow: 0 1px 0 rgba(44, 51, 48, 0.06);
  }

  .screen.overlay .card-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    gap: 20px 28px;
  }

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

  /* Patient profile on main patient screen stays full width in main column */
  #screen-patient .app-content {
    max-width: 920px;
  }

  #screen-midwife .app-content {
    max-width: 1100px;
  }

  /* —— Sheets → centered modal —— */
  .sheet-backdrop.open {
    background: rgba(28, 32, 30, 0.4);
    backdrop-filter: blur(6px);
  }

  .sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    width: min(440px, calc(100% - 48px));
    max-height: min(80vh, 720px);
    border-radius: 24px;
    transform: translate(-50%, -46%) scale(0.96);
    opacity: 0;
    padding: 20px 24px 24px;
    box-shadow: 0 24px 64px rgba(28, 32, 30, 0.25);
    pointer-events: none;
    visibility: hidden;
  }

  .sheet.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  .sheet-handle {
    display: none;
  }

  /* —— Notifications —— */
  .notif-panel {
    top: calc(var(--header-h) + 8px);
    left: auto;
    right: 28px;
    width: min(360px, calc(100% - 280px));
    border-radius: 18px;
  }

  /* —— Toast / success —— */
  .toast-wrap {
    left: auto;
    right: 28px;
    bottom: 28px;
    width: min(360px, 100%);
  }

  .success-overlay {
    background: rgba(247, 248, 246, 0.72);
    backdrop-filter: blur(10px);
  }

  .success-overlay.open {
    /* keep centered */
  }

  .success-overlay .btn {
    min-width: 160px;
  }

  /* Role screen full bleed soft bg */
  #screen-role.active {
    background:
      radial-gradient(900px 500px at 15% 20%, var(--rose-soft), transparent 55%),
      radial-gradient(800px 480px at 85% 80%, var(--sage-soft), transparent 50%),
      var(--bg);
  }

  /* Hover polish */
  .role-btn:hover {
    box-shadow: 0 12px 32px rgba(44, 51, 48, 0.1);
    transform: translateY(-2px);
  }

  .footer-fab:hover {
    filter: brightness(1.03);
  }

  .tab:hover:not(.active) {
    background: rgba(44, 51, 48, 0.04);
  }
}

/* Large desktop */
@media (min-width: 1280px) {
  .app-shell {
    grid-template-columns: 272px minmax(0, 1fr);
  }

  .desk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 28px;
  }

  .patients-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }

  .card-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }

  .screen.overlay .subpage-header,
  .screen.overlay .app-content.no-footer {
    width: min(1040px, 100%);
  }
}
