:root {
  color-scheme: light;
  --forest: #0c6a53;
  --forest-dark: #084c3d;
  --mint: #24b9a3;
  --cream: #f7f2e8;
  --paper: #fffdf8;
  --ink: #17342c;
  --muted: #63746e;
  --line: #d8ded9;
  --warning: #b36b15;
  --danger: #a63c32;
  --shadow: 0 18px 50px rgba(20, 45, 37, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: #eef1eb; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.eyebrow { margin: 0 0 .35rem; color: var(--forest); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; background: radial-gradient(circle at 20% 10%, #d9e7d2, transparent 40%), var(--cream); }
.login-card { width: min(100%, 430px); padding: 2.4rem; border: 1px solid rgba(12, 106, 83, .14); border-radius: 28px; background: var(--paper); box-shadow: var(--shadow); }
.login-card img { object-fit: contain; }
.login-card h1 { margin: .2rem 0 .5rem; font-family: Georgia, serif; font-size: 2.4rem; }
.login-card > p:not(.eyebrow,.message) { color: var(--muted); line-height: 1.5; }
label { display: grid; gap: .45rem; margin: 1rem 0; font-size: .82rem; font-weight: 750; }
input, textarea, select { width: 100%; border: 1px solid #c9d2cc; border-radius: 11px; padding: .78rem .86rem; color: var(--ink); background: #fff; }
input[type="checkbox"] { width: auto; justify-self: start; }
textarea { min-height: 105px; resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(36, 185, 163, .2); border-color: var(--mint); }
.button { border: 0; border-radius: 999px; padding: .78rem 1.15rem; font-weight: 800; cursor: pointer; }
.button:disabled { opacity: .55; cursor: wait; }
.button.primary { color: white; background: var(--forest); }
.button.primary:hover { background: var(--forest-dark); }
.button.secondary { border: 1px solid var(--line); color: var(--forest); background: white; }
.button.danger { color: var(--danger); background: #fff0ee; }
.message { min-height: 1.4rem; color: var(--danger); }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1.2rem; color: white; background: var(--forest-dark); }
.admin-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 2rem; color: white; text-decoration: none; }
.admin-brand img { width: 42px; height: 42px; padding: .3rem; border-radius: 12px; background: white; object-fit: contain; }
.admin-brand span { display: grid; }
.admin-brand small { color: #b9d7cd; }
#admin-nav { display: grid; gap: .2rem; }
#admin-nav button, .sidebar-foot button, .sidebar-foot a { width: 100%; border: 0; border-radius: 10px; padding: .72rem .8rem; color: #d7e7e1; text-align: left; text-decoration: none; background: transparent; cursor: pointer; }
#admin-nav button:hover, #admin-nav button.active, .sidebar-foot button:hover, .sidebar-foot a:hover { color: white; background: rgba(255,255,255,.1); }
.nav-count { float: right; min-width: 1.5rem; padding: .1rem .35rem; border-radius: 999px; color: var(--forest-dark); text-align: center; background: #f0b44d; }
.sidebar-foot { display: grid; gap: .1rem; margin-top: auto; border-top: 1px solid rgba(255,255,255,.15); padding-top: 1rem; }
.workspace { min-width: 0; padding: 2rem clamp(1.2rem, 4vw, 4rem) 5rem; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.topbar h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2rem, 4vw, 3.3rem); }
.top-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .65rem; }
.help-button { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; flex: 0 0 2.65rem; border: 2px solid var(--forest); border-radius: 50%; padding: 0; color: var(--forest); font-size: 1.15rem; font-weight: 900; background: white; cursor: pointer; }
.help-button:hover, .help-button:focus-visible { color: white; background: var(--forest); }
.help-button:focus-visible { outline: 3px solid rgba(36, 185, 163, .25); outline-offset: 2px; }
.publish-state { color: var(--muted); font-size: .78rem; }
.notice { margin-bottom: 1.2rem; padding: .85rem 1rem; border-radius: 12px; color: var(--forest-dark); background: #dff3ec; }
.notice.error { color: #76271f; background: #fde8e4; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat, .panel, .submission-card { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: 0 8px 25px rgba(20,45,37,.04); }
.stat { padding: 1.2rem; }
.stat strong { display: block; font-family: Georgia, serif; font-size: 2.3rem; }
.stat span { color: var(--muted); font-size: .84rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, .8fr); gap: 1rem; margin-top: 1rem; }
.panel { padding: 1.25rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1.05rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; background: white; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid #e8ece9; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; background: #f8faf7; }
tr:last-child td { border-bottom: 0; }
td strong { display: block; }
td small { color: var(--muted); }
.row-action { border: 0; color: var(--forest); font-weight: 800; background: none; cursor: pointer; }
.badge { display: inline-block; padding: .28rem .5rem; border-radius: 999px; color: var(--muted); font-size: .72rem; font-weight: 800; background: #eef1ee; }
.badge.published { color: var(--forest); background: #ddf2e9; }
.badge.draft, .badge.review { color: var(--warning); background: #fff1d6; }
.badge.archived { color: var(--danger); background: #fde7e4; }
.badge.active { color: var(--forest); background: #ddf2e9; }
.badge.inactive { color: var(--danger); background: #fde7e4; }
.empty { padding: 3rem 1.5rem; color: var(--muted); text-align: center; }
.submission-list { display: grid; gap: 1rem; }
.submission-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, .45fr); gap: 1.4rem; padding: 1.25rem; }
.submission-card blockquote { margin: .8rem 0; padding-left: 1rem; border-left: 3px solid var(--mint); line-height: 1.55; }
.submission-card img { max-width: 220px; max-height: 160px; border-radius: 12px; object-fit: cover; }
.submission-controls { display: grid; align-content: start; }
.submission-controls label { margin: 0 0 .7rem; }
.submission-controls .button { margin-top: .4rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.media-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; }
.media-card img { width: 100%; height: 140px; object-fit: cover; background: #eef1eb; }
.media-card div { padding: .8rem; }
.media-card small { display: block; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
dialog { width: min(940px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 22px; padding: 0; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(9, 34, 27, .58); backdrop-filter: blur(3px); }
.editor-dialog form { display: flex; max-height: calc(100vh - 2rem); flex-direction: column; }
.editor-dialog header, .small-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); padding: 1.15rem 1.35rem; }
.editor-dialog h2, .small-dialog h2 { margin: 0; font-family: Georgia, serif; font-size: 1.7rem; }
.icon-button { width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; color: var(--ink); font-size: 1.7rem; background: #edf0ec; cursor: pointer; }
.editor-body { overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; padding: 1rem 1.35rem 2rem; }
.editor-body label { margin: .75rem 0; }
.editor-body label.full { grid-column: 1 / -1; }
.editor-body .hint { margin: -.2rem 0 .3rem; color: var(--muted); font-size: .75rem; font-weight: 450; }
.editor-dialog footer { display: flex; align-items: center; gap: .7rem; border-top: 1px solid var(--line); padding: 1rem 1.35rem; background: white; }
.spacer { flex: 1; }
.small-dialog { width: min(470px, calc(100vw - 2rem)); padding-bottom: 1.3rem; }
.small-dialog label, .small-dialog > form > .button { margin-left: 1.35rem; margin-right: 1.35rem; }
.help-dialog { width: min(590px, calc(100vw - 2rem)); }
.help-content > p, .help-content > ul { margin-left: 1.35rem; margin-right: 1.35rem; }
.help-content > p { color: var(--muted); line-height: 1.55; }
.help-content > ul { display: grid; gap: .65rem; padding-left: 1.25rem; line-height: 1.5; }
@media (max-width: 850px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  #admin-nav { grid-template-columns: repeat(2, 1fr); }
  .sidebar-foot { grid-template-columns: repeat(3, 1fr); margin-top: 1rem; }
  .workspace { min-height: 100vh; min-height: 100dvh; padding-top: 1.4rem; }
  .dashboard-grid, .submission-card { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .login-shell { padding: 1rem; }
  .login-card { padding: 1.5rem; }
  #admin-nav { grid-template-columns: 1fr; }
  .sidebar-foot { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  .publish-state { width: 100%; }
  .editor-body { grid-template-columns: 1fr; }
  .editor-body label.full { grid-column: auto; }
  .editor-dialog footer { flex-wrap: wrap; }
}
