:root {
    --navy: #102a43;
    --navy-2: #183b56;
    --gold: #c99a2e;
    --ink: #1f2933;
    --muted: #66788a;
    --line: #d9e2ec;
    --bg: #f5f7fa;
    --panel: #ffffff;
    --green: #1f8a5b;
    --amber: #b7791f;
    --red: #c53030;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    background: var(--navy);
    color: #fff;
    padding: 24px 18px;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    margin-bottom: 28px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    background: var(--gold);
    color: var(--navy);
    border-radius: 8px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 3px;
}

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a,
.sidebar nav summary {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #d9e2ec;
    font-size: 13px;
    font-weight: 700;
}

.sidebar nav a.active,
.sidebar nav a:hover,
.sidebar nav summary.active,
.sidebar nav summary:hover {
    background: var(--navy-2);
    color: #fff;
}

.nav-group {
    border: 1px solid rgba(217, 226, 236, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.nav-group summary {
    cursor: pointer;
    list-style: none;
    justify-content: space-between;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::after {
    content: '+';
    color: #9fb3c8;
    font-size: 14px;
}

.nav-group[open] summary::after {
    content: '-';
}

.nav-group div {
    display: grid;
    gap: 2px;
    padding: 0 6px 8px;
}

.nav-group div a {
    min-height: 32px;
    padding: 8px 10px 8px 18px;
    border-radius: 6px;
    color: #bcccdc;
    font-size: 12px;
    font-weight: 600;
}

.app-shell {
    margin-left: 252px;
    min-height: 100vh;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 30px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    min-width: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
}

.topbar-search {
    display: grid;
    grid-template-columns: 20px minmax(160px, 260px) 30px;
    align-items: center;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 4px 0 12px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.04);
    max-width: 100%;
}

.topbar-search svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

.topbar-search input {
    min-height: 30px;
    border: 0;
    padding: 0 8px;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    outline: none;
}

.topbar-search button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    cursor: pointer;
}

.topbar-search button svg {
    color: #fff;
}

.context-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 4px 4px 4px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.04);
}

.context-switcher label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
}

.context-switcher select {
    min-height: 30px;
    max-width: 210px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    outline: none;
}

.context-switcher button {
    min-height: 30px;
    border: 0;
    border-radius: 999px;
    padding: 0 12px;
    background: var(--navy);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.workspace-context-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    max-width: min(360px, 32vw);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
    background: #fff;
    color: var(--navy);
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.05);
}

.workspace-context-badge > svg {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    color: var(--gold);
}

.workspace-context-badge span {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.workspace-context-badge small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
}

.workspace-context-badge strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 13px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-action-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.06);
}

.topbar-action-icon:hover {
    border-color: var(--navy);
    background: #edf2f7;
}

.topbar-action-icon svg {
    width: 17px;
    height: 17px;
}

.new-menu {
    position: relative;
}

.new-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 92px;
    height: 36px;
    border: 1px solid var(--navy);
    border-radius: 999px;
    padding: 0 14px;
    background: var(--navy);
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    list-style: none;
    box-shadow: 0 8px 18px rgba(16, 42, 67, 0.14);
}

.new-menu summary::-webkit-details-marker {
    display: none;
}

.new-menu summary svg {
    width: 16px;
    height: 16px;
}

.new-menu[open] summary,
.new-menu summary:hover {
    background: #0b1f33;
}

.new-menu div {
    position: absolute;
    z-index: 30;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    width: min(280px, calc(100vw - 28px));
    max-height: min(520px, calc(100vh - 130px));
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(16, 42, 67, 0.16);
}

.new-menu a {
    display: grid;
    gap: 2px;
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--ink);
}

.new-menu a:hover {
    background: #edf2f7;
}

.new-menu a strong {
    color: #111827;
    font-size: 13px;
}

.new-menu a small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.profile-menu {
    position: relative;
}

.profile-menu summary {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 210px;
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 16px 8px 12px;
    background: #fff;
    color: var(--navy);
    cursor: pointer;
    list-style: none;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.08);
}

.profile-menu summary::-webkit-details-marker {
    display: none;
}

.profile-menu summary::after {
    content: '';
    width: 0;
    height: 0;
    margin-left: auto;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--navy);
}

.profile-menu[open] summary {
    border-color: var(--navy);
}

.avatar-mark {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 999px;
    background: #0b1720;
}

