:root {
  color-scheme: dark;
  --canvas: #0d1117;
  --canvas-subtle: #161b22;
  --canvas-inset: #010409;
  --border: #30363d;
  --border-muted: #21262d;
  --text: #f0f6fc;
  --muted: #8b949e;
  --blue: #58a6ff;
  --green: #3fb950;
  --green-strong: #238636;
  --green-hover: #2ea043;
  --danger: #f85149;
  --danger-bg: #da3633;
  --orange: #d29922;
  --purple: #a371f7;
  --shadow: 0 8px 24px #01040966;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: var(--canvas); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }

.shell { width: min(1216px, calc(100% - 48px)); margin: 0 auto; }
.site-header { min-height: 64px; background: var(--canvas-inset); border-bottom: 1px solid var(--border-muted); }
.header-inner { width: min(100% - 32px, 1376px); min-height: 64px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 32px; height: 32px; display: inline-grid; place-items: center; border: 1px solid #ffffff18; border-radius: 50%; color: #0d1117; background: var(--text); font-size: 16px; font-weight: 800; }
.brand-mark.large { width: 48px; height: 48px; font-size: 22px; }
.header-nav { display: flex; align-items: center; gap: 6px; }
.header-nav a { padding: 7px 10px; border-radius: 6px; color: var(--text); font-size: 13px; font-weight: 600; }
.header-nav a:hover { background: #b1bac41f; text-decoration: none; }

.public-main, .admin-main { padding-top: 28px; }
.repo-head { min-height: 74px; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.repo-path { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--blue); font-size: 20px; }
.repo-path strong { font-weight: 600; }
.repo-path .slash { color: var(--muted); font-weight: 300; }
.visibility { margin-left: 4px; padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 12px; font-weight: 500; }
.repo-head p { margin: 7px 0 0; color: var(--muted); }
.code-icon { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.repo-source { width: min(460px, 50%); }
.repo-source label { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.copy-field { display: flex; }
.copy-field input { min-width: 0; border-radius: 6px 0 0 6px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; cursor: text; }
.copy-field button { flex: 0 0 auto; border-left: 0; border-radius: 0 6px 6px 0; }
.catalog-intro { max-width: 720px; padding: 10px 0 20px; }
.catalog-intro p { margin: 0; color: var(--muted); font-size: 16px; }

.repo-tabs { display: flex; gap: 4px; min-height: 48px; margin-top: 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.repo-tabs::-webkit-scrollbar { display: none; }
.repo-tabs a { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 12px 14px; color: var(--text); white-space: nowrap; }
.repo-tabs a:hover { background: #b1bac414; border-radius: 6px 6px 0 0; text-decoration: none; }
.repo-tabs a.active::after { position: absolute; right: 8px; bottom: -1px; left: 8px; height: 2px; border-radius: 2px; background: #f78166; content: ""; }
.tab-icon { color: var(--muted); font-size: 15px; }
.counter { min-width: 20px; padding: 0 6px; border-radius: 999px; background: #6e768166; text-align: center; font-size: 12px; font-weight: 500; }

.catalog-panel { margin-top: 24px; }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 220px; gap: 8px; margin-bottom: 16px; }
.search-wrap { position: relative; }
.search-icon { position: absolute; top: 50%; left: 13px; width: 12px; height: 12px; transform: translateY(-58%); border: 1.5px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-icon::after { position: absolute; width: 5px; height: 1.5px; right: -4px; bottom: -2px; transform: rotate(45deg); background: var(--muted); content: ""; }
.search-wrap input { padding-left: 35px; }

input, select, textarea { width: 100%; min-height: 34px; padding: 5px 12px; border: 1px solid var(--border); border-radius: 6px; outline: none; color: var(--text); background: var(--canvas); box-shadow: 0 0 transparent; }
input::placeholder, textarea::placeholder { color: #6e7681; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #1f6feb4d; }
textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
input[type="file"] { padding: 6px; color: var(--muted); }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 5px; color: var(--text); background: #21262d; cursor: pointer; }

button, .button { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 14px; border: 1px solid #ffffff1a; border-radius: 6px; color: white; background: var(--green-strong); box-shadow: 0 0 transparent; font-weight: 600; line-height: 20px; cursor: pointer; }
button:hover, .button:hover { background: var(--green-hover); text-decoration: none; }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
button.secondary, .button.secondary { border-color: var(--border); color: var(--text); background: #21262d; }
button.secondary:hover, .button.secondary:hover { border-color: #8b949e; background: #30363d; }
button.danger { border-color: #f8514966; color: var(--danger); background: transparent; }
button.danger:hover { color: white; background: var(--danger-bg); }
.button.small, button.small { min-height: 28px; padding: 3px 10px; font-size: 12px; }

.list-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 16px; border: 1px solid var(--border); border-radius: 6px 6px 0 0; color: var(--muted); background: var(--canvas-subtle); font-size: 13px; }
.payload-list { border: 1px solid var(--border); border-top: 0; border-radius: 0 0 6px 6px; overflow: hidden; }
.payload-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; padding: 18px 16px; border-bottom: 1px solid var(--border-muted); background: var(--canvas); transition: background-color .12s ease; }
.payload-row:last-child { border-bottom: 0; }
.payload-row:hover { background: #161b2270; }
.file-mark { width: 36px; height: 42px; display: grid; place-items: center; position: relative; border: 1px solid #58a6ff55; border-radius: 5px; color: var(--blue); background: #1f6feb1a; }
.file-mark::after { position: absolute; top: -1px; right: -1px; width: 9px; height: 9px; border-bottom: 1px solid #58a6ff55; border-left: 1px solid #58a6ff55; background: var(--canvas); content: ""; }
.file-mark span { margin-top: 4px; font: 700 9px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; }
.payload-content { min-width: 0; }
.payload-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.payload-title > a { color: var(--blue); font-size: 16px; font-weight: 600; }
.payload-content > p { margin: 7px 0 9px; color: var(--muted); line-height: 1.45; }
.version, .category-tag, .status-pill { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.version { border-color: #a371f755; color: #d2a8ff; background: #8957e51a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.category-tag { color: var(--muted); }
.payload-meta, .admin-row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: #6e7681; font-size: 12px; }
.dot { color: #484f58; }
.filename { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.checksum { min-height: auto; padding: 0; border: 0; color: #6e7681; background: transparent; box-shadow: none; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; }
.checksum span { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.checksum:hover { color: var(--blue); background: transparent; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.download::before { content: "↓"; font-size: 15px; font-weight: 400; }
.empty { padding: 40px 20px; color: var(--muted); text-align: center; background: var(--canvas); }

label { display: block; margin: 14px 0 6px; color: var(--text); font-size: 13px; font-weight: 600; }
.hint { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.panel { border: 1px solid var(--border); border-radius: 6px; background: var(--canvas-subtle); box-shadow: 0 0 0 1px #0104090d; }
.form-panel { padding: 20px; }
.form-panel form > button[type="submit"] { width: 100%; margin-top: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: -20px -20px 18px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-head h1, .panel-head h2 { margin: 2px 0 0; font-size: 16px; line-height: 1.3; }
.section-kicker { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.upload-status { min-height: 20px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.invite-hint { margin: 0 0 14px; }
.invite-action { width: 100%; }
#invite-result { margin-top: 16px; }

.account-menu { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.avatar { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: #0d1117; background: #d29922; font-size: 12px; font-weight: 800; }
.admin-repo-head { min-height: 62px; }
.admin-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 24px; padding: 24px 0 64px; align-items: start; }
.admin-sidebar { display: grid; gap: 16px; position: sticky; top: 16px; }
.versions-section { min-width: 0; }
.users-panel, .edit-panel { margin-top: 0; }
.edit-panel { margin-bottom: 24px; }
.section-title { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.admin-list { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; padding: 16px; border-bottom: 1px solid var(--border-muted); background: var(--canvas-subtle); }
.admin-row:last-child { border-bottom: 0; }
.admin-row:hover { background: #1c2128; }
.admin-row.has-update { box-shadow: inset 3px 0 var(--blue); }
.admin-row-main { min-width: 0; }
.admin-row-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.admin-row-title strong { color: var(--blue); font-size: 15px; }
.admin-row-title > a:hover { text-decoration: underline; }
.admin-row-main p { margin: 7px 0; color: var(--muted); }
.status-pill.published { border-color: #3fb95055; color: #56d364; background: #2386361a; }
.status-pill.pending { border-color: #d2992255; color: #e3b341; background: #9e6a031a; }
.status-pill.update-available { border-color: #58a6ff66; color: #79c0ff; background: #1f6feb26; }
.row-buttons { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.row-buttons button { min-height: 28px; padding: 3px 9px; font-size: 12px; }

.login-wrap { width: min(340px, calc(100% - 32px)); margin: 0 auto; padding: 48px 0; text-align: center; }
.login-logo { display: inline-flex; margin-bottom: 24px; }
.login-logo:hover { text-decoration: none; }
.login-wrap h1 { margin: 0 0 18px; font-size: 24px; font-weight: 300; letter-spacing: -.02em; }
.auth-box { padding: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--canvas-subtle); text-align: left; }
.auth-box label { margin-top: 0; }
.auth-box .label-row { margin-top: 14px; }
.auth-box button { width: 100%; margin-top: 16px; }
.auth-note { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); }
.back-link { display: inline-block; margin-top: 20px; font-size: 13px; }
.invite-wrap { width: min(380px, calc(100% - 32px)); }
.invite-check { color: var(--muted); text-align: center; }
.invite-check.error-text { color: var(--danger); }
#registration-form { text-align: left; }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .users-panel { margin: 0; }
}

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1216px); }
  .header-inner { width: calc(100% - 24px); }
  .header-nav a:first-child { display: none; }
  .repo-head { align-items: flex-start; }
  .repo-source { width: min(100%, 460px); }
  .toolbar { grid-template-columns: 1fr; }
  .payload-row { grid-template-columns: 34px minmax(0, 1fr); padding: 15px 12px; }
  .file-mark { width: 32px; height: 38px; }
  .row-actions { grid-column: 2; justify-content: flex-start; margin-top: 2px; }
  .filename { display: none; }
  .admin-sidebar { grid-template-columns: 1fr; }
  .admin-row { grid-template-columns: 1fr; }
  .row-buttons { justify-content: flex-start; }
  .account-menu #identity { display: none; }
}

@media (max-width: 460px) {
  .site-header, .header-inner { min-height: 56px; }
  .brand > span:last-child { display: none; }
  .public-main, .admin-main { padding-top: 20px; }
  .repo-path { font-size: 17px; }
  .repo-head { flex-direction: column; gap: 12px; }
  .repo-head p { font-size: 13px; }
  .catalog-intro { padding-top: 18px; }
  .repo-tabs { margin-top: 6px; }
  .repo-tabs a { padding-right: 9px; padding-left: 9px; }
  .list-head span:last-child { display: none; }
  .payload-row { grid-template-columns: 1fr; }
  .file-mark { display: none; }
  .row-actions { grid-column: 1; }
  .payload-meta .dot, .payload-meta > span:first-child { display: none; }
}
