/* AMBOSS Investor Reports — theme follows amboss.com: Lato, ink #2A444B,
   teal #007D8C, white surfaces, 8px radii. The sheet grid itself is styled to
   match Google Sheets at 100% zoom (Arial 10pt, 21px rows, light gridlines). */

@import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght@0,400;0,600;0,700;1,400&display=swap');

:root {
  --brand: #007d8c;
  --brand-dark: #015a64;
  --brand-soft: #e6f3f4;
  --ink: #2a444b;
  --ink-2: #40515e;
  --muted: #607585;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --border: #e1e6e9;
  --border-strong: #c9d2d7;
  --text: var(--ink);
  --accent: var(--brand);
  --accent-soft: var(--brand-soft);
  --danger: #b42318;
  --ok-bg: #e6f4ea; --ok-text: #1e5631;
  --warn-bg: #fff4e0; --warn-text: #7a4e00;
  --err-bg: #fdecea; --err-text: #8a1c13;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(42 68 75 / 6%), 0 1px 3px rgb(42 68 75 / 5%);
  --font: "Lato", "LatoLocal", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --topbar-h: 60px;
}

/* Light only: the brand is light, and the logo's dark lettering needs a light header. */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ shell */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--topbar-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand .logo { height: 28px; width: auto; display: block; }
.brand-mark { font-weight: 700; font-size: 20px; letter-spacing: 0.5px; color: var(--ink); }
.brand-sub { color: var(--muted); font-size: 13px; padding-left: 14px; border-left: 1px solid var(--border); }
.topnav { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topnav a { color: var(--ink-2); font-weight: 600; }
.topnav .who { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

main { width: 100%; max-width: 760px; margin: 0 auto; padding: 32px 20px 64px; flex: 1; }
main.wide { max-width: 1180px; }

/* Sheet pages use the whole viewport: no centring, no max-width, the grid
   takes every pixel below the header. */
body.sheet-mode main {
  max-width: none; margin: 0; padding: 10px 16px 0;
  display: flex; flex-direction: column; min-height: 0;
  height: calc(100vh - var(--topbar-h));
}
body.sheet-mode .foot { display: none; }

.foot {
  width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px 32px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--muted); font-size: 12px;
}

.page-head { margin-bottom: 22px; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.2px; color: var(--ink); }
.lede { margin: 0; color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 12.5px; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ----------------------------------------------------------- feedback */

#nav-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: var(--brand); z-index: 100; opacity: 0;
  transition: width 0.4s ease, opacity 0.3s ease; pointer-events: none;
}
#nav-progress.on { opacity: 1; }
a.busy { opacity: 0.55; pointer-events: none; }
button[disabled] { opacity: 0.6; cursor: progress; }

/* Full-screen loading overlay: AMBOSS mark pulsing over a teal sweep. Shown
   only when something genuinely takes a moment (after a short delay). */
/* Page-level activity (navigation, downloads) is a compact card in the corner
   rather than a curtain over the page; the sheet grid has its own skeleton. */
#loading {
  position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 320px; max-width: calc(100vw - 32px);
  display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto auto; column-gap: 14px; row-gap: 4px; align-items: center;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgb(42 68 75 / 18%);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
#loading.on { opacity: 1; transform: none; pointer-events: auto; }
#loading .mark { position: relative; width: 56px; height: 56px; grid-row: 1 / span 3; }
#loading .mark .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin 1.1s cubic-bezier(0.4, 0.1, 0.3, 1) infinite;
}
#loading .mark .ring.two { inset: 8px; border-width: 2px; border-top-color: var(--brand-dark); animation-duration: 1.6s; animation-direction: reverse; }
#loading .mark .core {
  position: absolute; inset: 17px; border-radius: 50%; background: var(--brand);
  animation: pulse 1.6s ease-in-out infinite;
}
#loading .wordmark { display: none; }
#loading .text { font-weight: 700; color: var(--ink); font-size: 14px; }
#loading .sub { color: var(--muted); font-size: 12px; line-height: 1.3; }
#loading .sub:empty { display: none; }
#loading .bar { width: 100%; height: 3px; background: var(--brand-soft); border-radius: 2px; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 40%; background: var(--brand); border-radius: 2px; animation: sweep 1.3s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(0.92); opacity: 0.85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes sweep { 0% { transform: translateX(-120%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) { #loading .ring, #loading .core, #loading .bar i { animation: none; } }

