/* CS Platform — Grafana-like shell (pg-mon / FU visual language), full-bleed */

:root,
html[data-theme="dark"] {
    --bg: #111217;
    --bg-canvas: #0b0c0e;
    --panel: #181b1f;
    --panel-2: #22252b;
    --text: #ccccdc;
    --text-strong: #fff;
    --muted: #8e8e9a;
    --border: rgba(204, 204, 220, 0.12);
    --border-strong: rgba(204, 204, 220, 0.2);
    --primary: #3d71d9;
    --primary-text: #fff;
    --primary-hover: #6e9fff;
    --green: #73bf69;
    --yellow: #f2cc0c;
    --orange: #ff9830;
    --red: #f2495c;
    --blue: #3d71d9;
    --blue2: #6e9fff;
    --shadow: none;
    --radius: 2px;
    --radius-lg: 4px;
    --header-bg: rgba(17, 18, 23, 0.92);
    --hover: rgba(204, 204, 220, 0.08);
    --active-bg: rgba(61, 113, 217, 0.16);
    --active-border: #3d71d9;
    --input-bg: #111217;
    --bar-track: rgba(204, 204, 220, 0.1);
    --warn-bg: rgba(242, 204, 12, 0.08);
    --warn-border: rgba(242, 204, 12, 0.35);
    --warn-text: #f2cc0c;
    --ok-bg: rgba(115, 191, 105, 0.1);
    --ok-border: rgba(115, 191, 105, 0.35);
    --info-bg: rgba(61, 113, 217, 0.12);
    --info-border: rgba(61, 113, 217, 0.35);
    --danger-bg: rgba(242, 73, 92, 0.1);
    --danger-border: rgba(242, 73, 92, 0.35);
    --pre-bg: #0b0c0e;
    --pre-text: #e2e8f0;
    --pill-bg: rgba(204, 204, 220, 0.08);
    --pill-text: var(--muted);
    --pill-green-bg: rgba(115, 191, 105, 0.15);
    --pill-green-text: #73bf69;
    --pill-orange-bg: rgba(255, 152, 48, 0.15);
    --pill-orange-text: #ff9830;
    --pill-blue-bg: rgba(61, 113, 217, 0.18);
    --pill-blue-text: #6e9fff;
    --pill-gray-bg: rgba(204, 204, 220, 0.08);
    --drawer-bg: #181b1f;
    --cs-header-h: 3.5rem;

    /* Legacy aliases used across templates */
    --cs-blue: var(--primary);
    --cs-blue-dark: var(--primary-hover);
    --cs-blue-soft: var(--active-bg);
    --cs-orange: var(--orange);
    --cs-orange-dark: #e07a18;
    --cs-orange-soft: var(--pill-orange-bg);
    --cs-header-bg: var(--header-bg);
    --cs-surface: var(--panel);
    --cs-surface-muted: var(--bg);
    --cs-border: var(--border);
    --cs-text: var(--text);
    --cs-text-muted: var(--muted);
    --cs-radius: var(--radius-lg);
    --cs-shadow: var(--shadow);
    --cs-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.35);
    --cs-transition: 0.15s ease;

    --primary-color: var(--primary);
    --accent-color: var(--orange);
    --light-accent: var(--active-bg);
    --bg-color: var(--bg);
    --card-bg: var(--panel);
    --text-color: var(--text);
    --light-text: var(--muted);
    --border-color: var(--border);
    --btn-color: var(--primary);
}

