/* Bolt Tools -- shared styles. Tokens first; everything below uses them so
   light and dark mode stay in sync. */
:root {
  color-scheme: light dark;
  --bg: #f6f7f9; --panel: #ffffff; --panel-2: #f9fafb;
  --text: #0f172a; --muted: #64748b; --border: #e5e7eb; --border-strong: #d1d5db;
  --accent: #0055AD; --accent-hover: #004488; --accent-bg: #e6f0fa; --on-accent: #fff;
  --ok: #047857; --ok-bg: #ecfdf5;
  --warn: #b45309; --warn-bg: #fffbeb; --warn-border: #fcd34d;
  --danger: #b91c1c; --danger-bg: #fef2f2; --danger-border: #fca5a5;
  --info: #1d4ed8; --info-bg: #eff6ff;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / .06);
  --shadow-md: 0 4px 12px rgb(15 23 42 / .08), 0 1px 3px rgb(15 23 42 / .06);
  --radius: 12px; --radius-sm: 8px;
}
/* Dark mode: follows the device by default; the Auto / Light / Dark button in the top bar (saved in this browser) sets data-theme on <html> to force one. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f17; --panel: #131a26; --panel-2: #172033;
    --text: #e6eaf2; --muted: #93a0b5; --border: #243044; --border-strong: #334155;
    --accent: #4d94e0; --accent-hover: #7db3ec; --accent-bg: #10243d; --on-accent: #0b0f17;   /* the brand blue lifted a little so links stay readable on dark */
    --ok: #34d399; --ok-bg: #0d2a22;
    --warn: #fbbf24; --warn-bg: #2a2110; --warn-border: #6b4e12;
    --danger: #f87171; --danger-bg: #2b1316; --danger-border: #7f2a2f;
    --info: #60a5fa; --info-bg: #11213d;
    --shadow-sm: none; --shadow-md: 0 4px 16px rgb(0 0 0 / .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
    --bg: #0b0f17; --panel: #131a26; --panel-2: #172033;
    --text: #e6eaf2; --muted: #93a0b5; --border: #243044; --border-strong: #334155;
    --accent: #4d94e0; --accent-hover: #7db3ec; --accent-bg: #10243d; --on-accent: #0b0f17;   /* the brand blue lifted a little so links stay readable on dark */
    --ok: #34d399; --ok-bg: #0d2a22;
    --warn: #fbbf24; --warn-bg: #2a2110; --warn-border: #6b4e12;
    --danger: #f87171; --danger-bg: #2b1316; --danger-border: #7f2a2f;
    --info: #60a5fa; --info-bg: #11213d;
    --shadow-sm: none; --shadow-md: 0 4px 16px rgb(0 0 0 / .4);
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1 { font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 6px; font-weight: 700; }
h2, h3 { letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 28px;
  padding: 0 24px; height: 56px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text);
                 letter-spacing: -.01em; }
.topbar .brand img { display: block; height: 34px; width: 34px; object-fit: contain; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.topbar nav a:hover { background: var(--panel-2); color: var(--text); }
.topbar .who { margin-left: auto; color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px; }
.topbar .who a { font-weight: 500; }

main { max-width: 1120px; margin: 0 auto; padding: 36px 24px 72px; }
.page-head { margin-bottom: 28px; }
.page-head p { margin: 0; color: var(--muted); font-size: 16px; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; font-size: 14px;
        color: var(--muted); font-weight: 500; }
.back:hover { color: var(--text); }

/* ---- hub cards ---- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; padding: 22px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); color: var(--text);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); color: var(--text); }
.card .icon { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 10px;
              background: var(--accent-bg); color: var(--accent); border-radius: 10px; font-size: 20px; }
.card h2 { margin: 0; font-size: 17px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }
.card .go { margin-top: 12px; color: var(--accent); font-weight: 600; font-size: 14px; }

/* ---- tabs ---- */
.tabs { display: flex; align-items: center; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border);
        overflow-x: auto; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted);
          font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tabs .count { padding: 0 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border);
               color: var(--muted); font-size: 12px; font-weight: 600; }