.avatar-mark::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
}

.avatar-mark::after {
    content: '';
    position: absolute;
    left: 7px;
    bottom: 6px;
    width: 20px;
    height: 11px;
    border-radius: 14px 14px 8px 8px;
    background: #fff;
}

.profile-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.profile-copy strong {
    color: #111827;
    font-size: 15px;
    line-height: 1.1;
}

.profile-copy small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0;
}

.profile-menu div {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    display: grid;
    min-width: 240px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 0;
    background: #fff;
    box-shadow: 0 14px 30px rgba(16, 42, 67, 0.14);
}

.profile-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 36px;
    padding: 0 16px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 600;
}

.profile-menu a:hover {
    background: #edf2f7;
}

.profile-menu a svg {
    width: 18px;
    height: 18px;
    color: var(--navy);
}

.profile-menu a.danger {
    border-top: 1px solid var(--line);
    margin-top: 8px;
    padding-top: 8px;
    color: var(--red);
}

.profile-menu a.danger svg {
    color: var(--red);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 28px;
}

.context-label {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 0 10px;
    margin: 8px 0 0;
    background: #edf2f7;
    color: var(--navy);
    font-size: 12px;
    font-weight: 700;
}

h2 {
    font-size: 20px;
}

.eyebrow {
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.muted,
.hint {
    color: var(--muted);
}

.user-chip {
    display: grid;
    justify-items: end;
    gap: 2px;
    font-size: 14px;
    margin-left: 6px;
}

.user-chip small {
    color: var(--muted);
}

.user-chip a {
    color: var(--gold);
    font-weight: 700;
}

.content {
    padding: 30px;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid.cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.dashboard-cards {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid.two {
    grid-template-columns: 1.35fr 1fr;
}

.grid.dashboard-main {
    grid-template-columns: 1.2fr 1fr;
}

.grid.chart-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.table-panel,
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.05);
}

.metric {
    min-height: 150px;
}

.metric strong {
    display: block;
    margin: 12px 0 8px;
    font-size: 34px;
    color: var(--navy);
}

.metric .hint {
    margin: 10px 0 0;
    font-size: 13px;
}

.dashboard-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.dashboard-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    background: #fff;
    color: var(--navy);
    font-weight: 700;
}