html[data-theme="light"] {
    --bg: #f4f5f5;
    --bg-canvas: #e9ecee;
    --panel: #fff;
    --panel-2: #f4f5f5;
    --text: #524e59;
    --text-strong: #181b1f;
    --muted: #6e6e7a;
    --border: rgba(36, 41, 46, 0.12);
    --border-strong: rgba(36, 41, 46, 0.2);
    --primary: #3871dc;
    --primary-text: #fff;
    --primary-hover: #1f62e0;
    --green: #1a7f37;
    --yellow: #cc9d00;
    --orange: #ff9830;
    --red: #e02f44;
    --blue: #3871dc;
    --blue2: #1f62e0;
    --shadow: 0 1px 2px rgba(24, 27, 31, 0.06);
    --radius: 2px;
    --radius-lg: 4px;
    --header-bg: rgba(244, 245, 245, 0.94);
    --hover: rgba(36, 41, 46, 0.06);
    --active-bg: rgba(56, 113, 220, 0.1);
    --active-border: #3871dc;
    --input-bg: #fff;
    --bar-track: rgba(36, 41, 46, 0.1);
    --warn-bg: rgba(255, 152, 48, 0.1);
    --warn-border: rgba(255, 152, 48, 0.35);
    --warn-text: #a35b00;
    --ok-bg: rgba(26, 127, 55, 0.08);
    --ok-border: rgba(26, 127, 55, 0.3);
    --info-bg: rgba(56, 113, 220, 0.08);
    --info-border: rgba(56, 113, 220, 0.3);
    --danger-bg: rgba(224, 47, 68, 0.08);
    --danger-border: rgba(224, 47, 68, 0.3);
    --pre-bg: #181b1f;
    --pre-text: #e2e8f0;
    --pill-bg: #f4f5f5;
    --pill-text: #6e6e7a;
    --pill-green-bg: rgba(26, 127, 55, 0.1);
    --pill-green-text: #1a7f37;
    --pill-orange-bg: rgba(255, 152, 48, 0.12);
    --pill-orange-text: #a35b00;
    --pill-blue-bg: rgba(56, 113, 220, 0.1);
    --pill-blue-text: #3871dc;
    --pill-gray-bg: #e9ecee;
    --drawer-bg: #fff;
    --cs-shadow-lg: 0 8px 24px rgba(24, 27, 31, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    padding: 0 !important;
}

body.drawer-open { overflow: hidden; }

a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Header (full-bleed, pg-mon shell) —— */
.header-wrapper,
.header.header--shell,
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    padding: 0 !important;
    width: 100%;
}

.header.header--shell,
.header {
    margin: 0;
    max-width: none;
    background: var(--header-bg);
}

