/* Investors Deck: one stylesheet for every page.
   Nothing is loaded from outside (no CDN, no web fonts). */

:root {
  --navy: #1B3A6B;
  --navy-dark: #12284B;
  --honey: #EFBC49;
  --honey-soft: #FBF1D6;
  --cream: #F2F0E9;
  --text: #1B1B1B;
  --muted: #6C6C6A;
  --border: #E5E2DA;
  --green: #1E7A4F;
  --green-soft: #E3F1EA;
  --red: #B3261E;
  --red-soft: #FBE9E7;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: #fff;
  line-height: 1.5;
}

main { flex: 1; padding-top: 24px; padding-bottom: 48px; }

.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.wrap-wide { max-width: 1280px; }

a { color: var(--navy); }
a:hover { color: var(--navy-dark); }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }

h1 { font-size: 1.75rem; line-height: 1.25; margin: 0 0 .5rem; color: var(--navy); }
h2 { font-size: 1.3rem; line-height: 1.3; margin: 2rem 0 .5rem; color: var(--navy); }
h3 { font-size: 1.05rem; margin: 0 0 .35rem; }
p { margin: 0 0 .9rem; }
code { background: var(--cream); padding: .05rem .35rem; border-radius: 4px; font-size: .9em; word-break: break-all; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: .25rem; }
.lead { font-size: 1.05rem; }
.crumbs { margin-bottom: .75rem; font-size: .9rem; }

/* ----- Header and footer ----- */