/* ------------------------------------------------------- sheet skeleton */

.skeleton { padding: 14px 16px 24px; min-height: 60vh; }
.sk-top { display: flex; flex-direction: column; gap: 8px; max-width: 520px; margin-bottom: 18px; }
.sk-title { font: 600 14px/1.3 var(--font); color: var(--ink); }
.sk-title b { color: var(--brand); }
.sk-meta { font: 12.5px/1.3 var(--font); color: var(--muted); margin-left: 10px; }
.sk-bar { height: 3px; background: var(--brand-soft); border-radius: 2px; overflow: hidden; }
.sk-bar i { display: block; height: 100%; width: 35%; background: var(--brand); border-radius: 2px; animation: sweep 1.2s ease-in-out infinite; }
.sk-grid { display: flex; flex-direction: column; gap: 7px; }
.sk-row { display: flex; gap: 7px; }
.sk-cell {
  height: 14px; flex: 1 1 0; border-radius: 3px;
  background: linear-gradient(90deg, #eef1f3 0%, #f7f9fa 40%, #eef1f3 80%);
  background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.sk-cell.sk-label { flex: 2.4 1 0; }
.sk-cell.sk-head { background: linear-gradient(90deg, #dfe6ea 0%, #eef2f4 40%, #dfe6ea 80%); background-size: 200% 100%; height: 18px; }
.sk-row:nth-child(5n+2) .sk-cell.sk-label { flex: 1.6 1 0; opacity: 0.8; }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -80% 0; } }
@media (prefers-reduced-motion: reduce) { .sk-cell, .sk-bar i { animation: none; } }

/* ------------------------------------------------------------- components */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 24px; }
.card h2 { margin: 0 0 16px; font-size: 16px; color: var(--ink); }
.card.empty { text-align: center; color: var(--muted); }
.card.empty h1 { color: var(--ink); }

.auth { max-width: 440px; margin: 8vh auto 0; padding: 32px; }
.auth h1 { margin: 0 0 8px; font-size: 24px; color: var(--ink); }
.auth .lede { margin-bottom: 22px; }

label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
input[type="email"], input[type="text"], input:not([type]) {
  width: 100%; padding: 11px 12px; font-size: 15px; font-family: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); margin-bottom: 16px;
}
input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.codeinput { font: 600 26px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 12px; text-align: center; padding: 14px 12px; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink-2);
  padding: 9px 16px; display: inline-block; line-height: 1.3;
}
.btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.btn.ghost { background: transparent; }
button.primary, .primary { width: 100%; background: var(--brand); border-color: var(--brand); color: #fff; padding: 12px 16px; }
button.primary:hover, .primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.grid-form button.primary { width: auto; }
/* Admin: a grant chip with its remove button, and the share control in the Drive browser. */
.chip.grant { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0; }
.chip.grant .x { border: none; background: none; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 2px; cursor: pointer; }
.chip.grant .x:hover { color: var(--danger); }
form.share { display: inline-flex; gap: 6px; align-items: center; }
form.share select { font-size: 13px; padding: 5px 8px; max-width: 240px; }
.btn.small { padding: 5px 12px; font-size: 13px; width: auto; }
.small { font-size: 12px; }
.linkbtn { border: none; background: none; color: var(--brand); padding: 0; font-size: 14px; font-weight: 600; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--danger); }
form.inline, .inline { display: inline; }
form.inline + form.inline { margin-left: 12px; }
.inline-resend { margin-top: -4px; }

