﻿/* ------------------------------------------------------------------
   Generated data-admin styling
   Palette: ink spruce sidebar, paper content, amber action accent
------------------------------------------------------------------- */
:root {
    /* These bridge to the active theme (injected by the layout as --c-* variables),
       falling back to the original palette when no theme is applied. */
    --ink: var(--c-header-bg, #17282b);
    --ink-2: #21393d;
    --paper: var(--c-page-bg, #f6f7f6);
    --card: #ffffff;
    --line: #dfe4e2;
    --text: var(--c-text, #22302f);
    --muted: #6b7a77;
    --accent: var(--c-accent, #b95f2f);
    --accent-soft: #f4e3d7;
    --primary: var(--c-primary, #2F5D62);
    --ok: #1a7f37;
    --bad: #b42318;
    --mono: "Cascadia Code", "Consolas", ui-monospace, monospace;
    --app-font-stack: var(--app-font, "Segoe UI", system-ui, -apple-system, sans-serif);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--text);
    font: 15px/1.55 var(--app-font-stack);
}

.shell { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.sidenav {
    width: 248px;
    flex: 0 0 248px;
    background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 100%);
    color: #d7e0dd;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-family: var(--mono);
    letter-spacing: .5px;
}

.brand-name { font-weight: 600; letter-spacing: .2px; }
.brand-logo { max-height: 38px; max-width: 220px; display: block; }

.nav-label {
    padding: 16px 16px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: #8fa39e;
}

.nav-tables { display: flex; flex-direction: column; padding: 0 8px 12px; }

.nav-tables a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin: 1px 0;
    border-radius: 8px;
    color: #cfdad6;
    text-decoration: none;
    font-size: 14px;
}

.nav-tables a:hover { background: rgba(255,255,255,.07); color: #fff; }

.nav-tables .tbadge {
    width: 22px; height: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,.12);
    font-family: var(--mono);
    font-size: 11px;
    color: #fff;
}

.nav-foot {
    margin-top: auto;
    padding: 14px 16px;
    font-size: 11px;
    color: #7d918c;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ---------- content ---------- */
.content { flex: 1; padding: 26px 30px 60px; min-width: 0; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.page-head h1 { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.01em; }

.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--c-button, var(--accent));
    background: var(--c-button, var(--accent));
    color: var(--c-button-text, #fff);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { filter: brightness(1.06); }

.btn-outline { background: #fff; color: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); filter: none; }

.btn-quiet {
    background: transparent;
    border-color: var(--line);
    color: var(--text);
    font-weight: 500;
}
.btn-quiet:hover { background: #eef1f0; filter: none; }

.btn-danger { background: #fff; border-color: #e6b6b0; color: var(--bad); }
.btn-danger:hover { background: #fbeceb; filter: none; }

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

/* ---------- cards / tables ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.table-wrap { overflow-x: auto; }

table.grid { border-collapse: collapse; width: 100%; font-size: 14px; }

table.grid th {
    text-align: left;
    padding: 10px 12px;
    background: #fbfcfb;
    border-bottom: 1px solid var(--line);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    white-space: nowrap;
}

table.grid td {
    padding: 9px 12px;
    border-bottom: 1px solid #edf0ef;
    white-space: nowrap;
    max-width: 340px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Action cells hold several buttons - never clip them; let them wrap if needed. */
table.grid td.row-actions {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}
table.grid td.row-actions form { margin: 0; }
table.grid td.row-actions .btn { margin: 2px 2px; }

table.grid tr:hover td { background: #f7f9f8; }

td.actions { text-align: right; }
td.actions form { display: inline; }

.pk-chip {
    font-family: var(--mono);
    font-size: 12px;
    background: #eef1f0;
    border-radius: 5px;
    padding: 1px 6px;
}

/* ---------- forms ---------- */
.form-card { max-width: 720px; padding: 24px; }

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 5px;
}

.field .type-chip {
    font-weight: 400;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    margin-left: 6px;
}

.field .req { color: var(--bad); margin-left: 3px; }

.field input[type=text],
.field input[type=number],
.field input[type=datetime-local],
.field input[type=date],
.field input[type=time],
.field select,
.field textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    color: var(--text);
}

.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.field input[readonly] { background: #f2f4f3; color: var(--muted); }

.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- alerts ---------- */
.alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error { background: #fbeceb; border: 1px solid #f1c1bb; color: var(--bad); }
.alert-ok { background: #e8f4ec; border: 1px solid #bfe0ca; color: var(--ok); }
.alert-info { background: #eef3f8; border: 1px solid #c9dcee; color: #1c4d7c; }

/* ---------- home tiles ---------- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.tile {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    display: block;
}

.tile:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(23,40,43,.06); }

.tile .tbadge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-family: var(--mono);
    font-size: 13px;
    margin-bottom: 10px;
}

.tile h3 { margin: 0 0 4px; font-size: 15px; }
.tile p { margin: 0; color: var(--muted); font-size: 12px; }

/* ---------- excel page ---------- */
.excel-help {
    background: #fbfcfb;
    border: 1px dashed var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13.5px;
    color: var(--muted);
    margin-bottom: 18px;
}

.excel-help code {
    font-family: var(--mono);
    background: #eef1f0;
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--text);
}

.check-row { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.pager .info { color: var(--muted); font-size: 13px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 14px; }
.searchbar input {
    flex: 1;
    max-width: 340px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

@media (max-width: 820px) {
    .shell { flex-direction: column; }
    .sidenav { width: 100%; flex: none; height: auto; position: static; }
    .content { padding: 18px 14px 50px; }
}

/* ------------------------------------------------------------------ */
/*  Sign-in / reset pages (bare layout)                                */
/* ------------------------------------------------------------------ */
body.bare {
    background: #17282b;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

.gate {
    width: 100%;
    max-width: 400px;
    padding: 24px;
    display: flex;
    flex-direction: var(--gate-dir, column);
    align-items: center;
    gap: 18px;
}
/* When the logo sits left/right, widen the container to fit both side by side. */
.gate.gate-left, .gate.gate-right { max-width: 640px; }
.gate-body { width: 100%; max-width: 400px; }

.gate-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #f6f7f6;
    text-align: center;
}
.gate-logo { display: block; object-fit: contain; }

.gate-brand .brand-name {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .01em;
}

.gate-card {
    background: #fff;
    border-radius: 10px;
    padding: 26px 24px 22px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}

.gate-card h1 {
    margin: 0 0 16px;
    font-size: 20px;
}

.gate-foot {
    margin-top: 14px;
    text-align: center;
    font-size: 12px;
    color: rgba(246, 247, 246, .5);
}

/* ------------------------------------------------------------------ */
/*  Users, permissions and shared bits                                 */
/* ------------------------------------------------------------------ */
.nav-empty {
    display: block;
    padding: 8px 14px;
    font-size: 12.5px;
    color: rgba(246, 247, 246, .45);
    line-height: 1.5;
}

.badge-ok,
.badge-off {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-ok {
    background: #e4efe6;
    color: #2c5c38;
}

.badge-off {
    background: #f1e2dc;
    color: #8a3d20;
}

.perm-grid td.c,
.perm-grid th.c {
    text-align: center;
    width: 74px;
}

.perm-grid input[type=checkbox] {
    width: 17px;
    height: 17px;
    accent-color: #b95f2f;
}

.perm-grid .tbadge {
    margin-right: 6px;
}

.section-rule {
    margin: 20px 0 12px;
    padding-top: 14px;
    border-top: 1px solid #e3e5e2;
    font-weight: 600;
    font-size: 13.5px;
}

.muted {
    color: #6d7975;
    font-size: 12.5px;
    font-weight: 400;
}

/* Inline editors inside the admin configuration grids */
.grid input[type=text],
.grid input[type=number] {
    width: 100%;
    padding: 5px 7px;
    border: 1px solid #d7dbd7;
    border-radius: 5px;
    font: inherit;
    font-size: 12.5px;
    background: #fff;
}

.grid input.tiny {
    width: 56px;
    text-align: center;
}

/* Stored procedure output */
.proc-messages {
    margin: 0;
    padding: 12px 14px;
    background: #17282b;
    color: #dfe6e2;
    border-radius: 8px;
    font-family: Consolas, "SF Mono", Menlo, monospace;
    font-size: 12.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* ================================================================== */
/*  Top navigation bar                                                 */
/* ================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0;
    height: 48px;
    background: var(--c-header-bg, #17282b);
    padding: 0 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--c-header-text, #f6f7f6);
    text-decoration: none;
    margin-right: 16px;
    flex-shrink: 0;
}
.topbar .brand-mark {
    background: var(--c-accent, #b95f2f);
    color: #fff;
    border-radius: 6px;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px;
}
.topbar .brand-name { font-weight: 600; font-size: 15px; }

/* No overflow:hidden here - it would clip the dropdowns, which are
   absolutely positioned below the 48px bar. */
.topnav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; flex-wrap: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 2px; flex-shrink: 0; margin-left: auto; }

.topnav-item {
    display: inline-flex; align-items: center;
    height: 34px; padding: 0 12px;
    color: rgba(246,247,246,.85);
    font-size: 13.5px; white-space: nowrap;
    border-radius: 6px; border: none; background: none;
    cursor: pointer; font-family: inherit;
    transition: background .15s;
}
.topnav-item:hover, .topnav-item:focus { background: rgba(255,255,255,.1); color: #fff; outline: none; }
.topnav-toggle { gap: 4px; }

.topnav-empty { color: rgba(246,247,246,.45); font-size: 13px; padding: 0 12px; }

.topnav-group { position: relative; }
.topnav-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); left: 0;
    min-width: 200px; background: #fff;
    border: 1px solid #dde0dc; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 6px 0; z-index: 500;
}
.topnav-dropdown-right { left: auto; right: 0; }

/* Open on hover / keyboard focus so the menus work without JavaScript,
   and on .open which the click handler toggles. */
.topnav-group:hover > .topnav-dropdown,
.topnav-group:focus-within > .topnav-dropdown,
.topnav-dropdown.open { display: block; }
.topnav-dropdown a {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px; color: #1e2d2b; font-size: 13.5px;
    text-decoration: none;
}
.topnav-dropdown a:hover { background: #f3f5f2; }
.topnav-dropdown .tbadge { font-size: 10px; width: 20px; height: 20px; }

/* adjust shell so it doesn't include a topbar height margin */
.shell { display: flex; min-height: calc(100vh - 48px); }

/* ================================================================== */
/*  Sortable grid headers and per-column filters                       */
/* ================================================================== */
.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: #b95f2f; }

.grid-filter td { padding: 4px 6px; background: #f9faf8; }
.col-filter {
    width: 100%; padding: 4px 7px;
    border: 1px solid #d7dbd7; border-radius: 5px;
    font: inherit; font-size: 12px; background: #fff;
}

/* ================================================================== */
/*  Pager                                                              */
/* ================================================================== */
.pager {
    display: flex; align-items: center; flex-wrap: wrap;
    gap: 12px; margin-top: 16px; padding: 10px 0;
    border-top: 1px solid #e3e5e2;
}
.pager-nav { display: flex; align-items: center; gap: 4px; }
.pager-info { font-size: 13px; color: #6d7975; padding: 0 6px; }
.pager-controls {
    display: flex; align-items: center; gap: 10px;
    margin-left: auto;
}
.pager-controls label { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.pager-controls select { padding: 4px 6px; border-radius: 5px; border: 1px solid #d7dbd7; font: inherit; }
.pager-goto { width: 56px; padding: 4px 6px; border-radius: 5px; border: 1px solid #d7dbd7; font: inherit; }
.btn.disabled { opacity: .4; pointer-events: none; }

/* ================================================================== */
/*  Searchable select (live filtering in dropdowns)                    */
/* ================================================================== */
.sel-wrap { position: relative; }
.sel-search {
    width: 100%; padding: 6px 10px;
    border: 1px solid #d0d4d0; border-radius: 6px 6px 0 0;
    font: inherit; font-size: 13px;
    border-bottom: none; box-sizing: border-box;
    background: #f9faf8;
}
.sel-list {
    max-height: 240px; overflow-y: auto;
    border: 1px solid #d0d4d0; border-radius: 0 0 6px 6px;
    background: #fff;
}
.sel-list label {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; cursor: pointer; font-size: 13.5px;
    border-bottom: 1px solid #f0f2ef;
}
.sel-list label:last-child { border-bottom: none; }
.sel-list label:hover { background: #f3f5f2; }
.sel-list label.hidden { display: none; }
.sel-list input[type=radio] { accent-color: #b95f2f; }
.sel-empty { padding: 10px; color: #888; font-size: 13px; }

/* When every table sits under a top menu there is no sidebar to show.
   Use the full available width (like the sidebar layout) rather than a narrow
   centred column, so the grid is just as wide for users as for admins. */
.shell.no-side .content {
    width: 100%;
    max-width: none;
    margin: 0;
}

.topnav-hint {
    color: rgba(246, 247, 246, .55);
    font-style: italic;
    text-decoration: none;
}
.topnav-hint:hover { color: #fff; }

/* ================================================================== */
/*  Report builder                                                     */
/* ================================================================== */
.col-builder { margin-top: 6px; }
.col-list { list-style: none; margin: 0; padding: 0; }
.col-item {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 7px 10px; margin-bottom: 4px;
    background: #f9faf8; border: 1px solid #e3e5e2; border-radius: 6px;
    cursor: default;
}
.col-item.dragging { opacity: .5; }
.col-item .drag { cursor: grab; color: #9aa5a0; font-size: 16px; user-select: none; }
.col-item .col-pick { flex: 1; min-width: 180px; display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.col-item .hdr { width: 160px; padding: 4px 7px; border: 1px solid #d7dbd7; border-radius: 5px; font: inherit; font-size: 12.5px; }
.col-item .col-filt,
.col-item .col-blank,
.col-item .col-load { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #6d7975; white-space: nowrap; }
.col-item input[type=checkbox] { accent-color: #b95f2f; }

.logo-preview { display: block; max-height: 44px; margin: 4px 0; border: 1px solid #e3e5e2; border-radius: 4px; padding: 3px; background: #fff; }
.check-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #8a3d20; margin-left: 8px; }

.report-filters .filter-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

/* Report run-page multi-value filters */
.filter-box { border: 1px solid #e3e5e2; border-radius: 8px; padding: 10px 12px; background: #fff; }
.filter-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #1e2d2b; }
.filter-values { max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.filter-check { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 2px 0; cursor: pointer; }
.filter-check input { accent-color: #b95f2f; }
.filter-text { width: 100%; padding: 6px 9px; border: 1px solid #d7dbd7; border-radius: 6px; font: inherit; font-size: 13px; }
.loading-vals { font-size: 12px; }

/* Report settings list toggle + radio rows + viewer picker */
.toggle {
    border: 1px solid #c9cec9; background: #fff; color: #6d7975;
    border-radius: 20px; padding: 3px 14px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.toggle.on { background: #2c5c38; border-color: #2c5c38; color: #fff; }
.radio-row { display: flex; flex-wrap: wrap; gap: 16px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 400; }
.radio-row input[type=radio] { accent-color: #b95f2f; }
.logo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.viewer-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; max-height: 240px; overflow-y: auto; }
.viewer-check { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 3px 0; }
.viewer-check input { accent-color: #b95f2f; }
.col-item .sortsel { padding: 4px 6px; border: 1px solid #d7dbd7; border-radius: 5px; font: inherit; font-size: 12px; }

/* Report field width-weight input */
.col-item .col-wt { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #6d7975; }
.col-item .wt { width: 44px; padding: 4px 6px; border: 1px solid #d7dbd7; border-radius: 5px; font: inherit; font-size: 12px; }

/* Report sort builder */
.sort-builder { }
.sort-add { display: flex; gap: 8px; margin-bottom: 10px; }
.sort-add select { flex: 1; padding: 6px 9px; border: 1px solid #d7dbd7; border-radius: 6px; font: inherit; }
.sort-list { list-style: none; margin: 0; padding: 0; }
.sort-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; margin-bottom: 4px;
    background: #f9faf8; border: 1px solid #e3e5e2; border-radius: 6px;
}
.sort-item .sc { flex: 1; font-size: 13.5px; }
.sort-item .sp { flex: 0; }
.sort-item button {
    border: 1px solid #c9cec9; background: #fff; border-radius: 5px;
    padding: 3px 8px; font-size: 12px; cursor: pointer;
}
.sort-item .dir { min-width: 62px; }
.sort-item .rm { color: #a23; border-color: #e0c3c3; }

/* Report field "blank" checkbox + run-page blank filter option */
.col-item .col-blank { display: flex; align-items: center; gap: 5px; font-size: 12px; color: #6d7975; white-space: nowrap; }
.col-item .col-blank input { accent-color: #b95f2f; }
.filter-blank { font-style: italic; color: #6d7975; border-bottom: 1px dashed #d7dbd7; padding-bottom: 3px; margin-bottom: 3px; }

/* Export dropdown on table list pages */
.export-menu { position: relative; display: inline-block; }
.export-menu > summary { list-style: none; cursor: pointer; user-select: none; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu[open] > summary { background: #eef1ee; }
.export-options {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 400;
    background: #fff; border: 1px solid #d7dbd7; border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.12); min-width: 260px; padding: 6px;
}
.export-options a {
    display: block; padding: 8px 10px; border-radius: 6px;
    text-decoration: none; color: #1e2d2b; font-weight: 600; font-size: 13.5px;
}
.export-options a:hover { background: #f3f5f2; }
.export-options a span {
    display: block; font-weight: 400; font-size: 11.5px; color: #6d7975; margin-top: 1px;
}

/* Activity log */
.filter-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.filter-row label { display: flex; flex-direction: column; font-size: 12px; color: #6d7975; gap: 4px; }
.filter-row select, .filter-row input[type=date] {
    padding: 6px 9px; border: 1px solid #d7dbd7; border-radius: 6px; font: inherit; font-size: 13px;
}
.log-details { font-size: 12px; color: #55605c; max-width: 420px; word-break: break-word; }

/* Saved searches + create-report row (reports) */
.saved-search { display:inline-flex; align-items:center; gap:6px; flex-wrap:wrap; margin-left:auto; }
.saved-search .saved-select { min-width:160px; padding:6px 8px; }
.saved-search .save-name { padding:6px 8px; min-width:150px; }
.report-filters .form-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.row-form { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; }
.row-form label { display:flex; flex-direction:column; gap:4px; font-size:13px; }
.row-form input, .row-form select { padding:7px 9px; }
.col-load { white-space:nowrap; }
.btn.disabled, .btn:disabled { opacity:.5; pointer-events:none; }

/* Mixed report layout: chart + table stacked, order controlled by chart position */
.results-flow { display: flex; flex-direction: column; gap: 16px; }
.results-flow.chart-bottom { flex-direction: column-reverse; }
.results-flow .result-table { display: flex; flex-direction: column; gap: 12px; }

/* Multi-level group builder on the report Fields page */
.mini-grid { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.mini-grid th { text-align: left; font-size: 12px; color: var(--muted, #6D7975); font-weight: 600;
    padding: 4px 6px; border-bottom: 1px solid var(--line, #E0E3E0); }
.mini-grid td { padding: 4px 6px; border-bottom: 1px solid var(--line, #F0F2F0); vertical-align: middle; }
.mini-grid td.c, .mini-grid th.c { text-align: center; }
.mini-grid select { width: 100%; }
.group-row .reorder { white-space: nowrap; }
.linkish { background: none; border: none; cursor: pointer; color: var(--c-primary, #2F5D62);
    font-size: 12px; padding: 0 3px; line-height: 1; }
.linkish:hover { opacity: .7; }

/* Busy state for buttons that trigger a synchronous download */
.btn.is-busy { opacity: .7; position: relative; }
.btn.is-busy::after {
    content: ""; display: inline-block; width: 12px; height: 12px; margin-left: 8px;
    vertical-align: -2px; border: 2px solid currentColor; border-right-color: transparent;
    border-radius: 50%; animation: btnspin .7s linear infinite;
}
@keyframes btnspin { to { transform: rotate(360deg); } }

/* ==== Configurable home dashboard ==== */
.dash-cell { display: flex; flex-direction: column; overflow: hidden; }
.dash-cell-title { font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--c-text, #243230); }
.dash-empty { flex: 1; min-height: 60px; }
.dash-noaccess { color: var(--muted, #6D7975); font-size: 13px; font-style: italic; padding: 12px 0; }
.dash-count { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; flex: 1; gap: 6px; }
.dash-count-num { font-size: 40px; font-weight: 700; line-height: 1; color: var(--c-primary, #2F5D62); }
.dash-count-link { font-size: 13px; color: var(--muted, #6D7975); text-decoration: none; }
.dash-count-link:hover { text-decoration: underline; }
.dash-chart-wrap { position: relative; flex: 1; min-height: 180px; }
.dash-table-wrap { flex: 1; overflow: auto; }
.dash-table { width: 100%; font-size: 12.5px; }
.dash-table th, .dash-table td { padding: 5px 8px; }
.dash-open { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--c-primary, #2F5D62); text-decoration: none; }
.dash-open:hover { text-decoration: underline; }

/* Small, non-blocking loading indicator (report apply/sort/page/search/export).
   Fixed to the bottom-right; never covers the page or blocks clicks. */
.loading-overlay {
    position: fixed; right: 20px; bottom: 20px; z-index: 9999;
    display: none; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--line, #E0E3E0);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    border-radius: 10px; padding: 10px 14px;
    pointer-events: none;   /* clicks pass through; page stays usable */
}
.loading-overlay.show { display: flex; }
.loading-overlay .spinner {
    width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: var(--c-primary, #2F5D62);
    animation: loadspin 0.8s linear infinite; flex: none;
}
.loading-overlay .loading-text {
    font-size: 13px; font-weight: 600; color: var(--c-text, #243230); white-space: nowrap;
}
@keyframes loadspin { to { transform: rotate(360deg); } }

/* Inbox icon + unread badge in the top nav */
.topnav-inbox { position: relative; font-size: 18px; line-height: 1; padding: 8px 10px; text-decoration: none; }
.inbox-badge {
    position: absolute; top: 2px; right: 0;
    background: var(--c-accent, #B95F2F); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
}

/* Typed (number/date) report filter */
.typed-filter { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.typed-filter .typed-op { flex: none; width: auto; }
.typed-filter input { flex: 1; min-width: 90px; }

/* Report-group headings on the reports list */
.report-group-head {
    font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted, #6D7975); margin: 18px 0 8px; padding-bottom: 4px;
    border-bottom: 1px solid var(--line, #E0E3E0);
}
.report-group-head:first-of-type { margin-top: 4px; }

/* Two-column field layout (used on several settings forms) */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* "Private" badge on report tiles (shown only to report builders/admins) */
.tile .tbadge.tbadge-private {
    background: var(--c-accent, #B95F2F); color: #fff; font-weight: 700;
    letter-spacing: .03em; text-transform: uppercase;
    width: auto; height: auto; min-width: 0;
    padding: 3px 10px; border-radius: 999px;
    font-size: 11px; font-family: inherit;
}

/* Edit-in-modal (iframe) sub-window for table rows */
.edit-modal-backdrop {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.45);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow: auto;
}
.edit-modal {
    position: relative; background: var(--c-page-bg, #F5F7F5);
    width: 100%; max-width: 720px; border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0,0,0,.3); overflow: hidden;
}
.edit-modal-frame { width: 100%; height: 70vh; border: 0; display: block; background: var(--c-page-bg,#F5F7F5); }
.edit-modal-close {
    position: absolute; top: 8px; right: 10px; z-index: 2;
    background: rgba(255,255,255,.85); border: 1px solid var(--line,#E0E3E0);
    border-radius: 50%; width: 30px; height: 30px; font-size: 20px; line-height: 1;
    cursor: pointer; color: var(--c-text,#243230);
}
.edit-modal-close:hover { background: #fff; }

/* Report type icon on tiles */
.rpt-icon { display:inline-flex; vertical-align:-2px; margin-right:6px; color: var(--c-primary, #2F5D62); }
.rpt-icon svg { fill: currentColor; }

/* "all" toggle links in the permissions column headers */
.perm-grid .col-all {
    font-size: 10px; font-weight: 400; text-transform: none;
    color: var(--c-primary, #2F5D62); text-decoration: none; letter-spacing: 0;
}
.perm-grid .col-all:hover { text-decoration: underline; }

/* Static (rich content) dashboard cell */
.dash-static { flex: 1; overflow: auto; font-size: 13.5px; color: var(--c-text, #243230); line-height: 1.5; }
.dash-static img { max-width: 100%; height: auto; }
.dash-static a { color: var(--c-primary, #2F5D62); }
.dash-static h1, .dash-static h2, .dash-static h3 { margin: 0.2em 0 0.3em; }
.dash-static ul, .dash-static ol { margin: 0.3em 0 0.3em 1.2em; }

/* =======================================================================
   Mobile / responsive navigation (hamburger menu)
   ======================================================================= */

/* The topbar-collapse wraps the nav + right side. On desktop it's transparent
   and just lays them out in a row; on mobile it becomes the dropdown panel. */
.topbar-collapse { display: flex; align-items: center; flex: 1; min-width: 0; }

/* Hamburger button — hidden on desktop, shown on small screens. */
.nav-toggle {
    display: none;
    margin-left: auto;
    width: 40px; height: 36px;
    background: none; border: none; cursor: pointer;
    flex-direction: column; justify-content: center; gap: 5px;
    padding: 0 8px;
}
.nav-toggle span {
    display: block; height: 2px; width: 22px;
    background: var(--c-header-text, #f6f7f6); border-radius: 2px;
    transition: transform .2s, opacity .2s;
}
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Section labels inside a dropdown (used to organise the Admin menu). */
.dropdown-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted, #8a948f); padding: 8px 14px 3px; margin-top: 2px;
    border-top: 1px solid #eef1ee;
}
.dropdown-label:first-child { border-top: none; margin-top: 0; }
.topnav-dropdown-wide { min-width: 230px; }

@media (max-width: 900px) {
    .topbar { flex-wrap: wrap; height: auto; min-height: 48px; padding: 0 10px; }
    .nav-toggle { display: flex; }

    /* Collapse panel: full-width, drops below the bar, hidden until toggled. */
    .topbar-collapse {
        display: none;
        flex-basis: 100%; width: 100%;
        flex-direction: column; align-items: stretch;
        background: var(--c-header-bg, #17282b);
        padding: 6px 0 10px;
        max-height: calc(100vh - 48px); overflow-y: auto;
    }
    .topbar-collapse.open { display: flex; }

    .topnav, .topbar-right {
        display: flex; flex-direction: column; align-items: stretch;
        width: 100%; gap: 0; margin: 0;
    }

    /* Each item becomes a full-width row. */
    .topnav-item {
        height: auto; width: 100%; justify-content: flex-start;
        padding: 11px 16px; border-radius: 0; font-size: 15px;
    }
    .topnav-group { width: 100%; }

    /* Dropdowns render inline (stacked) instead of floating overlays. */
    .topnav-dropdown {
        position: static; display: none; width: 100%;
        min-width: 0; border: none; border-radius: 0; box-shadow: none;
        background: rgba(0,0,0,.18); padding: 2px 0;
    }
    .topnav-group:hover > .topnav-dropdown,
    .topnav-group:focus-within > .topnav-dropdown { display: none; }  /* no hover-open on touch */
    .topnav-dropdown.open { display: block; }
    .topnav-dropdown a {
        color: rgba(246,247,246,.9); padding: 10px 28px; font-size: 14px;
    }
    .topnav-dropdown a:hover { background: rgba(255,255,255,.08); }
    .dropdown-label { color: rgba(246,247,246,.55); border-top-color: rgba(255,255,255,.1); padding-left: 22px; }
    .topnav-toggle::after { content: ""; }

    /* Inbox + its badge inline. */
    .topnav-inbox { width: 100%; justify-content: flex-start; }
    .inbox-badge { position: static; margin-left: 8px; }

    /* Hide the "set up menus" hint on mobile to save room. */
    .topnav-hint { font-size: 14px; }
}

/* Make wide content (tables) scroll horizontally instead of breaking the layout. */
@media (max-width: 760px) {
    .content, .content-inner, .page { max-width: 100%; }
    .grid-wrap, .table-wrap, .report-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.grid, table.report-table { min-width: 560px; }
    .page-head { flex-wrap: wrap; gap: 8px; }
    .head-actions { flex-wrap: wrap; }
    .card, .form-card { padding-left: 14px; padding-right: 14px; }
}

/* Secondary user info (full name / email) under the username in the activity log */
.log-subtle { font-size: 11px; color: var(--muted, #8a948f); line-height: 1.3; }

/* Per-series chart colour pickers (report Settings) */
.series-colors { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin:4px 0; }
.series-color { display:inline-flex; align-items:center; gap:2px; }
.series-color input[type=color] { width:36px; height:30px; padding:1px; border:1px solid var(--line,#E0E3E0); border-radius:4px; }
.sc-remove { border:none; background:none; color:var(--muted,#8a948f); cursor:pointer; font-size:16px; line-height:1; padding:0 2px; }
.sc-remove:hover { color:var(--c-accent,#B95F2F); }
