:root {
  color-scheme: dark;
  --ink: #edf7f5;
  --muted: #8ba4a1;
  --line: rgba(157, 205, 198, .15);
  --panel: rgba(11, 28, 29, .82);
  --panel-strong: #10292a;
  --accent: #5de0c1;
  --accent-strong: #20b993;
  --warning: #ffbc66;
  --bg: #071314;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 84% 3%, rgba(34, 178, 147, .16), transparent 31rem),
    linear-gradient(180deg, #081718 0, var(--bg) 36rem);
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: sticky; top: 0; z-index: 10;
  min-height: 76px; padding: 12px clamp(18px, 4vw, 64px);
  display: flex; align-items: center; gap: 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 19, 20, .88); backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; margin-right: auto; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border: 1px solid rgba(93, 224, 193, .46); border-radius: 12px;
  color: var(--accent); font-weight: 800; letter-spacing: -.08em;
  background: linear-gradient(145deg, rgba(93,224,193,.13), rgba(93,224,193,.02));
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .08em; font-size: .92rem; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .69rem; }
nav { display: flex; gap: 24px; }
nav a { color: var(--muted); text-decoration: none; font-size: .88rem; }
nav a:hover { color: var(--ink); }
.account-actions { display: flex; align-items: center; gap: 9px; }
.language-picker { display: block; }
.language-picker select { width: auto; min-height: 40px; padding-right: 34px; }
.button {
  min-height: 40px; padding: 0 15px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); background: transparent; text-decoration: none; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 650; font-size: .84rem;
}
.button:hover { border-color: rgba(93,224,193,.48); }
.button.primary { color: #05211b; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: #78edd1; }
.button.subtle { background: rgba(255,255,255,.03); }
.button.full { width: 100%; }
.role-pill {
  padding: 7px 10px; border-radius: 999px; font-size: .74rem; font-weight: 750;
  color: var(--accent); background: rgba(93,224,193,.1); border: 1px solid rgba(93,224,193,.2);
}
.role-pill.guest { color: var(--muted); background: rgba(255,255,255,.04); border-color: var(--line); }

main { width: min(1480px, calc(100% - 36px)); margin: 0 auto; }
.hero { min-height: 500px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .72fr); gap: 9vw; align-items: center; padding: 82px 4vw 72px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
h1 { max-width: 850px; margin: 0; font-size: clamp(3rem, 6.5vw, 6.6rem); line-height: .94; letter-spacing: -.065em; }
.hero-text { max-width: 680px; margin: 26px 0 0; color: #abc0bd; font-size: clamp(1rem, 1.6vw, 1.24rem); line-height: 1.65; }
.hero-stats { display: flex; gap: clamp(24px, 5vw, 72px); margin-top: 42px; }
.hero-stats div { display: grid; gap: 5px; }
.hero-stats strong { font-size: 1.8rem; }
.hero-stats span { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .1em; }
.access-card { padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.access-card h2 { margin: 22px 0 10px; font-size: 1.45rem; }
.access-card p { color: #b6c8c5; line-height: 1.6; }
.access-card .muted, .muted { color: var(--muted); }
.signal { display: flex; align-items: center; gap: 8px; color: var(--accent); font: 700 .75rem/1 monospace; text-transform: uppercase; }
.signal i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px rgba(93,224,193,.09); }

.catalog { scroll-margin-top: 92px; padding: 48px 0 60px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.6rem); letter-spacing: -.04em; }
.catalog-actions, .admin-catalog-controls { display: flex; align-items: center; gap: 10px; }
.edit-switch { min-height: 40px; padding: 0 13px; display: flex; grid-auto-flow: column; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.03); cursor: pointer; }
.edit-switch input, .check-row input { width: auto; min-height: auto; accent-color: var(--accent); }
.filters { display: grid; grid-template-columns: 1fr repeat(2, minmax(190px, .3fr)); gap: 12px; margin: 28px 0; }
label { display: grid; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 650; }
input, select, textarea {
  width: 100%; min-height: 46px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px;
  outline: none; color: var(--ink); background: rgba(10,28,28,.8);
}
textarea { padding-top: 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(93,224,193,.1); }
.catalog-status { padding: 20px 0; color: var(--muted); }
.family-list { display: grid; gap: 28px; }
.family-block { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.family-title { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.family-title h3 { margin: 0; font-size: 1.15rem; }
.family-title span { color: var(--muted); font: .76rem/1 monospace; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 870px; }
th, td { padding: 15px 18px; border-bottom: 1px solid rgba(157,205,198,.09); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; background: rgba(255,255,255,.018); }
td { color: #c7d8d5; font-size: .85rem; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(93,224,193,.025); }
.dataset-name strong, .dataset-name small { display: block; }
.dataset-name strong { color: var(--ink); }
.dataset-name small { max-width: 360px; margin-top: 4px; color: var(--muted); line-height: 1.35; }
.dataset-id { color: var(--accent); font: .77rem/1.3 ui-monospace, monospace; }
.profile-badge { color: #b8d9d2; font: .72rem/1.3 ui-monospace, monospace; }
.link-stack { display: flex; flex-wrap: wrap; gap: 6px; }
.download-link, .locked-link, .reference-link {
  min-height: 30px; padding: 5px 9px; border-radius: 8px; font-size: .72rem; font-weight: 700; text-decoration: none;
}
.download-link { color: #041b16; background: var(--accent); border: 0; cursor: pointer; }
.download-link.external { color: var(--ink); background: rgba(93,224,193,.09); border: 1px solid rgba(93,224,193,.2); }
.locked-link { color: var(--muted); border: 1px dashed var(--line); background: transparent; cursor: pointer; }
.reference-link { color: var(--accent); border: 1px solid var(--line); }
.empty { color: #526b68; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.button.compact { min-height: 30px; padding: 4px 9px; font-size: .72rem; }
.button.danger { color: #ffaaa4; border-color: rgba(255,104,104,.3); }

.access-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 30px 0 90px; }
.access-grid article { padding: 26px; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.025), transparent); }
.access-grid article > span { color: var(--accent); font: .75rem/1 monospace; }
.access-grid h3 { margin: 24px 0 8px; }
.access-grid p { margin: 0; color: var(--muted); line-height: 1.55; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px clamp(18px,4vw,64px); border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }

dialog { width: min(470px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: #0c2021; box-shadow: 0 24px 100px #000; }
dialog::backdrop { background: rgba(1,8,8,.76); backdrop-filter: blur(7px); }
.login-card { position: relative; display: grid; gap: 16px; padding: 30px; }
.login-card h2, .login-card p { margin: 0; }
.dialog-close { position: absolute; top: 16px; right: 18px; border: 0; color: var(--muted); background: transparent; font-size: 1.5rem; cursor: pointer; }
.form-message { min-height: 1.2em; color: #ff8f87; font-size: .8rem; }
.http-warning { padding: 12px; border-left: 2px solid var(--warning); color: #d4b68e; background: rgba(255,188,102,.06); font-size: .76rem; line-height: 1.45; }
.dataset-editor { position: relative; display: grid; gap: 20px; padding: 30px; }
.dataset-editor h2, .dataset-editor p { margin: 0; }
.dataset-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.dataset-editor-grid .wide { grid-column: 1 / -1; }
.dataset-editor small { color: var(--muted); font-weight: 400; line-height: 1.35; }
.check-row { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
#siteDatasetDialog { width: min(760px, calc(100% - 28px)); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(420px, calc(100% - 44px)); padding: 13px 16px; border: 1px solid rgba(93,224,193,.28); border-radius: 10px; color: var(--ink); background: #143431; box-shadow: 0 16px 50px #000; }
.toast.error { border-color: rgba(255,104,104,.35); background: #3a2020; }

@media (max-width: 900px) {
  nav { display: none; }
  .role-pill { display: none; }
  .hero { grid-template-columns: 1fr; gap: 42px; padding: 62px 0; }
  .access-card { max-width: 620px; }
  .access-grid { grid-template-columns: 1fr; }
  .section-heading { align-items: flex-start; }
  .catalog-actions { align-items: flex-end; flex-direction: column; }
}
@media (max-width: 640px) {
  .site-header { min-height: 66px; padding: 10px 14px; gap: 10px; }
  .brand small { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .account-actions .button { min-height: 38px; padding: 0 10px; font-size: .75rem; }
  .language-picker select { max-width: 98px; padding: 0 8px; }
  main { width: min(100% - 24px, 1480px); }
  h1 { font-size: clamp(2.8rem, 15vw, 4.4rem); }
  .hero-stats { justify-content: space-between; gap: 10px; }
  .filters { grid-template-columns: 1fr; }
  .section-heading { display: grid; }
  .catalog-actions, .admin-catalog-controls { width: 100%; align-items: stretch; flex-direction: column; }
  .dataset-editor-grid { grid-template-columns: 1fr; }
  .dataset-editor-grid .wide { grid-column: auto; }
  footer { flex-direction: column; }
}