.dashboard-tabs a.active {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.dashboard-section {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.ceo-start-guide {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.ceo-start-guide a {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 4px 10px;
    min-height: 118px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(16, 42, 67, 0.05);
}

.ceo-start-guide a:hover {
    border-color: var(--navy);
    text-decoration: none;
}

.ceo-start-guide span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-weight: 800;
}

.ceo-start-guide strong {
    align-self: center;
    color: var(--navy);
    font-size: 15px;
}

.ceo-start-guide small {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

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

.action-tiles a {
    display: grid;
    gap: 6px;
    min-height: 96px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
}

.action-tiles a:hover {
    border-color: var(--navy);
    background: #fff;
    text-decoration: none;
}

.action-tiles strong {
    color: var(--navy);
    font-size: 15px;
}

.action-tiles span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.structure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.structure-card {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.structure-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.structure-card h3 {
    margin: 0 0 4px;
    color: var(--navy);
    font-size: 17px;
}

.structure-card p {
    margin: 0;
}

.analysis-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.analysis-actions a {
    display: grid;
    gap: 6px;
    min-height: 96px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    border-radius: 8px;
    padding: 14px;
    background: #fff;
}

.analysis-actions a:hover {
    border-color: var(--navy);
    border-left-color: var(--navy);
    box-shadow: 0 12px 24px rgba(16, 42, 67, 0.08);
}

.analysis-actions strong {
    color: var(--navy);
    font-size: 14px;
}

.analysis-actions span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.compact-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-charts .chart-card {
    min-height: 0;
}

.financial-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 18px;
    align-items: stretch;
    margin-bottom: 18px;
}

.financial-hero > div,
.period-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.05);
}

.financial-hero > div {
    padding: 22px;
}

.financial-hero h2 {
    margin: 4px 0 8px;
    font-size: 24px;
}

.period-card {
    display: grid;
    align-content: center;
    gap: 8px;
    padding: 22px;
    border-top: 5px solid var(--gold);
}

.period-card span,
.period-card small {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.period-card strong {
    color: var(--navy);
    font-size: 26px;
}

.finance-summary-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.credit-summary-cards {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.finance-ratio-panel {
    background: linear-gradient(180deg, #fff, #f8fafc);
}

.ratio-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.ratio-strip article {
    display: grid;
    gap: 8px;
    min-height: 118px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.ratio-strip span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.ratio-strip strong {
    color: var(--navy);
    font-size: 28px;
}

.credit-ratio-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.finance-entry-panel {
    padding: 0;
    overflow: hidden;
}

.credit-entry-panel {
    padding: 0;
    overflow: hidden;
}

.credit-entry-panel > .section-heading {
    padding: 20px 20px 0;
}

.finance-upload-panel {
    border-top: 5px solid var(--gold);
}

.credit-upload-panel {
    border-top-color: var(--green);
}

.finance-upload-form {
    display: grid;
    grid-template-columns: minmax(180px, 260px) minmax(180px, 260px) minmax(0, 1fr);
    gap: 14px;
    align-items: end;
    margin-top: 16px;
}

.finance-upload-form .span-2 {
    grid-column: auto;
}

.credit-upload-panel .finance-upload-form {
    grid-template-columns: minmax(180px, 260px) minmax(280px, 1fr) auto;
}

.finance-upload-form label {
    margin-bottom: 0;
}

.finance-document-panel table {
    margin-top: 12px;
}

.section-heading-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.inline-capture-form {
    display: grid;
    grid-template-columns: minmax(150px, 190px) auto;
    gap: 10px;
    align-items: center;
}

.inline-capture-form input {
    min-height: 38px;
}

.inline-delete-form {
    display: inline-flex;
}

.finance-entry-panel > .section-heading {
    padding: 20px 20px 0;
}

.finance-form {
    display: grid;
    gap: 18px;
    padding: 0 20px 20px;
}

.period-selector {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 16px;
    border: 1px solid #cfe3f3;
    border-radius: 8px;
    background: #f4f9fd;
}

.period-selector label,
.finance-form-section label,
.remarks-box {
    margin-bottom: 0;
}

.period-selector input[readonly] {
    background: #fff;
    color: var(--navy);
    font-weight: 700;
}

.finance-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.credit-brief-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 18px;
}

.credit-brief-grid label {
    margin-bottom: 0;
}

.credit-recovery-panel {
    background: #f8fbfd;
    border-color: #cfe3f3;
}

.credit-recovery-panel h3 {
    margin-top: 2px;
}

.credit-source-grid,
.credit-rate-grid {
    display: grid;
    gap: 14px 18px;
}

.credit-source-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.credit-rate-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.credit-source-grid label,
.credit-rate-grid label {
    margin-bottom: 0;
}

.finance-form-section {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.finance-form-section h3 {
    margin: 0 0 4px;
    color: var(--navy);
    font-size: 17px;
}

.remarks-box textarea {
    min-height: 92px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chart-frame {
    position: relative;
    width: 100% !important;
    height: var(--chart-height, 240px);
    min-height: 180px;
    max-height: 320px;
    overflow: hidden;
    flex: 0 0 var(--chart-height, 240px);
}

.chart-card canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 0;
    max-height: 100%;
}

.calendar-list {
    display: grid;
    gap: 12px;
}

.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    gap: 8px;
    margin: 18px 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.calendar-weekdays span {
    padding: 0 8px;
}

.calendar-grid {
    gap: 8px;
}

.calendar-day {
    min-height: 138px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.calendar-day.is-muted {
    background: #f8fafc;
    color: var(--muted);
}

.calendar-day-number {
    margin-bottom: 8px;
    color: var(--navy);
    font-weight: 800;
}

.calendar-chip {
    display: grid;
    gap: 2px;
    margin-bottom: 6px;
    border-radius: 6px;
    padding: 6px;
    background: #edf2f7;
    color: var(--navy);
    font-size: 11px;
    line-height: 1.25;
}

.calendar-chip.success {
    background: #e3f8ef;
}

.calendar-chip.warning {
    background: #fff4d6;
}

.calendar-chip.danger {
    background: #ffe3e3;
}

.calendar-week-row {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.calendar-week-row h3 {
    margin-bottom: 8px;
}

.calendar-item {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 12px;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.calendar-week-row .calendar-item {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px 0;
}

.calendar-date {
    display: grid;
    place-items: center;
    min-height: 58px;
    border-radius: 8px;
    background: #edf2f7;
    color: var(--navy);
}

.calendar-date strong {
    font-size: 22px;
    line-height: 1;
}

.calendar-date span {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.actions form,
.inline-action-form {
    display: inline-flex;
    margin: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 14px;
    background: #fff;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary {
    background: var(--navy);
    color: #fff;
    border-color: var(--navy);
}

.btn-gold {
    background: var(--gold);
    color: var(--navy);
    border-color: var(--gold);
}

.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

.btn:disabled,
.btn.disabled {
    opacity: .52;
    cursor: not-allowed;
    box-shadow: none;
}

.invitation-actions {
    gap: 8px;
    margin: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
}

.badge.success {
    background: #e3f8ef;
    color: var(--green);
}

.badge.warning {
    background: #fff4d6;
    color: var(--amber);
}

.badge.danger {
    background: #ffe3e3;
    color: var(--red);
}

.badge.neutral {
    background: #edf2f7;
    color: var(--muted);
}

.progress {
    height: 10px;
    overflow: hidden;
    background: #edf2f7;
    border-radius: 999px;
}

.progress span {
    display: block;
    height: 100%;
    background: var(--gold);
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
    background: linear-gradient(135deg, var(--navy), #24476a);
}

.login-panel {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 34px;
    align-items: center;
    max-width: 1040px;
    color: #fff;
}

.login-panel h1 {
    font-size: 44px;
    line-height: 1.08;
    margin-bottom: 16px;
}

.auth-card {
    color: var(--ink);
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font: inherit;
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 14px;
}

.alert-danger {
    background: #ffe3e3;
    color: var(--red);
}

.alert-info {
    background: #e6f6ff;
    color: var(--navy);
}

.alert-warning {
    background: #fff4d6;
    color: var(--amber);
}

.alert-success {
    background: #e3f8ef;
    color: var(--green);
}

.auth-links {
    display: flex;
    gap: 12px;
    margin-top: 14px;
    font-weight: 700;
}

.auth-links a {
    color: var(--navy);
}

.check-row {
    display: flex;
    grid-template-columns: none;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: 400;
}

.check-row input {
    width: auto;
    min-height: auto;
    margin-top: 3px;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 16px;
    margin-bottom: 16px;
}

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

.span-2 {
    grid-column: 1 / -1;
}

.text-link {
    color: var(--navy);
    font-weight: 700;
    text-decoration: underline;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.report-hero {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    margin-bottom: 18px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.05);
}

.report-document {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 18px;
}

.report-document aside,
.report-document article section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.05);
}

.report-document aside {
    position: sticky;
    top: 18px;
    align-self: start;
    display: grid;
    gap: 4px;
    max-height: calc(100vh - 36px);
    overflow: auto;
    padding: 16px;
}

.report-document aside a {
    border-radius: 6px;
    padding: 7px 8px;
    color: var(--navy);
    font-size: 12px;
    font-weight: 700;
}

.report-document aside a:hover {
    background: #edf2f7;
}

.report-document article {
    display: grid;
    gap: 14px;
}

.report-document article section {
    padding: 20px;
}

.report-document article section p:last-child {
    margin-bottom: 0;
    line-height: 1.6;
}

.agenda-total {
    display: grid;
    justify-items: end;
    color: var(--navy);
}

.agenda-total strong {
    font-size: 34px;
    line-height: 1;
}

.agenda-total span {
    color: var(--muted);
    font-size: 13px;
}

.lifecycle {
    display: grid;
    gap: 10px;
}

.lifecycle span {
    display: flex;
    align-items: center;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--muted);
    background: #fff;
    font-weight: 700;
}

.lifecycle span.current {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.meeting-status-panel {
    scroll-margin-top: 110px;
    margin-bottom: 18px;
}

.meeting-close-panel {
    scroll-margin-top: 110px;
    margin-bottom: 18px;
}

.meeting-close-panel table {
    margin: 14px 0;
}

.meeting-close-panel .closure-form {
    margin-top: 8px;
}

.status-lifecycle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.status-lifecycle span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.status-lifecycle span.done {
    border-color: #b7e4cf;
    background: #f0fff7;
    color: var(--green);
}

.status-lifecycle span.current {
    border-color: var(--navy);
    background: var(--navy);
    color: #fff;
}

.status-change-form {
    display: grid;
    gap: 10px;
}

.status-lock-note {
    margin: 6px 0 0;
}

.workflow-steps {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

.workflow-step {
    display: grid;
    gap: 6px;
    min-height: 96px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fff;
}

.workflow-step strong {
    color: var(--navy);
}

.workflow-step span {
    color: var(--muted);
    font-size: 13px;
}

.workflow-step.done {
    border-color: #b7e4cf;
    background: #f0fff7;
}

.agenda-workflow {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 16px;
}

.agenda-preview {
    max-width: 980px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.05);
}

.document-viewer {
    position: relative;
    min-height: 680px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.05);
}

.document-image-preview {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: 720px;
    margin: 0 auto;
    object-fit: contain;
}

.inline-edit {
    display: grid;
    grid-template-columns: 80px minmax(130px, 1fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 310px;
}

.document-viewer iframe {
    width: 100%;
    min-height: 680px;
    border: 0;
}

.watermark {
    position: absolute;
    inset: 40% auto auto 8%;
    z-index: 2;
    width: 84%;
    color: rgba(197, 48, 48, 0.18);
    font-size: 30px;
    font-weight: 700;
    text-align: center;
    transform: rotate(-18deg);
    pointer-events: none;
}

.pdf-placeholder {
    display: grid;
    place-content: center;
    min-height: 680px;
    padding: 30px;
    text-align: center;
}

.minute-export {
    min-height: 520px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
    background: #fff;
}

.calendar-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.board-pack-page {
    background: #eef3f8;
}

.board-pack-cover,
.board-pack-document,
.board-pack-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.05);
}

.board-pack-cover {
    padding: 36px;
    margin-bottom: 18px;
}

.board-pack-cover h2 {
    max-width: 860px;
    margin: 8px 0;
    font-size: 34px;
}

.board-pack-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.board-pack-meta span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 12px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.board-pack-summary {
    margin-bottom: 18px;
}

.board-pack-toc {
    margin: 0;
    padding-left: 20px;
}

.board-pack-toc li {
    margin: 8px 0;
    color: var(--navy);
    font-weight: 700;
}

.board-pack-document {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.board-pack-section {
    padding: 22px;
    box-shadow: none;
}

.board-pack-section h3 {
    margin-top: 18px;
}

.board-pack-section table + table {
    margin-top: 16px;
}

.print-only {
    display: none;
}

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

.row-actions form {
    margin: 0;
}

code {
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 900px) {
    .sidebar {
        position: static;
        width: auto;
    }

    .app-shell {
        margin-left: 0;
    }

    .topbar,
    .login-panel {
        grid-template-columns: 1fr;
    }

    .grid.cards,
    .grid.dashboard-cards,
    .grid.two,
    .grid.dashboard-main,
    .grid.chart-grid,
    .ceo-start-guide,
    .financial-hero,
    .finance-summary-cards,
    .credit-summary-cards,
    .period-selector,
    .finance-upload-form,
    .finance-form-grid,
    .credit-brief-grid,
    .credit-source-grid,
    .credit-rate-grid,
    .ratio-strip,
    .permission-grid,
    .form-grid,
    .calendar-board,
    .calendar-weekdays,
    .calendar-grid,
    .workflow-steps,
    .agenda-workflow {
        grid-template-columns: 1fr;
    }

    .calendar-weekdays {
        display: none;
    }

    .calendar-day {
        min-height: 92px;
    }

    .calendar-week-row,
    .calendar-item,
    .calendar-week-row .calendar-item {
        grid-template-columns: 1fr;
    }

    .section-heading {
        display: grid;
    }

    .agenda-total {
        justify-items: start;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        width: 100%;
    }

    .topbar-search {
        grid-template-columns: 20px minmax(0, 1fr) 30px;
        width: 100%;
    }

    .workspace-context-badge {
        width: 100%;
        max-width: none;
        border-radius: 8px;
    }

    .board-pack-cover {
        padding: 22px;
    }

    .board-pack-cover h2 {
        font-size: 28px;
    }

    .profile-menu div {
        left: 0;
        right: auto;
    }

    .new-menu div {
        left: 0;
        right: auto;
    }

    .user-chip {
        justify-items: start;
        width: 100%;
        margin-left: 0;
    }

    .finance-upload-form .span-2 {
        grid-column: 1 / -1;
    }
}

/* Focused authentication and record-detail layouts */
.login-shell {
    min-height: 100vh;
    padding: 20px;
    background: #eef2f7;
}

.login-panel.auth-single {
    display: block;
    width: min(100%, 470px);
    max-width: 470px;
    color: var(--ink);
}

.auth-brand {
    display: grid;
    justify-items: center;
    gap: 5px;
    margin-bottom: 14px;
    color: var(--navy);
    text-align: center;
}

.auth-brand strong { font-size: 20px; }

.auth-brand > span:last-child,
.auth-footer {
    color: var(--muted);
    font-size: 13px;
}

.auth-brand-mark {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: var(--navy);
    color: #fff;
    font-weight: 800;
    box-shadow: inset 0 -4px 0 var(--gold);
}

.auth-brand-logo {
    width: 88px;
    height: 88px;
    object-fit: contain;
    border-radius: 18px;
    background: #fff;
    padding: 5px;
    box-shadow: 0 10px 24px rgba(16, 42, 67, 0.12);
}

.auth-card {
    padding: 24px;
    border-color: #cbd6e2;
    box-shadow: 0 18px 45px rgba(16, 42, 67, 0.1);
}

.auth-heading { margin-bottom: 16px; }

.auth-heading h1 {
    margin: 4px 0 8px;
    font-size: 27px;
    line-height: 1.2;
}

.auth-card input,
.auth-card select {
    min-height: 44px;
    background: #fff;
}

.auth-card input:focus,
.auth-card select:focus,
.auth-card textarea:focus {
    outline: 3px solid rgba(31, 138, 91, 0.13);
    border-color: var(--green);
}

.auth-submit {
    width: 100%;
    min-height: 44px;
    justify-content: center;
    margin-top: 4px;
    background: var(--green);
    border-color: var(--green);
}

.auth-footer {
    margin: 10px 0 0;
    text-align: center;
}

.context-selection-panel {
    width: min(100%, 620px);
    max-width: 620px;
}

.auth-stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.auth-stepper li {
    min-height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fafc;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-stepper li.done {
    border-color: #b8ead8;
    background: #e5f8f0;
    color: #047857;
}

.auth-stepper li.current {
    border-color: var(--navy);
    background: var(--navy);
    color: #fff;
}

.record-page { max-width: 1240px; }

.minutes-view-page {
    max-width: none;
}

.minutes-view-page .lifecycle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.minutes-view-page .lifecycle span {
    width: auto;
    min-width: 128px;
    justify-content: center;
}

.record-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 24px 0 18px;
    border-bottom: 1px solid var(--line);
}

.record-header h2 {
    margin: 4px 0 8px;
    font-size: 25px;
}

.record-body {
    min-height: 220px;
    font-size: 16px;
    line-height: 1.7;
}

.minute-content {
    min-height: 180px;
    line-height: 1.7;
}

.minutes-reading-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.minutes-reading-panel {
    width: 100%;
}

.minutes-reading-panel .minute-content {
    min-height: 540px;
    padding: 24px 26px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    font-size: 17px;
    line-height: 1.8;
    overflow-x: auto;
    overflow-wrap: anywhere;
}

.minutes-support-grid {
    align-items: start;
}

.response-line {
    display: grid;
    grid-template-columns: minmax(130px, .55fr) auto minmax(180px, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 5px 0;
    border-bottom: 1px solid rgba(207, 218, 230, .65);
}

.response-line .btn {
    min-height: 32px;
    padding: 0 10px;
    white-space: nowrap;
}

.response-line:last-child {
    border-bottom: 0;
}

.minutes-editor-page {
    max-width: none;
}

.minutes-editor-header {
    align-items: center;
    margin-bottom: 16px;
}

.minutes-editor-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr);
    align-items: start;
}

.minutes-rich-form.compact {
    display: grid;
    gap: 12px;
}

.rich-editor-source {
    display: none;
}

.word-import-strip {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfe;
}

.word-import-strip label {
    flex: 1;
    margin-bottom: 0;
}

.rich-editor-shell {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f3f6fa;
}

.rich-editor-ribbon {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: #eef3f8;
}

.rich-editor-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-right: 8px;
    border-right: 1px solid #cfdae6;
}

.rich-editor-group:last-child {
    border-right: 0;
}

.rich-editor-group button,
.rich-editor-group select,
.rich-editor-group input[type="color"] {
    min-height: 34px;
}

.rich-editor-group button {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid #c8d5e2;
    border-radius: 6px;
    background: #fff;
    color: var(--navy);
    font-weight: 800;
    cursor: pointer;
}

.rich-editor-group button:hover,
.rich-editor-group button:focus-visible {
    border-color: var(--navy);
    background: #f7fafc;
}

.rich-editor-group select {
    width: auto;
    min-width: 92px;
    padding: 6px 28px 6px 8px;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
}

.rich-editor-group.color-group label {
    display: inline-grid;
    grid-template-columns: auto 26px;
    align-items: center;
    gap: 4px;
    margin: 0;
    font-size: 13px;
}

.rich-editor-group input[type="color"] {
    width: 26px;
    height: 30px;
    padding: 2px;
    cursor: pointer;
}

.rich-editor-page {
    min-height: 560px;
    max-height: 70vh;
    overflow: auto;
    margin: 14px;
    padding: 42px 52px;
    border: 1px solid #d8e2ec;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 14px 35px rgba(16, 42, 67, .08);
    color: #102a43;
    font-family: Calibri, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    outline: none;
}

.rich-editor-page.compact {
    min-height: 320px;
    max-height: 520px;
    padding: 28px 34px;
}

.rich-editor-page:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 138, 91, .12), 0 14px 35px rgba(16, 42, 67, .08);
}

.rich-editor-page h1,
.minute-content h1 {
    font-size: 26px;
    margin: 0 0 14px;
}

.rich-editor-page h2,
.minute-content h2 {
    font-size: 22px;
    margin: 20px 0 10px;
}

.rich-editor-page h3,
.minute-content h3 {
    font-size: 18px;
    margin: 16px 0 8px;
}

.rich-editor-page p,
.minute-content p {
    margin: 0 0 12px;
}

.rich-editor-page ul,
.rich-editor-page ol,
.minute-content ul,
.minute-content ol {
    margin: 0 0 14px 24px;
}

.rich-editor-page blockquote,
.minute-content blockquote {
    margin: 14px 0;
    padding: 8px 14px;
    border-left: 4px solid var(--gold);
    background: #f8fbfe;
}

.rich-editor-page table,
.minute-content table {
    width: 100%;
    margin: 14px 0;
    border-collapse: collapse;
}

.rich-editor-page th,
.rich-editor-page td,
.minute-content th,
.minute-content td {
    border: 1px solid var(--line);
    padding: 9px 10px;
    text-align: left;
    vertical-align: top;
}

.rich-editor-page th,
.minute-content th {
    background: #eef3f8;
    color: var(--navy);
    font-size: 13px;
    text-transform: none;
}

.form-panel { max-width: 920px; }
.communication-nav { margin-bottom: 18px; }

.auth-card label { margin-bottom: 10px; }

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

@media (max-width: 600px) {
    .login-shell { padding: 22px 14px; }
    .auth-card { padding: 22px 18px; }
    .auth-stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .record-header { flex-direction: column; }
    .content { padding: 18px 14px; }
    .table-panel { padding: 16px; }
    .minutes-editor-layout { grid-template-columns: 1fr; }
    .word-import-strip { align-items: stretch; flex-direction: column; }
    .rich-editor-page { margin: 10px; padding: 24px 18px; }
    .rich-editor-group { width: 100%; border-right: 0; padding-right: 0; }
    .minutes-reading-panel .minute-content { padding: 18px 14px; font-size: 16px; }
    .response-line { grid-template-columns: 1fr; align-items: start; }
}

/* CEO executive module */
.metric-link { color: inherit; text-decoration: none; display: block; transition: transform .15s ease, box-shadow .15s ease; }
.metric-link:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(16,42,67,.10); }
.ceo-tabs { overflow-x: auto; white-space: nowrap; padding-bottom: 4px; }
.inline-form { display: inline-flex; margin: 0; }

@media print {
    body {
        background: #fff;
    }

    .sidebar,
    .topbar,
    .no-print {
        display: none !important;
    }

    .app-shell {
        margin-left: 0;
    }

    .content {
        padding: 0;
    }

    .board-pack-page {
        background: #fff;
    }

    .board-pack-cover,
    .board-pack-document,
    .board-pack-section {
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .board-pack-cover,
    .board-pack-section {
        page-break-inside: avoid;
    }

    .board-pack-document {
        padding: 0;
    }

    .print-only {
        display: inline;
    }
}