.headerInner {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 10px 20px;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header__brand-block {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex-wrap: wrap;
}

.headerActions,
.header__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.topSections {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.topSec {
    display: inline-flex;
    align-items: center;
    padding: 7px 12px;
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
}

.topSec:hover {
    background: var(--hover);
    color: var(--text-strong);
}

.topSec.active {
    background: var(--active-bg);
    color: var(--primary-hover);
    border-color: var(--active-border);
}

/* —— Always-visible sidebar shell ——
   Authed layout fills the viewport; only .wrap scrolls when content overflows.
   Avoid min-height: calc(100vh - 58px) — header is often taller than 58px. */
body.app-shell-authed {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

body.app-shell-authed > .header {
    flex-shrink: 0;
}

.shell {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.sideNav {
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 14px 12px;
    align-self: stretch;
    min-height: 0;
    height: auto;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.shell > .wrap {
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

/* TKP embed: fill pane, no double scrollbars */
.shell > .wrap:has(.tkp-embed) {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sideNav .navLabel {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0 0 10px 6px;
    font-weight: 700;
}

.sideNav .navLabel + .navLabel { margin-top: 18px; }
.sideNav .tabs + .navLabel { margin-top: 22px; }
.sideNav .navLabel.navRelated {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sideNav .tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
}

.sideNav a.tab {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    border-radius: var(--radius-lg);
    padding: 9px 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    width: 100%;
    font-size: 13px;
    text-decoration: none !important;
    display: block;
}

.sideNav a.tab:hover {
    background: var(--hover);
    color: var(--text-strong);
}

.sideNav a.tab.active {
    background: var(--active-bg);
    color: var(--primary-hover);
    border-color: var(--active-border);
}

.wrap {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

/* Guest landing: fit viewport — no vertical page scrollbar.
   Header + landing min-height (100vh - 58px) overflowed because header is taller than 58px. */
body.app-shell-guest {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

body.app-shell-guest > .header {
    flex-shrink: 0;
}

body.app-shell-guest .landing-page {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
}

.app-shell-guest .landing-hero__intro--centered {
    max-width: 520px;
    margin: 2.5rem auto;
    text-align: left;
}

/* User menu */
.userMenu {
    position: relative;
}

.userMenu__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    border-radius: var(--radius-lg);
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    max-width: 280px;
}

.userMenu__btn:hover,
.userMenu.is-open .userMenu__btn {
    background: var(--hover);
    border-color: var(--border-strong);
}

.userMenu__avatar {
    width: 22px;
    height: 22px;
    border-radius: var(--radius);
    background: var(--active-bg);
    color: var(--primary-hover);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.userMenu__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.userMenu__caret { font-size: 10px; color: var(--muted); }

.userMenu__dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--cs-shadow-lg);
    padding: 6px;
    z-index: 200;
}

.userMenu__item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none !important;
    cursor: pointer;
}

.userMenu__item:hover {
    background: var(--hover);
    color: var(--text-strong);
}

.userMenu__item--danger { color: var(--red); }

/* Dashboard */
.dash-hero { margin-bottom: 12px; }
.dash-sub { margin: 0; color: var(--muted); font-size: 13px; }
.dash-kpis { margin-bottom: 12px; }
.dash-row { margin-bottom: 12px; }
.grid { display: grid; gap: 12px; }
.cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    min-height: 84px;
}
.kpi .lbl { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi .val { font-size: 24px; font-weight: 700; color: var(--text-strong); }
.kpi .val--sm { font-size: 16px; line-height: 1.3; }
.hubTile {
    display: block;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px;
    text-decoration: none !important;
    color: inherit;
    transition: border-color 0.15s, background 0.15s;
}
.hubTile:hover {
    border-color: var(--active-border);
    background: var(--active-bg);
}
.hubTitle { font-weight: 700; font-size: 14px; color: var(--text-strong); margin: 0 0 4px; }
.hubDesc { color: var(--muted); font-size: 12px; margin: 0; line-height: 1.4; }
.hubMeta {
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.hub-grid { gap: 8px; }
.bulletList { margin: 0; padding-left: 0; list-style: none; }
.bulletList li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}
.bulletList li:last-child { border-bottom: 0; }
.progress-list { display: flex; flex-direction: column; gap: 12px; }
.progress-row__head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 13px;
}
.progress-bar {
    height: 8px;
    border-radius: 999px;
    background: var(--bar-track);
    overflow: hidden;
}
.progress-bar__fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

@media (max-width: 1000px) {
    .shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
    .sideNav {
        position: static;
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sideNav .tabs { flex-direction: row; flex-wrap: wrap; }
    .sideNav a.tab { width: auto; }
    .cols2, .cols3, .cols4 { grid-template-columns: 1fr; }
    .headerInner { padding-left: 12px; padding-right: 12px; }
}

.header__user {
    color: var(--muted);
    font-size: 13px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--cs-transition);
}

.nav-toggle:hover {
    background: var(--hover);
    border-color: var(--border-strong);
}

.header__logo {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none !important;
    background: none !important;
    background-image: none !important;
    width: auto;
    height: auto;
    white-space: nowrap;
}

.header__logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: var(--radius-lg);
    background: var(--primary);
    color: var(--primary-text);
    font-size: 0.7rem;
    font-weight: 800;
    flex-shrink: 0;
}

.header__logo-text {
    color: var(--text-strong);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header__link {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.header__link--compact {
    font-size: 13px;
    padding: 7px 12px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--panel);
}

.header__button,
.header__exitbutton,
.themeToggle {
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--cs-transition), border-color var(--cs-transition);
}

.header__button--ghost,
.themeToggle {
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
}

.header__button--ghost:hover,
.themeToggle:hover {
    background: var(--hover);
    border-color: var(--border-strong);
}

.header__button--primary,
.header__exitbutton {
    border: none;
    background: var(--primary);
    color: var(--primary-text);
}

.header__button--primary:hover,
.header__exitbutton:hover {
    background: var(--primary-hover);
}

/* —— Legacy drawer (hidden; shell uses .sideNav) —— */
.app-drawer-overlay,
.app-drawer { display: none !important; }
.nav-toggle { display: none !important; }

/* —— Content: full viewport width —— */
.app-content,
.main-content,
.tkp-main-content,
.landing-container,
.listform-container,
.docs-container,
.container,
.content-wrapper {
    max-width: none !important;
    margin: 0 !important;
    width: 100% !important;
}

.app-content,
.main-content,
.tkp-main-content {
    padding: 16px 20px 40px;
}

.listform-container { padding: 0; }

.page-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-strong);
    margin: 0 0 4px;
}

.card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--panel);
    padding: 16px;
    margin-bottom: 12px;
}

