:root {
  color-scheme: light;
  --bg: #f9fafb;
  --surface: #ffffff;
  --soft: #f3f4f6;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #111111;
  --muted: #6b7280;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 8px 22px rgba(17, 24, 39, .04);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; overflow-x: hidden; color: var(--text); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 100; top: -4rem; left: 1rem; padding: .7rem 1rem; border-radius: 8px; color: #fff; background: #111; }
.skip-link:focus { top: 1rem; }
.app-shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); width: min(100%, 1440px); min-height: 100vh; margin: 0 auto; background: var(--bg); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; gap: 2rem; padding: 1.75rem 1rem; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 11px; padding: 0 .75rem 1.5rem; border-bottom: 1px solid var(--line); }
.brand > span:last-child { display: grid; line-height: 1.05; }
.brand strong { font-size: .95rem; letter-spacing: -.02em; }
.brand small { margin-top: 5px; color: #9ca3af; font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { display: grid; grid-template-columns: repeat(2, 9px); grid-template-rows: repeat(2, 9px); gap: 3px; transform: rotate(-5deg); }
.brand-mark i { display: block; border-radius: 2px; background: #111; }
.brand-mark i:nth-child(3) { grid-column: 1 / 3; width: 21px; height: 4px; align-self: end; border-radius: 4px; background: #6b7280; }
.primary-nav { display: grid; gap: 4px; width: 100%; }
.nav-item { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .7rem .75rem; border: 0; border-radius: .65rem; color: var(--muted); background: transparent; cursor: pointer; font-size: .875rem; text-align: left; }
.nav-item span { width: 1.1rem; color: #9ca3af; text-align: center; }
.nav-item:hover, .nav-item:focus-visible { color: var(--text); background: var(--soft); }
.nav-item.is-active { color: #111; background: #f0f1f2; font-weight: 600; }
.nav-item.is-active span { color: #111; }
.workspace, main, .resource-grid { min-width: 0; max-width: 100%; }
.site-header { position: sticky; z-index: 20; top: 0; display: flex; min-height: 4rem; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 0 clamp(1rem, 3vw, 2.5rem); border-bottom: 1px solid var(--line); background: rgba(249, 250, 251, .96); }
.global-search { position: relative; display: flex; width: min(27rem, 52%); min-width: 14rem; margin-left: auto; align-items: center; color: #9ca3af; }
.global-search span { position: absolute; left: .8rem; font-size: 1.05rem; pointer-events: none; }
.global-search input { width: 100%; height: 2.5rem; margin: 0; padding: 0 .9rem 0 2.25rem; border: 1px solid transparent; border-radius: .65rem; outline: 0; color: var(--text); background: #f1f2f4; }
.global-search input:focus { border-color: var(--line-strong); background: #fff; box-shadow: 0 0 0 3px rgba(17, 17, 17, .06); }
.account-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: .5rem; }
.account-chip { display: flex; min-width: 0; max-width: 15rem; align-items: center; gap: .6rem; padding: .3rem .7rem .3rem .3rem; border: 1px solid var(--line); border-radius: 999px; color: var(--text); background: #fff; cursor: pointer; }
.account-copy { display: grid; min-width: 0; text-align: left; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: .75rem; }
.account-copy small { color: var(--muted); font-size: .65rem; }
.avatar { display: grid; width: 2rem; height: 2rem; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: #111; font-size: .78rem; font-weight: 700; }
.avatar.has-image { color: transparent; background-position: center; background-size: cover; }

main { width: min(100%, 80rem); min-height: calc(100vh - 7rem); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem); }
.view { padding: 2.75rem 0 5rem; animation: view-in .25s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.page-heading, .section-heading, .subsection-heading { display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.page-heading { margin-bottom: 2.5rem; }
.page-heading h1 { margin: 0; color: #111; font-size: 1.875rem; font-weight: 600; letter-spacing: -.035em; line-height: 1.2; }
.page-heading p:last-child, .subsection-heading p:last-child { margin: .55rem 0 0; color: var(--muted); font-size: .875rem; line-height: 1.6; }
.section-heading { margin-bottom: 1.25rem; }
.section-heading h2, .subsection-heading h2 { margin: 0; color: #1f2937; font-size: 1.125rem; font-weight: 500; letter-spacing: -.015em; }
.theme-filters { display: flex; align-items: center; justify-content: flex-start; gap: 1.5rem; margin-bottom: 1.25rem; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: .85rem; background: #fff; box-shadow: var(--shadow); }
.theme-filters label { display: inline-flex; min-width: 0; align-items: center; gap: .6rem; color: var(--muted); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.theme-filters select { min-width: 0; padding-block: .5rem; font-size: .8125rem; }
.subsection-heading { margin: 3rem 0 1.25rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.eyebrow { margin: 0 0 .55rem; color: #9ca3af; font-size: .68rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.page-actions, .row-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.button { display: inline-flex; min-height: 2.5rem; align-items: center; justify-content: center; padding: 0 1rem; border: 1px solid transparent; border-radius: .75rem; font-size: .875rem; font-weight: 600; cursor: pointer; transition: background .16s, border-color .16s, opacity .16s; }
.button:hover { transform: none; }
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { color: #fff; background: #18181b; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.button-primary:hover { background: #27272a; }
.button-secondary { border-color: var(--line); color: #374151; background: #fff; }
.button-secondary:hover { background: var(--soft); }
.button-ghost { color: var(--muted); background: transparent; }
.button-ghost:hover { color: #111; background: var(--soft); }
.button-danger { color: #374151; background: #f3f4f6; }
.button-block { width: 100%; min-height: 3rem; }
.button-small { min-height: 2rem; padding-inline: .75rem; font-size: .75rem; }
.icon-button { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 1px solid var(--line); border-radius: .75rem; color: var(--muted); background: #fff; cursor: pointer; font-size: 1.1rem; }
.icon-button:hover { color: #111; background: var(--soft); }

.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.resource-grid > * { min-width: 0; }
.resource-card, .resource-row, .summary-item, .empty-state, .loading-state { border: 1px solid rgba(229, 231, 235, .9); border-radius: 1rem; background: #fff; box-shadow: var(--shadow); }
.resource-card { display: flex; min-width: 0; min-height: 15rem; flex-direction: column; padding: 1.5rem; overflow: hidden; transition: border-color .16s, box-shadow .16s, transform .16s; }
.resource-card:hover { border-color: #d1d5db; box-shadow: 0 2px 4px rgba(17,24,39,.05), 0 12px 26px rgba(17,24,39,.06); transform: translateY(-2px); }
.file-badge { display: grid; width: 2.75rem; height: 2.75rem; flex: 0 0 auto; place-items: center; margin-bottom: 1.5rem; border: 1px solid var(--line); border-radius: .75rem; color: #374151; background: var(--soft); font: 700 .65rem ui-monospace, monospace; }
.resource-card h3 { margin: 0; overflow-wrap: anywhere; color: #111; font-size: 1rem; font-weight: 600; line-height: 1.4; }
.resource-card p { display: -webkit-box; margin: .6rem 0 1.25rem; overflow: hidden; color: var(--muted); font-size: .8125rem; line-height: 1.6; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.card-meta { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: .75rem; margin-top: auto; color: var(--muted); font-size: .72rem; }
.card-meta > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download-link { flex: 0 0 auto; color: #111; font-weight: 700; }
.like-button { flex: 0 0 auto; margin: 0; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: .6rem; color: #6b7280; background: #fff; cursor: pointer; font-size: .75rem; }
.like-button:hover, .like-button.is-liked { color: #111; background: var(--soft); }
.official-badge, .status { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; color: #4b5563; background: var(--soft); font-size: .65rem; font-weight: 700; }
.official-badge { margin-left: .5rem; padding: .2rem .45rem; vertical-align: middle; }
.status { gap: .35rem; padding: .35rem .55rem; }
.status::before { width: .3rem; height: .3rem; border-radius: 50%; background: currentColor; content: ""; }
.status-pending, .status-approved, .status-rejected, .status-validation-failed { color: #4b5563; background: var(--soft); }
.resource-list { display: grid; gap: .75rem; }
.resource-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.25rem; padding: 1rem 1.25rem; }
.resource-row-main { display: flex; min-width: 0; align-items: center; gap: .9rem; }
.resource-row .file-badge { width: 2.5rem; height: 2.5rem; margin: 0; }
.resource-row-copy { min-width: 0; }
.resource-row h3 { margin: 0 0 .35rem; overflow: hidden; color: #111; font-size: .9375rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.resource-row p { margin: 0; overflow: hidden; color: var(--muted); font-size: .75rem; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.row-actions .button { min-height: 2rem; padding-inline: .75rem; font-size: .75rem; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
.summary-item { padding: 1rem; }
.summary-item strong { display: block; font-size: 1.25rem; }
.summary-item span { color: var(--muted); font-size: .72rem; }
.load-more-wrap { display: flex; justify-content: center; padding: 1.5rem 0; }
.empty-state, .loading-state { display: grid; min-width: 0; grid-column: 1 / -1; min-height: 13rem; place-items: center; padding: 2rem; color: var(--muted); text-align: center; }
.empty-state > div { min-width: 0; max-width: 100%; }
.empty-state span { display: block; overflow-wrap: anywhere; }
.empty-state strong { display: block; margin-bottom: .5rem; color: #111; }
.loading-dot { width: 1.75rem; height: 1.75rem; border: 2px solid var(--line); border-top-color: #111; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.filter-label { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .75rem; }
select, input, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: .65rem; outline: 0; color: var(--text); background: #fff; }
select { width: auto; padding: .55rem 2rem .55rem .7rem; }
input, textarea { margin-top: .5rem; padding: .7rem .8rem; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: #111; box-shadow: 0 0 0 3px rgba(17,17,17,.08); }
label { color: #374151; font-size: .78rem; font-weight: 600; }
.modal { position: relative; width: min(92vw, 30rem); padding: 1.75rem; border: 1px solid var(--line); border-radius: 1rem; color: var(--text); background: #fff; box-shadow: 0 20px 50px rgba(17,24,39,.14); }
.modal::backdrop { background: rgba(17,24,39,.28); }
.modal h2 { margin: .25rem 0 .45rem; font-size: 1.6rem; letter-spacing: -.03em; }
.modal-intro { margin: 0 0 1.25rem; color: var(--muted); font-size: .84rem; line-height: 1.6; }
.modal-close { position: absolute; top: .8rem; right: .8rem; display: grid; width: 2rem; height: 2rem; place-items: center; border: 0; border-radius: 50%; color: var(--muted); background: var(--soft); cursor: pointer; font-size: 1.1rem; }
.modal form { display: grid; gap: 1rem; }
.modal-brand { margin-bottom: 1.1rem; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; margin-bottom: 1.25rem; padding: .25rem; border-radius: .65rem; background: var(--soft); }
.auth-tabs button { padding: .55rem; border: 0; border-radius: .45rem; color: var(--muted); background: transparent; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { color: #111; background: #fff; box-shadow: 0 1px 3px rgba(17,24,39,.08); }
.form-hint, .form-error { font-size: .72rem; line-height: 1.4; }
.form-hint { margin: -.4rem 0 0; color: var(--muted); }
.form-error { min-height: 1em; margin: -.35rem 0 0; color: #4b5563; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; color: var(--muted); }
.checkbox-label input { width: auto; margin: 0; }
.file-drop { display: grid; place-items: center; padding: 1.5rem 1rem; border: 1px dashed var(--line-strong); border-radius: .8rem; background: #fafafa; text-align: center; cursor: pointer; }
.file-drop:hover, .file-drop.is-dragging { border-color: #111; background: var(--soft); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop strong { margin: .5rem 0 .3rem; overflow-wrap: anywhere; color: #111; font-size: .84rem; }
.file-drop small { color: var(--muted); font-weight: 400; }
.file-icon { display: grid; width: 2.2rem; height: 2.2rem; place-items: center; border-radius: .65rem; color: #374151; background: var(--soft); font-size: 1.2rem; }
.account-menu { position: fixed; z-index: 40; top: 4.4rem; right: max(1rem, calc((100vw - 1440px) / 2 + 1rem)); width: 15rem; padding: .55rem; border: 1px solid var(--line); border-radius: .8rem; background: #fff; box-shadow: 0 14px 35px rgba(17,24,39,.12); }
.account-identity { display: flex !important; align-items: center; gap: .5rem; padding: .55rem .6rem .75rem !important; }
.account-identity > div { display: grid; min-width: 0; }
.account-identity strong { overflow: hidden; font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.account-identity small { margin-top: .2rem; color: var(--muted); }
.account-edit-icon { margin-left: auto; padding: .2rem .3rem; border: 0; border-radius: .35rem; color: var(--muted); background: transparent; cursor: pointer; }
.profile-form { padding: .25rem .6rem .65rem; }
.profile-form > label { display: block; margin-bottom: .3rem; color: var(--muted); font-size: .7rem; }
.profile-form > div { display: flex; gap: .4rem; }
.profile-form input { min-width: 0; margin: 0; padding: .45rem; }
.avatar-upload { display: block; margin: .25rem 0 .5rem; text-align: center; }
.account-menu > button:last-child { width: 100%; padding: .6rem; border: 0; border-radius: .5rem; color: #374151; background: var(--soft); cursor: pointer; text-align: left; }
.toast-region { position: fixed; z-index: 80; right: 1.25rem; bottom: 1.25rem; display: grid; width: min(22.5rem, calc(100vw - 2.5rem)); gap: .5rem; }
.toast { padding: .8rem .9rem; border: 1px solid var(--line); border-radius: .7rem; color: #111; background: #fff; box-shadow: 0 12px 28px rgba(17,24,39,.1); font-size: .8rem; }
footer { display: flex; width: min(100%, 80rem); justify-content: space-between; gap: 1rem; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 2rem; border-top: 1px solid var(--line); color: #9ca3af; font-size: .7rem; }
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 25; top: 0; display: flex; width: 100%; height: auto; flex-direction: row; align-items: center; gap: 1rem; padding: .75rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { flex: 0 0 auto; padding: 0 1rem 0 0; border-right: 1px solid var(--line); border-bottom: 0; }
  .primary-nav { display: flex; min-width: 0; flex: 1; gap: .25rem; overflow-x: auto; }
  .nav-item { width: auto; flex: 0 0 auto; white-space: nowrap; }
  .site-header { top: 4.55rem; }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .brand small { display: none; }
  .sidebar { gap: .75rem; }
  .brand strong { font-size: .85rem; }
  .nav-item { padding-inline: .6rem; }
  .site-header { position: sticky; top: 4.25rem; flex-wrap: wrap; gap: .65rem; padding-block: .65rem; }
  .global-search { order: 2; width: calc(100% - .65rem); max-width: 100%; min-width: 0; margin-left: 0; }
  .account-actions { margin-left: auto; }
  #register-button { display: none; }
  main { padding-inline: 1rem; }
  .view { padding-top: 2rem; }
  .page-heading, .section-heading, .subsection-heading { align-items: flex-start; flex-direction: column; }
  .page-heading { margin-bottom: 2rem; }
  .page-actions, .section-heading > button { align-self: stretch; justify-content: flex-start; }
  .page-actions .button-primary { width: 100%; }
  .theme-filters { align-items: stretch; flex-direction: column; gap: .6rem; }
  .theme-filters label { width: 100%; justify-content: space-between; }
  .resource-grid { grid-template-columns: 1fr; gap: 1rem; }
  .resource-row { grid-template-columns: 1fr; gap: .85rem; }
  .row-actions { justify-content: flex-start; }
  .summary-strip { gap: .5rem; }
  .summary-item { padding: .75rem; }
  footer { align-items: flex-start; flex-direction: column; }
  .account-copy { display: none; }
  .account-menu { top: 8.5rem; right: 1rem; }
}
@media (max-width:570px) { .resource-card { min-height: 14rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
