.sortable-rows > tr > td {
    vertical-align: middle;
}

/* Shared application surface; AdminLTE remains responsible for navigation. */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #263746;
}
.app-main { background: #f3f6fa; }
.app-content-header { padding: 1.5rem 1rem 1rem; }
.app-content-header h1 { font-size: 1.65rem; font-weight: 600; overflow-wrap: anywhere; }
.app-content-header .breadcrumb { background: transparent; padding: 0; }
.card { border-radius: .65rem; box-shadow: 0 2px 12px rgb(24 50 74 / 6%); }

.card-header { border-bottom-color: #e9eef3; }
.form-control, .form-select, .btn { border-radius: .35rem; }
.form-control:focus, .form-select:focus { border-color: #4388ac; box-shadow: 0 0 0 .2rem rgb(35 113 156 / 14%); }
.table td, .table th { border-top-color: #e9eef3; }
.table thead th { border-bottom-width: 1px; }
.table-responsive { overscroll-behavior-x: contain; }
.app-main .nav-tabs { flex-wrap: wrap; }
.app-main .nav-tabs .nav-link { white-space: normal; }
.select2-container { max-width: 100%; }
.select2-container--default .select2-selection--multiple { min-height: calc(2.25rem + 2px); border-color: #ced4da; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { background: #e8f2f8; border-color: #c7dfea; color: #214d68; }

.climate-login { min-height: 100vh; min-height: 100dvh; background: #f5f8fb; }
.auth-shell { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; min-height: 100dvh; }
.auth-intro { display: flex; flex-direction: column; padding: clamp(2rem, 5vw, 5rem); background: radial-gradient(ellipse at 15% 85%, #236b76 0, transparent 55%), linear-gradient(140deg, #112d44, #16445b); color: #fff; }
.auth-brand { text-decoration: none; display: inline-flex; align-items: center; gap: .8rem; align-self: flex-start; font-size: 1.45rem; color: #fff; }
.auth-brand:hover { color: #fff; }
.auth-brand img { object-fit: contain; }
.auth-intro-copy { margin: auto 0; padding: 5rem 0; max-width: 31rem; }
.auth-eyebrow { font-size: .75rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #506e80; margin-bottom: 1.25rem; }
.auth-intro .auth-eyebrow { color: #a1d9dc; }
.auth-intro h1 { font-size: clamp(2.25rem, 4vw, 3.75rem); line-height: 1.12; font-weight: 650; letter-spacing: -.035em; margin-bottom: 1.5rem; }
.auth-intro-copy > p:not(.auth-eyebrow) { color: #d0e1e9; font-size: 1.05rem; line-height: 1.8; }
.auth-capabilities { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-top: 2.5rem; font-size: .85rem; color: #d0e1e9; }
.auth-capabilities i { margin-right: .4rem; color: #a1d9dc; }
.auth-intro-footer { font-size: .8rem; color: #bad1de; margin: 0; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 3rem 2rem; }
.auth-form-wrap { width: 100%; max-width: 25rem; }
.auth-panel h2 { font-size: 2rem; font-weight: 650; letter-spacing: -.025em; }
.auth-description { color: #5b6d7c; margin: .75rem 0 2rem; line-height: 1.7; }
.auth-panel label { font-size: .875rem; }
.auth-panel .form-group { margin-bottom: 1.4rem; }
.auth-panel .form-control { min-height: 3rem; background-color: #fff; }
.auth-options { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin: .5rem 0 1.75rem; font-size: .85rem; }
.auth-options label { font-weight: 400; }
.auth-panel a { color: #226586; }
.auth-submit { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1.1rem; background: #206480; border-color: #206480; font-weight: 600; }
.auth-submit:hover, .auth-submit:focus { background: #174e65; border-color: #174e65; }
.auth-submit:disabled { background: #206480; border-color: #206480; cursor: wait; }
.auth-register { text-align: center; font-size: .875rem; margin: 1.75rem 0 0; }
a:focus-visible, button:focus-visible { outline: 3px solid #55a1c2; outline-offset: 3px; }
@media (max-width: 767.98px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-intro { padding: 1.5rem; }
    .auth-intro-copy { padding: 2.5rem 0 0; max-width: none; }
    .auth-intro h1 { font-size: 2rem; }
    .auth-intro-copy > p:not(.auth-eyebrow), .auth-capabilities, .auth-intro-footer { display: none; }
    .auth-panel { padding: 2.5rem 1.5rem; align-items: flex-start; }
    .app-content-header { padding: 1rem .5rem; }
    .app-content-header h1 { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Bootstrap 5 spacing and AdminLTE 4 layout surfaces. */
.form-group { margin-bottom: 1rem; }
.form-group > label, .form-label { margin-bottom: .5rem; font-weight: 600; }
.form-actions { margin-top: 1.25rem; }
.app-main { min-width: 0; }
.sidebar-wrapper { overflow-y: auto; scrollbar-width: thin; }
.account-nav-label { display: inline-block; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; white-space: nowrap; }
.app-content-header .breadcrumb { flex-wrap: wrap; }
.auth-panel .form-check-label { font-weight: 400; }

/* Shared Climate Balance palette: the same navy and teal as the sign-in page. */
:root, [data-bs-theme="light"] {
    --bs-primary: #206480;
    --bs-primary-rgb: 32, 100, 128;
    --bs-link-color: #226586;
    --bs-link-color-rgb: 34, 101, 134;
    --bs-link-hover-color: #174e65;
    --bs-link-hover-color-rgb: 23, 78, 101;
    --bs-body-color: #263746;
    --bs-body-bg: #f5f8fb;
}
.btn-primary { --bs-btn-bg: #206480; --bs-btn-border-color: #206480; --bs-btn-hover-bg: #174e65; --bs-btn-hover-border-color: #174e65; --bs-btn-active-bg: #174e65; --bs-btn-active-border-color: #174e65; --bs-btn-disabled-bg: #206480; --bs-btn-disabled-border-color: #206480; --bs-btn-focus-shadow-rgb: 32, 100, 128; }
.btn-outline-secondary { --bs-btn-color: #315b70; --bs-btn-border-color: #b7ccd7; --bs-btn-hover-bg: #e8f2f6; --bs-btn-hover-color: #174e65; --bs-btn-hover-border-color: #6b9bb0; --bs-btn-active-bg: #d8eaf1; --bs-btn-active-color: #174e65; }
.app-sidebar { background: linear-gradient(160deg, #112d44, #16445b) !important; --lte-sidebar-menu-active-bg: #236b76; --lte-sidebar-menu-hover-bg: #ffffff14; --lte-sidebar-menu-color: #d0e1e9; --lte-sidebar-menu-active-color: #fff; }
.app-sidebar .brand-text { color: #fff; }
.app-sidebar .sidebar-brand { border-color: #ffffff18; }
.app-header { border-bottom: 1px solid #dce7ee; box-shadow: 0 2px 12px #18324a05; }
.app-header .nav-link { color: #315b70; }
.card-primary { --lte-card-variant-bg: #206480; --lte-card-variant-bg-rgb: 32, 100, 128; }
.card { --bs-card-bg: #fff; border-color: #e1e9ef; }
.form-control, .form-select { background-color: #fff; }
.form-check-input:checked { background-color: #206480; border-color: #206480; }
.form-check-input:focus { border-color: #4388ac; box-shadow: 0 0 0 .2rem #23719c24; }
/* Flat tabs: the active surface continues into the white card body. */
.app-content .nav-tabs {
    --bs-nav-tabs-border-radius: 0;
    --bs-nav-tabs-link-active-bg: #fff;
    --bs-nav-tabs-link-active-color: #174e65;
    --bs-nav-tabs-link-active-border-color: #d6e1e8 #d6e1e8 #fff;
    background: #e7eef3;
    border-bottom-color: #d6e1e8;
}
.app-content .nav-tabs .nav-link,
.app-content .report-type-tabs > .btn {
    --bs-btn-border-radius: 0;
    border-radius: 0;
    background: #e7eef3;
    color: #426c80;
    border-color: #d6e1e8;
    border-top: 2px solid transparent;
    box-shadow: none;
}
.app-content .nav-tabs .nav-link:hover,
.app-content .report-type-tabs > .btn:hover { background: #dbe6ee; color: #174e65; }
.app-content .nav-tabs .nav-link.active,
.app-content .nav-tabs .nav-item.show > .nav-link,
.app-content .report-type-tabs > .btn.active {
    background: #fff;
    color: #174e65;
    border-color: #d6e1e8 #d6e1e8 #fff;
    border-top-color: #206480;
    font-weight: 600;
}
.page-link { color: #226586; }
.page-item.active .page-link { background: #206480; border-color: #206480; }
.form-text { font-size: .77rem; line-height: 1.6; color: #596d7b; margin-top: .4rem; }
.required-mark { color: #a64444; font-weight: 600; }
.form-page-note { color: #596d7b; font-size: .8rem; margin-bottom: 1rem; }
.form-page .app-content > .container-fluid > .row > [class*="col-"] > .card > .card-header { background: transparent; border-bottom: 0; padding-bottom: 0; }
.form-page .card > .card-header:has(.card-title:empty) .card-title { display: none; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .75rem; padding-top: 1rem; border-top: 1px solid #e4ecf1; }
.form-actions > a:first-child { margin-right: auto; }
.form-error-summary a { color: inherit; text-decoration: underline; }
.climate-map { width: 100%; min-height: 340px; border: 1px solid #d5e3eb; border-radius: .65rem; z-index: 0; }
@media (max-width: 767.98px) { .climate-map { min-height: 280px; } }

/* Metric filters and actions wrap as complete controls, with stable icon spacing. */
.metric-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
.metric-toolbar-title { padding-top: .45rem; }
.metric-group-filter { display: flex; flex: 1 1 22rem; align-items: flex-start; gap: .5rem; min-width: 0; max-width: 36rem; }
.metric-group-control { flex: 1 1 auto; min-width: 0; }
.metric-group-control .select2-container { width: 100% !important; }
.metric-filter-submit { min-height: 2.25rem; flex-shrink: 0; }
.metric-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-inline-start: auto; }
.metric-resync-form { display: inline-flex; align-items: center; gap: .5rem; }
.metric-resync-days { width: 4.5rem; flex: 0 0 4.5rem; }
.metric-toolbar-actions > .btn, .metric-resync-form > .btn { white-space: nowrap; }
.metric-flags { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; vertical-align: middle; }
.metric-flags > i { flex: 0 0 auto; }
.metrics-table .metric-flags-cell, .metrics-table .metric-actions-cell { width: 1%; white-space: nowrap; }
.metric-row-actions, .metric-row-actions > form { display: inline-flex; align-items: center; justify-content: flex-end; gap: .35rem; white-space: nowrap; }
.metrics-table td { vertical-align: middle; }
@media (max-width: 575.98px) {
    .metric-toolbar-title { flex-basis: 100%; padding-top: 0; }
    .metric-group-filter { flex-basis: 100%; max-width: none; }
    .metric-toolbar-actions { margin-inline-start: 0; }
}

/* Dashboard spacing and nested navigation after the Bootstrap 5 migration. */
.app-content .card { margin-bottom: 1.25rem; }
.sidebar-menu .nav-treeview { padding-inline-start: 1rem; }
.sidebar-menu .nav-treeview .nav-link { font-size: .875rem; }
.card-header > div[style*="display: flex"] { gap: .75rem; flex-wrap: wrap; }
.card-header .float-end { margin-inline-start: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.card-tabs > .card-header { padding-top: 0 !important; }
.card-tabs .nav-tabs { margin: 0; }
.card-title, .section-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card-header:has(> div:empty), .card-header:empty { display: none; }

.listing-filter { padding: 0 1rem 1rem; }
.listing-filter-controls { display: flex; align-items: flex-start; gap: .75rem; }
.listing-filter-field { flex: 0 1 28rem; min-width: 0; }
.listing-filter-submit { flex-shrink: 0; }
.card-header > div:has(> .section-title) { align-items: center; }
.card-header:not(.listing-toolbar) > div:not(:has(.section-title)):not(:has(.nav-tabs)) { justify-content: flex-end; }

/* One quiet table and action style throughout the dashboard. */
.app-content .table { font-size: .875rem; --bs-table-bg: #fff; --bs-table-color: #263746; --bs-table-hover-bg: #f3f6f8; margin-bottom: 0; }
.app-content .table > :not(caption) > * > * { padding: .65rem .75rem; vertical-align: middle; }
.app-content .table thead th { background: #f3f6f8; color: #516474; font-weight: 600; }
.app-content .card-footer { background: #fff; border-top: 1px solid #e1e9ef; }
.row-actions, .page-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .35rem; }
.table .row-actions { flex-wrap: nowrap; }
.action-button { background: transparent; border-color: transparent; color: #596d7b; box-shadow: none; min-width: 2rem; min-height: 2rem; }
.action-delete:hover, .action-delete:focus-visible { color: #a63040; background: #fff0f1; border-color: #e9b8bf; }
@media (max-width: 575.98px) { .app-content-header h1 { font-size: 1.4rem; } .card-header { padding: .75rem; } .page-actions { width: 100%; } }

.listing-toolbar { display: flex; flex-wrap: wrap; align-items: flex-start; gap: .75rem 1rem; padding: 1rem; }
.listing-toolbar .listing-filter { flex: 1 1 24rem; max-width: 34rem; padding: 0; }
.listing-toolbar-actions { margin-inline-start: auto; display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.row-actions > .action-form { display: inline-flex; margin: 0; }
.action-form .action-button { flex-shrink: 0; }
@media (max-width: 575.98px) { .listing-toolbar .listing-filter { flex-basis: 100%; max-width: none; } }

/* Grafana needs an explicit height: Bootstrap 4 embed-responsive classes no longer exist. */
.grafana-dashboard { width: 100%; min-width: 0; background: #fff; }
.grafana-dashboard-actions { padding: .5rem .75rem; border-bottom: 1px solid #e1e9ef; }
.grafana-dashboard-frame { display: block; width: 100%; height: 75vh; height: 75dvh; min-height: 30rem; border: 0; background: #fff; }
.grafana-dashboard:fullscreen { display: flex; flex-direction: column; width: 100%; height: 100%; }
.grafana-dashboard:fullscreen .grafana-dashboard-frame { flex: 1 1 auto; height: 0; min-height: 0; }
