@layer objects {
  /* icon of icons.svg, sized like a letter */
  .i { width:16px; height:16px; flex:none; vertical-align:-3px; }

  /* button look for links, and the variants of buttons */
  .btn { display:inline-flex; align-items:center; gap:.35rem; font:inherit; font-weight:500; line-height:1.4; padding:.35rem .8rem; color:var(--fg); border:1px solid var(--line); background:var(--soft); border-radius:var(--radius); cursor:pointer; }
  .btn:hover { background:var(--line-soft); text-decoration:none; }
  .btn--primary { background:var(--primary); border-color:var(--primary); color:#fff; }
  .btn--primary:hover { background:var(--primary-dark); border-color:var(--primary-dark); }
  .btn--danger { color:var(--red); }
  .btn--small { font-size:12px; padding:.15rem .5rem; }
  .btn--link { display:inline; background:none; border:0; padding:0; color:var(--accent); font-weight:inherit; }
  .btn--link:hover { background:none; text-decoration:underline; }

  /* chips: a word in a frame */
  .badge, .phase, .warn { display:inline-block; vertical-align:middle; font-size:12px; line-height:1.5; padding:0 .4rem; border-radius:var(--radius); border:1px solid var(--line); background:var(--soft); white-space:nowrap; }
  .phase-public { background:#e0e7ff; border-color:#c7d2fe; }
  .phase-draft { background:#fff7e6; border-color:#fde68a; }
  /* a branch, topic, bookmark, tag or commit: all alike, the icon tells the kind ({% ref %}) */
  .ref, .node-chip { display:inline-flex; align-items:center; gap:.25rem; max-width:100%; font-size:12px; line-height:1.5; padding:0 .4rem; border-radius:var(--radius); border:1px solid var(--line); background:var(--soft); white-space:nowrap; vertical-align:middle; }
  .ref { color:var(--fg); }
  .ref__name { overflow:hidden; text-overflow:ellipsis; }
  .ref__icon { width:12px; height:12px; color:var(--muted); vertical-align:0; }
  a.node-chip:hover { text-decoration:none; background:var(--line-soft); }
  .warn { color:var(--warn); border-color:var(--warn); background:none; }
  /* badges only: an entry carries its state as a class too (_entry.html) and is not to be tinted */
  .badge.state-open { background:#eafaf1; } .badge.state-merged { background:#ede9fe; } .badge.state-closed { background:#f3f4f6; }
  .count { display:inline-block; min-width:1.5em; padding:0 .4rem; border-radius:var(--radius); background:var(--line-soft); font-size:12px; font-weight:500; line-height:1.5; text-align:center; }
  .node-chip code { padding:0; border:0; background:none; font-size:12px; }
  .copy { user-select:all; display:inline-block; max-width:100%; overflow-wrap:anywhere; background:var(--soft); padding:.1rem .4rem; border:1px solid var(--line); border-radius:var(--radius); cursor:text; }

  /* message after an action */
  .flash { padding:.5rem .8rem; border-radius:var(--radius); border:1px solid #bfdbfe; background:#eff6ff; margin-bottom:1rem; }
  .flash.error { background:var(--del); border-color:#fecaca; }
  .flash.success { background:var(--add); border-color:#bbf7d0; }

  /* a framed block, optionally with a head line */
  .box { border:1px solid var(--line); border-radius:var(--radius); margin:1rem 0; }
  .box__head { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; margin:0; padding:.5rem .8rem; background:var(--soft); border-bottom:1px solid var(--line); border-radius:var(--radius) var(--radius) 0 0; }
  .box__head:last-child { border-bottom:0; border-radius:var(--radius); }
  .box__title { margin:0; font-size:14px; font-weight:600; }
  .box__body { padding:.6rem .8rem; }
  .box__body--prose { padding:1rem 1.5rem; }
  .box__rows { list-style:none; margin:0; padding:0; }
  .box__rows > li { padding:.35rem .8rem; border-top:1px solid var(--line-soft); }
  .box__rows > li:first-child { border-top:0; }

  /* one line of controls above a list or a table */
  .bar { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; margin:0 0 .8rem; }
  .bar__title { margin:0 .5rem 0 0; }

  /* tabs: a line of links, the current one underlined. --repo sits in the repository
     header, --sub is the second line below the tabs of a merge request. */
  /* .menu: a <details> whose <summary> is the button and whose panel opens below it;
     nav.js closes it on a click elsewhere and on Escape. --end aligns the panel right. */
  .menu { position:relative; }
  .menu__button { list-style:none; cursor:pointer; }
  .menu__button::-webkit-details-marker { display:none; }
  .menu__panel { position:absolute; left:0; top:calc(100% + .3rem); z-index:5; width:min(20rem, calc(100vw - 2rem)); padding:.4rem; background:var(--bg); border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 6px 18px rgb(0 0 0 / .12); }
  .menu--end .menu__panel { left:auto; right:0; }
  .menu__label { margin:.4rem .5rem .2rem; font-size:12px; font-weight:600; color:var(--muted); }
  .menu__label:first-child { margin-top:.1rem; }
  .menu__list, .tabs .menu__list { display:block; list-style:none; margin:0; padding:0; } /* not a row of tabs when the menu sits in one */
  .menu__item { display:flex; align-items:center; gap:.4rem; padding:.3rem .5rem; border-radius:var(--radius); color:var(--fg); overflow-wrap:anywhere; }
  .menu__item:hover { background:var(--soft); text-decoration:none; }
  .menu__item .i { flex:none; color:var(--muted); }
  .menu__item[aria-current] { font-weight:600; background:var(--softer); }
  .tabs { border-bottom:1px solid var(--line); margin:.8rem 0; }
  .tabs ul { list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; }
  .tabs a { display:flex; align-items:center; gap:.4rem; padding:.45rem .8rem; color:var(--fg); border-bottom:2px solid transparent; margin-bottom:-1px; }
  .tabs a:hover { text-decoration:none; border-bottom-color:var(--line); }
  .tabs a[aria-current] { border-bottom-color:var(--fg); font-weight:600; }
  .tabs__hint { font-size:11px; color:var(--muted); font-weight:var(--weight); }
  .tabs__label { color:var(--muted); }
  .tabs--repo { border-bottom:0; margin:.7rem 0 0; }
  .tabs--repo a { padding:.55rem .8rem; }
  .tabs--sub { display:flex; flex-wrap:wrap; align-items:baseline; gap:.3rem; margin:.6rem 0 1rem; }
  .tabs--sub a { padding:.5rem .8rem; }
  /* --grouped: several <ul> in one nav, a gap between them; each group carries the
     line, the last one grows so that the line reaches the right edge */
  .tabs--grouped { display:flex; flex-wrap:wrap; align-items:stretch; gap:0 2rem; border-bottom:0; }
  .tabs--grouped > ul { flex:0 1 auto; max-width:100%; border-bottom:1px solid var(--line); }
  .tabs--grouped > ul:last-child { flex:1 0 auto; }   /* too little room: the group moves down whole, not tab by tab */
  /* a menu that belongs to its group, such as the revision of the code views */
  .tabs__menu { display:flex; align-items:center; margin-right:.4rem; padding-bottom:.25rem; }
  .tabs__end { margin-left:auto; }

  /* segmented control: alternatives in one frame */
  .seg { display:flex; flex-wrap:wrap; list-style:none; margin:0; padding:0; border:1px solid var(--line); border-radius:var(--radius); background:var(--soft); }
  .seg a { display:flex; align-items:center; gap:.35rem; padding:.35rem .8rem; color:var(--fg); border-right:1px solid var(--line); }
  .seg li:last-child a { border-right:0; }
  .seg a:hover { background:var(--line-soft); text-decoration:none; }
  .seg a[aria-current] { background:var(--line-soft); font-weight:600; }

  /* list of things with a title: issues, merge requests, discussions, repositories */
  .item-list { list-style:none; margin:0; padding:0; border-top:1px solid var(--line-soft); }
  .item-list__item { display:flex; gap:.6rem; padding:.6rem .2rem; border-bottom:1px solid var(--line-soft); }
  .item-list__item--empty { color:var(--muted); }
  .item-list__icon { margin-top:.25rem; color:var(--muted); }
  .item-list__main { flex:1; min-width:0; }
  .item-list__title { font-size:16px; font-weight:600; color:var(--fg); overflow-wrap:anywhere; }
  a.item-list__title:hover { color:var(--accent); }
  .item-list__meta { margin:.1rem 0 0; font-size:13px; color:var(--muted); }
  a.item-list__side:hover { color:var(--accent); text-decoration:none; }
  .item-list__side { display:flex; align-items:flex-start; gap:.3rem; color:var(--muted); white-space:nowrap; }

  /* boxes side by side while there is room */
  .grid-cards { display:grid; grid-template-columns:repeat(auto-fit, minmax(22rem, 1fr)); gap:0 1.5rem; }

  /* plain table of rows */
  table.list { width:100%; border-collapse:collapse; }
  .table-scroll { overflow-x:auto; }
  table.list td, table.list th { border-bottom:1px solid var(--line-soft); padding:.4rem .4rem; text-align:left; vertical-align:top; }
  table.list th { color:var(--muted); font-weight:500; border-bottom-color:var(--line); }
  table.meta th { text-align:left; padding-right:1rem; color:var(--muted); font-weight:var(--weight); vertical-align:top; }

  .trail ol { list-style:none; margin:0 0 .4rem; padding:0; display:flex; flex-wrap:wrap; }
  .trail li + li::before { content:"›"; padding:0 .4rem; color:var(--muted); }
  .pager a { margin-right:1rem; }

  /* Django's as_p: label above the field, help text below; a checkbox stands
     before its label. Fields share one width so their edges line up. */
  .form { max-width:40rem; }
  .form p { display:grid; gap:.3rem; margin:0 0 1.1rem; }
  .form p > label { font-weight:600; }
  .form p > label.plain { font-weight:inherit; }
  .form input:not([type=checkbox], [type=radio]), .form select, .form textarea { width:100%; box-sizing:border-box; }
  .form .helptext, .form .error { font-size:13px; color:var(--muted); }
  .form .error, .form .errorlist { color:var(--red); }
  .form .errorlist { list-style:none; margin:0 0 .3rem; padding:0; font-size:13px; }
  .form p:has(> input[type=checkbox]) { grid-template-columns:auto 1fr; column-gap:.5rem; align-items:center; }
  .form p:has(> input[type=checkbox]) > input { grid-area:1 / 1; margin:0; }
  .form p:has(> input[type=checkbox]) > label { grid-area:1 / 2; }
  .form p:has(> input[type=checkbox]) > .helptext { grid-column:2; }
  /* short forms in one row: fields side by side, the button on their baseline */
  .inline-form { max-width:none; display:flex; flex-wrap:wrap; align-items:flex-end; gap:0 1rem; }
  .inline-form p { margin:0 0 .6rem; }
  .inline-form input:not([type=checkbox], [type=radio]), .inline-form select { width:16rem; }
  .inline-form > button { margin-bottom:.6rem; }
  .inline-form > .errorlist { flex-basis:100%; }
  .list__actions { text-align:right; width:1%; white-space:nowrap; }
  .inlineform { display:inline-flex; gap:.3rem; align-items:baseline; margin:0; }
  form.stacked label { display:block; margin:.3rem 0; }
}
