:root {
  --deep: #00524E;
  --deep-hover: #003D3A;
  --turq: #40C9D1;
  --mint: #E8F7F5;
  --ground: #F6FAF9;
  --line: #D5E5E3;
  --line-soft: #EEF4F3;
  --field: #B9D6D3;
  --ink: #1A1A1A;
  --body: #3D3D3A;
  --muted: #55554F;
  --on-deep-soft: #CDEEEC;
  --green: #38CB70;
  --green-ink: #06331A;
  --gold-bg: #FCF3CC;
  --gold-ink: #5C4A00;
  --red-bg: #FBE4E4;
  --red-ink: #8A1C1C;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--deep); }
a:hover { color: var(--deep-hover); }
h1, h2, h3, .poppins { font-family: Poppins, system-ui, sans-serif; }
h1 { margin: 0; font-weight: 700; font-size: 34px; line-height: 1.15; color: var(--deep); }
h2 { margin: 0; font-weight: 600; font-size: 19px; color: var(--deep); }
p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- Header with white pill nav ---------- */
.site-header {
  background: var(--deep);
  color: #fff;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand-name { font-family: Poppins, sans-serif; font-weight: 700; font-size: 19px; }
.brand-sub { font-size: 15px; color: var(--on-deep-soft); }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-family: Poppins, sans-serif; font-size: 15px; }
.nav a, .nav button {
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 10px 18px;
  background: transparent;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--deep); font-weight: 600; }