.card-title {
    border-bottom: 1px solid var(--border);
    color: var(--text-strong);
    font-weight: 600;
    font-size: 16px;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.btn,
.landing-login-btn,
.submit-btn,
.btn-primary,
.change-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 9px 14px;
    border-radius: var(--radius);
    border: none;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--cs-transition);
    background: var(--primary);
    color: var(--primary-text);
    text-decoration: none !important;
}

.btn-primary:hover,
.landing-login-btn:hover,
.submit-btn:hover,
.change-submit-btn:hover,
.btn:hover {
    background: var(--primary-hover);
    box-shadow: none;
}

.btn-secondary,
.landing-login-btn--ghost,
.btn-ghost {
    background: var(--panel-2);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-secondary:hover,
.landing-login-btn--ghost:hover,
.btn-ghost:hover {
    background: var(--hover);
    border-color: var(--border-strong);
}

.document-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.document-option {
    display: block;
    border-radius: var(--radius-lg);
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    text-decoration: none !important;
    color: inherit;
    transition: border-color var(--cs-transition), background var(--cs-transition);
}

.document-option:hover {
    border-color: var(--active-border);
    background: var(--active-bg);
    box-shadow: none;
    transform: none;
}

.document-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    background: var(--active-bg);
    color: var(--primary-hover);
}

.document-option:nth-child(2) .document-icon {
    background: var(--pill-orange-bg);
    color: var(--orange);
}

.document-desc {
    margin: 0.35rem 0 0;
    font-size: 13px;
    color: var(--muted);
}

/* Landing */
.landing-page {
    min-height: calc(100vh - 58px);
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.landing-page__glow { display: none; }

.landing-container {
    padding: 0 20px;
}

.landing-hero { padding: 24px 0 16px; }

.landing-hero__grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    gap: 12px;
    align-items: start;
}

.landing-title {
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    font-weight: 600;
    color: var(--text-strong);
}

.landing-subtitle,
.landing-hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.landing-subtitle {
    margin-top: 8px;
    max-width: none;
}

.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 7px 11px;
    border-radius: var(--radius-lg);
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-transform: none;
    margin-bottom: 12px;
}

.landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.landing-hero-card,
.landing-service-card,
.service-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.landing-hero-card { padding: 14px 16px; }

.landing-hero-card__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 10px;
}

.landing-stat {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.landing-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.landing-stat strong {
    display: block;
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 600;
}

.landing-stat span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
    line-height: 1.4;
}

.landing-stat__icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--active-bg);
    color: var(--primary-hover);
    flex-shrink: 0;
}

.landing-stat__icon--orange {
    background: var(--pill-orange-bg);
    color: var(--orange);
}

.landing-services { padding: 0 0 40px; }

.landing-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong);
    margin: 0 0 12px;
}

.landing-services-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.landing-service-card {
    display: block;
    padding: 16px;
    text-decoration: none !important;
    color: var(--text) !important;
    transition: border-color var(--cs-transition), background var(--cs-transition);
}

.landing-service-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--active-border);
    background: var(--active-bg);
}

