:root {
  --canvas: #f2f0e9;
  --paper: #fffdf7;
  --ink: #142019;
  --muted: #68716b;
  --line: #d9d8cf;
  --green: #176b46;
  --green-dark: #0f3f2c;
  --mint: #dfece3;
  --lime: #d7e888;
  --shadow: 0 22px 55px rgba(20, 32, 25, .08);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.clipboard-helper { position: fixed; width: 1px; height: 1px; left: -9999px; opacity: 0; }

.site-header {
  width: min(1220px, calc(100% - 40px));
  height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 800; letter-spacing: -.03em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--ink); color: var(--lime); font-size: .8rem; }
.site-nav { display: flex; align-items: center; gap: 8px; }
.nav-label { color: var(--muted); font-size: .82rem; margin-right: 6px; }
.nav-link { border: 0; background: transparent; color: var(--ink); padding: 8px 12px; border-radius: 999px; }
.nav-link:hover { background: var(--paper); }
.inline { display: inline; }

.container { width: min(1220px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 100px; }
.container.home-container { width: min(1720px, calc(100% - 40px)); padding-top: 32px; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: .72rem; font-weight: 850; letter-spacing: .18em; }
.muted { color: var(--muted); }
.back-link { display: inline-flex; align-items: center; margin-bottom: 34px; font-weight: 700; }

.home-hero { display: grid; grid-template-columns: minmax(0, 1fr) 180px; align-items: end; gap: 40px; padding: 36px 0 46px; }
.hero-copy h1 { margin: 0; max-width: 800px; font-size: clamp(3.6rem, 7vw, 6.6rem); line-height: .98; letter-spacing: -.075em; }
.hero-copy h1 em { color: var(--green); font-style: normal; }
.hero-note { max-width: 570px; margin: 26px 0 0; color: var(--muted); font-size: 1.03rem; }
.hero-index { display: flex; align-items: flex-end; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.hero-index strong { font-size: 3.7rem; line-height: 1; letter-spacing: -.06em; }
.hero-index span { color: var(--muted); font-size: .76rem; line-height: 1.45; }

.search-bar { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; padding: 9px 10px 9px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 10px 30px rgba(20, 32, 25, .04); }
.search-bar > span { font-size: 1.7rem; color: var(--green); line-height: 1; }
.search-bar input { width: 100%; border: 0; outline: 0; background: transparent; padding: 11px 4px; color: var(--ink); }
.search-bar button, .primary-action, .editor-actions button {
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  padding: 12px 22px;
  font-weight: 750;
}

.section-heading, .admin-section-head { display: flex; align-items: end; justify-content: space-between; margin: 32px 0 18px; }
.section-heading h1, .section-heading h2, .admin-section-head h2 { margin: 0; font-size: 2rem; letter-spacing: -.04em; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: .86rem; }
.section-heading > span, .admin-section-head > span { color: var(--muted); font-size: .72rem; letter-spacing: .12em; }
.resource-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.resource-card { min-height: 330px; padding: 20px; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); color: var(--ink); border: 1px solid rgba(23,107,70,.12); border-radius: 21px; box-shadow: 0 12px 30px rgba(20,32,25,.055); }
.resource-card h3 { min-block-size: 3em; margin: 0 0 15px; font-size: 1.06rem; line-height: 1.5; letter-spacing: -.025em; overflow-wrap: anywhere; }
.card-actions { display: flex; flex-direction: column; gap: 10px; }
.card-action { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 9px 14px; border: 1px solid transparent; border-radius: 13px; font-size: .88rem; font-weight: 800; line-height: 1.2; transition: border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease, filter .18s ease; }
.card-action-link { color: #a7472b; border-color: #dfc2b1; background: linear-gradient(135deg, #fffefb 0%, #f9e9df 100%); }
.card-action-copy { color: #9a513c; border-color: #dec5b8; background: linear-gradient(90deg, #fcf8f3 0%, #f8eee7 56%, #f2ddd2 100%); }
.card-action-tutorial { color: #79604a; border-color: #d9cdbd; background: linear-gradient(135deg, #fbfaf5 0%, #efe5d5 100%); }
a.card-action:hover, button.card-action:not(:disabled):hover { color: inherit; transform: translateY(-1px); filter: saturate(1.08); box-shadow: 0 7px 16px rgba(109,72,52,.09); }
.card-action-icon { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.card-action-icon-fill { fill: currentColor; stroke: none; }
.card-action.is-disabled { cursor: not-allowed; opacity: .5; box-shadow: none; transform: none; filter: saturate(.45); }
.card-action:focus-visible { outline: 3px solid #bd765a; outline-offset: 3px; }
.copy-code.copied { color: #7d3e2d; border-color: #bd765a; box-shadow: inset 0 0 0 1px rgba(189,118,90,.14); }
.card-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 14px; padding-top: 13px; color: var(--muted); font-size: .72rem; border-top: 1px solid rgba(23,107,70,.12); }
.card-provider { color: #536158; font-weight: 700; }

.admin-hero { display: flex; justify-content: space-between; align-items: end; padding: 35px 0 24px; }
.admin-hero h1 { margin: 0; font-size: clamp(3rem, 6vw, 5.8rem); line-height: 1; letter-spacing: -.07em; }
.admin-hero p:last-child { color: var(--muted); }
.primary-action { display: inline-flex; align-items: center; gap: 9px; }
.primary-action span { color: var(--lime); font-size: 1.25rem; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 32px; }
.metric-card { min-height: 170px; padding: 24px; display: grid; grid-template-columns: 1fr auto; align-content: space-between; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; }
.metric-card strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 4rem; line-height: 1; letter-spacing: -.07em; }
.metric-card small { color: var(--muted); letter-spacing: .12em; }
.metric-card.accent { background: var(--mint); border-color: transparent; }
.admin-section { margin-top: 72px; }
.admin-section-head { margin: 0 0 20px; }
.admin-resource-list, .request-list { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; }
.admin-resource-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 20px; border-bottom: 1px solid var(--line); }
.admin-resource-row:last-child { border-bottom: 0; }
.resource-monogram { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; background: var(--mint); color: var(--green-dark); font-size: 1.3rem; font-weight: 850; }
.admin-resource-copy h3 { margin: 0; font-size: 1.05rem; }
.admin-resource-copy p { margin: 3px 0 7px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.admin-resource-copy div { display: flex; gap: 16px; color: var(--green); font-size: .7rem; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.row-actions a, .row-actions button { min-width: 38px; height: 38px; padding: 0 13px; display: grid; place-items: center; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; background: transparent; }
.row-actions .edit-action { background: var(--ink); color: white; border-color: var(--ink); }
.delete-resource-form { margin: 0; }
.row-actions .delete-action { color: #a6372d; border-color: #e8c1bd; }
.row-actions .delete-action:hover { background: #f9e8e5; border-color: #d89c96; }
.request-row { display: grid; grid-template-columns: 180px 1fr auto 240px; gap: 18px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.request-row:last-child { border-bottom: 0; }
.request-row > span:first-child, .request-row > span:last-child { color: var(--muted); font-size: .78rem; }
.status-badge { width: fit-content; padding: 5px 10px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: .72rem; font-weight: 750; }

.editor-shell, .form-page, .auth-card { max-width: 820px; margin: 0 auto; }
.editor-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.editor-heading h1, .form-page h1, .auth-card h1 { margin: 0; font-size: 3rem; letter-spacing: -.055em; }
.editor-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.editor-card, .form-page, .auth-card { padding: clamp(24px, 5vw, 42px); background: var(--paper); border: 1px solid var(--line); border-radius: 24px; }
.editor-card label, .form-page label, .auth-card label { display: block; margin-bottom: 24px; font-weight: 750; }
.editor-card label:last-child { margin-bottom: 0; }
.editor-card label > span { float: right; color: var(--muted); font-size: .7rem; font-weight: 500; }
.editor-card input, .editor-card textarea, .form-page input, .form-page textarea, .form-page select, .auth-card input {
  width: 100%; margin-top: 8px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #fff; color: var(--ink);
}
.editor-card input:focus, .editor-card textarea:focus, .form-page input:focus, .form-page textarea:focus, .auth-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,70,.09); }
.fixed-community-field { margin-bottom: 24px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #f7f6f0; }
.fixed-community-field > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fixed-community-field small { color: var(--muted); font-weight: 500; }
.fixed-community-field p { margin: 9px 0 0; color: var(--ink); white-space: pre-line; }
.automatic-field { display: grid; grid-template-columns: 1fr auto; gap: 2px 18px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--canvas); }
.automatic-field > span { font-weight: 750; }
.automatic-field strong { text-align: right; font-size: .86rem; }
.automatic-field small { grid-column: 1 / -1; color: var(--muted); }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; }
.editor-actions { display: flex; justify-content: flex-end; align-items: center; gap: 20px; margin-top: 20px; }
.editor-actions a { color: var(--muted); }
.auth-card { margin-top: 6vh; }
.auth-card button, .form-page button { border: 0; background: var(--ink); color: white; border-radius: 12px; padding: 12px 20px; font-weight: 750; }
.check input { width: auto; }

.flash { max-width: 820px; margin: 0 auto 18px; padding: 12px 16px; border-radius: 12px; background: var(--mint); color: var(--green-dark); }
.flash.error { background: #f6dddd; color: #972d2d; }
.empty { grid-column: 1 / -1; padding: 55px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; }
.empty.compact { padding: 28px; border: 0; }
.pager { display: flex; justify-content: center; gap: 18px; margin-top: 34px; }

@media (max-width: 1300px) {
  .resource-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
  .resource-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-row { grid-template-columns: 130px 1fr auto; }
  .request-row > span:last-child { display: none; }
}

@media (max-width: 640px) {
  .site-header, .container { width: min(100% - 24px, 1220px); }
  .site-header { height: 66px; }
  .container { padding-top: 30px; }
  .brand > span:last-child, .nav-label { display: none; }
  .home-hero { grid-template-columns: 1fr; padding-top: 24px; }
  .hero-copy h1 { font-size: 3.35rem; }
  .hero-index { width: 170px; }
  .search-bar { grid-template-columns: auto 1fr auto; }
  .search-bar > a { display: none; }
  .search-bar button { padding-inline: 15px; }
  .resource-grid, .metric-grid, .form-grid { grid-template-columns: 1fr; }
  .resource-card { min-height: 0; padding: 20px; }
  .resource-card h3 { min-block-size: 0; }
  .section-heading { margin-top: 30px; align-items: flex-start; flex-direction: column; gap: 8px; }
  .section-heading > span { letter-spacing: .06em; }
  .admin-hero { display: block; }
  .admin-hero h1 { font-size: 3.5rem; }
  .primary-action { margin-top: 18px; }
  .metric-card { min-height: 125px; }
  .admin-resource-row { grid-template-columns: auto minmax(0,1fr); }
  .row-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .request-row { grid-template-columns: 1fr auto; }
  .request-row > span:first-child { grid-column: 1 / -1; }
  .editor-heading { display: block; }
  .editor-heading > .status-badge { margin-top: 14px; }
  .editor-card label > span { float: none; display: block; margin-top: 3px; }
}
