/* ============================================================
   DERBi PIE — style.css
   Overrides Bootstrap 5.3 with a refined scholarly aesthetic.
   Fonts: Crimson Pro (serif) + Source Code Pro (mono) + Libre Franklin (sans)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400;1,600&family=Source+Code+Pro:wght@400;600&family=Libre+Franklin:wght@300;400;500;600&display=swap');

/* ── Variables ── */
:root {
  --ink:         #1a1714;
  --ink-mid:     #4a4540;
  --ink-soft:    #7a7068;
  --ink-faint:   #b0a89e;
  --paper:       #faf8f5;
  --paper-warm:  #f2ede6;
  --rule:        #e0d8ce;
  --accent:      #8b3a1e;
  --accent-soft: #c4784f;
  --blue:        #2a4a7f;
  --blue-soft:   #d6e0f0;
  --tag-bg:      #ede8e0;
}

/* ── Base ── */
body {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--paper);
  color: var(--ink);
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ── Navbar ── */
.navbar {
  background-color: var(--ink) !important;
  padding-top: 0;
  padding-bottom: 0;
  min-height: 48px;
}
.navbar .navbar-brand {
  font-family: 'Source Code Pro', monospace;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: #fff !important;
}
.navbar .nav-link {
  font-size: 13px;
  color: #b8b0a4 !important;
  letter-spacing: 0.02em;
  padding: 0.85rem 0.9rem;
}
.navbar .nav-link:hover {
  color: #fff !important;
}
.navbar .text-secondary {
  color: #b8b0a4 !important;
  font-size: 13px;
}
.navbar .btn-outline-secondary {
  color: #b8b0a4;
  border-color: #b8b0a4;
  font-size: 12px;
}
.navbar .btn-outline-secondary:hover {
  background: #b8b0a4;
  color: var(--ink);
}

/* ── Page layout ── */
.page-container {
  min-height: 100vh;
}
main.container {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

/* ── Results page ── */
.d-flex.align-items-center.justify-content-between {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.6rem;
  margin-bottom: 1.5rem;
}
.d-flex h1 {
  font-family: 'Crimson Pro', serif;
  font-size: 1.6rem;
  font-weight: 300;
  margin: 0 !important;
}

.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  font-size: 12px;
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 500;
  letter-spacing: 0.04em;
  border-radius: 2px;
  padding: 5px 14px;
}
.btn-primary:hover {
  background: #1e3a6a;
  border-color: #1e3a6a;
}

/* Result cards */
.card {
  border: 1px solid var(--rule);
  border-left: 3px solid transparent;
  border-radius: 2px;
  background: #fff;
  box-shadow: none;
  transition: border-left-color 0.15s, box-shadow 0.15s;
}
.card:hover {
  border-left-color: var(--accent);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
}
.card.mb-3 {
  margin-bottom: 6px !important;
}
.card-body {
  padding: 0.85rem 1.25rem;
}

.card-title {
  margin-bottom: 0.15rem;
}
.card-title a {
  font-family: 'Source Code Pro', monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
}
.card-title a:hover {
  color: var(--accent);
  text-decoration: none;
}

.card-text {
  font-family: 'Crimson Pro', serif;
  font-size: 1.05rem;
  color: var(--ink-mid);
  margin-bottom: 0;
  line-height: 1.4;
}
.card-text.text-muted.small {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.8rem;
  color: var(--ink-soft) !important;
  margin-top: 0.35rem;
}

.results-section-header {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 1.5rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.results-section-header::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}

.card-reflex {
  border-left-color: var(--accent-soft) !important;
  background: #fffcfa;
}
.card-semantic {
  background: #f8fafd;
}
.card-semantic .card-title a {
  color: var(--ink-mid);
}
.card-fuzzy {
  background: #faf9f8;
  opacity: 0.9;
}
.card-fuzzy .card-title a {
  color: var(--ink-soft);
}

hr {
  border-color: var(--rule);
  opacity: 1;
  margin: 1.5rem 0 0.75rem;
}
p.text-center.mt-3 {
  font-size: 12px;
  color: var(--ink-soft);
}
p.text-center.mt-3.text-muted {
  color: var(--ink-faint) !important;
}

/* ── Dictionary entry page ── */