.landing-service-card h3 {
    margin: 10px 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-strong);
}

.landing-service-card p {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
    line-height: 1.4;
}

.landing-service-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--active-bg);
    color: var(--primary-hover);
    font-size: 1.1rem;
}

.landing-service-icon--orange {
    background: var(--pill-orange-bg);
    color: var(--orange);
}

.landing-services-grid--compact {
    grid-template-columns: 1fr;
    gap: 10px;
}

.landing-services-grid--compact .landing-service-card { padding: 14px; }

.landing-services-grid--compact .landing-service-card h3 {
    margin-top: 8px;
    font-size: 14px;
}

.landing-services-grid--compact .landing-service-card p { font-size: 13px; }

@media (max-width: 900px) {
    .landing-hero { padding-top: 16px; }
    .landing-hero__grid { grid-template-columns: 1fr; }
    .landing-services-grid { grid-template-columns: 1fr; }
}

/* Modal */
.modal-content,
.modalChange-content {
    background: var(--panel) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--cs-shadow-lg) !important;
}

.modal-content .tab {
    color: var(--muted) !important;
    background: transparent !important;
    border-radius: var(--radius-lg);
}

.modal-content .tab.active {
    background: var(--active-bg) !important;
    color: var(--primary-hover) !important;
}

.modal-content .form-group label { color: var(--text) !important; }

.modal-content .form-group input {
    background: var(--input-bg) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
}

/* TKP helpers + shell embed */
.tkp-embed {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
}

.app-content.app-content--tkp {
    padding: 0 !important;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tkp-frame {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    height: 100%;
    border: 0;
    background: var(--bg);
    display: block;
}

.tkp-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 14px;
    margin-bottom: 12px;
}

.tkp-input {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    font: inherit;
    background: var(--input-bg);
    color: var(--text);
}

.tkp-steps-sidebar {
    width: 220px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
}

.tkp-steps-sidebar .nav-btn.active {
    background: var(--active-bg);
    color: var(--primary-hover);
}

@media (max-width: 768px) {
    .header__user { display: none; }
    .header { padding: 10px 12px; }
    .app-content,
    .main-content,
    .tkp-main-content { padding: 12px 12px 32px; }
}

/* MT layout */
.app-content:has(.mt-layout) { padding-top: 12px; }

.mt-layout {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: none;
    margin: 0;
    width: 100%;
}

.mt-layout__main {
    flex: 1;
    min-width: 0;
}

.mt-section-nav {
    flex: 0 0 220px;
    position: sticky;
    top: calc(var(--cs-header-h) + 0.75rem);
    align-self: flex-start;
    max-height: calc(100vh - var(--cs-header-h) - 1.5rem);
    overflow-y: auto;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px 10px;
    box-shadow: var(--shadow);
}

.mt-section-nav__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 0 6px 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.mt-section-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mt-section-nav__btn {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid transparent !important;
    border-radius: var(--radius-lg);
    background: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    transition: background var(--cs-transition);
}

.mt-section-nav__btn:hover {
    background: var(--hover);
    color: var(--text-strong);
}

.mt-section-nav__btn.active {
    background: var(--active-bg);
    color: var(--primary-hover);
    border-color: var(--active-border) !important;
    font-weight: 600;
    box-shadow: none;
}

.mt-layout .listform-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.mt-layout .form-page {
    background: transparent;
    padding: 0;
    margin: 0;
    border-radius: 0;
}

.mt-layout .list-container {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}

.mt-layout .list-container a {
    color: var(--primary-hover);
    text-decoration: none;
}

.mt-layout .list-container a:hover { text-decoration: underline; }

.mt-layout .list-container span { color: var(--primary); }

.mt-layout h2 {
    color: var(--text-strong);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 0;
    border: none;
}

.mt-layout h3 {
    color: var(--text-strong);
    font-size: 14px;
    font-weight: 600;
}

.mt-layout .list-group label {
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}

