/* Polish layer (loaded last): calmer headings, clear button hierarchy, a real search bar and filter pills,
   quieter tables, readable messages. Only refines what app.css / theme.css draw. */

/* ---------- icons inside buttons and fields ---------- */
.ico { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; }

/* ---------- headings: no accent bar before card titles ---------- */
.card > h2:first-child::before { content: none; display: none; }
.card > h2:first-child { font-size: 16px; font-weight: 700; color: #0f172a; }
.page-head h1 { letter-spacing: -.02em; }
.page-head .sub { color: #64748b; }

/* ---------- buttons: one clear main action, quiet secondary ones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px;
  padding: 8px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; color: #1e293b; line-height: 1.2;
  background: #fff; border: 1px solid #d7dee8; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); cursor: pointer;
  text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f8fafc; border-color: #b9c4d3; color: #0f172a; text-decoration: none; }
.btn:focus-visible, .pill-select select:focus-visible, .tb-search input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 2px; }
.btn.primary { color: #fff; border-color: transparent; }
.btn.primary:hover { color: #fff; }
.btn.danger { color: #b91c1c; border-color: #f3c4c4; background: #fff; }
.btn.danger:hover { background: #fef2f2; border-color: #e99a9a; color: #991b1b; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--brand); }
.btn.ghost:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.btn.sm { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 9px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions form { margin: 0; }

/* ---------- export menu ---------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: "▾"; font-size: 11px; margin-left: 2px; opacity: .6; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 170px; padding: 6px;
  background: #fff; border: 1px solid #dfe5ee; border-radius: 12px; box-shadow: 0 16px 36px -12px rgba(15, 23, 42, .3); }
.menu-list a { display: block; padding: 8px 10px; border-radius: 8px; color: #1e293b; font-size: 14px; text-decoration: none; }
.menu-list a:hover { background: #f1f5f9; }

/* ---------- list toolbar: search bar + filter pills ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; }
.tb-search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #d7dee8;
  border-radius: 12px; padding: 5px 5px 5px 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
  transition: border-color .15s, box-shadow .15s; }
.tb-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.tb-search .ico { color: #94a3b8; width: 18px; height: 18px; }
.tb-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 15px;
  padding: 8px 4px; color: #0f172a; }
.tb-search input::placeholder { color: #94a3b8; }
.tb-x { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 99px; color: #64748b;
  font-size: 20px; line-height: 1; text-decoration: none; }
.tb-x:hover { background: #f1f5f9; color: #0f172a; text-decoration: none; }
.tb-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-select { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 0; cursor: pointer;
  background: #fff; border: 1px solid #d7dee8; border-radius: 99px; padding: 0 30px 0 14px; min-height: 36px;
  font-size: 13.5px; color: #475569; transition: border-color .15s, background .15s; }
.pill-select:hover { border-color: #b9c4d3; }
.pill-select::after { content: "▾"; position: absolute; right: 12px; font-size: 11px; color: #94a3b8; pointer-events: none; }
.pill-select > span { font-weight: 600; }
.pill-select select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font: inherit;
  color: #0f172a; font-weight: 500; padding: 7px 0; cursor: pointer; max-width: 220px; outline: 0; }
.pill-select.on { background: color-mix(in srgb, var(--brand) 9%, #fff); border-color: color-mix(in srgb, var(--brand) 45%, #fff); }
.pill-select.on > span, .pill-select.on select { color: var(--brand); }
.chips-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -2px 0 12px; }
.chip-x { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 99px;
  background: color-mix(in srgb, var(--brand) 10%, #fff); color: #1e3a8a; font-size: 13px; text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--brand) 25%, #fff); }
.chip-x span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 99px; font-size: 15px; }
.chip-x:hover { text-decoration: none; } .chip-x:hover span { background: color-mix(in srgb, var(--brand) 22%, #fff); }
/* the old "Search & filter" box is gone; keep other filter forms tidy */
.filters { gap: 10px; align-items: flex-end; }

/* ---------- tables: one link per row, aligned numbers ---------- */
.list-card { padding: 0; overflow: hidden; }
table.t th { font-size: 11.5px; letter-spacing: .05em; color: #64748b; white-space: nowrap; }
table.t th.num, table.t td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t td { color: #1e293b; vertical-align: top; }
table.t td:not(:first-child) a { color: inherit; text-decoration: none; }
table.t td:not(:first-child) a:hover { color: var(--brand); text-decoration: underline; }
table.t td:first-child a { color: var(--brand); }
table.t th.sortable::after { opacity: 0; transition: opacity .15s; }
table.t th.sortable:hover::after, table.t th.sorted::after, table.t th[aria-sort]::after { opacity: .55; }
.empty { text-align: center; color: #64748b; padding: 36px 16px; }
.empty b { color: #0f172a; font-size: 15px; }
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.pager-btns { display: flex; align-items: center; gap: 10px; }

/* ---------- messages: the round icon was white on white ---------- */
.msg { color: #1e3a8a; background: #eff6ff; border-color: #c7dbfe; }
.msg::before { content: "i"; color: #fff; background: #2563eb; }
.msg.success { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }
.msg.success::before { content: "✓"; background: #059669; }
.msg.error { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.msg.error::before { content: "!"; background: #dc2626; }
.msg.warning { color: #92400e; background: #fffbeb; border-color: #fde68a; }
.msg.warning::before { content: "!"; background: #d97706; }
.errorlist { color: #b91c1c; }

/* ---------- top search bar ---------- */
.top .search { flex: 1; max-width: 560px; }
.search-trigger { padding: 10px 14px; border-radius: 12px; background: #fff; border-color: #d7dee8; font-size: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .05); }
.search-trigger:hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 12%, transparent); }
.search-trigger .ni { width: 18px; height: 18px; color: #94a3b8; }

/* ---------- forms ---------- */
.input, select.input, textarea.input { font-size: 14.5px; min-height: 40px; }
.field label { font-size: 13px; color: #334155; }
.help { color: #64748b; font-size: 12.5px; }

@media (max-width: 640px) {
  .tb-search button { display: none; }
  .tb-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .pill-select { flex: none; }
  .page-head .actions .btn { min-height: 36px; }
}
table.t td.nowrap, table.t th.nowrap { white-space: nowrap; }
.pill-select select { max-width: 170px; text-overflow: ellipsis; }
.pill-select select { field-sizing: content; min-width: 2.5em; }

/* the page header (with the Export menu) sits above the help box, toolbar and table that follow it */
.content > .page-head { position: relative; z-index: 20; }
details.menu[open] > summary { background: #f1f5f9; border-color: #b9c4d3; }
.menu-list { z-index: 50; }
