/* ==========================================================================
   Clancore Repo — GitHub / Primer inspired theme
   Light by default, follows the system color scheme in dark mode.
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --bg: #ffffff;
  --bg-subtle: #f6f8fa;
  --bg-inset: #f6f8fa;
  --fg: #1f2328;
  --fg-muted: #656d76;
  --border: #d0d7de;
  --border-muted: #d8dee4;

  --header-bg: #ffffff;
  --header-border: #d0d7de;
  --header-fg: #1f2328;

  --accent: #0969da;
  --accent-subtle: #ddf4ff;

  --success-fg: #1a7f37;
  --success-emphasis: #1f883d;
  --success-emphasis-hover: #1a7f37;
  --success-subtle: #dafbe1;
  --success-border: rgba(74, 194, 107, 0.4);

  --danger-fg: #cf222e;
  --danger-subtle: #ffebe9;
  --danger-border: rgba(255, 129, 130, 0.4);

  --attention-fg: #9a6700;
  --attention-subtle: #fff8c5;
  --attention-border: rgba(212, 167, 44, 0.4);

  --neutral-subtle: #eaeef2;
  --neutral-border: rgba(31, 35, 40, 0.15);

  --btn-bg: #f6f8fa;
  --btn-hover-bg: #f3f4f6;
  --btn-active-bg: #ebecf0;
  --btn-border: rgba(31, 35, 40, 0.15);
  --btn-hover-border: rgba(31, 35, 40, 0.15);

  --focus-ring: rgba(9, 105, 218, 0.3);
  --shadow-small: 0 1px 0 rgba(31, 35, 40, 0.04);
  --input-shadow: inset 0 1px 0 rgba(208, 215, 222, 0.2);

  --radius: 6px;
  --tab-underline: #fd8c73;

  --log-bg: #0d1117;
  --log-fg: #e6edf3;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #0d1117;
    --bg-subtle: #161b22;
    --bg-inset: #010409;
    --fg: #e6edf3;
    --fg-muted: #8b949e;
    --border: #30363d;
    --border-muted: #21262d;

    --header-bg: #010409;
    --header-border: #21262d;
    --header-fg: #e6edf3;

    --accent: #4493f8;
    --accent-subtle: rgba(56, 139, 253, 0.15);

    --success-fg: #3fb950;
    --success-emphasis: #238636;
    --success-emphasis-hover: #2ea043;
    --success-subtle: rgba(46, 160, 67, 0.15);
    --success-border: rgba(46, 160, 67, 0.4);

    --danger-fg: #f85149;
    --danger-subtle: rgba(248, 81, 73, 0.1);
    --danger-border: rgba(248, 81, 73, 0.4);

    --attention-fg: #d29922;
    --attention-subtle: rgba(187, 128, 9, 0.15);
    --attention-border: rgba(187, 128, 9, 0.4);

    --neutral-subtle: #21262d;
    --neutral-border: rgba(240, 246, 252, 0.1);

    --btn-bg: #21262d;
    --btn-hover-bg: #30363d;
    --btn-active-bg: #282e33;
    --btn-border: rgba(240, 246, 252, 0.1);
    --btn-hover-border: rgba(240, 246, 252, 0.1);

    --focus-ring: rgba(47, 129, 247, 0.3);
    --shadow-small: 0 0 0 transparent;
    --input-shadow: inset 0 1px 0 rgba(1, 4, 9, 0.2);

    --tab-underline: #f78166;
  }
}

/* ===== Base ===== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main.container {
  flex: 1 0 auto;
  padding-top: 24px;
  padding-bottom: 40px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
}

p {
  margin: 0 0 16px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

pre {
  font-family: var(--font-mono);
  margin: 0;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
}

svg {
  vertical-align: middle;
}

button,
input,
select,
textarea {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

.octicon {
  flex-shrink: 0;
  fill: currentColor;
  vertical-align: text-bottom;
}

.muted {
  color: var(--fg-muted);
}

.text-small {
  font-size: 12px;
}

.mt-2 {
  margin-top: 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -1000px;
  left: 16px;
  z-index: 200;
  padding: 8px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
}

.skip-link:focus {
  top: 16px;
}

/* ===== Header ===== */

.header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  color: var(--header-fg);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
}