.mt-layout .list-group input:not([type="checkbox"]),
.mt-layout .list-group textarea,
.mt-layout .list-group select {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color var(--cs-transition);
}

.mt-layout .list-group input:focus,
.mt-layout .list-group textarea:focus,
.mt-layout .list-group select:focus {
    outline: none;
    border-color: var(--active-border);
    box-shadow: none;
}

.mt-layout .expandable-section,
.mt-layout .groups-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 10px;
    background: var(--panel-2);
}

.mt-layout .expand-header { color: var(--text-strong); }

.mt-layout .add-btn,
.mt-layout .add-group,
.mt-layout .delete-group-btn,
.mt-layout .consequence-add-btn { color: var(--primary-hover); }

.mt-layout .help-btn { color: var(--muted); }

.mt-layout .buttons {
    border-top: 1px solid var(--border);
    margin-top: 16px;
    padding-top: 14px;
    gap: 8px;
    flex-wrap: wrap;
}

.mt-layout #questionnaireForm button.primary,
.mt-layout #questionnaireForm .next-btn.primary {
    background: var(--primary);
    color: var(--primary-text);
    border-color: var(--primary);
}

.mt-layout #questionnaireForm button.primary:hover,
.mt-layout #questionnaireForm .next-btn.primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.mt-layout #questionnaireForm button.secondary,
.mt-layout #questionnaireForm .prev-btn {
    background: var(--panel-2);
    color: var(--text);
    border-color: var(--border);
}

.mt-layout #questionnaireForm button.secondary:hover,
.mt-layout #questionnaireForm .prev-btn:hover {
    background: var(--hover);
    border-color: var(--border-strong);
}

@media (max-width: 900px) {
    .mt-layout {
        flex-direction: column;
        gap: 10px;
    }

    .mt-section-nav {
        position: static;
        flex: none;
        width: 100%;
        max-height: none;
    }

    .mt-section-nav__list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2px;
    }

    .mt-layout .listform-container { padding: 12px; }
}

/* Override older stylesheet width caps */
.main-container,
.page-container,
.form-container,
.docs-page,
.personal-page,
.mt-page,
.docs-container,
.form-wrapper,
.questionnaire-container,
.list-form,
.content {
    max-width: none !important;
    width: 100% !important;
}

/* Legacy style.css / MTpg_style.css / docs_page_style.css width locks */
body .header,
body .main-content,
body .app-content,
body .listform-container,
body .docs-list,
body .document-list,
body .personal-info,
body .mt-layout {
    max-width: none !important;
}

/* Tables / forms stretch with viewport */
table.data-table,
.table-responsive,
.form-page,
.list-group {
    width: 100%;
    max-width: none;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    background: var(--input-bg);
    color: var(--text);
    border-color: var(--border);
}



/* === LEGACY style.css KILL-SWITCH (post pg-mon restyle) === */
html[data-theme] body {
    background: var(--bg) !important;
    color: var(--text) !important;
    padding: 0 !important;
}

html[data-theme] .header-wrapper {
    background: var(--header-bg) !important;
    padding: 0 !important;
}

html[data-theme] .header {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 12px 20px !important;
    background: transparent !important;
}

html[data-theme] .header__logo {
    display: inline-flex !important;
    width: auto !important;
    height: auto !important;
    background: none !important;
    background-image: none !important;
}

html[data-theme] .header__button,
html[data-theme] .header__exitbutton,
html[data-theme] .themeToggle {
    font-size: 13px !important;
}

html[data-theme] .modal {
    z-index: 200 !important;
}

/* mp_style.css :root light defaults must not leak under dark/light tokens */
html[data-theme] {
    --bg-color: var(--bg);
    --card-bg: var(--panel);
    --text-color: var(--text);
    --light-text: var(--muted);
    --border-color: var(--border);
    --primary-color: var(--primary);
    --accent-color: var(--orange);
    --light-accent: var(--active-bg);
    --btn-color: var(--primary);
}


a.landing-login-btn,
a.header__button {
    text-decoration: none;
    box-sizing: border-box;
}