.dict-hero {
  background: var(--ink);
  color: #f0ece4;
  border-radius: 2px 2px 0 0;
  padding: 1.75rem 2rem;
}
.dict-hero h2 strong {
  font-family: 'Source Code Pro', monospace;
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  display: block;
  margin-bottom: 0.4rem;
}
.dict-hero h4 {
  font-family: 'Crimson Pro', serif;
  font-size: 1.2rem;
  font-weight: 300;
  font-style: italic;
  color: #d8d0c4;
  margin-bottom: 0.3rem;
}
.dict-hero h4 .dict-pos {
  font-style: normal;
  font-size: 0.75rem;
  font-family: 'Libre Franklin', sans-serif;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-soft);
  background: rgba(255,255,255,0.1);
  padding: 2px 8px;
  border-radius: 2px;
  margin-right: 0.5rem;
  vertical-align: middle;
}
.dict-hero h4 strong {
  font-style: italic;
  font-weight: 300;
  color: #d8d0c4;
  font-size: 1.2rem;
}
.dict-hero strong,
.dict-hero span {
  color: #c8c0b4;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 12px;
}

/* ── Attested in strip ── */
.dict-attested {
  background: var(--paper-warm);
  border-top: 1px solid var(--rule);
  padding: 0.75rem 1.25rem 0;
}

/* Summary row: "Attested in X branches, Y languages" + tree button */
.dict-attest-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.75rem;
}
.dict-attested-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.dict-attested-label strong {
  font-weight: 600;
  color: var(--ink-mid);
  font-family: 'Libre Franklin', sans-serif;
  font-size: 11px;
}

/* Tree toggle button */
.dict-tree-btn {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 5px 14px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  cursor: pointer;
  background: #fff;
  color: var(--accent);
  transition: background .15s, color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.dict-tree-btn:hover {
  background: var(--accent);
  color: #fff;
}
.dict-tree-btn.open {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.dict-tree-btn-arrow {
  font-size: 8px;
  transition: transform .2s;
}
.dict-tree-btn.open .dict-tree-btn-arrow {
  transform: rotate(180deg);
}

/* Collapsible tree panel */
.dict-tree-panel {
  display: none;
  border-top: 1px solid var(--rule);
  padding: 0.75rem 0 0.5rem;
}
.dict-tree-panel.open {
  display: block;
}

/* Attested only / Full tree sub-toggle inside panel */
.dict-tree-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.dict-source-note {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink-faint);
  font-style: italic;
}
.dict-tree-toggle {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.dict-tree-toggle button {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border: none;
  cursor: pointer;
  background: var(--paper-warm);
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.dict-tree-toggle button:first-child {
  border-right: 1px solid var(--rule);
}
.dict-tree-toggle button.active {
  background: var(--ink);
  color: #fff;
}
#dendro-container {
  overflow-x: auto;
}

/* ── Reflex section ── */
.reflex-wrap {
  background: #fff;
  border-top: 1px solid var(--rule);
}
.source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1.25rem;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--rule);
}
.source-bar-left { display: flex; align-items: center; gap: .75rem; }
.source-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft);
}
.source-select {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 11px; font-weight: 500;
  padding: 3px 24px 3px 8px;
  border: 1px solid var(--rule); border-radius: 2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a7068'/%3E%3C/svg%3E") no-repeat right 8px center #fff;
  background-size: 8px; -webkit-appearance: none; appearance: none;
  color: var(--ink); cursor: pointer;
}

/* ── POS sections ── */
.pos-section { border-bottom: 1px solid var(--rule); }
.pos-section:last-child { border-bottom: none; }
.pos-header {
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem 1.25rem;
  background: var(--paper-warm);
  font-size: 11px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft);
  cursor: pointer; user-select: none;
}
.pos-header:hover { background: #ede7de; }
.pos-toggle { font-size: 9px; color: var(--ink-faint); }
.pos-count {
  font-size: 10px; font-weight: 400; color: var(--ink-faint);
  letter-spacing: 0; text-transform: none;
}

/* ── Grammar grouping ── */
.grammar-section {
  border-bottom: 1px solid var(--rule);
}
.grammar-section:last-child {
  border-bottom: none;
}
.grammar-section.unclassified .grammar-pill {
  background: var(--tag-bg);
  color: var(--ink-soft);
  border-color: var(--rule);
}
.grammar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 1.25rem;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--rule);
}
.grammar-pill {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 99px;
  border: 1px solid #b8d0e8;
  background: #e8f0f8;
  color: var(--blue);
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.recon-shape {
  font-family: 'Source Code Pro', monospace;
  font-size: 12px;
  color: var(--ink);
}
.recon-gloss {
  font-size: 12px;
  color: var(--ink-soft);
}

/* ── Branch sidebar layout ── */
.branch-header { display: none; }  /* old header row — retired */

.branch-group {
  display: flex;
  border-top: 1px solid var(--rule);
}
.branch-group:first-child {
  border-top: none;
}
.branch-sidebar {
  width: 84px;
  min-width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border-right: 1px solid var(--rule);
  gap: 3px;
  background: var(--paper-warm);
}
.branch-name-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0.04em;
}
.branch-count-text {
  font-size: 10px;
  color: var(--ink-faint);
}
.reflex-table-wrap {
  flex: 1;
  overflow: hidden;
}