.alert { padding: 11px 14px; border-radius: var(--radius); font-size: 14px; margin-bottom: 18px; }
.alert.error { background: var(--err-bg); color: var(--err-text); }
.alert.ok { background: var(--ok-bg); color: var(--ok-text); }
.alert.warn { background: var(--warn-bg); color: var(--warn-text); }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--border); color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.pill.on { background: var(--ok-bg); color: var(--ok-text); }
.pill.off { background: var(--err-bg); color: var(--err-text); }
.pill.admin { background: var(--brand-soft); color: var(--brand); }

.chip { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 5px 11px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--ink-2); white-space: nowrap; }
.chip:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.chip.static { color: var(--muted); border-style: dashed; font-weight: 400; }
.chip + .chip { margin-left: 6px; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.crumbs .sep { margin: 0 8px; opacity: 0.5; }

/* ------------------------------------------------------------- landing */

.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 26px 28px; margin-bottom: 30px;
  background: linear-gradient(135deg, var(--brand-soft) 0%, #ffffff 70%);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.hero .eyebrow { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }
.hero h2 { margin: 0 0 4px; font-size: 22px; color: var(--ink); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn.primary { width: auto; padding: 10px 18px; }

.root { margin-bottom: 36px; }
.root-name { font-size: 16px; font-weight: 700; margin: 0 0 14px; color: var(--ink); }
.root-name a { color: inherit; }
.group { margin-bottom: 26px; }
.group h3 { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 0 0 12px; }
.group h3 a { color: inherit; }

.periods { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.period { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.period-name { display: block; font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 10px; }
.period-files { list-style: none; margin: 0; padding: 0; }
.period-files li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px;  flex-wrap: wrap; }
.period-files li:first-child { border-top: none; }
.file-icon { flex: none; }
.file-name { flex: 1 1 160px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.file-actions { margin-left: auto; flex: none; display: flex; gap: 4px; }
.file-actions .chip { padding: 3px 9px; font-size: 12px; }
.file-actions .chip + .chip { margin-left: 0; }
.chip.primary-chip { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.primary-chip:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

/* ------------------------------------------------------------- file lists */

.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; padding: 4px 16px 4px 4px; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.row:hover { background: var(--brand-soft); }
.row-main { display: flex; align-items: center; gap: 14px; padding: 14px 12px; flex: 1; min-width: 0; color: inherit; }
.row-main:hover { text-decoration: none; }
.row-icon { font-size: 20px; line-height: 1; flex: none; }
.row-text { min-width: 0; }
.row-name { display: block; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: block; font-size: 12px; color: var(--muted); }
.row-actions { flex: none; display: flex; gap: 6px; }

/* ----------------------------------------------------------------- tables */

.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th { background: var(--bg); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.table tbody tr:last-child td { border-bottom: none; }
code.copyable { cursor: pointer; font-size: 12px; background: var(--bg); padding: 3px 7px; border-radius: 5px; border: 1px solid var(--border); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-form .span2 { grid-column: 1 / -1; }
.grid-form .checkline label { font-weight: 400; font-size: 14px; margin-bottom: 16px; }
.grid-form .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.picks { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--surface); margin-bottom: 8px; max-height: 260px; overflow: auto; }
.picks .pick { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; padding: 6px 4px; margin: 0; }
.picks .pick input { width: 18px; height: 18px; margin: 0; }
details.extra { margin-bottom: 16px; }
details.extra summary { cursor: pointer; font-size: 13px; color: var(--brand); font-weight: 600; }
details.extra input { margin-top: 8px; }
.grid-form .checkline input { width: auto; margin-right: 6px; }

/* ----------------------------------------------------------- sheet viewer */

.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; }
.sheet-head h1 { font-size: 18px; margin: 0 0 2px; }
.downloads { display: flex; gap: 8px; flex-wrap: wrap; }
.downloads .btn { padding: 7px 13px; font-size: 13.5px; }

.tabs { display: flex; gap: 2px; overflow-x: auto; margin-bottom: -1px; flex: none; }
.tab { padding: 7px 14px; font-size: 13px; font-weight: 600; color: var(--muted); background: var(--bg); border: 1px solid var(--border); border-bottom: none; border-radius: 8px 8px 0 0; white-space: nowrap; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.active { background: #ffffff; color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }

/* The grid is always paper — white, dark text — in both themes, because its
   colours come straight from the sheet and were chosen against white. It is
   styled to match Google Sheets at 100%: Arial 10pt, 21px rows, #e2e3e3
   gridlines, grey row/column headers. */
.sheetwrap {
  flex: 1 1 auto; min-height: 240px; overflow: auto;
  border: 1px solid var(--border); border-radius: 0 var(--radius) 0 0;
  background: #ffffff; color: #000000; color-scheme: light;
}
body.sheet-mode .sheetwrap { margin-bottom: 0; }
.sheet { border-collapse: collapse; table-layout: fixed; font: 13.33px/1.3 Arial, Helvetica, sans-serif; }
.sheet td, .sheet th {
  border: 1px solid #e2e3e3; padding: 0 3px; height: 21px;
  white-space: nowrap; overflow: hidden; text-overflow: clip; vertical-align: bottom;
}
.sheet td.wrap { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
/* Sheets lets a tab hide its gridlines; explicit cell borders still show. */
.sheet.nogrid td { border-width: 0; }   /* no hairline gaps in coloured bands */
.sheet .more { margin: 10px 8px 14px; font-size: 13px; }
/* Text runs into empty neighbours, as in Sheets (OVERFLOW_CELL); the span's
   max-width (set per cell) ends the run where the next filled cell starts. */
.sheet td.ovf { overflow: visible; position: relative; z-index: 1; }
.sheet td.ovf .spill { display: inline-block; max-width: 100%; overflow: hidden; white-space: nowrap; vertical-align: bottom; }
.sheet thead th {
  position: sticky; top: 0; z-index: 6; height: 22px;
  background: #f8f9fa; color: #5f6368; font: 11px/1 Arial, Helvetica, sans-serif; font-weight: 400;
  text-align: center; border-color: #d9dadb;
}
.sheet thead th.corner { left: 0; z-index: 7; background: #f8f9fa; }
.sheet th.gutter {
  background: #f8f9fa; color: #5f6368; font: 11px/1 Arial, Helvetica, sans-serif; font-weight: 400;
  text-align: center; position: sticky; left: 0; z-index: 4; min-width: 46px; width: 46px; border-color: #d9dadb;
}
.sheet col.gutter { width: 46px; }
.sheet tr.freeze-row td { position: sticky; top: var(--ft, 22px); z-index: 3; background: #ffffff; }
.sheet tr.freeze-row th.gutter { top: var(--ft, 22px); z-index: 5; }
.sheet tr.freeze-last td, .sheet tr.freeze-last th { border-bottom: 2px solid #c6c6c6; }
.sheet td.freeze-col { position: sticky; left: 46px; z-index: 2; background: #ffffff; }
.sheet td.freeze-col-last { border-right: 2px solid #c6c6c6; }
.sheet tr.freeze-row td.freeze-col { z-index: 5; }
/* A frozen cell whose text spills must paint above its (sticky, white) neighbours. */
.sheet td.freeze-col.ovf { z-index: 3; }
.sheet tr.freeze-row td.freeze-col.ovf { z-index: 6; }

/* ------------------------------------------------------------ small print */

@media (max-width: 640px) {
  main { padding: 24px 16px 48px; }
  .topbar { padding: 0 16px; }
  .topnav .who { display: none; }
  .brand-sub { display: none; }
  .grid-form { grid-template-columns: 1fr; }
  .row { flex-wrap: wrap; }
  .row-actions { padding: 0 0 12px 58px; }
  .sheet-head { flex-direction: column; }
  .auth { margin-top: 4vh; }
}

/* "Being prepared" page: a slow bar above the text, nothing to click yet. */
.card.preparing .sk-bar { width: 220px; margin: 0 auto 18px; position: relative; }
.card.preparing .sk-bar span { position: absolute; left: -40%; width: 40%; height: 100%; background: var(--brand); border-radius: 2px; animation: prep 1.4s ease-in-out infinite; }
@keyframes prep { to { left: 100%; } }