.site-header { background: var(--navy); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand img { display: block; }
.brand-name { font-weight: 700; font-size: 1.3rem; letter-spacing: .01em; }
.brand-product { color: var(--honey); font-size: 1rem; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .35); }
.top-nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.top-nav a { color: #fff; text-decoration: none; font-weight: 600; }
.top-nav a:hover { text-decoration: underline; color: #fff; }
.top-nav .who { color: rgba(255, 255, 255, .8); font-size: .9rem; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; padding: 18px 0; }

/* ----- Buttons, badges, notes ----- */

.btn {
  display: inline-block;
  padding: .55rem 1.1rem;
  border: 1px solid var(--navy);
  border-radius: 6px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}
.btn:hover { background: var(--navy-dark); border-color: var(--navy-dark); color: #fff; }
.btn-secondary { background: #fff; color: var(--navy); }
.btn-secondary:hover { background: var(--cream); color: var(--navy-dark); }
.btn-light { background: transparent; border-color: rgba(255, 255, 255, .6); color: #fff; }
.btn-light:hover { background: rgba(255, 255, 255, .15); border-color: #fff; }
.btn-small { padding: .25rem .65rem; font-size: .85rem; }
.btn-block { display: block; width: 100%; margin-top: 1rem; }

.badge { display: inline-block; padding: .08rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.badge-download { background: var(--honey); color: #3a2b00; }
.badge-view { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.badge-none { background: var(--cream); color: var(--muted); }

.pill { display: inline-block; padding: .08rem .65rem; border-radius: 999px; font-size: .8rem; background: #fff; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pill-warn { background: var(--red-soft); border-color: #E8C2BE; color: var(--red); }
.pill-ok { background: var(--green-soft); border-color: #BFDCCD; color: var(--green); }

.flash { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid var(--border); background: var(--cream); }
.flash-ok { background: var(--green-soft); border-color: #BFDCCD; color: #14583A; }
.flash-error { background: var(--red-soft); border-color: #E8C2BE; color: var(--red); }

/* ----- Cards and the home page ----- */

.card { background: var(--cream); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; }
.card > :first-child { margin-top: 0; }
.hero { margin-bottom: 18px; }
.hero h1 { margin-bottom: .15rem; }

.group h2 { margin-top: 2rem; }
.group-desc { margin-top: -.2rem; }
.section-title { margin: 1.4rem 0 .6rem; padding-bottom: .3rem; border-bottom: 2px solid var(--honey); color: var(--navy); font-size: 1rem; }

.item { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; }
.item h3 a { text-decoration: none; }
.item h3 a:hover { text-decoration: underline; }
.desc { color: #3b3b3a; margin-bottom: .5rem; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0; font-size: .85rem; color: var(--muted); }
.item-actions { display: flex; flex-direction: column; gap: 6px; min-width: 120px; }
.item-actions .btn { width: 100%; }

.status-text { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: .4rem 0 .75rem; white-space: pre-line; }

.whats-new summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; list-style: none; }
.whats-new summary::-webkit-details-marker { display: none; }
/* The box opens and closes; say so in words, because the usual little triangle is hidden. */
.whats-new summary::after { content: "Show list"; margin-left: auto; color: var(--navy); font-size: .85rem; font-weight: 700; text-decoration: underline; }
.whats-new[open] summary::after { content: "Hide list"; }
.summary-title { font-size: 1.2rem; font-weight: 700; color: var(--navy); }
.new-list { margin: .8rem 0 0; padding-left: 1.2rem; columns: 2; column-gap: 32px; }
.new-list li { margin-bottom: .4rem; break-inside: avoid; }
.new-list .muted { display: block; font-size: .8rem; }

/* ----- Detail page and viewer ----- */

.detail .actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 1rem 0; align-items: baseline; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 12px; }
.toolbar-title { flex: 1; min-width: 200px; color: var(--navy); }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pdf-frame { width: 100%; height: 78vh; min-height: 480px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--cream); }

/* ----- The ownership tree ----- */

.tree { list-style: none; margin: 1rem 0 .5rem; padding: 0; }
.tree li { position: relative; margin: 0 0 1.1rem; }
.tree li + li::before { content: ""; position: absolute; left: 1.4rem; top: -1.1rem; height: 1rem; border-left: 2px solid var(--navy); }
.tree li + li::after { content: ""; position: absolute; left: calc(1.4rem - 5px); top: -.15rem; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--navy); }
.tree .lvl-1 { margin-left: 1.5rem; }
.tree .lvl-2 { margin-left: 3rem; }
.tree .lvl-3 { margin-left: 4.5rem; }
.tree .lvl-4 { margin-left: 6rem; }
.tree .lvl-5 { margin-left: 7.5rem; }
.tree-box { background: #fff; border: 1px solid var(--border); border-left: 5px solid var(--honey); border-radius: var(--radius); padding: .6rem .9rem; }
.tree-box strong { display: block; color: var(--navy); }
.tree-box span { display: block; font-size: .875rem; color: var(--muted); }

/* ----- Markdown pages ----- */

.prose h1 { font-size: 1.6rem; }
.prose h2 { font-size: 1.25rem; margin-top: 1.8rem; }
.prose table { border-collapse: collapse; width: 100%; background: #fff; font-size: .92rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: .45rem .7rem; text-align: left; vertical-align: top; }
.prose thead th { background: var(--navy); color: #fff; }
.prose thead:not(:has(th:not(:empty))) { display: none; }
.prose tbody tr:nth-child(even) td { background: #FAF9F5; }
.table-wrap { overflow-x: auto; margin: 0 0 1rem; max-width: 100%; }

/* ----- Forms ----- */

label { display: block; font-weight: 700; font-size: .9rem; margin: .9rem 0 .25rem; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid #CFCBC0;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  color: var(--text);
}
/* Text fields and drop-down lists have one height, so they line up in a row. */
input[type=text], input[type=email], input[type=password], input[type=date], select:not(.level) { height: 2.6rem; }
textarea { resize: vertical; }
form.inline { display: inline; margin: 0; }

.auth-card { max-width: 440px; margin: 24px auto; text-align: left; }
.auth-logo { display: block; margin: 0 auto 12px; }
.auth-card h1 { text-align: center; }
.auth-card > p { text-align: center; }
.auth-card form + p { margin-top: 1rem; }

.form-row { display: grid; grid-template-columns: 2fr 2fr 1fr auto; gap: 12px; align-items: end; }
.form-row label { margin-top: 0; }
.form-row-button { padding-bottom: 1px; }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 12px 0; }
.bar-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; }

.copy-row { display: flex; gap: 8px; margin: 1rem 0; }
.copy-row .btn { flex: none; white-space: nowrap; }
.link-input { font-family: Menlo, Consolas, monospace; font-size: .85rem; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 14px; align-items: end; }
.filters label { margin-top: .4rem; }
.filter-buttons { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 1px; }
.pager { display: flex; align-items: center; gap: 14px; }

/* ----- Admin ----- */

.admin-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.admin-nav a { padding: .55rem 1rem; text-decoration: none; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.admin-nav a:hover { color: var(--navy); }
.admin-nav a.active { color: var(--navy); border-bottom-color: var(--honey); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat { margin: 0; }
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .9rem; }

.table { width: 100%; border-collapse: collapse; background: #fff; font-size: .9rem; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: .55rem .7rem; text-align: left; vertical-align: top; }
.table thead th { background: var(--cream); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table tbody tr:hover td { background: #FCFBF8; }
.actions-cell { white-space: nowrap; }
.actions-cell .btn, .actions-cell form { margin: 0 4px 4px 0; }
.status-row td { background: var(--cream); }
.status-row:hover td { background: var(--cream) !important; }

.action { font-family: Menlo, Consolas, monospace; font-size: .8rem; }
.action-denied, .action-login_failed, .action-locked { color: var(--red); font-weight: 700; }
.action-download { color: var(--green); font-weight: 700; }

.perm-group { padding-bottom: 8px; }
.perm-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.perm-head h2 { margin: 0; }
.perm-table { background: transparent; }
.perm-table td { border-bottom: 1px solid var(--border); }
.perm-cell { width: 150px; }

/* Permission selects are tinted by their value (app.js keeps data-level up to date). */
select.level { width: auto; min-width: 7.5rem; padding: .3rem .4rem; font-size: .85rem; }
select.level[data-level="view"] { background: var(--honey-soft); border-color: var(--honey); }
select.level[data-level="download"] { background: var(--green-soft); border-color: #8CC3A6; }

/* The matrix: the first column and the header row stay in view while scrolling. */
.matrix-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.matrix { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.matrix th, .matrix td { padding: .3rem .45rem; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); text-align: left; background: #fff; }
.matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--cream); min-width: 118px; vertical-align: bottom; }
.matrix .sticky-col { position: sticky; left: 0; z-index: 1; min-width: 230px; max-width: 280px; background: #fff; }
.matrix thead .sticky-col { z-index: 3; background: var(--cream); }
.matrix .group-row th, .matrix .group-row td { background: var(--navy); color: #fff; font-size: .85rem; }
.matrix .section-row th, .matrix .section-row td { background: var(--honey-soft); color: var(--navy); }
.matrix .item-col { font-weight: 400; }
.matrix select.level { min-width: 6.4rem; font-size: .78rem; padding: .15rem .2rem; }
.matrix .user-col a { color: var(--navy); }

/* ----- Phones ----- */

@media (max-width: 720px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  h1 { font-size: 1.45rem; }
  .item { grid-template-columns: 1fr; }
  .item-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .item-actions .btn { width: auto; }
  .new-list { columns: 1; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dt { margin-top: .5rem; }
  .form-row { grid-template-columns: 1fr; }
  .header-inner { flex-direction: column; align-items: flex-start; }
  .pdf-frame { height: 70vh; }
  .copy-row { flex-direction: column; }
  .matrix .sticky-col { min-width: 150px; }
}