.tabs a.active .count { background: var(--accent-bg); border-color: transparent; color: var(--accent); }
.tabs .spacer { flex: 1; }

/* ---- table ---- */
.table-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
              box-shadow: var(--shadow-sm); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { padding: 13px 16px; text-align: left; white-space: nowrap; }
table.list th { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
                color: var(--muted); background: var(--panel-2); border-bottom: 1px solid var(--border); }
table.list td { border-bottom: 1px solid var(--border); }
table.list tr:last-child td { border-bottom: none; }
table.list tbody tr { transition: background .1s; }
table.list tbody tr:hover td { background: var(--panel-2); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list td .vendor { font-weight: 600; }

.empty { padding: 56px 24px; text-align: center; color: var(--muted); background: var(--panel);
         border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px;
         font-size: 12px; font-weight: 600; line-height: 1.6; background: var(--panel-2); color: var(--muted);
         border: 1px solid var(--border); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.high, .badge.user_confirmed, .badge.vendor_history, .badge.email_domain, .badge.manual
  { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.medium, .badge.heuristic
  { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.low, .badge.missing { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

/* ---- bill review ---- */
.bill-detail { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.bill-detail .pdf-pane { position: sticky; top: 76px; }
.bill-detail .pdf-pane iframe { display: block; width: 100%; height: calc(100vh - 110px); min-height: 480px;
                                background: var(--panel); border: 1px solid var(--border);
                                border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.form-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
             box-shadow: var(--shadow-sm); padding: 24px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: 18px; }
.field label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px;
               font-weight: 600; color: var(--text); margin-bottom: 6px; }
.field .hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=tel], input[type=url], input[type=password], input[type=time], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .12s, box-shadow .12s;
}
/* Search boxes: one modern look everywhere (rounded pill, magnifier icon, soft focus ring) */
input[type=search] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 40px; padding: 0 14px 0 40px; font: inherit; font-size: 14.5px; color: var(--text);
  background: var(--panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") no-repeat 13px center;
  border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s;
}
input[type=search]:hover { border-color: var(--border-strong); }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none; }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; height: 16px; width: 16px; margin-right: -4px; cursor: pointer; opacity: .55;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.4' stroke-linecap='round'><path d='M6 6l12 12M18 6 6 18'/></svg>") center/contain no-repeat; }
input[type=search]::-webkit-search-cancel-button:hover { opacity: 1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
                                            box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input::placeholder { color: var(--muted); opacity: .7; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: -2px; margin-right: 8px; }
.field input + input { margin-top: 8px; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
         padding: 18px 20px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 8px; font-size: 15px; }
.panel p { margin: 0 0 8px; }
.panel.warn { background: var(--warn-bg); border-color: var(--warn-border); }
.panel.warn h3 { color: var(--warn); }
.panel details { margin-top: 8px; font-size: 14px; }
.panel summary { cursor: pointer; color: var(--accent); font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 18px; border-top: 1px solid var(--border);
           margin-top: 8px; }
.actions .spacer { flex: 1; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px;
       font: inherit; font-size: 14px; font-weight: 600; line-height: 1.4; cursor: pointer;
       color: var(--text); background: var(--panel); border: 1px solid var(--border-strong);
       border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
       transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--panel-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.danger { background: transparent; border-color: var(--danger-border); color: var(--danger); box-shadow: none; }
.btn.danger:hover { background: var(--danger-bg); color: var(--danger); }

.checklist label { display: block; margin: 8px 0 0; font-size: 14px; font-weight: 500; }

/* ---- admin rows (vendor / account mapping) ---- */
.row-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
            box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 16px; }
.row-form { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.row-form:last-child { border-bottom: none; }
.row-form .name { flex: 1 1 200px; font-weight: 600; min-width: 0; }
.row-form select, .row-form input[type=text] { flex: 1 1 160px; width: auto; padding: 7px 10px; }
.row-form .btn { flex: 0 0 auto; padding: 7px 14px; }
/* legacy: row-forms rendered as direct children of main, not inside .row-list */
main > .row-form, main form > .row-form { background: var(--panel); border: 1px solid var(--border); border-top: none; }

@media (max-width: 860px) {
  main { padding: 24px 16px 56px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .bill-detail { grid-template-columns: 1fr; }
  .bill-detail .pdf-pane { position: static; }
  .bill-detail .pdf-pane iframe { height: 60vh; }
  .field-grid { grid-template-columns: 1fr; }
  .row-form { flex-wrap: wrap; }
}

/* ---- save feedback ---- */
.toast-stack { position: fixed; top: 68px; right: 20px; z-index: 50; display: flex; flex-direction: column;
               gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm);
         background: var(--ok-bg); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
         box-shadow: var(--shadow-md); font-weight: 600; animation: toast-in .2s ease-out; }
.toast::before { content: "\2713"; font-weight: 700; }
.toast.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.toast.warn::before { content: "!"; }
.toast.err { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.toast.err::before { content: "\2715"; }
.toast button { margin-left: auto; background: none; border: none; color: inherit; font-size: 18px; line-height: 1;
                cursor: pointer; opacity: .7; }
.toast button:hover { opacity: 1; }
.toast.leaving { opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.row-form.dirty { background: var(--accent-bg); box-shadow: inset 3px 0 0 var(--accent); }
.row-form.dirty::after { content: "Unsaved"; flex: 0 0 auto; padding: 1px 9px; border-radius: 999px; font-size: 12px;
                         font-weight: 600; color: var(--accent); background: var(--panel); border: 1px solid var(--accent); }

/* sticky save bar for long edit-many-rows forms */
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end;
           gap: 14px; padding: 14px 0; margin-top: 8px;
           background: linear-gradient(to top, var(--bg) 70%, transparent); }

.upload-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; padding: 14px 16px;
              background: var(--panel); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.upload-bar input[type=file] { width: auto; flex: 0 1 280px; padding: 6px; }

/* "where this was read" crops on the review page */
.crop { margin: 8px 0 0; }
.crop img { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--border);
            border-radius: 6px; }
.crop figcaption { margin-top: 4px; font-size: 12px; color: var(--muted); }
.pdf-link { margin: 0 0 8px; font-size: 14px; }
.badge.text_match, .badge.heuristic { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.po_history { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

.btn.small { padding: 4px 10px; font-size: 13px; }

/* PO line items shown on the review page: stacked cards so they fit any width */
.po-items { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.po-item { padding: 8px 12px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.po-item-name { font-weight: 600; font-size: 14px; word-break: break-word; }
.po-item-math { font-size: 13px; font-variant-numeric: tabular-nums; }
.po-item-when { font-size: 12px; }

.site-footer { max-width: 1120px; margin: 0 auto; padding: 0 24px 40px; font-size: 13px; color: var(--muted); }
.site-footer a { color: var(--muted); }
.panel h3 { margin-top: 18px; }

button.linklike { background: none; border: none; padding: 0; margin-left: 10px; font: inherit; font-weight: 500;
                  color: var(--accent); cursor: pointer; }
button.linklike:hover { color: var(--accent-hover); }

/* module status on the hub cards, and the QC Check banner */
.card .status { align-self: flex-start; margin-top: 8px; padding: 3px 11px; border-radius: 999px; font-size: 13px; font-weight: 600;
                background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.card .status.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.card .status.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.qc-banner { display: flex; align-items: center; gap: 18px; padding: 22px 26px; border-radius: var(--radius); font-size: 16px; }
.qc-banner strong { font-size: 22px; }
.qc-banner.ok { background: var(--ok-bg); color: var(--ok); }
.qc-banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.qc-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.qc-mark { color: inherit; font-size: 26px; font-weight: 700; }
.qc-banner.ok .qc-mark, .qc-banner.warn .qc-mark { background: var(--panel); }

/* slim expandable dashboard strip above the tool cards */
.dash { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; }
.dash summary { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; list-style: none; font-size: 14px; }
.dash summary::-webkit-details-marker { display: none; }
.dash .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.dash.ok .dot { background: var(--ok); }
.dash.warn .dot { background: var(--warn); }
.dash.warn { border-color: var(--warn-border); }
.dash .dash-name { font-weight: 600; }
.dash .dash-text { color: var(--muted); }
.dash.warn .dash-text { color: var(--warn); font-weight: 600; }
.dash .chev { margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.dash[open] .chev { transform: rotate(-135deg); }
.dash-body { padding: 0 16px 12px; border-top: 1px solid var(--border); }
.dash-body p { margin: 10px 0 0; }
.dash-table { margin-top: 6px; }
.dash-links { font-size: 14px; }
.section-head { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 12px; }
.panel.danger { background: #fde8e8; border-color: #d33; color: #7a1010; animation: pulse-danger 1.4s ease-in-out infinite; }
@keyframes pulse-danger { 0%,100% { box-shadow: 0 0 0 0 rgba(211,51,51,.5); } 50% { box-shadow: 0 0 0 8px rgba(211,51,51,0); } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .panel.danger { background: #4a1414; color: #ffd6d6; } }
:root[data-theme="dark"] .panel.danger { background: #4a1414; color: #ffd6d6; }

/* ---- hamburger menu ---- */
.menu-wrap { position: relative; margin-right: -14px; }
.menu-btn { display: flex; flex-direction: column; justify-content: center; gap: 4px; width: 38px; height: 38px; padding: 0 9px; border: 0; background: transparent; border-radius: 10px; cursor: pointer; }
.menu-btn span { display: block; height: 2px; border-radius: 2px; background: var(--text); }
.menu-btn:hover { background: var(--panel-2); }
.menu-panel { position: absolute; top: 46px; left: 0; z-index: 30; min-width: 250px; padding: 8px; background: var(--panel); border: 1px solid var(--border);
              border-radius: 14px; box-shadow: var(--shadow-md); }
.topbar .menu-panel { display: flex; flex-direction: column; gap: 2px; flex: none; }
.topbar .menu-panel[hidden] { display: none; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--text); font-weight: 500; }
.menu-item:hover { background: var(--panel-2); color: var(--text); }
.menu-item .mi-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-bg); font-size: 15px; }
.menu-hint { padding: 8px 10px; color: var(--muted); font-size: 13px; max-width: 240px; }

/* ---- compact hub ---- */
.hub-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.hub-bar h1 { margin: 0; font-size: 24px; }
.hub-tools { display: flex; gap: 8px; align-items: center; }
.hub-sections { display: flex; flex-direction: column; gap: 4px; }
.hub-section { padding: 0; }
.hub-section-head { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; }
.hub-section-head .section-head { margin: 0; flex: 1; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; min-height: 12px; }
.tile { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--panel); border: 1px solid var(--border);
        border-radius: 12px; color: var(--text); box-shadow: var(--shadow-sm); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; min-width: 0; }
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--border-strong); color: var(--text); }
.tile .t-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-bg); font-size: 17px; }
.tile .t-body { min-width: 0; flex: 1; }
.tile .t-name { font-weight: 650; font-size: 15px; line-height: 1.25; }
.tile .t-desc { color: var(--muted); font-size: 12.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .t-status { margin-left: 6px; vertical-align: 1px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tile .t-status.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tile .t-status.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
/* customize mode */
.tile .t-rename { flex: none; width: 28px; height: 28px; padding: 0; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); cursor: pointer; font-size: 14px; }
.tile .t-rename:hover { color: var(--accent); border-color: var(--accent); }
.editing .tile { cursor: grab; border-style: dashed; }
.editing .tile::after { content: "\2630"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; opacity: .6; }
.editing .tile .t-rename { margin-right: 20px; }
.editing .tile .t-status { display: none; }
.sortable-ghost { opacity: .35; }
.hub-name-input { display: none; font: inherit; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--panel); color: var(--text); width: 240px; max-width: 60%; }
.editing .hub-name-input { display: inline-block; } .editing .hub-section-head .section-head { display: none; }
.hub-edit-only { display: none; } .editing .hub-edit-only { display: inline-flex; } .editing .hub-view-only { display: none; }
.handle { cursor: grab; color: var(--muted); user-select: none; padding: 2px 6px; }
.hub-menu-zone { margin-top: 18px; padding: 12px; border: 2px dashed var(--accent); border-radius: 14px; background: var(--accent-bg); }
.hub-menu-zone h3 { margin: 0 0 8px; font-size: 14px; }
.hub-menu-zone .hint { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.hub-menu-zone .hub-grid { min-height: 62px; padding: 6px; border-radius: 10px; background: color-mix(in srgb, var(--panel) 55%, transparent); align-content: start; }
.hub-menu-zone .hub-grid:empty::before { content: "Drop tools here"; color: var(--muted); font-size: 13px; padding: 14px 4px; }

/* the hidden attribute must always win (button and other component styles set their own display) */
[hidden] { display: none !important; }

/* ======================================================================
   Standard UI kit (2026-10-17, Ryan: "follow standard UI conventions").
   - .page-bar: title on the left, the ONE primary action (+ secondary) on the right.
   - dialog.dlg: small pop-up form (only the fields that are needed) opened by [data-open="id"], closed by [data-close].
   - .kebab: the "..." overflow menu for rare or destructive actions (Delete, Remove, corrections).
   - .linkbtn: a small text button for rare actions.  .danger-zone: Remove/Delete section at the bottom of an Edit page.
   ====================================================================== */
.page-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 24px; }
.page-bar > :first-child { flex: 1 1 320px; min-width: 0; }
.page-bar h1 { margin-bottom: 4px; } .page-bar p { margin: 0; color: var(--muted); }
.page-bar .btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
dialog.dlg { border: 1px solid var(--border); border-radius: 16px; padding: 0; max-width: 460px; width: calc(100% - 32px); background: var(--panel); color: var(--text);
             box-shadow: 0 20px 50px rgb(0 0 0 / .28); }
dialog.dlg::backdrop { background: rgb(15 20 40 / .45); }
dialog.dlg.wide { max-width: 640px; }
dialog.dlg > form, dialog.dlg > .dlg-body { padding: 20px 22px; display: grid; gap: 14px; margin: 0; }
dialog.dlg > form:empty { display: none; }
dialog.dlg h3 { margin: 0; font-size: 19px; letter-spacing: -.01em; }
dialog.dlg .field { margin: 0; } dialog.dlg label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
dialog.dlg label.check { font-weight: 400; display: flex; gap: 8px; align-items: center; margin: 0; }
dialog.dlg .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.kebab { position: relative; flex: none; }
.kebab > summary { list-style: none; cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px;
                   font-size: 20px; line-height: 1; color: var(--muted); user-select: none; }
.kebab > summary::-webkit-details-marker { display: none; }
.kebab > summary:hover, .kebab[open] > summary { background: var(--panel-2); color: var(--text); }
.kebab-list { position: absolute; right: 0; top: 40px; z-index: 20; min-width: 190px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
              box-shadow: var(--shadow-md); padding: 6px; }
.kebab-list form { margin: 0; }
.kebab-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 8px; font: inherit; font-size: 14.5px; color: var(--text);
              cursor: pointer; text-decoration: none; }
.kebab-item:hover { background: var(--panel-2); color: var(--text); } .kebab-item.danger { color: var(--danger); }
/* `.kebab-menu` is the same menu written with plain links, buttons and forms inside (no per-item class needed) */
.kebab-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
              box-shadow: var(--shadow-md); padding: 6px; display: flex; flex-direction: column; gap: 1px; }
.kebab-menu form { margin: 0; display: block; }
.kebab-menu > a, .kebab-menu > button, .kebab-menu form > button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; font: inherit; font-size: 14.5px;
              font-weight: 500; color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; }
.kebab-menu > a:hover, .kebab-menu > button:hover, .kebab-menu form > button:hover { background: var(--panel-2); color: var(--text); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:hover { color: var(--accent-hover); }
.danger-zone { border: 1px solid var(--danger-border); border-radius: var(--radius); padding: 16px 20px; margin-top: 24px; background: var(--panel); }
.danger-zone h2 { font-size: 16px; margin: 0 0 6px; } .danger-zone p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.list-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.chip-note { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: var(--panel-2); color: var(--muted); }
@media (max-width: 560px) { dialog.dlg .two { grid-template-columns: 1fr; } }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

/* Favorites: the star on a tile, and the Favorites box at the top of the main page */
.tile .t-fav { flex: none; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--text); font-size: 18px; cursor: pointer; opacity: .6; transition: opacity .12s, color .12s; }
.tile:hover .t-fav, .tile .t-fav.on, .tile .t-fav:focus-visible { opacity: 1; }
.tile .t-fav.on { color: #e0a100; } .tile .t-fav:hover { color: #e0a100; }
.hub-fav-empty { margin-top: 6px; color: var(--muted); font-size: 13px; } .hub-fav-empty[hidden] { display: none; }
.hub-fav { margin-bottom: 22px; } .hub-fav .hub-grid { margin-top: 8px; } .hub-fav-hidden { display: none; }
.editing .hub-fav { display: none; }
.editing .tile .t-fav { display: none; }

/* Main page: tiles or list, foldable sections (this browser's choice, see hub.html) */
.hub-viewtoggle { display: inline-flex; gap: 0; align-items: center; }
.hub-viewtoggle .btn { border-radius: 0; margin-left: -1px; }
.hub-viewtoggle .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.hub-viewtoggle #hub-v-list { border-radius: 0 8px 8px 0; }
.hub-viewtoggle #hub-collapse-all { border-radius: 8px; margin-left: 8px; }
.hub-viewtoggle .btn[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); position: relative; }
.hub-section-head .section-head { cursor: pointer; user-select: none; }
.hub-section-head .section-head::before { content: "\25BE"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .12s; }
.hub-section.collapsed .hub-section-head .section-head::before { transform: rotate(-90deg); }
.hub-section.collapsed .hub-grid { display: none; }
.editing .hub-section.collapsed .hub-grid { display: grid; }
.editing .hub-section-head .section-head { cursor: default; }
body.hub-as-list .hub-sections .hub-grid, body.hub-as-list .hub-fav .hub-grid { grid-template-columns: 1fr; gap: 3px; }
body.hub-as-list .hub-sections .tile, body.hub-as-list .hub-fav .tile { padding: 5px 12px; }
body.hub-as-list .tile .t-icon { width: 28px; height: 28px; font-size: 15px; }
body.hub-as-list .tile .t-name { font-size: 14.5px; }
body.hub-as-list .editing .hub-grid, body.hub-as-list.editing .hub-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.hub-searching .hub-section.collapsed .hub-grid { display: grid; }

/* theme button in the top bar */
.theme-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; width: 30px; height: 30px; font-size: 15px; line-height: 1; cursor: pointer; padding: 0; display: inline-grid; place-items: center; }
.theme-btn:hover { color: var(--text); border-color: var(--border-strong); }
