:root {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  color: #252e28;
  background: #f8f6ee;
  font-synthesis: none;
  line-height: 1.5;
  --ink: #252e28;
  --muted: #5d675c;
  --surface: #fdfcf7;
  --border: #ddded1;
  --field-border: #c9cdbf;
  --accent: #264d38;
  --accent-hover: #1c3a2a;
  --accent-tint: #e9eee3;
  --namespace: #68517d;
  --number: #92501f;
  --danger: #963e2f;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 20;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.skip-link:focus { top: 12px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.04em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  flex: none;
  width: 34px;
  height: 34px;
}
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  font-weight: 700;
}
.primary:hover { background: var(--accent-hover); }
.icon-button, .repo-external {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}
.icon-button:hover, .repo-external:hover { color: var(--accent); background: var(--accent-tint); }
label { display: block; margin-bottom: 8px; font-size: 13px; }
input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--field-border);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  font-size: 14px;
}
input::placeholder { color: var(--muted); opacity: 1; }
.field-hint { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; }
.toast {
  position: fixed;
  z-index: 30;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  font-size: 13px;
  box-shadow: 0 5px 22px #252e281a;
  overflow-wrap: anywhere;
}
.toast[data-error="true"] { background: #fff5ed; border-color: #dfbaab; color: var(--danger); }

.auth-layout { display: grid; place-items: center; min-height: 100svh; padding: 64px 20px; }
.auth-help { position: absolute; top: 20px; right: 24px; }
.auth-box {
  width: 100%;
  max-width: 424px;
  padding: clamp(20px, 5vw, 36px);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.auth-brand { margin-bottom: 28px; font-size: inherit; }
.auth-brand .brand { font-size: 19px; }
.auth-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.auth-tabs button {
  min-height: 42px;
  padding: 0;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.auth-tabs [aria-pressed="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.auth-box form > label:not(:first-child) { margin-top: 19px; }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-toggle {
  position: absolute;
  display: grid;
  place-items: center;
  inset: 3px 3px 3px auto;
  width: 38px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
}
.password-toggle:hover, .password-toggle[aria-pressed="true"] { color: var(--accent); background: var(--accent-tint); }
.auth-submit { width: 100%; margin-top: 24px; }

.workspace { min-height: 100svh; }
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  min-height: 73px;
  padding: 0 max(24px, calc((100% - 1120px) / 2));
  border-bottom: 1px solid var(--border);
}
.workspace-nav { display: flex; align-self: stretch; gap: clamp(14px, 2.4vw, 30px); }
.workspace-nav a {
  display: grid;
  align-items: center;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}
.workspace-nav a:hover, .workspace-nav a:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }
.workspace-nav a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); font-weight: 700; }
.account { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
#account-email { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workspace-content { max-width: 964px; padding: 46px 28px 72px; margin: auto; }
.workspace-sidebar { display: grid; align-content: start; gap: 12px; margin-top: 16px; }
.workspace-sidebar .workspace-panel { margin-top: 0; }
.page-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin-bottom: 22px; }
.page-title h1 { font-size: clamp(30px, 6vw, 48px); font-weight: 700; line-height: 1.12; letter-spacing: -.045em; }
.page-title h1:focus { outline: none; }
.count { color: var(--muted); font-size: 13px; }
.add-panel, .workspace-panel { scroll-margin: 24px; }
#subscription-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid var(--field-border);
  border-radius: 9px;
  background: var(--surface);
}
.url-field { display: flex; align-items: center; flex: 1; min-width: 0; gap: 9px; padding-left: 12px; }
.url-prompt { color: var(--namespace); font-size: 17px; font-weight: 700; }
.url-field input { height: 44px; padding-left: 4px; background: transparent; border-color: transparent; }
.url-field input:focus-visible { outline-offset: -2px; }
.collection-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  border-bottom: 1px solid var(--border);
}
.search-field { flex: 1; min-width: 0; margin: 0; position: relative; }
.search-field > .icon { position: absolute; top: 11px; left: 2px; color: var(--muted); pointer-events: none; }
.search-field input { height: 40px; padding-left: 27px; border-color: transparent; background: transparent; }
select {
  min-height: 36px;
  max-width: 100%;
  padding: 0 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
}
.collection-tools select { background: transparent; }
.subscriptions, .row-tags, .workspace-list { list-style: none; padding: 0; margin: 0; }
.subscription-row {
  display: grid;
  grid-template-columns: 126px 36px minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px 13px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border);
}
.repo-date { align-self: start; padding-top: 8px; color: var(--muted); font-size: 12px; }
.repo-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--provider-ink, var(--accent));
  background: var(--provider-tint, var(--accent-tint));
}
.github { --provider-ink: #3d4c43; --provider-tint: #e7ebe4; }
.gitlab { --provider-ink: #964638; --provider-tint: #f6e9e0; }
.stack { --provider-ink: #8a501a; --provider-tint: #f5ebd5; }
.repo-info { min-width: 0; }
.source-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding-top: 6px; }
.repo-name { font-size: 14px; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
a.repo-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.repo-provider { color: var(--provider-ink); font-size: 11px; white-space: nowrap; }
.syntax-namespace { color: var(--namespace); }
.syntax-name { color: var(--accent); }
.syntax-separator { color: var(--muted); }
.syntax-number { color: var(--number); }
.row-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag {
  max-width: 100%;
  padding: 1px 6px;
  border: 1px solid #d8d9ce;
  border-radius: 2px;
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.tag .syntax-separator { margin-right: 1px; }
.row-actions, .workspace-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.row-actions { justify-content: flex-end; }
.row-actions .text-action { min-height: 36px; padding: 0 4px; }
.repo-external .icon { width: 16px; height: 16px; }

.empty-state, .list-notice {
  padding: 62px 16px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.empty-state .empty-icon { width: 24px; height: 24px; margin-bottom: 12px; color: var(--accent); }
.empty-state h2 { margin-bottom: 7px; color: var(--ink); font-size: 14px; }
.text-action {
  display: inline-block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  text-decoration: none;
}
.text-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.row-actions .text-action:nth-child(2):hover { color: var(--danger); }

.workspace-panel { margin-top: 16px; padding: 14px 17px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.collection-panel + .workspace-panel { margin-top: 30px; }
.workspace-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.workspace-panel summary::-webkit-details-marker { display: none; }
.panel-indicator { position: relative; flex: none; width: 14px; height: 14px; color: var(--muted); }
.panel-indicator::before, .panel-indicator::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 2px;
  width: 10px;
  height: 2px;
  background: currentColor;
}
.panel-indicator::after { transform: rotate(90deg); }
.workspace-panel[open] .panel-indicator::after { display: none; }
.workspace-panel[open] summary { margin-bottom: 12px; }
.workspace-panel p, .workspace-list li { font-size: 13px; overflow-wrap: anywhere; }
.workspace-actions { margin-block: 10px; }
.workspace-list li { padding: 10px 0; border-top: 1px solid var(--border); }
.workspace-list small { display: block; margin-top: 4px; color: var(--muted); }
.workspace-list button { margin-left: 12px; }
.updates-heading { align-items: center; justify-content: space-between; row-gap: 12px; }
.updates-list li { padding: 14px 0; }
.updates-list li:last-child { border-bottom: 1px solid var(--border); }
.updates-list strong { color: var(--namespace); }
.updates-more { min-height: 44px; margin-top: 8px; }
.admin-tools { justify-content: flex-start; flex-wrap: wrap; }
.admin-list { padding: 0 16px; }
.admin-list .admin-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 16px; align-items: baseline; }
.admin-id, .admin-meta { color: var(--namespace); }
.recommendation-topics { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.recommendation-topic { border: 1px solid var(--border); padding: 1px 5px; color: var(--namespace); font-size: .8rem; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .admin-list .admin-row { grid-template-columns: auto minmax(0, 1fr); }
  .admin-meta { grid-column: 2; }
}

dialog {
  width: min(450px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 22px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px #252e2826;
}
dialog::backdrop { background: #252e2855; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.dialog-heading h2 { font-size: 18px; }
dialog p { font-size: 13px; line-height: 1.65; color: var(--muted); margin-bottom: 12px; }
dialog p:last-child { margin-bottom: 0; }
#tags-error { margin-top: 8px; color: var(--danger); }
#tags-error:empty { display: none; }
#refresh[aria-busy="true"] .icon { animation: rotate 1s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

@media (min-width: 980px) {
  .workspace-content { max-width: 1176px; }
  .workspace-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(225px, 23vw, 272px);
    align-items: start;
    gap: 24px;
  }
  .workspace-sidebar { margin-top: 0; min-width: 0; }
}
@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; min-height: auto; gap: 2px 10px; padding: 10px 22px 0; }
  .workspace-nav { grid-row: 2; grid-column: 1 / -1; min-height: 42px; }
  .workspace-content { padding: 34px 22px 56px; }
  .subscription-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .repo-icon { grid-column: 1; grid-row: 1; }
  .repo-info { grid-column: 2 / -1; grid-row: 1; }
  .repo-date { grid-column: 2; grid-row: 2; align-self: center; padding: 0; }
  .row-actions { grid-column: 3; grid-row: 2; gap: 2px; }
}
@media (max-width: 460px) {
  .topbar { padding-inline: 16px; }
  #account-email { max-width: 82px; }
  .workspace-content { padding-inline: 16px; }
  .page-title { column-gap: 12px; }
  input { font-size: 16px; }
  #subscription-form { flex-wrap: wrap; }
  .url-field { flex-basis: 100%; padding-left: 8px; }
  #subscription-form .primary { width: 100%; }
  .collection-tools { flex-wrap: wrap; justify-content: space-between; gap: 0 8px; padding: 6px 0; }
  .search-field { flex-basis: 100%; }
  .subscription-row { grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 9px; }
  .repo-icon { width: 32px; height: 32px; }
  .repo-date { font-size: 11px; }
  .row-actions .text-action { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  #refresh[aria-busy="true"] .icon { animation: none; }
}