.header-logo {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--header-fg);
}

.header-logo:hover {
  color: var(--fg-muted);
  text-decoration: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a,
.header-link,
.header-link-button {
  display: inline-flex;
  align-items: center;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--header-fg);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.header-nav a:hover,
.header-link:hover,
.header-link-button:hover {
  background: var(--neutral-subtle);
  text-decoration: none;
}

.header-search {
  flex: 1 1 200px;
  max-width: 272px;
  margin-left: auto;
}

.header-search form {
  position: relative;
  display: flex;
  align-items: center;
}

.header-search-icon {
  position: absolute;
  left: 8px;
  color: var(--fg-muted);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  height: 30px;
  padding: 0 30px 0 30px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  font-size: 14px;
  line-height: 20px;
  outline: none;
}

.header-search input::-webkit-search-cancel-button {
  display: none;
}

.search-kbd {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1;
  pointer-events: none;
}

.header-search input::placeholder {
  color: var(--fg-muted);
}

.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

/* ===== Footer ===== */

.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 12px;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-mark {
  display: inline-flex;
  color: var(--fg-muted);
}

.footer-mark:hover {
  color: var(--fg);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 16px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  box-shadow: var(--shadow-small);
  transition: background-color 0.2s cubic-bezier(0.3, 0, 0.5, 1),
    border-color 0.2s cubic-bezier(0.3, 0, 0.5, 1);
}

.btn:hover {
  background: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  text-decoration: none;
}

.btn:active {
  background: var(--btn-active-bg);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn-primary {
  background: var(--success-emphasis);
  border-color: var(--btn-border);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--success-emphasis-hover);
  border-color: var(--btn-border);
}

/* Зелёная кнопка (как Code в GitHub) */
.btn-success {
  background: var(--success-emphasis);
  border-color: rgba(31, 35, 40, 0.15);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--success-emphasis-hover);
  border-color: rgba(31, 35, 40, 0.15);
  color: #ffffff;
}

/* Инвертированная кнопка (в шапке) */
.btn-inverted {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.btn-inverted:hover {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  opacity: 0.85;
}

.btn-secondary {
  background: var(--btn-bg);
  color: var(--fg);
}

.btn-danger {
  background: var(--danger-subtle);
  border-color: var(--danger-border);
  color: var(--danger-fg);
}

.btn-danger:hover {
  background: var(--danger-subtle);
  border-color: var(--danger-fg);
}

.btn-sm {
  min-height: 28px;
  padding: 3px 12px;
  font-size: 12px;
  line-height: 18px;
}

.btn-block {
  display: flex;
  width: 100%;
  text-align: center;
}

.btn.copied {
  background: var(--success-subtle);
  border-color: var(--success-border);
  color: var(--success-fg);
}

.inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

/* ===== Boxes and counters ===== */

.box {
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 14px;
  font-weight: 600;
}

.box-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.box-body {
  padding: 16px;
}

.box-body-bordered {
  border-top: 1px solid var(--border);
}

.counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 2em;
  background: var(--neutral-subtle);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
}

/* ===== Badges ===== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid var(--neutral-border);
  border-radius: 2em;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
  vertical-align: middle;
}

.badge.success {
  background: var(--success-subtle);
  border-color: var(--success-border);
  color: var(--success-fg);
}

.badge.failed {
  background: var(--danger-subtle);
  border-color: var(--danger-border);
  color: var(--danger-fg);
}

.badge.running {
  background: var(--attention-subtle);
  border-color: var(--attention-border);
  color: var(--attention-fg);
}

.badge.pending {
  background: var(--neutral-subtle);
  border-color: var(--neutral-border);
  color: var(--fg-muted);
}

/* Обводка без заливки (Public / Private в хлебных крошках) */
.badge-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--fg-muted);
  font-weight: 500;
}

/* ===== Alerts ===== */

.flash {
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}

.flash-error {
  background: var(--danger-subtle);
  border-color: var(--danger-border);
}

.flash-attention {
  background: var(--attention-subtle);
  border-color: var(--attention-border);
}

/* ===== Page heading ===== */

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.page-heading h1 {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.page-description {
  margin: -8px 0 16px;
  color: var(--fg-muted);
  font-size: 14px;
}

/* ===== Repo topline, tabs and heading ===== */

.repo-topline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 14px;
}

