:root {
  --admin-forest: #315c42;
  --admin-forest-dark: #173d29;
  --admin-forest-deep: #0d3522;
  --admin-cream: #f6f0e3;
  --admin-cream-light: #fffaf0;
  --admin-gold: #c89b45;
  --admin-ink: #263029;
  --admin-muted: #687168;
  --admin-line: rgba(81, 102, 79, .23);
  --admin-gold-line: rgba(200, 155, 69, .47);
  --admin-rust: #a3432c;
  --admin-serif: "Source Serif 4", Georgia, serif;
  --admin-sans: "DM Sans", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 26px; }

body {
  margin: 0;
  color: var(--admin-ink);
  background: var(--admin-cream);
  font: 16px/1.5 var(--admin-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(200, 155, 69, .62);
  outline-offset: 3px;
}

.admin-skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  color: #fff;
  background: var(--admin-forest-deep);
  transform: translateY(-160%);
}

.admin-skip-link:focus { transform: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.admin-shell { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: 100vh; }

.admin-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  padding: 18px 12px;
  flex-direction: column;
  color: rgba(255, 250, 240, .92);
  background: var(--admin-forest-deep);
  border-right: 1px solid rgba(200, 155, 69, .4);
}

.admin-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 90px;
  padding: 12px 18px;
  border: 1px solid var(--admin-gold);
  border-radius: 9px;
}

.admin-brand-mark {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--admin-cream-light);
  -webkit-mask: url("/static/images/logo.svg") center / contain no-repeat;
  mask: url("/static/images/logo.svg") center / contain no-repeat;
}

.admin-nav { display: grid; margin-top: 30px; gap: 7px; }

.admin-nav a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 11px 14px;
  gap: 13px;
  border-left: 3px solid transparent;
  border-radius: 7px;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.admin-nav a:hover, .admin-nav a.is-active { background: rgba(255, 250, 240, .12); border-left-color: var(--admin-gold); }
.admin-nav svg, .admin-logout svg { width: 23px; height: 23px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.admin-logout { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255, 250, 240, .24); }
.admin-logout button { display: flex; align-items: center; width: 100%; padding: 12px 14px; gap: 13px; color: inherit; background: transparent; border: 0; border-radius: 7px; text-align: left; }
.admin-logout button:hover { background: rgba(255, 250, 240, .1); }

.admin-main { width: min(100%, 1280px); padding: 30px 36px 52px; }
.admin-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.admin-heading h1, .admin-section h2, .news-admin-list-wrap h3 { margin: 0; color: var(--admin-forest-dark); font-family: var(--admin-serif); font-weight: 500; letter-spacing: -.025em; }
.admin-heading h1 { font-size: clamp(3rem, 5vw, 4.4rem); line-height: .95; }
.admin-heading p { margin: 8px 0 0; color: #4f5751; }
.admin-view-site { margin-top: 10px; padding-bottom: 4px; color: var(--admin-forest); border-bottom: 1px solid var(--admin-gold); font-weight: 600; text-decoration: none; }

.admin-section {
  margin-bottom: 20px;
  padding: 24px;
  background: rgba(255, 250, 240, .46);
  border: 1px solid var(--admin-gold-line);
  border-radius: 13px;
  box-shadow: 0 7px 24px rgba(47, 58, 47, .025);
  scroll-margin-top: 24px;
}

.admin-section h2 { font-size: clamp(2rem, 3vw, 2.65rem); line-height: 1; }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 25px; }
.section-heading-group { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; }
.menu-status { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; color: var(--admin-forest); }
.menu-status strong { font-weight: 600; }
.menu-status small { flex-basis: 100%; color: var(--admin-ink); font-size: .83rem; }

.admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: .92rem;
  font-weight: 600;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.admin-button:hover { transform: translateY(-1px); }