.nav .signout { color: var(--on-deep-soft); text-decoration: underline; padding: 10px 12px; }
.nav .signout:hover { color: #fff; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: #fff; }
.auth-page { background: var(--mint); }
.auth-page .site-footer { background: var(--mint); border-top-color: #CDE7E3; }
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.footer-text { display: flex; flex-direction: column; gap: 4px; max-width: 760px; }
.footer-text a { color: var(--deep); }
.footer-links { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; font-family: Poppins, sans-serif; font-size: 14px; color: var(--field); }
.footer-links a { color: var(--deep); padding: 4px 0; }

/* ---------- Layout ---------- */
.page { flex: 1 0 auto; width: 100%; max-width: 960px; margin: 0 auto; padding: 48px 24px 72px; display: flex; flex-direction: column; gap: 28px; }
.page.narrow { max-width: 760px; }
.page.wide { max-width: 1080px; }
.intro { display: flex; flex-direction: column; gap: 10px; }
.lead { font-size: 16px; color: var(--body); max-width: 680px; }
.small { font-size: 14px; color: var(--muted); }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.chip { border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.chip.mint { background: var(--mint); color: var(--deep); font-weight: 600; }
.chip.plain { background: #fff; border: 1px solid var(--line); color: var(--body); }

/* ---------- Forms ---------- */
label.field-label { font-family: Poppins, sans-serif; font-weight: 600; font-size: 14px; color: var(--deep); }
.field { display: flex; flex-direction: column; gap: 6px; }
input[type="email"], input[type="text"], input[type="search"], input[type="number"], select {
  height: 48px;
  border: 1.5px solid var(--field);
  border-radius: 10px;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 3px solid var(--turq);
  outline-offset: 2px;
}
.code-input { font-size: 24px !important; letter-spacing: 0.3em; text-align: center; font-family: Poppins, sans-serif !important; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > input { flex: 1 1 240px; min-width: 0; width: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 10px;
  background: var(--deep);
  color: #fff;
  text-decoration: none;
  font-family: Poppins, sans-serif;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn:hover { background: var(--deep-hover); color: #fff; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--deep); border: 1.5px solid var(--field); }
.btn.secondary:hover { background: var(--mint); color: var(--deep); }
.btn.small-btn { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn.block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--deep); text-decoration: underline; cursor: pointer; }

.msg { border-radius: 10px; padding: 12px 16px; font-size: 14px; line-height: 1.5; }
.msg.info { background: var(--mint); color: var(--deep); }
.msg.error { background: var(--red-bg); color: var(--red-ink); }
.msg.ok { background: #E1F5EE; color: var(--deep); }
.note-box { background: #F7FBFA; border-radius: 10px; padding: 14px 16px; font-size: 14px; line-height: 1.55; color: var(--body); }

/* ---------- Sign-in screens ---------- */
.auth-wrap { flex: 1 0 auto; background: var(--mint); display: flex; flex-direction: column; }
.auth-top { padding: 24px 32px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.auth-top .brand-name { color: var(--deep); font-size: 20px; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 16px 64px; }
.auth-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 2px 24px rgba(0, 82, 78, 0.08);
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.auth-card.wide { max-width: 520px; }
.auth-card h1 { font-size: 32px; }
.auth-card form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
@media (max-width: 520px) { .auth-card { padding: 32px 22px; } }

/* ---------- Library ---------- */
.category {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.category summary {
  list-style: none;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
}
.category summary::-webkit-details-marker { display: none; }
.cat-name { font-family: Poppins, sans-serif; font-weight: 600; font-size: 19px; color: var(--deep); display: block; }
.cat-meta { font-size: 14px; color: var(--muted); }
.chev { flex: none; transition: transform 0.15s ease; }
.category[open] .chev { transform: rotate(180deg); }
.file-list { border-top: 1px solid #E4EFEE; }
.file-row {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft);
}
.file-row:last-child { border-bottom: 0; }
.file-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.file-title { font-weight: 600; font-size: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.badge.new { background: var(--green); color: var(--green-ink); }
.badge.updated { background: #D3F1F3; color: #00524E; }
.badge.wait { background: var(--gold-bg); color: var(--gold-ink); }
.badge.on { background: #E1F5EE; color: var(--deep); }
.badge.off { background: #EEEEEC; color: var(--body); }
.gallery-card { display: flex; flex-direction: column; gap: 14px; padding: 20px 24px; text-decoration: none; color: inherit; }
.gallery-card:hover { border-color: var(--turq); color: inherit; }
.gallery-card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.peeks { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.peeks img { width: 100%; aspect-ratio: 2 / 3; object-fit: contain; background: #fff; border: 1px solid var(--line-soft); border-radius: 8px; display: block; }
@media (max-width: 640px) { .peeks { grid-template-columns: repeat(3, minmax(0, 1fr)); } .peeks img:nth-child(n+4) { display: none; } }
.folder-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 24px; background: #FAFCFC; border-bottom: 1px solid var(--line-soft); }
.chip-btn { border: 1.5px solid var(--field); border-radius: 999px; padding: 6px 14px; background: #fff; color: var(--deep); font: inherit; font-size: 14px; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; font-weight: 600; }
.folder-heading { display: flex; align-items: center; gap: 8px; padding: 14px 24px 4px; font-family: Poppins, sans-serif; font-weight: 600; font-size: 15px; color: var(--deep); }
.folder-heading.muted { color: var(--muted); }
.mobile-only { display: none; }
@media (max-width: 1024px), (pointer: coarse) { .mobile-only { display: block; } }
.big-note { color: #5C4A00; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

/* ---------- Team ---------- */
.meter { height: 10px; background: #E4EFEE; border-radius: 999px; overflow: hidden; }
.meter > div { height: 10px; background: var(--turq); border-radius: 999px; }
.list-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.list-row { padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line-soft); }
.list-row:last-child { border-bottom: 0; }

/* ---------- Admin ---------- */
.dropzone {
  border: 2px dashed var(--field);
  border-radius: 12px;
  padding: 20px;
  background: #F7FBFA;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { background: #F7FBFA; text-align: left; padding: 12px 16px; font-family: Poppins, sans-serif; font-weight: 600; font-size: 13px; color: var(--deep); }
td { padding: 12px 16px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 24px; }
.preview-list { max-height: 220px; overflow: auto; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 4px 0 0; }
details.plain summary { cursor: pointer; font-size: 14px; color: var(--deep); }

@media (max-width: 640px) {
  .site-header { padding: 10px 12px; row-gap: 6px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 17px; }
  .nav { width: 100%; gap: 2px; font-size: 14px; flex-wrap: nowrap; overflow-x: auto; }
  .nav a { padding: 8px 12px; white-space: nowrap; }
  .nav .signout { margin-left: auto; padding: 8px 6px; white-space: nowrap; }
  .page { padding: 32px 16px 56px; }
  h1 { font-size: 28px; }
  .file-row .btn { width: 100%; }
}

/* Member view banner (admins only) */
.preview-bar { background: #FFF4CC; color: #4A3B00; border-bottom: 1px solid #E8D27A; padding: 10px 24px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; font-size: 14px; line-height: 1.5; }
.preview-bar .preview-exit { font: inherit; font-weight: 600; background: #fff; color: var(--deep); border: 1px solid #D9C366; border-radius: 999px; padding: 6px 14px; cursor: pointer; white-space: nowrap; }
.preview-bar .preview-exit:hover { background: #FFFBEA; }
.member-view-card { margin: 8px 0 8px; }
@media (max-width: 640px) { .preview-bar { padding: 10px 12px; } }