.repo-topline-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--accent);
  text-decoration: none;
}

.repo-topline-link .octicon {
  color: var(--fg-muted);
}

.repo-topline-link:hover {
  text-decoration: underline;
}

.repo-topline-owner {
  font-weight: 400;
}

.repo-topline-sep {
  color: var(--fg-muted);
}

.repo-topline-name {
  font-weight: 600;
}

.repo-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 0 16px;
}

.repo-avatar {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-size: 20px;
  text-decoration: none;
}

.repo-avatar:hover {
  text-decoration: none;
}

.repo-heading-main {
  flex: 1 1 auto;
  min-width: 0;
}

.repo-heading-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.repo-heading-owner {
  color: var(--accent);
  font-weight: 400;
}

.repo-heading-sep {
  color: var(--fg-muted);
  font-weight: 400;
}

.repo-heading-name {
  color: var(--accent);
  font-weight: 600;
}

.repo-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.repo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.repo-tabs {
  display: flex;
  gap: 0;
  margin: 16px 0 24px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.repo-tabs::-webkit-scrollbar {
  display: none;
}

.repo-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 8px 16px;
  border-bottom: 2px solid transparent;
  color: var(--fg);
  font-size: 14px;
  line-height: 30px;
  white-space: nowrap;
  text-decoration: none;
}

.repo-tabs a:hover {
  border-bottom-color: var(--border);
  text-decoration: none;
}

.repo-tabs a.active {
  border-bottom-color: var(--tab-underline);
  font-weight: 600;
}

.repo-tabs .octicon {
  color: var(--fg-muted);
}

/* ===== Repository layout ===== */

.repo-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 24px;
  align-items: start;
}

.repo-main {
  min-width: 0;
}

.repo-main > .box + .box {
  margin-top: 16px;
}

.repo-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* ===== Repo toolbar (ветка, счётчики, Go to file, Code) ===== */

.file-view-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 32px;
  margin: 0 0 8px;
}

.repo-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.branch-selector {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
}

.branch-selector:hover {
  background: var(--btn-hover-bg);
}

.branch-selector-icon {
  flex-shrink: 0;
  color: var(--fg);
}

.branch-selector label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.branch-selector select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 32px;
  padding: 5px 28px 5px 4px;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='%23656d76'%3E%3Cpath d='M12.78 5.22a.749.749 0 0 1 0 1.06l-4.25 4.25a.749.749 0 0 1-1.06 0L3.22 6.28a.749.749 0 1 1 1.06-1.06L8 8.939l3.72-3.719a.749.749 0 0 1 1.06 0Z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 16px;
  border: 0;
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
}

.branch-selector select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.repo-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.repo-counter-value {
  color: var(--fg);
  font-weight: 600;
}

.go-to-file {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.go-to-file input {
  width: 200px;
  height: 32px;
  padding: 0 32px 0 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 14px;
  line-height: 20px;
  outline: none;
}

.go-to-file input::placeholder {
  color: var(--fg-muted);
}

.go-to-file input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.go-to-file .search-kbd {
  right: 8px;
}

.code-dropdown {
  position: relative;
}

.btn-code {
  font-weight: 600;
}

/* ===== Popover (панель клонирования) ===== */

.popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: none;
  width: 356px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(1, 4, 9, 0.12);
  text-align: left;
}

.popover.open {
  display: block;
}

.popover-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.popover-hint {
  margin: 8px 0 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  min-width: 0;
  font-size: 14px;
}

.breadcrumb a {
  color: var(--accent);
}

.breadcrumb .sep {
  margin: 0 2px;
  color: var(--fg-muted);
}

.toolbar-spacer {
  flex: 1 1 auto;
}

.commit-avatar {
  background: var(--bg-subtle);
  color: var(--fg-muted);
}

/* ===== File browser ===== */

.file-browser {
  overflow: hidden;
}

.file-browser-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.file-browser-head .commit-avatar {
  background: var(--neutral-subtle);
}

.head-commit-author {
  flex-shrink: 0;
  color: var(--fg);
  font-weight: 600;
}