/* ── Reflex table ── */
.reflex-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.reflex-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #f0ece8;
  vertical-align: top;
}
.reflex-table tbody tr:last-child td { border-bottom: none; }
.reflex-table tbody tr:hover td { background: #faf8f6; }
.td-lang {
  font-family: 'Source Code Pro', monospace;
  font-size: 11px; color: var(--ink-mid); width: 150px;
}
.td-reflex {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem; font-weight: 600; color: var(--ink); width: 130px;
}
.td-gloss { color: var(--ink-mid); }
.td-refs { text-align: right; white-space: nowrap; width: 80px; }

/* ── Citation badges ── */
.ref-badge {
  display: inline-block; font-size: 9px; font-weight: 600;
  letter-spacing: .04em; padding: 1px 5px; border-radius: 2px;
  margin-left: 3px; border: 1px solid;
}
.ref-liv  { background: #e8f0f8; border-color: #b8d0e8; color: #2a4a7f; }
.ref-nil  { background: #f0ebe8; border-color: #d8c8c0; color: #6a3a2a; }
.ref-iew  { background: #e8f0e8; border-color: #b8d8b8; color: #2a5a2a; }
.ref-wik  { background: #f0f0e8; border-color: #d8d8b8; color: #5a5a2a; }
.ref-other{ background: var(--tag-bg); border-color: var(--rule); color: var(--ink-soft); }

/* ── Misc ── */
.divider { height: 1rem; }
.alternate-letter-entry { padding: 2px; min-width: 2em; }
.popover { max-width: 60em; }
.splash-image { width: 400px; height: auto; margin: 2em; }

/* ── Footer ── */
.footer {
  background: var(--paper-warm);
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.footer a { color: var(--blue); }

/* ── Card headers (reconstruction sections) ── */
.card-header {
  background: var(--paper-warm) !important;
  border-bottom: 1px solid var(--rule) !important;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  user-select: none;
}
.card-header:hover { background: #ede7de !important; }
.card-header h4 {
  font-family: 'Crimson Pro', serif;
  font-size: 1rem; font-style: italic; color: var(--ink-mid); margin: 0;
}
.card-header h4 span { font-style: normal; color: var(--ink-soft); font-size: 0.85rem; }
.card-header h4 i { font-weight: 600; color: var(--ink); }
.card-header .dropdown-toggle::after { margin-left: auto; color: var(--ink-soft); }

h5.card-body {
  font-family: 'Source Code Pro', monospace;
  font-size: 0.9rem; font-weight: 600; color: var(--blue);
  background: #fff; padding: 0.75rem 1.25rem 0.4rem; margin: 0;
}
h5.card-body i { font-family: 'Crimson Pro', serif; font-size: 1rem; font-weight: 400; color: var(--ink-soft); }
h5.card-body .text-secondary { color: var(--ink-faint) !important; }

table.card-body { background: #fff; padding: 0; margin: 0 !important; font-size: 13px; }
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--paper-warm);
  --bs-table-accent-bg: var(--paper-warm);
}
.table-bordered > :not(caption) > * > * { border-color: var(--rule); }
.table thead tr { background: var(--paper-warm); }
.table th {
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-soft); padding: 7px 12px;
  border-bottom: 2px solid var(--rule) !important; background: var(--paper-warm);
}
.table td { padding: 6px 12px; vertical-align: top; border-color: var(--rule); }
.table tbody tr:hover td { background-color: #ede7de; }
.table-language { font-family: 'Source Code Pro', monospace; font-size: 12px; color: var(--ink-mid); }
.table-reflex { font-family: 'Crimson Pro', serif; font-size: 1rem; font-weight: 600; color: var(--ink); }
.table-gloss { color: var(--ink-mid); }
.table-grammar { font-size: 12px; color: var(--ink-soft); font-style: italic; }

.text-muted.mt-4 { font-size: 13px; color: var(--ink-faint) !important; font-style: italic; }

/* ── Script console ── */
#dc-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--ink); color: #fff; border: none; cursor: pointer;
  font-family: 'Source Code Pro', monospace; font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#dc-fab:hover { background: var(--blue); }
#dc-panel {
  position: fixed; bottom: 0; right: 0; z-index: 9998;
  width: 560px; max-height: 0; overflow: hidden;
  transition: max-height .25s ease;
}
#dc-panel.open { max-height: 420px; }
#dc-inner {
  background: #fff; border: 1px solid var(--rule);
  border-bottom: none; border-radius: 3px 3px 0 0;
  overflow: hidden; margin: 0 24px;
}
#dc-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; background: var(--paper-warm);
  border-bottom: 1px solid var(--rule);
}
#dc-topbar-left { display: flex; align-items: center; gap: 8px; }
.dc-label { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.dc-sublabel { font-size: 11px; color: var(--ink-faint); }
.dc-btn {
  font-size: 11px; padding: 3px 10px; border-radius: 2px;
  border: 1px solid var(--rule); background: transparent;
  color: var(--ink-soft); cursor: pointer;
}
.dc-btn-run { border-color: #b8d0e8; background: #e8f0f8; color: var(--blue); font-weight: 600; }
#dc-input {
  width: 100%; height: 120px; padding: 10px 14px;
  font-family: 'Source Code Pro', monospace; font-size: 12px;
  color: var(--ink); background: #fff; border: none;
  border-bottom: 1px solid var(--rule);
  resize: none; outline: none; box-sizing: border-box; line-height: 1.6;
}
#dc-output {
  min-height: 60px; max-height: 130px; overflow-y: auto;
  padding: 8px 14px;
  font-family: 'Source Code Pro', monospace; font-size: 12px; line-height: 1.6;
  background: var(--paper); color: var(--ink);
}
#dc-refpanel { border-top: 1px solid var(--rule); padding: 10px 14px; background: var(--paper-warm); }
#dc-refpanel p {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft); margin: 0 0 6px;
}
#dc-refpanel .dc-ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#dc-refpanel .dc-ref-item {
  background: #fff; border: 1px solid var(--rule); border-radius: 2px; padding: 6px 8px;
  font-family: 'Source Code Pro', monospace; font-size: 11px; color: var(--ink-mid);
}
#dc-refpanel .dc-ref-item span { display: block; color: var(--ink-soft); font-size: 10px; margin-top: 2px; }


/* ── Search page below-bar row ── */
.search-below-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.4rem;
}

