/* App theme (2026-11-16). Loaded last by _Layout.cshtml and scoped to body.app-theme, so it wins over
   bootstrap.min.css and the Inspinia style.css that some pages load again inside their body.
   Every colour is a variable below: the light set on .app-theme, the dark set under
   html[data-theme="dark"]. The layout sets data-theme before the page draws (saved choice, otherwise
   the device's light/dark setting) and the sun/moon button in the top bar switches it. */

.app-theme {
    --brand: #2563eb;
    --brand-hover: #1d4ed8;
    --brand-soft: #eff6ff;
    --brand-ring: rgba(37, 99, 235, .18);
    --brand-border: #bfdbfe;
    --brand-border-hover: #93c5fd;
    --link: #2563eb;
    --link-hover: #1d4ed8;
    --nav-bg: #0f172a;
    --nav-text: #cbd5e1;
    --nav-hover: rgba(255, 255, 255, .08);
    --nav-border: transparent;
    --page-bg: #f4f6fa;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --hover: #f1f5f9;
    --stripe: #fbfcfe;
    --row-hover: #eff6ff;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --cell-line: #edf1f6;
    --divider: #dbe3ee;
    --band: #f9fbfd;
    --band-head: #f1f5f9;
    --text: #1e293b;
    --heading: #0f172a;
    --muted: #64748b;
    --faint: #cbd5e1;
    --label: #475569;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --danger-text: #b91c1c;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --danger-border-hover: #fca5a5;
    --owed: #b91c1c;
    --success: #15803d;
    --warning: #d97706;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
    --shadow-pop: 0 10px 30px rgba(15, 23, 42, .15), 0 2px 6px rgba(15, 23, 42, .06);
}

/* Dark palette */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body.app-theme {
    --brand: #2563eb;
    --brand-hover: #3b82f6;
    --brand-soft: rgba(59, 130, 246, .16);
    --brand-ring: rgba(96, 165, 250, .30);
    --brand-border: rgba(96, 165, 250, .40);
    --brand-border-hover: rgba(96, 165, 250, .65);
    --link: #60a5fa;
    --link-hover: #93c5fd;
    --nav-bg: #0b1220;
    --nav-text: #cbd5e1;
    --nav-hover: rgba(255, 255, 255, .07);
    --nav-border: #1e293b;
    --page-bg: #0f1626;
    --surface: #151e31;
    --surface-alt: #1a2438;
    --hover: #222e45;
    --stripe: rgba(148, 163, 184, .035);
    --row-hover: rgba(59, 130, 246, .12);
    --border: #26324a;
    --border-strong: #34425e;
    --cell-line: #202b40;
    --divider: #2e3b55;
    --band: rgba(148, 163, 184, .045);
    --band-head: #1f2a40;
    --text: #dbe3ee;
    --heading: #f1f5f9;
    --muted: #94a3b8;
    --faint: #475569;
    --label: #b6c2d3;
    --danger: #dc2626;
    --danger-hover: #ef4444;
    --danger-text: #f87171;
    --danger-soft: rgba(239, 68, 68, .12);
    --danger-border: rgba(248, 113, 113, .35);
    --danger-border-hover: rgba(248, 113, 113, .6);
    --owed: #f87171;
    --success: #4ade80;
    --warning: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .25);
    --shadow-pop: 0 14px 34px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .35);
}

