:root {
  --forest: #173d33;
  --forest-light: #28614f;
  --lime: #dfff68;
  --cream: #f4f2ea;
  --paper: #fffefa;
  --ink: #17231e;
  --muted: #65746d;
  --line: #dce2da;
  --danger: #a93d35;
  --shadow: 0 20px 55px rgba(23, 61, 51, 0.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--cream);
  color: var(--ink);
  font-family: "Segoe UI", "Manrope", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
:focus-visible { outline: 3px solid #a5cd36; outline-offset: 2px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.eyebrow {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--forest);
  color: var(--lime);
  font-family: Georgia, serif;
  font-size: 21px;
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: .17em; font-size: 15px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.brand-light { color: white; }
.brand-light .brand-mark { background: var(--lime); color: var(--forest); }
.brand-light small { color: #bbd1c4; }

.initial-view {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--forest);
  font-weight: 700;
}
.login-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(330px, 46%) 1fr;
}
.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(32px, 5vw, 72px);
  background: var(--forest);
  color: white;
  overflow: hidden;
  position: relative;
}
.login-intro::after {
  content: "";
  position: absolute;
  width: 470px;
  height: 470px;
  right: -210px;
  top: 19%;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  box-shadow: 0 0 0 85px rgba(255,255,255,.025), 0 0 0 170px rgba(255,255,255,.018);
  pointer-events: none;
}
.login-intro > * { position: relative; z-index: 1; }
.login-intro .eyebrow { color: var(--lime); }
.login-intro h1 {
  margin: 20px 0 24px;
  font-family: Georgia, serif;
  font-size: clamp(48px, 5.5vw, 83px);
  font-weight: 400;
  letter-spacing: -.035em;
  line-height: 1.05;
}
.login-description { max-width: 380px; color: #d5e3d9; line-height: 1.65; }
.login-footnote { color: #a9c2b2; font-size: 12px; }
.login-form-wrap { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(100%, 420px); }
.login-card .eyebrow { color: var(--forest-light); }
.login-card h2 {
  margin: 14px 0 12px;
  font-family: Georgia, serif;
  font-size: clamp(34px, 4vw, 46px);
  font-weight: 400;
}
.login-card > p:not(.eyebrow):not(.form-error) {
  margin: 0 0 32px;
  color: var(--muted);
  line-height: 1.5;
}
.login-card label {
  display: block;
  margin: 20px 0 8px;
  font-size: 12px;
  font-weight: 750;
}
.login-card input, .field input, .search-label input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: white;
  color: var(--ink);
}
.login-card input:hover, .field input:hover, .search-label input:hover { border-color: #aebeb1; }
.login-card .button { width: 100%; margin-top: 28px; }
.form-error { margin: 14px 0 0; color: var(--danger); font-size: 13px; line-height: 1.4; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
  transition: background .16s ease, transform .16s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { background: var(--lime); color: var(--forest); }
.button-primary:hover:not(:disabled) { background: #d2f358; }
.button-outline { background: transparent; border-color: var(--line); color: var(--forest); }
.button-outline:hover:not(:disabled) { background: #f0f5ec; }
.button-danger { background: var(--danger); color: white; }
.button-danger:hover:not(:disabled) { background: #8c3029; }
.text-button { border: 0; background: transparent; color: var(--forest); font-size: 12px; font-weight: 750; }
.text-button:hover { text-decoration: underline; }

.dashboard-shell { min-height: 100vh; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 82px;
  gap: 20px;
  padding: 18px clamp(22px, 4vw, 64px);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: 26px; }
.signed-in-as { color: var(--muted); font-size: 12px; }
.dashboard-main { max-width: 1480px; margin: 0 auto; padding: 54px clamp(22px, 4vw, 64px) 90px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-heading .eyebrow { color: var(--forest-light); }
.page-heading h1 {
  margin: 11px 0 7px;
  font-family: Georgia, serif;
  font-size: clamp(42px, 5vw, 64px);
  font-weight: 400;
}
.page-heading p:last-child { margin: 0; color: var(--muted); }
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 38px 0;
}
.stat-card {
  min-height: 140px;
  padding: 26px 30px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.stat-card:first-child { background: var(--forest); border-color: var(--forest); color: white; }
.stat-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.stat-card:first-child span { color: #c0d7c8; }
.stat-card strong {
  display: inline-block;
  margin-top: 22px;
  font-family: Georgia, serif;
  font-size: clamp(28px, 3vw, 39px);
  font-weight: 400;
}
.stat-card small { margin-left: 7px; color: var(--muted); }
.public-columns-panel { margin-bottom: 24px; padding: 28px 30px; border: 1px solid var(--line); background: var(--paper); }
.public-columns-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.public-columns-heading h2 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 26px; font-weight: 400; }
.public-columns-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.public-columns-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.public-columns-list label { display: inline-flex; align-items: center; gap: 8px; padding: 10px 13px; border: 1px solid var(--line); font-size: 12px; cursor: pointer; }
.public-columns-list input { width: 17px; height: 17px; accent-color: var(--forest); }
.public-columns-list input:disabled { cursor: not-allowed; }
.public-columns-status { min-height: 18px; margin: 15px 0 0; color: var(--muted); font-size: 12px; }
.certificates-panel { margin-bottom: 24px; border: 1px solid var(--line); background: var(--paper); }
.certificates-panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; padding: 28px 30px; }
.certificates-panel-heading h2 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 26px; font-weight: 400; }
.certificates-panel-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.certificate-visibility { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 30px; padding: 18px 0; border-top: 1px solid var(--line); }
.certificate-visibility label { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }
.certificate-visibility input { width: 18px; height: 18px; accent-color: var(--forest); }
.certificates-panel > .public-columns-status { margin: 0 30px 20px; }
.admin-certificates-list { border-top: 1px solid var(--line); }
.admin-certificate-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 30px; border-top: 1px solid var(--line); }
.admin-certificate-row:first-child { border-top: 0; }
.admin-certificate-row strong { display: block; font-size: 14px; }
.admin-certificate-row p { margin: 5px 0; color: var(--muted); font-size: 12px; }
.admin-certificate-row small { color: var(--muted); font-size: 11px; }
.admin-certificate-actions { display: flex; gap: 12px; }
.certificates-empty { margin: 0; padding: 30px; color: var(--muted); font-size: 13px; }
.certificate-form-fields { display: grid; gap: 18px; margin-top: 28px; }
.certificate-form-fields textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 3px; resize: vertical; color: var(--ink); }
.certificate-current-file { margin: 0; color: var(--muted); font-size: 12px; }
.contacts-panel { margin-bottom: 24px; padding: 28px 30px; border: 1px solid var(--line); background: var(--paper); }
.contacts-panel-heading h2 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 26px; font-weight: 400; }
.contacts-panel-heading p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.contacts-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.contacts-form-grid textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 3px; resize: vertical; color: var(--ink); font-weight: 400; }
.contacts-form-actions { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-top: 24px; }
.registry-panel { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 30px;
  border-bottom: 1px solid var(--line);
}
.panel-heading h2 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 29px; font-weight: 400; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.panel-actions { display: flex; align-items: center; gap: 10px; }
.search-label { display: block; min-width: min(360px, 28vw); }
.search-label input { min-height: 44px; font-size: 12px; }
.panel-actions .button { min-height: 44px; }
.list-status { margin: 0; padding: 0 30px; color: var(--danger); font-size: 13px; }
.list-status:not(:empty) { padding-top: 18px; padding-bottom: 18px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 1000px; border-collapse: collapse; text-align: left; }
th {
  padding: 16px 18px;
  background: #f7f8f3;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
th:first-child, td:first-child { padding-left: 30px; }
th:last-child, td:last-child { padding-right: 30px; }
td { padding: 21px 18px; border-top: 1px solid var(--line); font-size: 12px; vertical-align: middle; }
tbody tr:hover { background: #fafbf7; }
td strong { display: block; font-size: 13px; }
td small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.row-actions { white-space: nowrap; }
.row-button { border: 0; background: transparent; color: var(--forest-light); font-size: 11px; font-weight: 750; }
.row-button:hover { text-decoration: underline; }
.row-button-danger { margin-left: 10px; color: var(--danger); }
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state strong { font-family: Georgia, serif; font-size: 24px; font-weight: 400; }
.empty-state p { color: var(--muted); font-size: 13px; }

dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(90vh, 900px);
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--paper);
  box-shadow: 0 28px 90px rgba(0,0,0,.24);
  color: var(--ink);
}
dialog::backdrop { background: rgba(13, 36, 29, .68); }
.entry-dialog form, .confirm-dialog { padding: 34px; }
.confirm-dialog { width: min(480px, calc(100vw - 28px)); }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; }
.dialog-heading .eyebrow { color: var(--forest-light); }
.dialog-heading h2 { margin: 9px 0 0; font-family: Georgia, serif; font-size: 34px; font-weight: 400; }
.icon-button { width: 34px; height: 34px; border: 0; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; }
.icon-button:hover { color: var(--ink); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 12px; font-weight: 750; }
.field-wide { grid-column: 1 / -1; }
.field input { min-height: 44px; font-weight: 400; }
.checkbox-field { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 650; }
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--forest); }
.dialog-actions { display: flex; justify-content: end; gap: 10px; margin-top: 28px; }
.confirm-dialog > p { color: var(--muted); line-height: 1.5; }
.confirm-dialog > p strong { color: var(--ink); }
.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  padding: 15px 22px;
  background: var(--forest);
  color: white;
  box-shadow: var(--shadow);
  font-size: 13px;
}

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: 310px; gap: 42px; }
  .login-intro h1 { font-size: 52px; }
  .login-footnote { display: none; }
  .login-form-wrap { padding: 55px 24px; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .search-label { min-width: 0; flex: 1; }
}
@media (max-width: 620px) {
  .topbar { min-height: 70px; }
  .signed-in-as { display: none; }
  .dashboard-main { padding-top: 32px; }
  .page-heading { align-items: start; flex-direction: column; }
  .page-heading .button { width: 100%; }
  .stats { grid-template-columns: 1fr; gap: 8px; margin: 28px 0; }
  .stat-card { min-height: 100px; padding: 20px; }
  .stat-card strong { margin-top: 12px; }
  .public-columns-panel { padding: 22px; }
  .contacts-panel { padding: 22px; }
  .contacts-form-grid { grid-template-columns: 1fr; }
  .contacts-form-actions { flex-direction: column; align-items: stretch; }
  .public-columns-heading { flex-direction: column; }
  .public-columns-heading .button { width: 100%; }
  .certificates-panel-heading, .certificate-visibility, .admin-certificate-row { flex-direction: column; align-items: stretch; }
  .certificates-panel-heading { padding: 22px; }
  .certificate-visibility { margin: 0 22px; }
  .certificates-panel > .public-columns-status { margin-left: 22px; margin-right: 22px; }
  .admin-certificate-row { padding: 20px 22px; }
  .panel-heading { padding: 22px; }
  .panel-actions { flex-direction: column; align-items: stretch; }
  .search-label { width: 100%; }
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .field-wide { grid-column: auto; }
  .entry-dialog form, .confirm-dialog { padding: 24px; }
  .dialog-actions .button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