/* ── Pattern syntax reference button (legacy, kept for safety) ── */
.btn-syntax-ref {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 1px dashed var(--rule);
  padding: 0;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-syntax-ref:hover,
.btn-syntax-ref.active {
  color: var(--ink);
  border-bottom-color: var(--ink-soft);
}

/* ── Syntax toggle icon button (search bar) ── */
#syntaxToggle {
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--blue);
  border-color: var(--rule);
  background: var(--paper-warm);
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
#syntaxToggle:hover {
  background: var(--paper);
  color: var(--blue);
  border-color: var(--ink-faint);
}
#syntaxToggle.active {
  background: var(--ink);
  color: var(--blue-soft);
  border-color: var(--ink);
}

/* ── Syntax reference panel ── */
.syntax-ref-panel {
  margin-top: 0.75rem;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 1rem 1.25rem;
}
.syntax-ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.syntax-ref-heading {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
}
.syntax-ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.syntax-ref-table td {
  padding: 2px 8px 2px 0;
  vertical-align: top;
  color: var(--ink-mid);
  border: none;
}
.syntax-ref-table td:first-child {
  font-family: 'Source Code Pro', monospace;
  font-size: 11px;
  color: var(--blue);
  white-space: nowrap;
  width: 1%;
}
.syntax-ref-note {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 0;
}

/* ── Language/Branch multi-filter ── */
.lang-filter-wrap {
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--paper-warm);
  padding: 8px 12px;
}
.lang-filter-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.lang-filter-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lang-and-or-toggle {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  cursor: pointer;
  background: #fff;
  color: var(--ink-soft);
  user-select: none;
  transition: background .15s, color .15s;
}
.lang-and-or-toggle.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.lang-filter-add {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--blue);
  cursor: pointer;
  padding: 0 4px;
  margin-left: auto;
  user-select: none;
  transition: color .15s;
}
.lang-filter-add:hover { color: var(--accent); }

.lang-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.lang-filter-row:last-child { margin-bottom: 0; }

.lang-type-btn {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 4px 10px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.lang-type-btn:hover {
  background: var(--paper-warm);
  color: var(--ink);
}

.lang-filter-select {
  font-family: 'Libre Franklin', sans-serif;
  font-size: 12px;
  padding: 4px 24px 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a7068'/%3E%3C/svg%3E") no-repeat right 8px center #fff;
  background-size: 8px;
  -webkit-appearance: none;
  appearance: none;
  color: var(--ink);
  flex: 1;
}

.lang-branch-select {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.lang-branch-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  padding: 1px 7px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s, border-color .15s;
}
.lang-branch-chip input { display: none; }
.lang-branch-chip:has(input:checked) {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.lang-filter-remove {
  font-size: 14px;
  line-height: 1;
  padding: 3px 6px;
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  flex-shrink: 0;
  transition: color .15s;
}
.lang-filter-remove:hover { color: var(--accent); }