.head-commit-subject {
  min-width: 0;
  overflow: hidden;
  color: var(--fg-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.head-commit-time {
  flex-shrink: 0;
  color: var(--fg-muted);
  white-space: nowrap;
}

.head-commit-count {
  flex-shrink: 0;
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
}

.head-commit-count:hover {
  color: var(--accent);
  text-decoration: underline;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.file-table th,
.file-table td {
  text-align: left;
}

.file-table td {
  padding: 8px 16px;
  border-top: 1px solid var(--border-muted);
  vertical-align: middle;
}

.file-table tr:first-child td {
  border-top: 0;
}

.file-table tbody tr:hover {
  background: var(--bg-subtle);
}

.file-icon {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  color: var(--fg-muted);
  vertical-align: middle;
}

.file-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.file-name a {
  color: var(--fg);
  vertical-align: middle;
}

.file-name a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.file-commit {
  width: 42%;
}

.file-commit-subject {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  color: var(--fg-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.file-date {
  width: 1%;
  color: var(--fg-muted);
  font-size: 12px;
  text-align: right !important;
  white-space: nowrap;
}

.file-size {
  width: 1%;
  color: var(--fg-muted);
  font-size: 12px;
  text-align: right !important;
  white-space: nowrap;
}

.empty-row {
  padding: 32px 16px !important;
  color: var(--fg-muted);
  text-align: center !important;
}

/* ===== Commits ===== */

.commit-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.commit-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-muted);
  font-size: 14px;
}

.commit-list li:first-child {
  border-top: 0;
}

.commit-list li:hover {
  background: var(--bg-subtle);
}

.commit-subject {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commit-meta {
  color: var(--fg-muted);
  font-size: 12px;
  white-space: nowrap;
}

.commit-hash {
  display: inline-block;
  padding: 0 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  white-space: nowrap;
}

/* ===== Sidebar ===== */

.sidebar-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.sidebar-desc {
  margin: 0 0 12px;
  color: var(--fg-muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.sidebar-facts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-facts li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--fg-muted);
  font-size: 12px;
}

.sidebar-facts .octicon {
  flex-shrink: 0;
  color: var(--fg-muted);
}

.sidebar-branches {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-branches li {
  margin: 0;
}

.sidebar-branches a,
.sidebar-branches .branch-current {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 14px;
  text-decoration: none;
}

.sidebar-branches a:hover {
  background: var(--bg-subtle);
  text-decoration: none;
}

.sidebar-branches li span,
.sidebar-branches li a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-releases {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
}

.sidebar-releases li {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 0;
  font-size: 14px;
}

.sidebar-releases li a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--fg);
  text-decoration: none;
}

.sidebar-releases li a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.sidebar-releases .octicon {
  flex-shrink: 0;
  color: var(--fg-muted);
}

.sidebar-release-tag {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-release-date {
  flex-shrink: 0;
  margin-left: auto;
  color: var(--fg-muted);
  font-size: 12px;
  white-space: nowrap;
}

.sidebar-more {
  font-size: 12px;
}

.branch-current {
  background: var(--accent-subtle);
  color: var(--accent) !important;
  font-weight: 600;
}

.branch-current .octicon {
  color: var(--accent);
}

/* ===== Clone field ===== */

.clone-field {
  display: flex;
  align-items: stretch;
}

.clone-field .form-control {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg-subtle);
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
}

.clone-field .btn {
  flex-shrink: 0;
  border-left: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.clone-copy {
  min-width: 34px;
  padding: 5px 9px;
}

/* ===== Empty repository ===== */

.empty-repo {
  padding: 40px 24px;
  text-align: center;
}

.empty-repo-icon {
  margin-bottom: 12px;
  color: var(--fg-muted);
}

.empty-repo h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.empty-repo p {
  margin: 0 auto;
  color: var(--fg-muted);
}

.empty-repo-clone {
  max-width: 560px;
  margin: 24px auto 16px;
}

.empty-repo-guide {
  max-width: 640px;
  margin: 0 auto;
  text-align: left;
}

/* ===== Forms ===== */

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group > label {
  display: block;
  margin-bottom: 8px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 400;
}

.form-control {
  width: 100%;
  min-height: 32px;
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  line-height: 20px;
  outline: none;
  box-shadow: var(--input-shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.form-control::placeholder {
  color: var(--fg-muted);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
}

.form-hint {
  margin: 4px 0 0;
  color: var(--fg-muted);
  font-size: 12px;
}

.form-hint-inline {
  display: block;
  margin-top: 2px;
}

.checkbox-label {
  display: flex !important;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400 !important;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 3px 0 0;
  accent-color: var(--success-emphasis);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group-prefix {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--fg-muted);
  font-size: 14px;
  white-space: nowrap;
}

.input-group .form-control {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.repo-create-form {
  max-width: 768px;
}

/* ===== Auth ===== */

body:has(.auth-page) {
  background: var(--bg-subtle);
}

.auth-page {
  max-width: 340px;
  margin: 40px auto 24px;
}

.auth-page-wide {
  max-width: 420px;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--fg);
}

.auth-title {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 300;
  line-height: 1.25;
  letter-spacing: -0.5px;
  text-align: center;
}

.auth-card {
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-small);
}

.auth-card-alt {
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 400;
}

.auth-card .btn-block {
  margin-top: 8px;
}

/* ===== Avatars ===== */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 50%;
  background: var(--neutral-subtle);
  color: var(--fg);
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
}

.avatar-sm {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.avatar-md {
  width: 32px;
  height: 32px;
  font-size: 14px;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: 28px;
}

.avatar-xl {
  width: 100%;
  max-width: 296px;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--border);
  font-size: 80px;
  font-weight: 300;
}

/* ===== Dashboard ===== */

.dashboard-layout {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.sidebar-section {
  min-width: 0;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.sidebar-section-header h2 {
  font-size: 14px;
  font-weight: 600;
}

.sidebar-new-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}

.sidebar-new-link:hover {
  background: var(--btn-hover-bg);
  text-decoration: none;
}

.sidebar-repo-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sidebar-repo-list li a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 0;
  color: var(--fg);
  font-size: 14px;
  text-decoration: none;
}

.sidebar-repo-list li a:hover .sidebar-repo-name {
  color: var(--accent);
  text-decoration: underline;
}

.sidebar-repo-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-size: 10px;
  font-weight: 600;
}

.sidebar-repo-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  color: var(--fg);
  font-weight: 600;
}

/* ===== Repo lists ===== */

.repo-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.repo-list-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-top: 1px solid var(--border-muted);
}

.repo-list-item:first-child {
  border-top: 0;
}

.repo-list-item:hover {
  background: var(--bg-subtle);
}

.repo-list-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--fg-muted);
}

