:root {
  --bg: #0a1628;
  --bg-deep: #07101e;
  --panel: rgba(14, 31, 55, 0.92);
  --panel-strong: rgba(18, 40, 70, 0.98);
  --text: #f6f8fb;
  --muted: #c7cfda;
  --silver: #d8dee8;
  --line: rgba(216, 222, 232, 0.18);
  --line-strong: rgba(216, 222, 232, 0.34);
  --accent: #9fb7d8;
  --accent-bright: #dce8f8;
  --gold: #d8c79a;
  --danger: #ffb4b4;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(93, 128, 179, 0.26), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(185, 203, 226, 0.14), transparent 30rem),
    linear-gradient(135deg, var(--bg-deep) 0%, var(--bg) 52%, #0c1d34 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.58), transparent 78%);
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel {
  width: min(680px, 100%);
  margin: 5vh auto 0;
  padding: 48px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 24px;
  border: 1px solid rgba(216, 222, 232, 0.36);
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(216, 222, 232, 0.20), rgba(216, 222, 232, 0.04));
  color: var(--accent-bright);
  font-family: "Fraunces", serif;
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 950px;
  margin-bottom: 18px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.9rem, 4.4vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.login-panel h1 { font-size: clamp(1.9rem, 4.6vw, 3.0rem); }

h2 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; font-weight: 700; }
h3 { font-family: "Fraunces", Georgia, serif; font-weight: 700; font-size: 1.45rem; margin-bottom: 10px; letter-spacing: -0.015em; }

.lede {
  max-width: 820px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.65;
}
.lede strong { color: var(--accent-bright); font-weight: 700; }

.login-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--silver);
  font-size: 0.9rem;
  font-weight: 700;
}

.password-row { display: flex; gap: 12px; }

input[type="password"], input[type="search"], select {
  width: 100%;
  border: 1px solid rgba(216, 222, 232, 0.26);
  border-radius: 14px;
  background: rgba(5, 14, 27, 0.8);
  color: var(--text);
  font: inherit;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type="password"] { padding: 15px 16px; border-radius: 16px; }
input[type="password"]:focus, input[type="search"]:focus, select:focus {
  border-color: rgba(220, 232, 248, 0.72);
  box-shadow: 0 0 0 4px rgba(159, 183, 216, 0.18);
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--silver) 50%),
                    linear-gradient(135deg, var(--silver) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
  cursor: pointer;
}
select option { background: #0a1628; color: var(--text); }

button, .download-link {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #eef4fb, #b9c9dc);
  color: #07101e;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 15px 22px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
button:hover, .download-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24);
}
button:active, .download-link:active { transform: translateY(0) scale(0.98); }

.secondary-button {
  border: 1px solid rgba(216, 222, 232, 0.26);
  background: rgba(216, 222, 232, 0.08);
  color: var(--text);
}

.error {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.fine-print {
  margin: 26px 0 0;
  color: rgba(216, 222, 232, 0.68);
  font-size: 0.84rem;
}

.archive-panel { padding: 38px; }

.archive-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding: 4px 2px 28px;
}

/* Dashboard stats */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.summary-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(216, 222, 232, 0.06);
  padding: 18px 20px;
}
.summary-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.summary-card strong {
  color: var(--accent-bright);
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 14, 27, 0.5);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 14px 18px;
  border: 1px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.tab:hover { background: rgba(216, 222, 232, 0.05); color: var(--silver); }
.tab.is-active {
  background: linear-gradient(135deg, rgba(220,232,248,0.18), rgba(159,183,216,0.10));
  color: var(--accent-bright);
  border-color: var(--line-strong);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.tab-label { font-size: 1rem; letter-spacing: -0.005em; }
.tab-sub {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
.tab.is-active .tab-sub { color: var(--accent); }

/* Lake toolbar */
.lake-toolbar {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 12px;
  margin-bottom: 16px;
}
.search-wrap { position: relative; }
.sort-wrap { display: flex; align-items: center; gap: 10px; }
.sort-wrap label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Table */
.table-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-strong);
}
.table-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}
.muted-line { color: var(--muted); font-size: 0.88rem; }

.report-row {
  display: grid;
  grid-template-columns: minmax(260px, 2.2fr) 160px 120px 100px 130px;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(216, 222, 232, 0.10);
}
.report-row:last-child { border-bottom: 0; }
.report-head {
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(5, 14, 27, 0.42);
  padding-top: 14px;
  padding-bottom: 14px;
}
.report-name {
  overflow-wrap: anywhere;
  font-weight: 700;
  color: var(--text);
}
.report-name small {
  display: block;
  margin-top: 4px;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.report-meta { color: var(--silver); font-size: 0.92rem; }

.vault-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(216, 222, 232, 0.06);
  color: var(--accent-bright);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  font-size: 0.86rem;
}

/* Vault grid */
.panel-lede {
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 0.98rem;
}
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.vault-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-strong);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.vault-card:hover { border-color: var(--line-strong); }
.vault-card[open] { transform: translateY(-2px); }
.vault-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 22px;
  cursor: pointer;
  list-style: none;
}
.vault-summary::-webkit-details-marker { display: none; }
.vault-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.vault-title .vault-name {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-bright);
  letter-spacing: -0.01em;
}
.vault-title .vault-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.vault-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(220, 232, 248, 0.10);
  border: 1px solid var(--line-strong);
  color: var(--accent-bright);
  font-weight: 800;
  font-size: 0.92rem;
}
.vault-files {
  border-top: 1px solid var(--line);
  background: rgba(5, 14, 27, 0.32);
}
.vault-file {
  display: grid;
  grid-template-columns: 1fr 110px 90px 120px;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(216, 222, 232, 0.08);
}
.vault-file:last-child { border-bottom: 0; }
.vault-file .report-name { font-size: 0.95rem; }

/* About */
.about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.about-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-strong);
  padding: 26px;
}
.about-card.span-2 { grid-column: span 2; }
.about-card p { color: var(--muted); line-height: 1.65; }
.about-card ul { color: var(--muted); padding-left: 18px; }
.about-card li { margin-bottom: 6px; }
.about-card code {
  font-size: 0.85rem;
  background: rgba(5, 14, 27, 0.6);
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  color: var(--accent-bright);
}

.hidden { display: none !important; }

@media (max-width: 980px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: 1fr; }
  .about-card.span-2 { grid-column: auto; }
  .lake-toolbar { grid-template-columns: 1fr; }
  .report-row { grid-template-columns: 1fr 130px 90px 110px; gap: 10px; }
  .report-row > div:nth-child(2) { display: none; }
  .vault-file { grid-template-columns: 1fr 90px 110px; }
  .vault-file > div:nth-child(2) { display: none; }
}

@media (max-width: 720px) {
  .app-shell { width: min(100% - 20px, 1120px); padding: 24px 0; }
  .login-panel, .archive-panel { padding: 24px; border-radius: 22px; }
  .archive-header { flex-direction: column; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .tabs { flex-direction: column; }
  .tab { flex-direction: row; align-items: baseline; justify-content: space-between; }
  .tab-sub { margin-top: 0; }
  .report-row { grid-template-columns: 1fr; gap: 6px; }
  .report-row > div:nth-child(2) { display: block; }
  .report-head { display: none; }
  .vault-file { grid-template-columns: 1fr; }
  .vault-file > div:nth-child(2) { display: block; }
  .password-row { flex-direction: column; }
  button, .download-link { width: 100%; }
}