.admin-button-primary { color: #fffdf6; background: var(--admin-forest-deep); border: 1px solid var(--admin-forest-deep); }
.admin-button-primary:hover { background: #194d33; }
.admin-button-outline { color: #9b6610; background: transparent; border: 1px solid var(--admin-gold); }
.admin-button-outline:hover { color: #fff; background: #a97821; }
.admin-button-wide { width: 100%; margin-top: 10px; }

.admin-menu-list { display: grid; grid-template-columns: 1fr 1fr; margin-top: 20px; column-gap: 38px; }
.admin-menu-row { display: flex; align-items: baseline; justify-content: space-between; padding: 9px 3px; gap: 20px; border-bottom: 1px solid var(--admin-line); font-size: .89rem; }
.admin-menu-row strong { flex: 0 0 auto; font-weight: 500; }
.section-note { margin: 14px 3px 0; color: var(--admin-muted); font-size: .78rem; }
.menu-upload-form { display: grid; grid-template-columns: .75fr 1.25fr; align-items: end; margin-top: 22px; padding-top: 20px; gap: 24px; border-top: 1px solid var(--admin-gold-line); }
.menu-upload-form h3 { margin: 0 0 5px; color: var(--admin-forest-dark); font: 500 1.45rem/1.1 var(--admin-serif); }
.menu-upload-form p { max-width: 440px; margin: 0; color: var(--admin-muted); font-size: .82rem; }
.menu-upload-controls { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 6px 12px; }
.menu-upload-controls label { grid-column: 1 / -1; color: var(--admin-muted); font-size: .76rem; }
.menu-upload-controls input[type="file"] { min-height: 44px; padding: 8px; color: var(--admin-ink); background: rgba(255, 252, 245, .76); border: 1px dashed var(--admin-gold); border-radius: 7px; font-size: .82rem; }
.menu-upload-controls input[type="file"]::file-selector-button { margin-right: 10px; padding: 6px 10px; color: var(--admin-forest-dark); background: var(--admin-cream-light); border: 1px solid var(--admin-line); border-radius: 5px; font-weight: 600; cursor: pointer; }

.menu-preview-main { max-width: 1320px; }
.preview-heading { margin-bottom: 22px; }
.preview-heading h1 { font-size: clamp(2.8rem, 4.5vw, 4rem); }
.admin-back-link { display: inline-block; margin-top: 14px; color: var(--admin-forest); font-weight: 600; text-decoration: none; }
.admin-back-link:hover { text-decoration: underline; }
.validation-success { display: flex; align-items: center; margin: 0 0 20px; padding: 13px 16px; gap: 12px; color: #17462f; background: #e0ebdf; border: 1px solid #a8c2a6; border-radius: 8px; }
.validation-success svg { width: 25px; height: 25px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.preview-file-summary { display: grid; grid-template-columns: 1.4fr 1fr .75fr .65fr; margin-bottom: 18px; padding: 20px 22px; background: rgba(255, 250, 240, .46); border: 1px solid var(--admin-gold-line); border-radius: 12px; }
.preview-file-summary > div { padding: 0 18px; border-right: 1px solid var(--admin-line); }
.preview-file-summary > div:first-child { padding-left: 0; }
.preview-file-summary > div:last-child { padding-right: 0; border-right: 0; }
.preview-file-summary span, .preview-file-summary strong { display: block; overflow-wrap: anywhere; }
.preview-file-summary span { margin-bottom: 4px; color: var(--admin-muted); font-size: .76rem; }
.preview-file-summary strong { font-size: .92rem; font-weight: 500; }
.menu-preview-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; }
.validation-checks, .recognized-menu { padding: 24px; background: rgba(255, 250, 240, .46); border: 1px solid var(--admin-gold-line); border-radius: 12px; }
.validation-checks h2, .recognized-menu h2 { margin: 0; color: var(--admin-forest-dark); font: 500 clamp(1.8rem, 3vw, 2.45rem)/1 var(--admin-serif); letter-spacing: -.02em; }
.validation-checks ul { display: grid; margin: 24px 0 0; padding: 0; gap: 0; list-style: none; }
.validation-checks li { display: flex; align-items: center; padding: 14px 0; gap: 11px; border-bottom: 1px solid var(--admin-line); font-size: .84rem; }
.validation-checks li:last-child { border-bottom: 0; }
.validation-checks li span { display: inline-grid; width: 23px; height: 23px; flex: 0 0 auto; color: #fff; background: var(--admin-forest); border-radius: 50%; place-items: center; font-size: .75rem; }
.recognized-menu-group { margin-top: 22px; }
.recognized-menu-group h3 { margin: 0; color: var(--admin-forest-dark); font: 500 1.35rem/1.2 var(--admin-serif); }
.recognized-menu-row { display: flex; align-items: baseline; justify-content: space-between; padding: 9px 0; gap: 25px; border-bottom: 1px solid var(--admin-line); font-size: .88rem; }
.recognized-menu-row small { margin-right: 7px; color: var(--admin-muted); }
.recognized-menu-row strong { flex: 0 0 auto; font-weight: 500; }
.preview-actions { display: flex; margin-top: 18px; padding: 18px 24px; gap: 14px; background: rgba(255, 250, 240, .46); border: 1px solid var(--admin-gold-line); border-radius: 12px; }
.preview-actions .admin-button { min-width: 200px; }

.announcement-title-row { justify-content: flex-start; margin-bottom: 18px; gap: clamp(30px, 7vw, 80px); }
.switch-label { display: flex; align-items: center; gap: 14px; font-size: .9rem; cursor: pointer; }
.switch-label input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 50px; height: 28px; background: #a8aea8; border-radius: 999px; transition: background-color 160ms ease; }
.switch::after { position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; content: ""; background: #fffaf0; border-radius: 50%; box-shadow: 0 1px 5px rgba(0, 0, 0, .22); transition: transform 160ms ease; }
.switch-label input:checked + .switch { background: var(--admin-forest); }
.switch-label input:checked + .switch::after { transform: translateX(22px); }
.switch-label input:focus-visible + .switch { outline: 3px solid rgba(200, 155, 69, .62); outline-offset: 3px; }
.announcement-form textarea, .admin-form input, .admin-form textarea {
  width: 100%;
  color: var(--admin-ink);
  background: rgba(255, 252, 245, .76);
  border: 1px solid rgba(119, 122, 103, .34);
  border-radius: 7px;
}
.announcement-form textarea { padding: 13px 15px; resize: vertical; }
.announcement-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 24px; }
.announcement-actions p { margin: 0; color: var(--admin-forest); font-size: .82rem; }

.news-admin-layout { display: grid; grid-template-columns: minmax(280px, .72fr) minmax(450px, 1.28fr); margin-top: 18px; gap: 24px; }
.admin-form { display: grid; gap: 8px; }
.admin-form label { color: var(--admin-ink); font-size: .81rem; font-weight: 500; }
.admin-form input, .admin-form textarea { min-height: 43px; padding: 10px 12px; font-size: .9rem; }
.admin-form textarea { resize: vertical; }
.news-form { padding-right: 24px; border-right: 1px solid var(--admin-line); }
.news-form .admin-button { justify-self: start; margin-top: 4px; }
.news-admin-list-wrap h3 { margin: -3px 0 9px; font-size: 1.25rem; }
.news-admin-list { border: 1px solid var(--admin-line); border-radius: 9px; }
.news-admin-row { display: grid; grid-template-columns: 88px 1fr auto; align-items: start; padding: 14px 12px; gap: 13px; border-bottom: 1px solid var(--admin-line); }
.news-admin-row:last-child { border-bottom: 0; }
.news-admin-row time { color: #4f5b52; font-size: .78rem; }
.news-admin-row h4 { margin: 0; color: var(--admin-ink); font-size: .9rem; font-weight: 600; }
.news-admin-row p { margin: 3px 0 0; color: var(--admin-muted); font-size: .78rem; }
.news-admin-row form { align-self: center; }
.admin-delete { padding: 6px 4px; color: var(--admin-rust); background: transparent; border: 0; font-size: .78rem; }
.admin-delete:hover { text-decoration: underline; }
.empty-state { padding: 20px; color: var(--admin-muted); }

.security-section { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 22px; }
.security-form { grid-template-columns: repeat(3, minmax(130px, 1fr)) auto; align-items: end; }
.security-form label { display: grid; gap: 6px; }
.security-form .admin-button { margin-bottom: 0; white-space: nowrap; }

.admin-messages { display: grid; margin-bottom: 18px; gap: 8px; }
.admin-message { margin: 0; padding: 11px 14px; border-radius: 7px; font-size: .88rem; }
.admin-message-success { color: #17462f; background: #e0ebdf; border: 1px solid #a8c2a6; }
.admin-message-error { color: #742d20; background: #f3dfd8; border: 1px solid #dbb2a7; }

/* First setup and login */
.admin-auth-page { min-height: 100vh; background: var(--admin-cream-light); }
.auth-header { display: flex; align-items: center; justify-content: space-between; height: 136px; padding: 18px clamp(32px, 7vw, 105px); background: var(--admin-forest-dark); border-bottom: 1px solid var(--admin-gold); }
.auth-brand { display: block; width: 222px; height: 92px; }
.auth-back { padding-bottom: 5px; color: #e3bd6c; border-bottom: 1px solid currentColor; font-size: 1.12rem; text-decoration: none; }
.auth-main { display: grid; grid-template-columns: 1fr 1fr; align-items: center; width: min(1240px, calc(100% - 64px)); min-height: calc(100vh - 136px); margin: 0 auto; gap: clamp(55px, 9vw, 135px); }
.auth-main-login { width: min(1050px, calc(100% - 64px)); }
.auth-intro h1 { max-width: 600px; margin: 0; color: var(--admin-forest-dark); font: 500 clamp(3.6rem, 5.6vw, 5.4rem)/.99 var(--admin-serif); letter-spacing: -.035em; }
.auth-rule { position: relative; width: 100%; height: 1px; margin: 36px 0 38px; background: var(--admin-gold); }
.auth-rule::after { position: absolute; right: 0; bottom: -5px; width: 11px; height: 11px; content: ""; background: var(--admin-cream-light); border: 1px solid var(--admin-gold); border-radius: 50%; }
.auth-intro > p:not(.auth-assurance) { max-width: 570px; margin: 0; font-size: clamp(1.12rem, 1.8vw, 1.42rem); line-height: 1.5; }
.auth-assurance { display: flex; align-items: center; max-width: 520px; margin: 40px 0 0; gap: 18px; color: #3f4942; }
.auth-assurance svg { width: 44px; height: 44px; flex: 0 0 auto; fill: none; stroke: var(--admin-forest); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.auth-form-panel { padding: clamp(28px, 4vw, 48px); background: rgba(255, 250, 240, .72); border: 1px solid var(--admin-gold-line); border-radius: 16px; box-shadow: 0 16px 38px rgba(42, 58, 45, .08); }
.auth-form { gap: 10px; }
.auth-form label { margin-top: 12px; font-size: 1rem; }
.auth-form input { min-height: 58px; padding: 14px 16px; font-size: 1rem; }
.field-help { margin: 0 0 6px; color: var(--admin-muted); font-size: .86rem; }
.auth-form .admin-button { min-height: 58px; margin-top: 22px; font-size: 1rem; }

@media (max-width: 980px) {
  html { scroll-padding-top: 96px; }
  .admin-shell { display: block; }
  .admin-sidebar { position: sticky; z-index: 20; top: 0; height: auto; padding: 10px 16px; flex-direction: row; align-items: center; gap: 18px; }
  .admin-brand { width: 150px; height: 68px; flex: 0 0 auto; padding: 8px 12px; }
  .admin-nav { display: flex; margin: 0; overflow-x: auto; gap: 2px; }
  .admin-nav a { min-height: 45px; padding: 8px 10px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .admin-nav a:hover, .admin-nav a.is-active { border-bottom-color: var(--admin-gold); }
  .admin-nav svg { display: none; }
  .admin-logout { margin: 0 0 0 auto; padding: 0; border: 0; }
  .admin-logout button { padding: 9px; }
  .admin-logout button svg { margin: 0; }
  .admin-logout button { font-size: 0; }
  .admin-main { padding: 28px 24px 48px; }
  .security-section { grid-template-columns: 1fr; }
  .security-form { grid-template-columns: 1fr 1fr; }
  .auth-main { gap: 48px; }
  .menu-preview-layout { grid-template-columns: 1fr; }
  .validation-checks ul { grid-template-columns: 1fr 1fr; column-gap: 25px; }
}

@media (max-width: 720px) {
  .admin-sidebar { flex-wrap: wrap; gap: 6px 14px; }
  .admin-brand { width: 132px; height: 56px; }
  .admin-nav { order: 3; width: calc(100% + 6px); }
  .admin-nav a { font-size: .82rem; }
  .admin-main { padding: 24px 15px 40px; }
  .admin-heading { align-items: flex-end; }
  .admin-heading h1 { font-size: 3.25rem; }
  .admin-view-site { font-size: .82rem; }
  .admin-section { padding: 20px 16px; }
  .section-heading-row, .section-heading-group { align-items: flex-start; flex-direction: column; }
  .admin-menu-list { grid-template-columns: 1fr; }
  .menu-admin-section .section-heading-row form, .menu-admin-section .admin-button { width: 100%; }
  .menu-upload-form, .menu-upload-controls { grid-template-columns: 1fr; }
  .menu-upload-controls .admin-button { width: 100%; }
  .preview-file-summary { grid-template-columns: 1fr 1fr; gap: 18px 0; }
  .preview-file-summary > div { padding: 0 12px; }
  .preview-file-summary > div:nth-child(2) { border-right: 0; }
  .preview-file-summary > div:nth-child(3) { padding-left: 0; }
  .validation-checks ul { grid-template-columns: 1fr; }
  .preview-actions { align-items: stretch; flex-direction: column; }
  .preview-actions form, .preview-actions .admin-button { width: 100%; }
  .announcement-title-row { gap: 18px; }
  .switch-label { width: 100%; justify-content: space-between; }
  .announcement-actions { align-items: stretch; flex-direction: column; }
  .announcement-actions .admin-button { width: 100%; }
  .news-admin-layout { grid-template-columns: 1fr; }
  .news-form { padding: 0 0 22px; border-right: 0; border-bottom: 1px solid var(--admin-line); }
  .news-form .admin-button { width: 100%; }
  .news-admin-row { grid-template-columns: 74px 1fr; }
  .news-admin-row form { grid-column: 2; }
  .security-form { grid-template-columns: 1fr; }
  .auth-header { height: 96px; padding: 12px 20px; }
  .auth-brand { width: 170px; height: 70px; }
  .auth-back { font-size: .9rem; }
  .auth-main, .auth-main-login { grid-template-columns: 1fr; width: min(100% - 30px, 600px); min-height: auto; padding: 64px 0 80px; gap: 46px; }
  .auth-intro h1 { font-size: clamp(3.3rem, 15vw, 4.7rem); }
  .auth-rule { margin: 25px 0 28px; }
  .auth-assurance { margin-top: 30px; }
  .auth-form-panel { padding: 28px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