/* ---------- Base ---------- */
html body.app-theme {
    background: var(--page-bg) !important; /* style.css forces body { background: #eee !important } */
    color: var(--text);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
.app-theme a { color: var(--link); }
.app-theme a:hover, .app-theme a:focus { color: var(--link-hover); }
.app-theme h1, .app-theme h2, .app-theme h3 { color: var(--heading); font-weight: 600; letter-spacing: -.01em; }
.app-theme h2 { font-size: 22px; margin: 4px 0 18px; }
.app-theme h3 { font-size: 18px; }
.app-theme h4, .app-theme h5 { color: var(--heading); font-weight: 600; }
.app-theme label { color: var(--label); font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.app-theme hr { border-color: var(--border); }
.app-theme .text-muted { color: var(--muted); }

/* ---------- Top bar ---------- */
.app-theme .navbar-static-top {
    background: var(--nav-bg);
    border: 0;
    border-bottom: 1px solid var(--nav-border);
    border-radius: 0;
    margin-bottom: 0;
    min-height: 56px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 2px 8px rgba(15, 23, 42, .25);
}
.app-theme .navbar-static-top .navbar-header { float: left; }
.app-theme .app-brand {
    display: flex; align-items: center; gap: 10px;
    height: 56px; padding: 0 22px 0 18px;
    color: #fff; font-size: 15px; font-weight: 600; letter-spacing: .01em;
    text-decoration: none;
}
.app-theme .app-brand:hover, .app-theme .app-brand:focus { color: #fff; text-decoration: none; }
.app-theme .app-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 7px;
    background: #2563eb; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.app-theme .navbar-static-top .nav > li > a {
    color: var(--nav-text);
    font-size: 14px; font-weight: 500;
    padding: 18px 13px 16px;
    border-bottom: 2px solid transparent;
    background: transparent;
}
.app-theme .navbar-static-top .nav > li > a:hover,
.app-theme .navbar-static-top .nav > li > a:focus,
.app-theme .navbar-static-top .nav > .open > a,
.app-theme .navbar-static-top .nav > .open > a:hover,
.app-theme .navbar-static-top .nav > .open > a:focus {
    color: #fff; background: var(--nav-hover);
}
.app-theme .navbar-static-top .nav > li.app-active > a { color: #fff; border-bottom-color: #60a5fa; }
.app-theme .navbar-static-top .caret { opacity: .6; margin-left: 3px; }
.app-theme .navbar-static-top .navbar-right { margin-right: 6px; }
.app-theme .navbar-static-top .UserName_ {
    color: #94a3b8; font-size: 13px; padding: 18px 10px 0 0;
}
.app-theme .navbar-static-top .UserName_:before {
    font-family: FontAwesome; content: "\f2be"; margin-right: 6px; color: #64748b;
}
.app-theme .navbar-static-top .navbar-right > li > a.btnlogout {
    margin: 11px 4px 0 6px; padding: 6px 12px; min-height: 0; line-height: 1.5;
    border: 1px solid rgba(255, 255, 255, .18); border-radius: 6px; font-size: 13px;
}
.app-theme .navbar-static-top .navbar-right > li > a.btnlogout:hover { background: var(--nav-hover); border-color: rgba(255, 255, 255, .35); }
/* light/dark switch */
.app-theme .navbar-static-top .navbar-right > li > a.app-theme-toggle {
    margin: 11px 6px 0 0; padding: 0; min-height: 0; width: 34px; height: 34px; line-height: 32px; text-align: center;
    border: 1px solid rgba(255, 255, 255, .18); border-radius: 8px; font-size: 15px; color: var(--nav-text);
}
.app-theme .navbar-static-top .navbar-right > li > a.app-theme-toggle:hover { background: var(--nav-hover); color: #fff; border-color: rgba(255, 255, 255, .35); }
.app-theme .navbar-static-top .navbar-toggle { border-color: rgba(255, 255, 255, .25); margin-top: 11px; }
.app-theme .navbar-static-top .navbar-toggle .icon-bar { background: #fff; }

/* Menus */
.app-theme .dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-pop);
    padding: 6px;
    min-width: 220px;
    font-size: 14px;
}
.app-theme .navbar-static-top .dropdown-menu { margin-top: 0; }
.app-theme .dropdown-menu > li > a {
    color: var(--text); padding: 7px 12px; margin: 0; line-height: 1.45; border-radius: 6px; font-weight: 500;
}
.app-theme .dropdown-menu > li > a:hover, .app-theme .dropdown-menu > li > a:focus {
    background: var(--hover); color: var(--heading);
}
.app-theme .dropdown-menu > li.app-active > a { background: var(--brand-soft); color: var(--link-hover); }
.app-theme .dropdown-menu .divider { background: var(--border); }
.app-theme .dropdown-submenu > .dropdown-menu { margin-left: 6px; top: -7px; }

/* ---------- Page title and content ---------- */
.app-theme .app-pagehead { padding: 22px 0 16px; }
.app-theme .app-pagehead .app-crumb { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.app-theme .app-pagehead h1 { font-size: 24px; margin: 2px 0 0; }
.app-theme #app-content { padding-bottom: 40px; }
.app-theme #app-content.app-content-fluid { padding: 18px 24px 40px; }
/* The views add 20 px + 80 px above their content (left over from a fixed top bar). */
.app-theme #app-content > .container[style*="margin-top"] { margin-top: 12px !important; }
.app-theme #app-content > .container > div[style*="margin-top:80px"],
.app-theme #app-content > .container > div[style*="margin-top: 80px"],
.app-theme #app-content > div[style*="margin-top:80px"] { margin-top: 0 !important; }

/* ---------- Buttons ---------- */
.app-theme .btn {
    border-radius: 6px; font-weight: 600; font-size: 14px;
    padding: 7px 14px; box-shadow: none; transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.app-theme .btn-lg { padding: 9px 18px; font-size: 15px; }
.app-theme .btn-sm, .app-theme .btn-xs { font-size: 12px; padding: 4px 10px; }
.app-theme .btn:focus, .app-theme .btn.focus { outline: 0; box-shadow: 0 0 0 3px var(--brand-ring); }
.app-theme .btn-primary, .app-theme .btn-success {
    background: var(--brand); border-color: var(--brand); color: #fff;
}
.app-theme .btn-primary:hover, .app-theme .btn-success:hover,
.app-theme .btn-primary:focus, .app-theme .btn-success:focus,
.app-theme .btn-primary:active, .app-theme .btn-success:active,
.app-theme .btn-primary.active, .app-theme .btn-success.active {
    background: var(--brand-hover); border-color: var(--brand-hover); color: #fff;
}
.app-theme .btn-default, .app-theme .btn-white {
    background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
}
.app-theme .btn-default:hover, .app-theme .btn-default:focus, .app-theme .btn-default:active,
.app-theme .btn-white:hover, .app-theme .btn-white:focus {
    background: var(--hover); border-color: var(--muted); color: var(--heading);
}
.app-theme .btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.app-theme .btn-danger:hover, .app-theme .btn-danger:focus { background: var(--danger-hover); border-color: var(--danger-hover); color: #fff; }
.app-theme .btn-warning { background: #d97706; border-color: #d97706; color: #fff; }
.app-theme .btn-info { background: #0891b2; border-color: #0891b2; color: #fff; }
.app-theme .btn[disabled], .app-theme .btn.disabled { opacity: .55; }

/* EDIT / Delete etc. inside tables are <input type="button" class="form-control">: show them as small buttons */
.app-theme table input[type="button"].form-control,
.app-theme table button.form-control {
    display: inline-block; width: auto; height: 30px; margin: 0 4px 0 0; padding: 3px 12px;
    font-size: 12.5px; font-weight: 600; line-height: 1.6;
    color: var(--link-hover); background: var(--surface); border: 1px solid var(--brand-border); border-radius: 6px;
    cursor: pointer; box-shadow: none;
}
.app-theme table input[type="button"].form-control:hover { background: var(--brand-soft); border-color: var(--brand-border-hover); }
.app-theme table input[type="button"].form-control[value="Delete"],
.app-theme table input[type="button"].form-control[value="DELETE"] { color: var(--danger-text); border-color: var(--danger-border); }
.app-theme table input[type="button"].form-control[value="Delete"]:hover,
.app-theme table input[type="button"].form-control[value="DELETE"]:hover { background: var(--danger-soft); border-color: var(--danger-border-hover); }

/* ---------- Forms ---------- */
.app-theme .form-control {
    height: 36px; padding: 6px 11px;
    font-size: 14px; color: var(--heading);
    background-color: var(--surface);
    border: 1px solid var(--border-strong); border-radius: 6px;
    box-shadow: none; transition: border-color .15s, box-shadow .15s;
}
.app-theme textarea.form-control { height: auto; }
.app-theme .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); outline: 0; }
.app-theme .form-control::placeholder { color: var(--muted); opacity: .8; }
.app-theme .form-control[readonly] { background-color: var(--surface-alt); }
.app-theme .form-control[disabled], .app-theme fieldset[disabled] .form-control { background-color: var(--hover); color: var(--muted); }
.app-theme .input-group-addon {
    background: var(--surface-alt); border: 1px solid var(--border-strong); color: var(--muted); border-radius: 6px;
}
.app-theme .input-group .form-control:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.app-theme .input-group-addon:last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.app-theme .currencyInputWrap:before { top: 8px; left: 9px; color: var(--muted); }

/* ---------- Tables ---------- */
.app-theme .dataTables_wrapper {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow); padding: 14px 16px 10px; margin-top: 6px;
}
.app-theme .table { background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums; }
.app-theme .table > thead > tr > th,
.app-theme .table > thead > tr > th.success,
.app-theme .table > thead > tr > td.success {
    background: var(--surface-alt);
    color: var(--label);
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border-strong);
    padding: 10px 10px;
    vertical-align: middle;
}
.app-theme .table > tbody > tr > td { padding: 9px 10px; vertical-align: middle; border-top: 1px solid var(--border); }
.app-theme .table-bordered, .app-theme .table-bordered > thead > tr > th, .app-theme .table-bordered > tbody > tr > td,
.app-theme .table-bordered > tfoot > tr > th, .app-theme .table-bordered > tfoot > tr > td { border-color: var(--border); }
.app-theme .table-striped > tbody > tr:nth-of-type(odd) { background: var(--stripe); }
.app-theme .table-hover > tbody > tr:hover { background: var(--row-hover); }
.app-theme .table > tfoot > tr > th, .app-theme .table > tfoot > tr > td { background: var(--surface-alt); font-weight: 700; color: var(--heading); }
.app-theme .dataTables_wrapper .dataTables_length, .app-theme .dataTables_wrapper .dataTables_filter,
.app-theme .dataTables_wrapper .dataTables_info { color: var(--muted); font-size: 13px; }
.app-theme .dataTables_wrapper .dataTables_filter input { width: 220px; margin-left: 8px; }
.app-theme .dataTables_wrapper .dataTables_length select { width: auto; display: inline-block; margin: 0 6px; }
.app-theme .dataTables_wrapper .dataTables_processing {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); color: var(--label);
}
/* keep DataTables' sort arrows clear of the heading text */
.app-theme table.dataTable thead > tr > th.sorting, .app-theme table.dataTable thead > tr > th.sorting_asc, .app-theme table.dataTable thead > tr > th.sorting_desc { padding-right: 26px; }

/* Paging */
.app-theme .pagination > li > a, .app-theme .pagination > li > span {
    color: var(--text); background: var(--surface); border-color: var(--border);
    margin-left: 4px; border-radius: 6px; min-width: 34px; text-align: center;
}
.app-theme .pagination > li:first-child > a, .app-theme .pagination > li:last-child > a { border-radius: 6px; }
.app-theme .pagination > li > a:hover { background: var(--hover); color: var(--heading); }
.app-theme .pagination > .active > a, .app-theme .pagination > .active > a:hover, .app-theme .pagination > .active > a:focus {
    background: var(--brand); border-color: var(--brand); color: #fff;
}
.app-theme .pagination > .disabled > a, .app-theme .pagination > .disabled > a:hover { color: var(--faint); background: var(--surface); }

/* ---------- Dialogs and pop-overs ---------- */
.app-theme .modal-content {
    background: var(--surface); color: var(--text);
    border: 0; border-radius: 12px; box-shadow: 0 24px 60px rgba(15, 23, 42, .28); overflow: hidden; padding: 0;
}
.app-theme .modal-header { padding: 16px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.app-theme .modal-title { font-size: 17px; font-weight: 600; color: var(--heading); }
.app-theme .modal-body { padding: 20px 22px; }
.app-theme .modal-footer { padding: 12px 22px; background: var(--surface-alt); border-top: 1px solid var(--border); }
.app-theme .modal-footer .btn.close { float: none; opacity: 1; text-shadow: none; font-size: 14px; }
.app-theme .modal-backdrop.in { opacity: .45; }
.app-theme .close { opacity: .45; }
.app-theme .popover { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); }
.app-theme .popover-title { background: var(--surface-alt); border-bottom: 1px solid var(--border); color: var(--heading); font-weight: 600; }
.app-theme .popover.top > .arrow:after { border-top-color: var(--surface); }
.app-theme .popover.bottom > .arrow:after { border-bottom-color: var(--surface); }
.app-theme .popover.left > .arrow:after { border-left-color: var(--surface); }
.app-theme .popover.right > .arrow:after { border-right-color: var(--surface); }
.app-theme .panel { background: var(--surface); border-color: var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.app-theme .panel > .panel-heading { border-top-left-radius: 9px; border-top-right-radius: 9px; font-weight: 600; }
.app-theme .panel-default > .panel-heading, .app-theme .panel-success > .panel-heading {
    background: var(--surface-alt); color: var(--heading); border-color: var(--border);
}
.app-theme .panel-success { border-color: var(--border); }
.app-theme .panel-primary { border-color: var(--brand); }
.app-theme .panel-primary > .panel-heading { background: var(--brand); border-color: var(--brand); color: #fff; }

/* SweetAlert confirmations */
.app-theme .sweet-alert { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); }
.app-theme .sweet-alert h2 { color: var(--heading); font-weight: 600; }
.app-theme .sweet-alert p { color: var(--muted); }
.app-theme .sweet-alert .sa-icon.sa-success::before, .app-theme .sweet-alert .sa-icon.sa-success::after,
.app-theme .sweet-alert .sa-icon.sa-success .sa-fix { background: var(--surface); }
.app-theme .sweet-alert button { border-radius: 6px; font-weight: 600; }

/* Date pickers (bootstrap-datepicker and the date/time picker) */
.app-theme .datepicker.dropdown-menu, .app-theme .bootstrap-datetimepicker-widget.dropdown-menu { color: var(--text); }
.app-theme .datepicker table tr td.day:hover, .app-theme .datepicker table tr td.focused,
.app-theme .datepicker .datepicker-switch:hover, .app-theme .datepicker .prev:hover, .app-theme .datepicker .next:hover,
.app-theme .datepicker tfoot tr th:hover, .app-theme .datepicker table tr td span:hover,
.app-theme .bootstrap-datetimepicker-widget table td.day:hover, .app-theme .bootstrap-datetimepicker-widget table td.hour:hover,
.app-theme .bootstrap-datetimepicker-widget table td.minute:hover, .app-theme .bootstrap-datetimepicker-widget table td.second:hover,
.app-theme .bootstrap-datetimepicker-widget table td span:hover, .app-theme .bootstrap-datetimepicker-widget table thead tr:first-child th:hover,
.app-theme .bootstrap-datetimepicker-widget .btn:hover { background: var(--hover); color: var(--heading); }
.app-theme .datepicker table tr td.old, .app-theme .datepicker table tr td.new,
.app-theme .bootstrap-datetimepicker-widget table td.old, .app-theme .bootstrap-datetimepicker-widget table td.new { color: var(--faint); }
.app-theme .datepicker table tr td.active, .app-theme .datepicker table tr td.active:hover,
.app-theme .datepicker table tr td.active.active, .app-theme .datepicker table tr td span.active,
.app-theme .bootstrap-datetimepicker-widget table td.active, .app-theme .bootstrap-datetimepicker-widget table td.active:hover,
.app-theme .bootstrap-datetimepicker-widget table td span.active { background: var(--brand); background-image: none; color: #fff; text-shadow: none; }
.app-theme .datepicker table tr td.today, .app-theme .datepicker table tr td.today:hover { background: var(--brand-soft); background-image: none; color: var(--link-hover); }
.app-theme .bootstrap-datetimepicker-widget table td.today:before { border-bottom-color: var(--brand); }
.app-theme .bootstrap-datetimepicker-widget .btn { background: transparent; color: var(--text); border: 0; }
.app-theme .datepicker-dropdown:after, .app-theme .bootstrap-datetimepicker-widget.dropdown-menu.bottom:after { border-bottom-color: var(--surface); }
.app-theme .datepicker-dropdown.datepicker-orient-top:after, .app-theme .bootstrap-datetimepicker-widget.dropdown-menu.top:after { border-top-color: var(--surface); }

/* ---------- On-screen reports (Scripts/custom/ReportView.js) ---------- */
.app-theme .rv-summary { margin: 18px 0 10px; color: var(--label); font-size: 14px; }
.app-theme .rv-summary b { color: var(--heading); font-weight: 600; }
.app-theme .rv-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 14px; }
.app-theme .rv-stat {
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
    padding: 10px 16px; min-width: 170px;
}
.app-theme .rv-stat .k { color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.app-theme .rv-stat .v { color: var(--heading); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.app-theme .rv-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 14px 16px; }
.app-theme .rv-scroll { max-height: calc(100vh - 300px); min-height: 160px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.app-theme table.rv-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 !important; border: 0; background: var(--surface); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.app-theme .rv-holder.rv-compact { max-width: 760px; }
.app-theme .rv-table > thead > tr > th, .app-theme .rv-table > tbody > tr > td, .app-theme .rv-table > tfoot > tr > th {
    padding: 8px 14px; border: 0; border-bottom: 1px solid var(--cell-line); white-space: nowrap; vertical-align: middle;
}
.app-theme .rv-table > thead > tr > th {
    position: sticky; top: 0; z-index: 2; background: var(--surface-alt); color: var(--label);
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border-strong);
}
.app-theme .rv-table > tfoot > tr > th { position: sticky; bottom: 0; z-index: 2; background: var(--band-head); color: var(--heading); font-weight: 700; border-top: 2px solid var(--border-strong); }
.app-theme .rv-table .num { text-align: right; }
.app-theme .rv-table .rv-wrap { white-space: normal; min-width: 180px; }
.app-theme .rv-table .rv-indent { padding-left: 28px; }
.app-theme .rv-table .rv-sub { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.app-theme .rv-table > tbody > tr > td { background: var(--surface); }
.app-theme .rv-table > tbody > tr:hover > td { background-image: linear-gradient(var(--row-hover), var(--row-hover)); }
.app-theme .rv-table > tbody > tr.rv-group > td { background: var(--band-head); color: var(--heading); font-weight: 600; }
.app-theme .rv-table > tbody > tr.rv-subtotal > td { background: var(--surface-alt); color: var(--heading); font-weight: 600; border-top: 1px solid var(--border-strong); }
.app-theme .rv-table > tbody > tr.rv-grand > td { background: var(--band-head); color: var(--heading); font-weight: 700; border-top: 2px solid var(--border-strong); }
.app-theme .rv-zero { color: var(--faint); }
.app-theme .rv-neg { color: var(--owed); }
.app-theme .rv-empty { padding: 30px 10px; text-align: center; color: var(--muted); }
.app-theme .report-buttons .btn { margin: 0 4px 4px 0; }

/* ---------- Misc ---------- */
.app-theme .pace .pace-progress { background: var(--brand); }
.app-theme .alert { border-radius: var(--radius); }
.app-theme .label, .app-theme .badge { border-radius: 999px; font-weight: 600; }
.app-theme #AjaxLoader { left: 0; background: rgba(15, 23, 42, .35); opacity: 1; }

/* Dark mode: Bootstrap colours that are not variables */
html[data-theme="dark"] .app-theme .close { color: #fff; text-shadow: none; }
html[data-theme="dark"] .app-theme .text-danger, html[data-theme="dark"] .app-theme font[color="red"] { color: #f87171; }
html[data-theme="dark"] .app-theme .text-success { color: #4ade80; }
html[data-theme="dark"] .app-theme .text-warning { color: #fbbf24; }
html[data-theme="dark"] .app-theme .text-info { color: #38bdf8; }
html[data-theme="dark"] .app-theme .text-primary { color: #60a5fa; }
html[data-theme="dark"] .app-theme .table > tbody > tr > td.success, html[data-theme="dark"] .app-theme .table > tbody > tr.success > td,
html[data-theme="dark"] .app-theme .table > tfoot > tr > td.success { background: rgba(34, 197, 94, .12); }
html[data-theme="dark"] .app-theme .table > tbody > tr > td.info, html[data-theme="dark"] .app-theme .table > tbody > tr.info > td { background: rgba(14, 165, 233, .12); }
html[data-theme="dark"] .app-theme .table > tbody > tr > td.warning, html[data-theme="dark"] .app-theme .table > tbody > tr.warning > td { background: rgba(234, 179, 8, .14); }
html[data-theme="dark"] .app-theme .table > tbody > tr > td.danger, html[data-theme="dark"] .app-theme .table > tbody > tr.danger > td { background: rgba(239, 68, 68, .14); }
html[data-theme="dark"] .app-theme .table > tbody > tr > td.active, html[data-theme="dark"] .app-theme .table > tbody > tr.active > td { background: rgba(148, 163, 184, .12); }
html[data-theme="dark"] .app-theme .well { background: var(--surface-alt); border-color: var(--border); }
html[data-theme="dark"] .app-theme .alert-success { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .3); color: #86efac; }
html[data-theme="dark"] .app-theme .alert-info { background: rgba(14, 165, 233, .12); border-color: rgba(14, 165, 233, .3); color: #7dd3fc; }
html[data-theme="dark"] .app-theme .alert-warning { background: rgba(234, 179, 8, .12); border-color: rgba(234, 179, 8, .3); color: #fde68a; }
html[data-theme="dark"] .app-theme .alert-danger { background: rgba(239, 68, 68, .12); border-color: rgba(239, 68, 68, .3); color: #fca5a5; }
html[data-theme="dark"] .app-theme .modal-content { box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
html[data-theme="dark"] .app-theme .modal-backdrop.in { opacity: .6; }

/* ---------- Login page (Views/Admin/Index.cshtml) ---------- */
html body.app-theme.app-login {
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 15% -10%, #1e3a8a 0%, rgba(30, 58, 138, 0) 60%), #0f172a !important;
}
.app-login .login-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.app-login .login-card {
    width: 100%; max-width: 380px; background: var(--surface); border-radius: 14px;
    padding: 30px 30px 26px; box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
}
.app-login .login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.app-login .login-brand .app-brand-mark { width: 40px; height: 40px; border-radius: 9px; font-size: 14px; }
.app-login .login-company { font-weight: 600; color: var(--heading); font-size: 14.5px; line-height: 1.3; }
.app-login .login-app { color: var(--muted); font-size: 13px; }
.app-login h1 { font-size: 22px; margin: 0 0 16px; }
.app-login label { display: block; margin-top: 12px; }
.app-login .form-control { height: 40px; }
.app-login .btnLogin { margin-top: 20px; }
.app-login .login-error {
    margin-top: 14px; padding: 9px 12px; border-radius: 8px;
    background: var(--danger-soft); color: var(--danger-text); border: 1px solid var(--danger-border); font-size: 13.5px;
}
.app-login .login-foot { margin-top: 18px; color: #64748b; font-size: 12.5px; }

/* ---------- Phones (under 768 px). Desktop is not affected by anything below. ---------- */
@media (max-width: 767px) {
    /* 16 px text in fields stops iPhones from zooming in when typing; bigger touch targets */
    .app-theme .form-control, .app-theme select, .app-theme textarea { font-size: 16px; }
    .app-theme .form-control { height: 40px; }
    .app-theme .btn { padding: 9px 14px; }
    .app-theme h2 { font-size: 20px; }
    .app-theme .app-pagehead { padding: 14px 0 10px; }
    .app-theme .app-pagehead h1 { font-size: 21px; }
    .app-theme #app-content.app-content-fluid { padding: 14px 14px 32px; }
    .app-theme #app-content > .container { padding-left: 14px; padding-right: 14px; }
    .app-theme .row { margin-left: -8px; margin-right: -8px; }
    .app-theme .row > [class*="col-"] { padding-left: 8px; padding-right: 8px; }
    .app-theme #app-content .row > [class*="col-sm"][style*="width"] { width: auto !important; }   /* a few columns have fixed widths written in */
    .app-theme #app-content .row > [class*="col-"] > label { margin-top: 8px; }
    .app-theme #app-content input[type="button"][style*="float"], .app-theme #app-content .btn[style*="float"] { margin-top: 10px; }

    /* top bar: brand on the left, menu button on the right; the menu opens below as a list */
    .app-theme .navbar-static-top .navbar-header { float: none; display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 0; }
    /* Bootstrap's clearfix ::before/::after would count as items in these flex rows and push things inward */
    .app-theme .navbar-static-top .navbar-header::before, .app-theme .navbar-static-top .navbar-header::after,
    .app-theme .navbar-static-top .navbar-right::before, .app-theme .navbar-static-top .navbar-right::after { display: none; }
    .app-theme .app-brand { padding-left: 14px; }
    .app-theme .navbar-static-top .navbar-toggle {
        float: none; display: block; margin: 0 12px 0 0; padding: 9px 10px;
        background: transparent; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px;
    }
    .app-theme .navbar-static-top .navbar-toggle:hover, .app-theme .navbar-static-top .navbar-toggle:focus { background: var(--nav-hover); }
    .app-theme .navbar-static-top .navbar-collapse {
        background: var(--nav-bg); border-top: 1px solid rgba(255, 255, 255, .08); box-shadow: none;
        max-height: calc(100vh - 56px); overflow-y: auto; padding: 4px 0 8px; margin: 0;
    }
    .app-theme .navbar-static-top .navbar-nav { margin: 0; }
    .app-theme .navbar-static-top .nav > li > a { padding: 12px 18px; border-bottom: 0; border-left: 3px solid transparent; }
    .app-theme .navbar-static-top .nav > li.app-active > a { border-left-color: #60a5fa; border-bottom-color: transparent; }
    .app-theme .navbar-static-top .nav .open .dropdown-menu,
    .app-theme .navbar-static-top .dropdown-submenu > .dropdown-menu {
        position: static; float: none; width: auto; margin: 0 0 6px; padding: 2px 0; background: rgba(255, 255, 255, .04); box-shadow: none; border: 0; border-radius: 0;
    }
    .app-theme .navbar-static-top .nav .open .dropdown-menu > li > a { color: var(--nav-text); padding: 10px 18px 10px 34px; border-radius: 0; }
    .app-theme .navbar-static-top .dropdown-submenu > .dropdown-menu > li > a { padding-left: 50px !important; }
    .app-theme .navbar-static-top .nav .open .dropdown-menu > li > a:hover,
    .app-theme .navbar-static-top .nav .open .dropdown-menu > li.app-active > a { background: var(--nav-hover); color: #fff; }
    .app-theme .navbar-static-top .navbar-right {
        display: flex; align-items: center; gap: 10px; float: none !important; margin: 4px 0 0; padding: 10px 18px 4px; border-top: 1px solid rgba(255, 255, 255, .08);
    }
    .app-theme .navbar-static-top .navbar-right > li { display: block; }
    .app-theme .navbar-static-top .navbar-right > li > a.app-theme-toggle, .app-theme .navbar-static-top .navbar-right > li > a.btnlogout { margin: 0; }
    .app-theme .navbar-static-top .UserName_ { padding: 0; flex: 1; }

    /* list tables: each row becomes a card, with the column name next to each value (labels set by the layout script) */
    .app-theme .dataTables_wrapper.app-cards-wrap { background: transparent; border: 0; box-shadow: none; padding: 0; }
    .app-theme .dataTables_wrapper .dataTables_filter label { display: flex; align-items: center; gap: 8px; width: 100%; }
    .app-theme .dataTables_wrapper .dataTables_filter input { flex: 1; width: auto; margin: 0; }
    .app-theme .dataTables_wrapper .dataTables_length, .app-theme .dataTables_wrapper .dataTables_filter { margin-bottom: 8px; }
    .app-theme table.app-cards { border: 0 !important; background: transparent !important; margin-top: 4px !important; }
    .app-theme table.app-cards > thead { display: none; }
    .app-theme table.app-cards > tbody > tr {
        display: block; background: var(--surface) !important; border: 1px solid var(--border); border-radius: 10px;
        box-shadow: var(--shadow); margin: 0 0 10px; padding: 4px 14px;
    }
    .app-theme table.app-cards > tbody > tr > td {
        display: flex; justify-content: space-between; align-items: center; gap: 14px;
        border: 0 !important; border-top: 1px solid var(--cell-line) !important; background: transparent !important;
        padding: 7px 0 !important; text-align: right !important; white-space: normal; word-break: break-word; min-height: 38px;
    }
    .app-theme table.app-cards > tbody > tr > td:first-child { border-top: 0 !important; font-weight: 600; color: var(--heading); }
    .app-theme table.app-cards > tbody > tr > td::before {
        content: attr(data-label); flex: 0 0 auto; max-width: 45%; text-align: left;
        color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    }
    .app-theme table.app-cards > tbody > tr > td[data-label=""]::before { content: none; }
    .app-theme table.app-cards > tbody > tr > td.dataTables_empty { display: block; text-align: center !important; }
    .app-theme table.app-cards > tbody > tr > td.dataTables_empty::before { content: none; }
    .app-theme table.app-cards input[type="button"].form-control { height: 34px; padding: 4px 14px; }
    .app-theme table.app-cards > tfoot { display: block; }
    .app-theme table.app-cards > tfoot > tr { display: flex; flex-wrap: wrap; justify-content: space-between; }

    /* other tables (entry lines in dialogs, daily cash flow, ...) scroll sideways inside themselves */
    .app-theme table.table:not(.app-cards):not(.rv-table):not(.subs-report) { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .app-theme .dataTables_wrapper .col-sm-12 { overflow-x: auto; }

    /* dialogs: the views write fixed widths (500-1170 px) on them; on a phone they use the screen width */
    .app-theme .modal-dialog { width: auto !important; max-width: none; margin: 8px !important; }
    .app-theme .modal-content[class*="col-"] { width: 100%; float: none; }
    .app-theme .modal-header { padding: 14px 16px; }
    .app-theme .modal-body { padding: 14px 16px; }
    .app-theme .modal-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 16px; }
    .app-theme .modal-footer .btn { margin: 0 !important; }
    .app-theme .modal-footer > .btn + .btn { margin-left: 0 !important; }

    /* reports */
    .app-theme .rv-stat { flex: 1 1 calc(50% - 12px); min-width: 0; padding: 9px 12px; }
    .app-theme .rv-stat .v { font-size: 17px; }
    .app-theme .rv-card { padding: 10px; }
    .app-theme .rv-scroll, .app-theme .subs-report-scroll { max-height: calc(100vh - 200px); }
    .app-theme .report-buttons > div, .app-theme .subs-report-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
    .app-theme .report-buttons .btn, .app-theme .subs-report-buttons .btn { margin: 0; flex: 1 1 auto; }
    .app-theme .subs-report-buttons > br, .app-theme .report-buttons > label { display: none; }
}
