/*
 * MEDSOC workspace — presentation layer.
 * Loaded after styles.css. Refines the shell and shared components with depth,
 * an institutional navy / teal / gold palette and restrained motion.
 * Never touches .opening-pages (the official paper form) or print output.
 */

:root {
  --gold: #c9a45c;
  --gold-soft: #f6eedc;
  --teal-2: #14b8a6;
  --navy-2: #0b2136;
  --shadow-sm: 0 1px 2px #0f2a4410, 0 4px 14px #0f2a440d;
  --shadow-md: 0 2px 6px #0f2a4414, 0 14px 32px #0f2a4417;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

body {
  background:
    radial-gradient(1100px 420px at 85% -120px, #dff3ef 0%, transparent 70%),
    radial-gradient(900px 380px at 10% -160px, #e3ebf8 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
}

/* ---------- sidebar ---------- */
.app .sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background:
    radial-gradient(420px 260px at 0% 0%, #1b4f6a55, transparent 70%),
    radial-gradient(380px 300px at 100% 100%, #0d968b2e, transparent 70%),
    linear-gradient(180deg, #11304b 0%, var(--navy-2) 100%);
  box-shadow: inset -1px 0 0 #ffffff12;
  scrollbar-width: thin; scrollbar-color: #ffffff22 transparent;
}
.app .sidebar::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(#ffffff10 1px, transparent 1px);
  background-size: 18px 18px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 45%);
}
.app .sidebar > * { position: relative; }
.app .brand { border-bottom: 0; padding-bottom: 20px; }
.app .brand::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--gold), #ffffff22 45%, transparent);
}
.app .brand-logo {
  background: linear-gradient(140deg, #2ad4bf, #0d968b 60%, #0b7a72);
  box-shadow: 0 0 0 3px #ffffff14, 0 6px 16px #0d968b55; color: #fff;
}
.app .brand strong { letter-spacing: 2px; }
.app .brand small { letter-spacing: 1.4px; font-size: 9px; color: #9ec3d6; }
.app .section-name { color: #c9a45cb3; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.app .section-name::after { content: ""; flex: 1; height: 1px; background: #ffffff14; }

.app .nav {
  position: relative; transition: background .2s var(--ease), color .2s, transform .2s var(--ease);
  border-left: 0;
}
.app .nav:hover { background: #ffffff0d; color: #fff; transform: translateX(2px); }
.app .nav.active {
  border-left: 0; color: #fff;
  background: linear-gradient(90deg, #1fbfa833, #1fbfa80d 70%, transparent);
  box-shadow: inset 0 0 0 1px #2ad4bf26;
}
.app .nav.active::before {
  content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, #2ad4bf, var(--gold));
}
.app .nav .icon { opacity: .8; transition: opacity .2s, color .2s; }
.app .nav.active .icon, .app .nav:hover .icon { opacity: 1; color: #5ee3cf; }
.app .badge:not(:empty) { background: linear-gradient(135deg, #f07a7f, #d9535d); box-shadow: 0 2px 6px #d9535d55; font-weight: 600; }
.app .badge:empty { display: none; }

.app .sidebar-end { border-top: 0; margin-top: auto; background: #ffffff0a; border: 1px solid #ffffff12; border-radius: 12px; padding: 11px; }
.app .sidebar-end .avatar, .app .top-actions .avatar {
  background: linear-gradient(140deg, var(--gold-soft), #e6d3a6); color: #6b5221;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px var(--gold);
}
.app .sidebar-end b { color: #fff; font-weight: 600; }
.app .sidebar-end small { font-size: 10px; }

/* ---------- topbar ---------- */
.app .topbar {
  position: sticky; top: 0; z-index: 15;
  background: #ffffffd9; backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid #e3e9f0;
}
.app .topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--teal) 0%, var(--teal-2) 30%, var(--gold) 70%, transparent 100%);
  opacity: .55;
}
.app .topbar .crumb { font-size: 12px; }
.app .topbar .crumb strong {
  background: #eef6f5; color: #0b6f68; padding: 4px 10px; border-radius: 999px; font-weight: 600;
  box-shadow: inset 0 0 0 1px #cfe9e5;
}
.app .role {
  background: linear-gradient(180deg, #f2fbf9, #e4f5f2); color: #0b6f68; font-weight: 600;
  border: 1px solid #c8e7e1; border-radius: 9px; padding: 7px 12px; box-shadow: var(--shadow-sm);
}
.app #notificationsButton {
  border: 1px solid #e1e8ef; background: #fff; border-radius: 9px; padding: 7px 11px; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s;
}
.app #notificationsButton:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ---------- page entrance (class toggled by workspace.js on route change) ---------- */
.app .content.ms-enter > * { animation: msRise .45s var(--ease) both; }
.app .content.ms-enter > :nth-child(2) { animation-delay: .04s; }
.app .content.ms-enter > :nth-child(3) { animation-delay: .08s; }
.app .content.ms-enter > :nth-child(4) { animation-delay: .12s; }
.app .content.ms-enter > :nth-child(n+5) { animation-delay: .16s; }
@keyframes msRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- headings ---------- */
.app .heading { padding-bottom: 18px; border-bottom: 1px solid #e3e9f0; position: relative; }
.app .heading::after {
  content: ""; position: absolute; left: 0; bottom: -1px; width: 72px; height: 2px;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}
.app .heading h1 { color: #0f2a44; letter-spacing: -.3px; font-weight: 600; }
.app .eyebrow { display: inline-flex; align-items: center; gap: 8px; letter-spacing: 1.6px; }
.app .heading .eyebrow::before, .app .pitch-overline::before {
  content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--gold);
}

/* ---------- hero banners ---------- */
.app .hero, .app .pitch-hero {
  border-radius: 18px; padding: 30px 32px; box-shadow: 0 18px 40px #0b213626;
  background:
    radial-gradient(520px 260px at 100% 0%, #2ad4bf40, transparent 70%),
    radial-gradient(420px 240px at 0% 100%, #c9a45c26, transparent 70%),
    linear-gradient(120deg, #0f2f4a 0%, #0f4a4a 55%, #0d6b5f 100%);
}
.app .hero::before, .app .pitch-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .45;
  background-image:
    linear-gradient(#ffffff0d 1px, transparent 1px),
    linear-gradient(90deg, #ffffff0d 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
}
.app .hero::after, .app .pitch-hero::after {
  content: ""; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; font-size: 0; opacity: 1;
  background: transparent;
  box-shadow: inset 0 0 0 1px #ffffff1f, 0 0 0 36px #ffffff06, 0 0 0 37px #ffffff14, 0 0 0 80px #ffffff04, 0 0 0 81px #ffffff10;
}
.app .hero > *, .app .pitch-hero > * { position: relative; }
.app .hero h1, .app .pitch-hero h1 { font-weight: 600; letter-spacing: -.5px; }
.app .hero .eyebrow, .app .pitch-overline { color: #e8cf98; letter-spacing: 2px; display: inline-flex; align-items: center; gap: 8px; }
.app .hero p, .app .pitch-hero p { color: #cfe4e0; }
.app .pitch-demo {
  display: block; width: fit-content; max-width: 100%; margin-top: 14px; padding: 5px 10px; border-radius: 999px;
  background: #ffffff10; border: 1px solid #ffffff1f; color: #cfe4e0; letter-spacing: .3px;
}

/* ---------- stat tiles ---------- */
.app .stat {
  --accent: var(--teal);
  overflow: hidden; border-color: #e3e9f0; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.app .stat::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.app .stat::after {
  content: ""; position: absolute; right: -30px; bottom: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  pointer-events: none;
}
.app :is(.grid4, .pitch-kpis, .stats) > .stat:nth-child(4n+2) { --accent: #3c78c9; }
.app :is(.grid4, .pitch-kpis, .stats) > .stat:nth-child(4n+3) { --accent: var(--gold); }
.app :is(.grid4, .pitch-kpis, .stats) > .stat:nth-child(4n+4) { --accent: #8a63c9; }
.app .stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.app .stat .mini, .app .stat small { text-transform: none; letter-spacing: .3px; font-weight: 500; }
.app .stat .number, .app .stat strong { font-variant-numeric: tabular-nums; color: #0f2a44; }
.app .stat .bubble { background: color-mix(in srgb, var(--accent) 12%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- cards ---------- */
.app .card {
  border-color: #e3e9f0; border-radius: 14px; box-shadow: var(--shadow-sm);
  transition: box-shadow .25s var(--ease), border-color .25s;
}
.app .card:hover { box-shadow: var(--shadow-md); border-color: #d6e0ea; }
.app .card-head { padding-bottom: 13px; border-bottom: 1px dashed #e3e9f0; }
.app .card-head h2 { display: flex; align-items: center; gap: 9px; color: #0f2a44; font-weight: 600; }
.app .card-head h2::before {
  content: ""; width: 4px; height: 16px; border-radius: 3px; flex: none;
  background: linear-gradient(180deg, var(--teal-2), var(--teal));
}

.app .pitch-card { position: relative; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.app .pitch-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--teal-2), var(--gold)); opacity: 0; transition: opacity .25s;
}
.app .pitch-card:hover { transform: translateY(-2px); }
.app .pitch-card:hover::before { opacity: 1; }
.app .pitch-side strong { font-variant-numeric: tabular-nums; color: #0f4a4a; }

.app .project-card { border-color: #e1e8ef; box-shadow: var(--shadow-sm); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.app .project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.app .board-col { background: linear-gradient(180deg, #eaf1f5, #f2f6f8); border: 1px solid #e1e9ef; }

/* ---------- buttons ---------- */
.app .btn, #modalRoot .btn { transition: transform .2s var(--ease), box-shadow .2s var(--ease), filter .2s; }
.app .btn:hover, #modalRoot .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); filter: none; }
.app .btn.primary, #modalRoot .btn.primary {
  background: linear-gradient(135deg, #14b8a6, #0d968b 55%, #0b7f76); border-color: #0b867d; color: #fff;
  box-shadow: 0 1px 0 #ffffff40 inset, 0 6px 14px #0d968b40;
}
.app .btn.primary:hover, #modalRoot .btn.primary:hover { box-shadow: 0 1px 0 #ffffff40 inset, 0 10px 20px #0d968b55; }
.app .linkbutton { transition: background .2s, color .2s; }
.app .linkbutton:hover { background: #d3f0eb; }
.app .small-link { transition: color .2s; }
.app .small-link:hover { color: #0b6f68; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- tabs ---------- */
.app .pitch-tabs button, .app .tab { transition: background .2s, color .2s, border-color .2s, box-shadow .2s; }
.app .pitch-tabs button:hover:not(.active), .app .tab:hover:not(.active) { border-color: #b8ddd6; color: #0b6f68; }
.app .pitch-tabs button.active, .app .tab.active {
  background: linear-gradient(135deg, #0f4a4a, #0d6b5f); border-color: #0f4a4a; box-shadow: 0 4px 12px #0f4a4a33;
}
.app .classic-project-tabs button.active { background: linear-gradient(135deg, #0f4a4a, #0d6b5f); }

/* ---------- tables ---------- */
.app .table-wrap th {
  background: linear-gradient(180deg, #f7f9fc, #f1f5f9); color: #6d7f92; font-weight: 600;
  letter-spacing: .5px; border-bottom: 1px solid #e3e9f0;
}
.app .table-wrap tbody tr { transition: background .15s; }
.app .table-wrap tbody tr:hover { background: #f5faf9; }

/* ---------- pills, chips, notices ---------- */
.app .pill { box-shadow: inset 0 0 0 1px currentColor; box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent); letter-spacing: .2px; }
.app .review-chip, .app .review-chips span { transition: transform .2s; }
.app .notice { border-left: 3px solid #39b3a1; }
.app .notice.amber { border-left-color: var(--gold); }
.app .notice.red { border-left-color: #d95765; }
.app .pitch-role-note {
  display: flex; align-items: center; gap: 9px; background: linear-gradient(90deg, #e9f6f2, #f5faf8);
  border: 1px solid #d7ece5;
}
.app .pitch-role-note::before { content: "◉"; color: var(--gold); font-size: 10px; }

/* ---------- progress & flow ---------- */
.app .fill, .app .progress > span { background: linear-gradient(90deg, #0d968b, #2ad4bf); }
.app .flow-node { box-shadow: var(--shadow-sm); transition: transform .2s var(--ease); }
.app .flow-node:hover { transform: translateY(-2px); }
.app .flow-day { background: linear-gradient(135deg, #0f2f4a, #0f4a4a); box-shadow: 0 6px 16px #0f2f4a33; }
.app .flow-arrow { color: var(--gold); font-weight: 600; }
.app .pitch-event::before, .app .event::before { box-shadow: 0 0 0 3px #e4f4ef; }

/* ---------- inputs ---------- */
.app .pitch-search, .app .toolbar input, .app .toolbar select, .app .search, #modalRoot .form :is(input, select, textarea) {
  transition: border-color .2s, box-shadow .2s;
}
.app .pitch-search:focus, .app .toolbar input:focus, .app .toolbar select:focus, .app .search:focus,
#modalRoot .form :is(input, select, textarea):focus {
  outline: none; border-color: #5cc7b6; box-shadow: 0 0 0 4px #14b8a61f;
}

/* ---------- modal & toast ---------- */
#modalRoot .modal-wrap { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
#modalRoot .modal {
  position: relative; border-radius: 18px; box-shadow: 0 30px 70px #0b213640;
  animation: msPop .28s var(--ease) both;
}
#modalRoot .modal::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; pointer-events: none;
  background: linear-gradient(90deg, var(--teal), var(--teal-2) 45%, var(--gold));
}
@keyframes msPop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
#toastRoot .toast {
  background: linear-gradient(135deg, #0f2f4a, #0f4a4a); border-left: 3px solid var(--gold);
  animation: msRise .3s var(--ease) both;
}

/* ---------- scrollbars ---------- */
.app ::-webkit-scrollbar { width: 10px; height: 10px; }
.app ::-webkit-scrollbar-thumb { background: #c8d4df; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.app .sidebar::-webkit-scrollbar-thumb { background: #ffffff22; background-clip: padding-box; }

/* ---------- responsive / motion / print ---------- */
@media (max-width: 760px) {
  .app .section-name { display: none; }
  .app .nav.active::before { left: 2px; }
  .app .sidebar-end { background: none; border: 0; padding: 9px 0; }
  .app .hero, .app .pitch-hero { padding: 22px 20px; }
  .app .hero::after, .app .pitch-hero::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .app .content.ms-enter > *, #modalRoot .modal, #toastRoot .toast { animation: none; }
  .app .stat, .app .card, .app .btn, .app .nav, .app .pitch-card, .app .project-card, .app .flow-node { transition: none; }
  .app .stat:hover, .app .pitch-card:hover, .app .project-card:hover, .app .flow-node:hover, .app .nav:hover, .app .btn:hover { transform: none; }
}
@media print {
  body { background: #fff; }
  .app .content.ms-enter > * { animation: none; }
  .app .stat, .app .card { box-shadow: none; }
}
