:root {
  color-scheme: light;
  --ink: #333333;
  --muted: #68757c;
  --line: #dce4e7;
  --panel: #ffffff;
  --wash: #f6f8f9;
  --brand: #0094bc;
  --brand-dark: #007d9e;
  --gainsboro: #e0e0e0;
  --accent: #f08a3c;
  --ok: #2d7a4f;
  --shadow: 0 16px 40px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 148, 188, 0.11), transparent 330px),
    var(--wash);
  color: var(--ink);
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 56px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.hero {
  min-height: 330px;
  align-items: flex-start;
  background:
    linear-gradient(135deg, rgba(0, 125, 158, 0.96), rgba(0, 148, 188, 0.84)),
    url("https://images.unsplash.com/photo-1576013551627-0cc20b96c2a7?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
  color: #ffffff;
  padding-top: 42px;
  padding-bottom: 22px;
}

.hero .eyebrow {
  color: #dff8ff;
}

.hero-copy {
  max-width: 780px;
}

.hero-brand {
  align-items: center;
  display: flex;
  gap: clamp(22px, 4vw, 48px);
  max-width: 1180px;
  min-width: 0;
}

.brand-logo {
  flex: 0 0 auto;
  display: block;
  height: auto;
  margin: 0;
  max-width: min(230px, 28vw);
  width: 230px;
}

.hero-text {
  max-width: 680px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: "Nunito", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(30px, 4vw, 48px);
  font-style: italic;
  font-weight: 800;
  line-height: 1.05;
}

h2 {
  margin-bottom: 18px;
  font-family: "Nunito", ui-sans-serif, system-ui, sans-serif;
  font-size: 22px;
  font-weight: 600;
}

.admin-link,
button,
.file-link {
  border: 0;
  border-radius: 7px;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

.hero .admin-link {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
}

.admin-nav {
  display: flex;
  gap: 10px;
}

button:hover,
.admin-link:hover,
.file-link:hover {
  background: var(--brand-dark);
}

button.secondary {
  background: #e9f0f3;
  color: var(--ink);
}

.reset-button {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 148, 188, 0.28);
  color: var(--brand-dark);
  min-width: 130px;
}

.reset-button:hover {
  background: var(--brand);
  color: #ffffff;
}

.shell {
  width: min(1180px, calc(100% - 36px));
  margin: -88px auto 56px;
}

.controls,
.panel {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls {
  align-items: end;
  display: grid;
  grid-template-columns: 1fr 280px auto;
  gap: 18px;
  padding: 20px;
  position: relative;
  z-index: 2;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  font: inherit;
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}

.stat {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  min-width: 150px;
  padding: 14px 16px;
}

.stat-aqua {
  background: linear-gradient(145deg, #ffffff, #e6f8fc);
}

.stat-steel {
  background: linear-gradient(145deg, #ffffff, #f1f4f5);
}

.stat-sun {
  background: linear-gradient(145deg, #ffffff, #fff3e9);
}

.stat::before {
  content: "";
  display: block;
  height: 4px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.stat-aqua::before {
  background: var(--brand);
}

.stat-steel::before {
  background: #607985;
}

.stat-sun::before {
  background: var(--accent);
}

.stat-best {
  background: linear-gradient(135deg, #ffffff, #eaf8fb);
}

.stat-best::before {
  background: linear-gradient(90deg, var(--brand), var(--accent));
}

.stat strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-family: "Nunito", ui-sans-serif, system-ui, sans-serif;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
}

.stat span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 7px;
  text-transform: uppercase;
}

.stat span::before {
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 9px;
  width: 9px;
}

.stat-aqua span {
  color: var(--brand-dark);
}

.stat-aqua span::before {
  background: var(--brand);
}

.stat-aqua strong {
  color: var(--brand-dark);
}

.stat-steel span {
  color: #536a74;
}

.stat-steel span::before {
  background: #607985;
}

.stat-steel strong {
  color: #334850;
}

.stat-sun span {
  color: #a75622;
}

.stat-sun span::before {
  background: var(--accent);
}

.stat-sun strong {
  color: #9b4c19;
}

.stat-best span {
  color: var(--brand-dark);
}

.stat-best span::before {
  background: linear-gradient(135deg, var(--brand), var(--accent));
}

.stat-best strong {
  color: var(--brand-dark);
}

.wide-stat {
  flex: 1;
  min-width: 270px;
}

.wide-stat strong {
  font-size: 16px;
  line-height: 1.3;
}

.browse-nav {
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 20px;
  padding: 16px;
}

.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.tab {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 38px;
}

.tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.mindmap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
}

.chip.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.doc-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  overflow: hidden;
  padding: 12px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.doc-card:hover {
  border-color: rgba(0, 148, 188, 0.38);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.doc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.thumb-wrap {
  background: #f0f5f6;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.thumb-wrap::before {
  content: "";
  display: block;
  padding-top: 65.625%;
}

.doc-thumb {
  height: 100%;
  inset: 0;
  object-fit: cover;
  position: absolute;
  width: 100%;
}

.doc-type {
  border-radius: 999px;
  background: #e8f4f6;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 5px 8px;
  text-transform: uppercase;
}

.doc-meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.doc-card h3 {
  margin: 10px 0 7px;
  font-family: "Nunito", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
}

.doc-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: auto 0 14px;
}

.tag {
  border: 0;
  border-radius: 999px;
  background: #edf3f4;
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 12px;
  min-height: 0;
  padding: 5px 8px;
}

.tag-filter:hover,
.tag-filter.active {
  background: var(--brand);
  color: #ffffff;
}

.doc-actions {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
}

.doc-actions .file-link {
  font-size: 13px;
  min-height: 36px;
  padding: 0 12px;
}

.icon-link {
  align-items: center;
  background: #e8f4f6;
  border: 1px solid rgba(0, 148, 188, 0.2);
  border-radius: 7px;
  color: var(--brand-dark);
  display: inline-flex;
  height: 36px;
  justify-content: center;
}

.icon-link:hover {
  background: var(--brand);
  color: #ffffff;
}

.icon-link svg {
  fill: none;
  height: 18px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 18px;
}

.empty-state {
  background: #ffffff;
  border: 1px dashed var(--line);
  border-radius: 8px;
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
}

.login-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(0, 125, 158, 0.96), rgba(0, 148, 188, 0.76)),
    url("https://images.unsplash.com/photo-1576013551627-0cc20b96c2a7?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 460px;
  padding: 30px;
  width: 100%;
}

.login-panel h1 {
  color: var(--brand-dark);
  margin-bottom: 10px;
}

.login-panel button {
  margin-top: 14px;
  width: 100%;
}

.error-status {
  color: #a33d2f;
}

.panel {
  margin-bottom: 18px;
  padding: 20px;
}

[hidden] {
  display: none !important;
}

.admin-shell {
  max-width: 1180px;
}

.admin-hero {
  min-height: 280px;
}

.access-panel {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr minmax(220px, 360px) auto;
}

.panel-title,
.panel-head h2,
.access-panel h2 {
  margin-bottom: 0;
}

.panel-note {
  color: var(--muted);
  margin: 6px 0 0;
}

.locked-note {
  background: linear-gradient(135deg, #ffffff, #eaf8fb);
  border-color: rgba(0, 148, 188, 0.24);
}

.actions,
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-head {
  justify-content: space-between;
}

.admin-tools {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: min(100%, 480px);
}

.admin-tools input {
  min-width: 220px;
}

.status {
  color: var(--ok);
  margin: 12px 0 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.edit-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.edit-card:hover {
  border-color: rgba(0, 148, 188, 0.38);
  box-shadow: var(--shadow);
}

.duplicate-card {
  border-color: rgba(240, 138, 60, 0.58);
  background: linear-gradient(135deg, #ffffff, #fff8f0);
}

.edit-card-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.edit-meta-line {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.duplicate-badge {
  border-radius: 999px;
  background: rgba(240, 138, 60, 0.14);
  color: #a44d11;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 10px;
}

.edit-fields {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 140px;
}

.edit-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.secondary-link {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--brand-dark);
  display: inline-flex;
  font-weight: 700;
  min-height: 42px;
  padding: 0 14px;
  text-decoration: none;
}

.secondary-link:hover {
  background: #e8f4f6;
}

.danger-button {
  background: #fff2ec;
  border: 1px solid rgba(190, 73, 32, 0.28);
  color: #a33d2f;
}

.danger-button:hover {
  background: #a33d2f;
  color: #ffffff;
}

.active-filter {
  background: var(--brand-dark);
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

@media (max-width: 760px) {
  .topbar,
  .controls,
  .form-grid,
  .edit-card,
  .edit-fields,
  .access-panel,
  .panel-head {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
  }

  .admin-tools {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .admin-tools input {
    min-width: 0;
  }

  .topbar {
    display: grid;
  }

  .hero {
    min-height: 430px;
  }

  .hero-brand {
    align-items: flex-start;
    display: grid;
    gap: 18px;
  }

  .brand-logo {
    max-width: 190px;
    width: 190px;
  }

  .shell {
    margin-top: -56px;
  }

  .reset-button {
    width: 100%;
  }
}
