:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191f;
  --muted: #5d6673;
  --line: #e3e6eb;
  --accent: #D42B30;
  --accent-ink: #ffffff;
  --accent-soft: #fdeced;
  --danger: #9f1c1c;
  --danger-soft: #fdecea;
  --warn-soft: #fff7e6;
  --ok: #157f3c;
  --ok-soft: #e7f6ec;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; font-weight: 650; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 34px; height: 29px; display: block; }
.topnav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; font-size: .93rem; }
.topnav a { color: var(--text); }
.org-pill { background: var(--accent-soft); color: var(--accent); padding: .15rem .6rem; border-radius: 999px; font-weight: 600; font-size: .82rem; }
.inline { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
.link-button:hover { color: var(--text); text-decoration: underline; }

.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.5rem 2.5rem; flex: 1; }
.page-wide { max-width: none; padding: 1.25rem 1.5rem 1rem; display: flex; flex-direction: column; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.eyebrow { margin: 0 0 .2rem; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .25rem 0 .9rem; }
.nowrap { white-space: nowrap; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; box-shadow: var(--shadow); overflow-x: auto; }
.panel.narrow { max-width: 640px; margin: 2rem auto; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 { margin-bottom: 1.25rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.tile {
  display: flex; flex-direction: column; gap: .35rem; padding: 1.2rem 1.3rem; min-height: 132px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.tile-title { font-weight: 650; font-size: 1.05rem; }
.tile-desc { color: var(--muted); font-size: .9rem; flex: 1; }
.tile-go { color: var(--accent); font-weight: 600; font-size: .9rem; }

.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

.switcher { display: flex; gap: .4rem; flex-wrap: wrap; }
.switcher a { padding: .35rem .75rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .88rem; }
.switcher a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.embed-frame { flex: 1; min-height: 70vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.embed-frame iframe { width: 100%; height: calc(100vh - 170px); min-height: 600px; border: 0; display: block; }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .85rem; }
input, select {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; font: inherit; font-weight: 400;
  border: 1px solid #cfd4dc; border-radius: 6px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
label.check input { width: auto; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; align-items: end; margin-top: 1rem; }
.form-grid .hint, .form-grid label.check { grid-column: 1 / -1; }
.form-grid button { justify-self: start; margin-bottom: .85rem; }
.filters { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label { margin: 0; min-width: 160px; }
.filters .button { margin-bottom: 1px; }

.button {
  display: inline-block; padding: .55rem 1rem; border-radius: 6px; border: 1px solid #cfd4dc; background: #fff;
  color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-align: center;
}
.button:hover { background: #f2f4f7; text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(1.08); }
.button.danger { color: var(--danger); border-color: #f1b8b2; }
.button.danger:hover { background: var(--danger-soft); }
.button.wide { width: 100%; padding: .7rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
details.add-block { margin-top: 1rem; }
details.add-block > summary { list-style: none; }
details.add-block > summary::-webkit-details-marker { display: none; }
details.inline-edit { display: inline-block; margin-left: .6rem; }
details.inline-edit summary { cursor: pointer; color: var(--accent); }
details.inline-edit form { position: absolute; right: 2rem; width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: 0 8px 24px rgba(16, 24, 40, .12); z-index: 3; white-space: normal; }

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); padding: .5rem .6rem; }
.table td { border-bottom: 1px solid var(--line); padding: .6rem; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: .4rem .6rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-warn td { background: var(--warn-soft); }

.status { display: inline-block; font-size: .75rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; vertical-align: middle; }
.status-active { background: var(--ok-soft); color: var(--ok); }
.status-invited { background: #eef2ff; color: #3538cd; }
.status-disabled { background: #f2f4f7; color: #475467; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .45rem; border-radius: 4px; background: #f2f4f7; color: #475467; margin-left: .3rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.2rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.flashes { margin-bottom: 1rem; }
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: .5rem; font-size: .92rem; border: 1px solid transparent; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #f6c9c4; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: #bfe5cc; }
.flash-info { background: #eef4fb; color: #1d4f91; border-color: #cddff5; }

.copy-row { display: flex; gap: .5rem; margin: 1rem 0 .25rem; }
.copy-row input { margin: 0; }

body.auth { background: linear-gradient(180deg, var(--accent-soft) 0, var(--bg) 340px); }
body.auth .page { display: flex; justify-content: center; align-items: flex-start; padding-top: 8vh; }
body.auth .flashes { position: absolute; top: 80px; left: 50%; transform: translateX(-50%); width: min(420px, 92vw); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 2rem 2rem 1.5rem; box-shadow: 0 12px 32px rgba(16, 24, 40, .08); }
.auth-card h1 { margin-bottom: .4rem; }
.auth-card .muted { margin-top: 0; margin-bottom: 1.4rem; }
.auth-links { text-align: center; margin: 1.1rem 0 0; font-size: .92rem; }

.footer { padding: 1rem 1.5rem; color: var(--muted); font-size: .8rem; text-align: center; }

@media (max-width: 720px) {
  .topbar { padding: .6rem 1rem; flex-wrap: wrap; }
  .brand-text { font-size: .95rem; }
  .page { padding: 1.2rem 1rem 2rem; }
  .page-wide { padding: 1rem; }
  .embed-frame iframe { height: 80vh; }
  details.inline-edit form { position: static; width: auto; }
  body.auth .flashes { top: 110px; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.25rem; }
.stat { display: flex; flex-direction: column; gap: .1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; color: var(--muted); font-size: .86rem; box-shadow: var(--shadow); }
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-n { color: var(--text); font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-warn { border-color: #f1c27d; background: var(--warn-soft); }
.access-block { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .9rem; }
.access-head { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.access-head h3 { margin: 0; font-size: 1rem; flex: 1; }
.tag-warn { background: var(--danger-soft); color: var(--danger); }
.steps { padding-left: 1.2rem; margin: 0 0 1rem; }
.steps li { margin-bottom: .6rem; }
.small-button { padding: .3rem .7rem; font-size: .82rem; }
.danger-link { color: var(--danger); cursor: pointer; margin-left: .4rem; }
.danger-zone { border-color: #f3c7c2; }