.repo-list-body {
  flex: 1;
  min-width: 0;
}

.repo-list-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 16px;
  line-height: 1.25;
}

.repo-list-title a {
  color: var(--accent);
  font-weight: 600;
}

.repo-list-title .muted {
  font-weight: 400;
}

.repo-list-desc {
  margin: 4px 0 0;
  color: var(--fg-muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.repo-list-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  color: var(--fg-muted);
  font-size: 12px;
}

.repo-list-action {
  flex-shrink: 0;
}

/* ===== Tables ===== */

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.data-table th {
  padding: 8px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 8px 16px;
  border-top: 1px solid var(--border-muted);
  vertical-align: middle;
}

.data-table tbody tr:first-child td {
  border-top: 0;
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

.build-link {
  font-family: var(--font-mono);
  font-size: 12px;
}

.branch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ===== Build pages ===== */

.build-summary + .flash,
.build-summary + .log-box,
.flash + .log-box {
  margin-top: 16px;
}

.build-summary-header {
  gap: 12px;
}

.build-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.build-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.build-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--fg-muted);
  font-size: 12px;
}

.log-box {
  overflow: hidden;
}

.build-log {
  max-height: 640px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  background: var(--log-bg);
  color: var(--log-fg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  white-space: pre-wrap;
  word-break: break-word;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ===== File view ===== */

.file-view {
  overflow: hidden;
}

.file-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 12px;
}

.file-box-path {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-box-path .octicon {
  color: var(--fg-muted);
}

.file-box-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 12px;
}

.blob-wrapper {
  overflow: auto;
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
}

.blob-code {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  tab-size: 4;
}

.blob-code td {
  padding: 0;
}

.blob-num {
  width: 1%;
  min-width: 50px;
  padding: 0 10px !important;
  background: var(--bg);
  border-right: 1px solid var(--border-muted);
  color: var(--fg-muted);
  text-align: right;
  vertical-align: top;
  user-select: none;
  -webkit-user-select: none;
}

.blob-code-cell {
  padding: 0 10px !important;
  background: var(--bg);
  vertical-align: top;
  white-space: pre;
}

.blob-code-inner {
  white-space: pre;
}

/* подсветка синтаксиса (highlight.js) внутри таблицы строк;
   фон даёт строка таблицы, поэтому .hljs здесь без своего фона */
.blob-code-inner.hljs-highlighted {
  color: var(--fg);
}

.blob-code-inner .hljs-comment,
.blob-code-inner .hljs-quote {
  font-style: italic;
}

.blob-code tr:hover .blob-num,
.blob-code tr:hover .blob-code-cell {
  background: var(--bg-subtle);
}

/* ===== Profile ===== */

.profile-layout {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.profile-name {
  margin: 8px 0 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.profile-login {
  font-size: 20px;
  font-weight: 300;
  line-height: 1.25;
}

.profile-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--fg-muted);
  font-size: 14px;
}

.profile-main {
  min-width: 0;
}

/* ===== Code snippets and empty states ===== */

.mini-code {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 40px 16px;
  color: var(--fg-muted);
  text-align: center;
}

.empty-state > svg {
  margin-bottom: 12px;
  color: var(--fg-muted);
}

.empty-state h3 {
  margin: 0 0 8px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 600;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 14px;
}

/* ===== Releases ===== */

.release-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.release-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.release-main {
  flex: 1;
  min-width: 0;
}

.release-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.release-tag {
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid var(--success-border);
  border-radius: 2em;
  background: var(--success-subtle);
  color: var(--success-fg);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
}

.release-title {
  color: var(--fg);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.release-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.release-date {
  margin-top: 4px;
  color: var(--fg-muted);
  font-size: 12px;
}

.release-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-muted);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.release-delete {
  flex: none;
}

.release-empty {
  margin-bottom: 16px;
}

.release-form {
  max-width: 760px;
}

/* ===== Responsive ===== */

@media (max-width: 1012px) {
  .container {
    padding: 0 24px;
  }

  .repo-layout,
  .dashboard-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    order: 2;
  }

  .dashboard-main {
    order: 1;
  }

  .avatar-xl {
    width: 128px;
    height: 128px;
    max-width: 128px;
    font-size: 48px;
    aspect-ratio: auto;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .header-logo {
    order: 0;
  }

  .header-user {
    order: 1;
    margin-left: auto;
  }

  .header-search {
    order: 2;
    flex: 1 0 100%;
    max-width: none;
    margin-left: 0;
  }

  .header-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .header-nav::-webkit-scrollbar {
    display: none;
  }

  .file-browser-head {
    gap: 6px;
    padding: 8px 12px;
  }

  .head-commit-subject {
    max-width: 40vw;
  }

  .repo-toolbar {
    gap: 8px;
  }

  .go-to-file {
    order: 3;
  }

  .go-to-file input {
    width: 160px;
  }

  .repo-tabs a {
    padding: 8px 12px;
  }

  .repo-list-item {
    flex-wrap: wrap;
  }

  .repo-list-action {
    width: 100%;
    margin-left: 32px;
  }

  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 544px) {
  .page-heading h1 {
    font-size: 20px;
  }

  .repo-heading-title {
    font-size: 18px;
  }

  .repo-heading {
    gap: 12px;
  }

  .repo-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .file-commit {
    display: none;
  }

  .file-table td,
  .file-browser-head {
    padding-left: 12px;
    padding-right: 12px;
  }

  .go-to-file input {
    width: 132px;
  }

  .popover {
    right: auto;
    left: 0;
    width: min(356px, calc(100vw - 32px));
  }

  .repo-list-item {
    gap: 12px;
    padding: 12px;
  }

  .repo-list-action {
    margin-left: 28px;
  }

  .file-size {
    display: none;
  }

  .header-nav a,
  .header-link,
  .header-link-button {
    padding: 6px 6px;
  }

  .auth-page {
    margin-top: 24px;
  }

  .release-item {
    flex-direction: column;
  }

  .release-delete {
    align-self: flex-end;
  }
}
