:root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-line: #e6ebf2;
    --app-line-strong: #d8e0ea;
    --app-text: #262b40;
    --app-text-soft: #66799e;
    --app-text-muted: #93a4bd;
    --app-primary: #1f2937;
    --app-primary-soft: #23395d;
    --app-link: #0d6efd;
    --app-link-hover: #0a58ca;
    --app-success: #10b981;
    --app-warning: #f59e0b;
    --app-danger: #ef4444;
    --app-shadow-sm: 0 0.125rem 0.25rem rgba(46, 54, 80, 0.08);
    --app-shadow-md: 0 0.5rem 1rem rgba(46, 54, 80, 0.1);
    --sidebar-width: 264px;
    --topbar-height: 76px;
}

* {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
    background: var(--app-bg);
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Nunito Sans", sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--app-text);
    background: var(--app-bg);
    overflow-x: hidden;
    overflow-x: clip;
}

body.nav-open,
body.modal-open {
    overflow: hidden;
}

body.modal-open {
    padding-right: var(--scroll-lock-offset, 0px);
}

body.modal-open .app-topbar,
body.modal-open .site-footer {
    padding-right: var(--scroll-lock-offset, 0px);
}

a {
    color: var(--app-link);
    text-decoration: none;
}

a:hover {
    color: var(--app-link-hover);
}

a:focus,
button:focus,
.button:focus,
.text-link:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(13, 110, 253, 0.22);
    outline-offset: 2px;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 1.75rem;
    min-width: 0;
}

.app-container {
    width: 100%;
    min-width: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1030;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    padding: 1.5rem 1rem;
    overflow-y: auto;
    background: var(--bs-primary, var(--app-primary));
    color: #ffffff;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-brand {
    padding: 0.5rem 0.75rem 1.25rem;
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
}

.sidebar-subtitle {
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-user {
    margin: 0 0.5rem 1rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-user span {
    display: block;
}

.sidebar-user-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.65);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-user-name {
    margin-top: 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.sidebar-user-role {
    margin-top: 0.15rem;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.72);
}

.sidebar-group {
    margin-bottom: 0.7rem;
}

.sidebar-label {
    display: block;
    padding: 0 1rem;
    margin-bottom: 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-link {
    display: block;
    margin: 0 0.4rem 0.15rem;
    padding: 0.72rem 1rem;
    border-radius: 0.5rem;
    color: #ffffff;
    font-weight: 600;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.sidebar-link:hover {
    background: #ffffff;
    color: #111111;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.sidebar-footer {
    margin: 1rem 0.5rem 0;
    padding: 0.9rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.78rem;
}

.nav-overlay {
    display: none;
}

.app-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    z-index: 1020;
    padding: 1rem 1.75rem 0;
    background: var(--app-bg);
    display: none;
}

.app-topbar-inner {
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--app-line);
    border-radius: 0.9rem;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
    min-width: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.nav-toggle {
    display: none;
    align-items: center;
    gap: 0.6rem;
    min-height: 42px;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--app-line);
    border-radius: 0.65rem;
    background: var(--app-surface);
    color: var(--app-text);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--app-shadow-sm);
}

.nav-toggle-lines {
    display: inline-flex;
    flex-direction: column;
    gap: 0.22rem;
}

.nav-toggle-lines span {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.nav-user-wrap {
    position: relative;
    flex-shrink: 0;
}

.user-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
    padding: 0.15rem 0.65rem 0.15rem 0.15rem;
    border: 1px solid var(--app-line);
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-text);
    cursor: pointer;
    box-shadow: var(--app-shadow-sm);
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    background: var(--bs-secondary, #6b7280);
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
}

.user-avatar.large {
    width: 3rem;
    height: 3rem;
    font-size: 0.95rem;
}

.user-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
    min-width: 0;
}

.user-meta strong,
.user-meta small {
    max-width: 11rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta strong {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--app-text);
}

.user-meta small {
    font-size: 0.74rem;
    color: var(--app-text-soft);
}

.user-menu {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    z-index: 20;
    display: none;
    width: 18rem;
    overflow: hidden;
    border: 1px solid var(--app-line);
    border-radius: 0.9rem;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-md);
}

.user-menu.open {
    display: block;
}

.user-menu-profile {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--app-line);
    background: var(--app-surface-soft);
}

.user-menu-profile div {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-menu-profile strong {
    color: var(--app-text);
}

.user-menu-profile small {
    color: var(--app-text-soft);
}

.user-menu a {
    display: block;
    padding: 0.9rem 1.15rem;
    border-bottom: 1px solid var(--app-line);
    color: var(--app-text);
    font-size: 0.92rem;
}

.user-menu a:last-child {
    border-bottom: 0;
}

.user-menu a:hover {
    background: var(--app-surface-soft);
    color: var(--app-link);
}

.user-menu-signout {
    color: var(--app-danger);
}

.mobile-account-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.page-shell {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: 1.75rem 0 2.2rem;
    min-width: 0;
    overflow-x: hidden;
    overflow-x: clip;
}

.page-shell .app-container > section {
    margin-top: 1.5rem;
}

.page-shell .app-container > section:first-of-type {
    margin-top: 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 0 0.25rem;
}

.page-header h1,
.auth-card-header h1 {
    margin: 0 0 0.25rem;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--app-text);
}

.page-header p,
.auth-card-header p,
.muted,
.field-hint,
.empty-state,
.panel p,
.stat-card small {
    color: var(--app-text-soft);
}

.page-header p {
    margin: 0;
    max-width: 52rem;
}

.header-actions,
.form-actions,
.action-row,
.inline-form,
.checkbox-row,
.modal-head,
.auth-meta-row,
.pot-inline-head,
.pot-inline-meta,
.summary-list div,
.planner-summary,
.panel-header,
.monzo-status-strip-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.button,
button.button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    background: var(--bs-primary, var(--app-link));
    color: #ffffff;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--app-shadow-sm);
}

.button:hover,
button.button:hover {
    transform: translateY(-1px);
    background: var(--bs-primary, var(--app-link)) !important;
    border-color: var(--bs-primary, var(--app-link)) !important;
    color: #ffffff !important;
}

.button-secondary {
    background: var(--app-surface);
    border-color: var(--app-line);
    color: var(--app-text);
}

.button-secondary:hover {
    background: var(--bs-primary, var(--app-link)) !important;
    border-color: var(--bs-primary, var(--app-link)) !important;
    color: #ffffff !important;
}

.setup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.setup-card {
    padding: 1.25rem;
    border: 1px solid var(--app-line);
    border-radius: 0.75rem;
    background: var(--app-surface-soft);
}

.setup-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 700;
}

.setup-card p {
    margin: 0;
}

.setup-qr {
    display: block;
    width: 100%;
    max-width: 220px;
    height: auto;
    margin-top: 1rem;
    border-radius: 0.75rem;
    border: 1px solid var(--app-line);
    background: #ffffff;
}

.code-block {
    margin-top: 0.9rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--app-line);
    border-radius: 0.65rem;
    background: #ffffff;
    color: var(--app-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.84rem;
    word-break: break-all;
}

.settings-page-header {
    padding-bottom: 0.5rem;
}

.settings-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.settings-overview-card {
    padding: 1rem 1.1rem;
    border: 1px solid var(--app-line);
    border-radius: 0.85rem;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.settings-overview-label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--app-text-soft);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.settings-overview-card strong {
    display: block;
    color: var(--app-text);
    font-size: 1rem;
    font-weight: 800;
}

.settings-overview-card small {
    display: block;
    margin-top: 0.35rem;
    color: var(--app-text-soft);
}

.settings-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.settings-subnav {
    position: sticky;
    top: 1.25rem;
}

.settings-subnav-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-subnav-links a {
    display: block;
    padding: 0.72rem 0.9rem;
    border: 1px solid var(--app-line);
    border-radius: 0.6rem;
    background: var(--app-surface-soft);
    color: var(--app-text);
    font-weight: 700;
}

.settings-subnav-links a:hover {
    border-color: var(--bs-primary, var(--app-link));
    background: rgba(13, 110, 253, 0.06);
    color: var(--bs-primary, var(--app-link));
}

.settings-subnav-links a.active {
    border-color: var(--bs-primary, var(--app-link));
    background: rgba(13, 110, 253, 0.08);
    color: var(--bs-primary, var(--app-link));
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section {
    scroll-margin-top: 1rem;
}

.settings-section .panel-header p {
    margin: 0.25rem 0 0;
    max-width: 46rem;
}

.inline-notice {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(13, 110, 253, 0.2);
    border-radius: 0.75rem;
    background: rgba(13, 110, 253, 0.05);
}

.inline-notice strong {
    color: var(--app-text);
}

.settings-link-card {
    color: inherit;
}

.settings-link-card:hover {
    color: inherit;
    border-color: var(--bs-primary, var(--app-link));
    transform: translateY(-1px);
}

.settings-section-list {
    display: grid;
    gap: 0.85rem;
}

.settings-section-list-item {
    display: block;
    padding: 1rem 1.1rem;
    border: 1px solid var(--app-line);
    border-radius: 0.8rem;
    background: var(--app-surface-soft);
    color: var(--app-text);
}

.settings-section-list-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--app-text);
    font-size: 0.95rem;
}

.settings-section-list-item span {
    color: var(--app-text-soft);
    font-size: 0.88rem;
}

.settings-section-list-item:hover {
    border-color: var(--bs-primary, var(--app-link));
    background: rgba(13, 110, 253, 0.04);
    color: var(--app-text);
}

.button-danger {
    background: var(--app-danger);
    border-color: var(--app-danger);
    color: #ffffff;
}

.text-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--app-link);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.text-link:hover {
    color: var(--app-link-hover);
}

.danger-link {
    color: var(--app-danger);
}

.value-positive {
    color: var(--app-success);
    font-weight: 700;
}

.value-negative {
    color: var(--app-danger);
    font-weight: 700;
}

.panel,
.stat-card,
.monzo-status-strip,
.modal-card,
.auth-card {
    border: 1px solid var(--app-line);
    border-radius: 1rem;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.panel {
    padding: 1.5rem;
}

.stat-card {
    min-height: 9.8rem;
    padding: 1.35rem;
}

.monzo-status-strip {
    display: grid;
    gap: 0.9rem;
    padding: 1rem 1.15rem;
}

.monzo-status-strip-error,
.panel-error,
.danger-panel {
    border-color: rgba(239, 68, 68, 0.35);
}

.monzo-status-strip-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem 1rem;
}

.monzo-status-strip-grid span {
    color: var(--app-text-soft);
    font-size: 0.76rem;
}

.monzo-status-strip-grid strong {
    color: var(--app-text);
    font-size: 0.88rem;
    word-break: break-word;
}

.page-section,
.card-grid,
.dashboard-grid,
.two-column,
.three-column {
    display: grid;
    gap: 1.5rem;
}

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

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

.dashboard-grid,
.two-column,
.page-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-header {
    margin-bottom: 1rem;
}

.panel-header.compact {
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.panel h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--app-text);
}

.stat-card strong {
    display: block;
    margin-top: 0.55rem;
    margin-bottom: 0.35rem;
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 700;
    color: var(--app-text);
}

.stat-label {
    display: inline-block;
    color: var(--app-text-soft);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stat-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.stat-card-good {
    border-color: rgba(16, 185, 129, 0.25);
}

.stat-card-alert {
    border-color: rgba(239, 68, 68, 0.3);
}

.info-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    padding: 0;
    border: 1px solid var(--app-line-strong);
    border-radius: 999px;
    background: var(--app-surface-soft);
    color: var(--app-text-soft);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: help;
}

.info-button:hover,
.info-button:focus-visible {
    color: var(--app-text);
    border-color: var(--app-link);
    outline: none;
}

.info-tooltip {
    position: absolute;
    top: calc(100% + 0.7rem);
    left: 0;
    z-index: 60;
    display: none;
    width: min(27rem, 78vw);
    padding: 0.9rem 1rem;
    border: 1px solid var(--app-line);
    border-radius: 0.85rem;
    background: #ffffff;
    box-shadow: var(--app-shadow-md);
    color: var(--app-text);
    text-align: left;
    white-space: normal;
}

.info-tooltip strong {
    display: block;
    margin: 0 0 0.45rem;
    font-size: 0.84rem;
    line-height: 1.3;
}

.info-tooltip span {
    display: block;
    color: var(--app-text-soft);
    font-size: 0.81rem;
    line-height: 1.5;
}

.info-tooltip span + span {
    margin-top: 0.45rem;
}

.info-button:hover .info-tooltip,
.info-button:focus-visible .info-tooltip,
.info-button:focus-within .info-tooltip {
    display: block;
}

.stat-card:nth-child(4n) .info-tooltip,
.stat-card:last-child .info-tooltip {
    left: auto;
    right: 0;
}

.info-list,
.summary-list {
    display: grid;
    gap: 0.9rem;
}

.info-row,
.summary-list div {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--app-line);
}

.info-row:last-child,
.summary-list div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.panel > .table-wrap,
.panel > .empty-state,
.panel > .summary-list,
.panel > form,
.panel > .warning-box,
.panel > .info-list {
    margin-top: 1.15rem;
}

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

.single-column {
    grid-template-columns: 1fr;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.pot-form-grid {
    max-width: 58rem;
}

.pot-form-grid > div {
    display: grid;
    gap: 0.45rem;
}

.field-inline-label {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.checkbox-row-stack {
    align-items: flex-start;
    gap: 0.35rem;
}

.checkbox-row-stack .checkbox {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--app-text);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 0.72rem 0.85rem;
    border: 1px solid var(--app-line);
    border-radius: 0.55rem;
    background: #ffffff;
    color: var(--app-text);
    font: inherit;
}

input::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

textarea {
    min-height: 140px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(13, 110, 253, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    color: var(--app-text);
}

.checkbox input {
    width: 16px;
    min-height: auto;
    height: 16px;
    margin: 0;
    accent-color: var(--app-link);
}

.compact-toggle-form {
    margin: 0;
}

.compact-toggle-form select {
    min-height: 40px;
    padding: 0.45rem 0.75rem;
    border-radius: 0.55rem;
    font-size: 0.84rem;
}

.inline-form {
    flex-wrap: wrap;
}

.inline-form > div {
    min-width: 220px;
}

.table-action-group {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.table-action-group form {
    margin: 0;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--app-line);
    border-radius: 0.75rem;
    background: #ffffff;
}

.pots-table td:first-child {
    min-width: 24rem;
}

.pots-table td:last-child {
    min-width: 11rem;
}

.pot-summary {
    display: grid;
    gap: 0.35rem;
    margin-top: 0.45rem;
}

.pots-actions {
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.4rem;
    flex-direction: column;
}

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

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

th {
    background: #f8fafc;
    color: var(--app-text);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

td {
    color: var(--app-text-soft);
    font-size: 0.88rem;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: rgba(13, 110, 253, 0.03);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 0.18rem 0.55rem;
    border-radius: 0.55rem;
    font-size: 0.7rem;
    font-weight: 800;
    border: 1px solid transparent;
    letter-spacing: 0.02em;
}

.badge-low,
.badge-neutral {
    background: #eef2f7;
    color: #5f6b7a;
}

.badge-medium,
.badge-info {
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
}

.badge-high,
.badge-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.badge-essential,
.badge-negative {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.badge-positive {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.score-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.12);
    color: var(--app-link);
    font-weight: 800;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 6px;
    margin: 0.82rem 0 0.72rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e9eef5;
}

.progress-bar span {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--app-link);
}

.progress-bar.compact {
    margin-top: 0.65rem;
    margin-bottom: 0;
}

.pot-card-inline {
    padding: 1rem 0;
    border-bottom: 1px solid var(--app-line);
}

.pot-card-inline:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.pot-inline-meta,
.summary-list div {
    color: var(--app-text-soft);
    font-size: 0.87rem;
}

.empty-state {
    margin: 0;
}

.warning-box {
    padding: 0.95rem 1rem;
    border: 1px solid rgba(245, 158, 11, 0.34);
    border-radius: 0.6rem;
    background: #fff8eb;
    color: #9a6700;
    font-weight: 600;
}

.flash-stack {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.flash {
    padding: 0.95rem 1rem;
    border: 1px solid var(--app-line);
    border-radius: 0.6rem;
    font-weight: 600;
    background: var(--app-surface);
    box-shadow: var(--app-shadow-sm);
}

.flash-success {
    border-color: rgba(16, 185, 129, 0.24);
    background: #ecfdf5;
    color: #047857;
}

.flash-error {
    border-color: rgba(239, 68, 68, 0.24);
    background: #fef2f2;
    color: #b91c1c;
}

.flash-warning {
    border-color: rgba(245, 158, 11, 0.24);
    background: #fffbeb;
    color: #b45309;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(17, 24, 39, 0.45);
}

.modal-backdrop.open {
    display: flex;
}

.modal-card {
    width: min(980px, 100%);
    max-height: 90vh;
    overflow: auto;
    padding: 1.35rem;
    box-shadow: var(--app-shadow-md);
}

.modal-head {
    align-items: flex-start;
    margin-bottom: 1rem;
}

.modal-close {
    min-height: 40px;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--app-line);
    border-radius: 0.6rem;
    background: var(--app-surface-soft);
    color: var(--app-text);
    cursor: pointer;
}

.error-list,
.plain-list {
    margin: 0;
    padding-left: 1.2rem;
}

.error-list li,
.plain-list li {
    margin-bottom: 0.55rem;
}

.top-space {
    margin-top: 1.15rem;
}

.site-footer {
    margin-left: var(--sidebar-width);
    padding: 0 1.75rem 1.5rem;
    overflow-x: hidden;
    overflow-x: clip;
}

.site-footer-inner {
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: var(--app-text-soft);
    font-size: 0.82rem;
}

.auth-layout {
    background: var(--app-bg);
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.8rem 1rem;
}

.auth-container {
    width: 100%;
    max-width: 760px;
}

.auth-panel {
    display: grid;
    gap: 1.5rem;
}

.auth-brand {
    display: inline-flex;
    flex-direction: column;
    gap: 0.2rem;
    color: var(--app-text);
}

.auth-brand strong {
    font-size: 1.3rem;
    font-weight: 800;
}

.auth-brand span {
    color: var(--app-text-soft);
    font-size: 0.9rem;
}

.auth-card {
    width: 100%;
    padding: 1.5rem;
}

.auth-card-wide {
    width: 100%;
}

.auth-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    column-gap: 1.5rem;
    row-gap: 0.65rem;
    margin-bottom: 1.4rem;
}

.auth-card-header > :last-child {
    max-width: 14rem;
    justify-self: end;
    text-align: right;
}

.auth-form {
    gap: 1.15rem;
    grid-template-columns: 1fr;
}

.auth-form input {
    min-height: 50px;
    font-size: 0.98rem;
}

.auth-alert {
    margin-bottom: 1.2rem;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(239, 68, 68, 0.24);
    border-radius: 0.75rem;
    background: #fef2f2;
    color: #b91c1c;
    font-weight: 600;
}

.auth-alert div + div {
    margin-top: 0.3rem;
}

.auth-password-field {
    position: relative;
}

.auth-password-field input {
    padding-right: 4.5rem;
}

.password-toggle {
    position: absolute;
    top: calc(50% + 0.42rem);
    right: 0.8rem;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--app-text-soft);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}


.auth-meta-row {
    align-items: flex-start;
    flex-wrap: nowrap;
}

.auth-meta-row .muted {
    flex: 1 1 auto;
    min-width: 0;
}

.auth-meta-row a {
    margin-left: auto;
    white-space: nowrap;
}

.auth-meta-row-single {
    justify-content: flex-end;
}

@media (max-width: 1200px) {
    .four-up,
    .three-up,
    .dashboard-grid,
    .two-column,
    .three-column,
    .page-section {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    :root {
        --sidebar-width: min(320px, calc(100vw - 2.5rem));
        --topbar-height: 70px;
    }

    .app-sidebar {
        left: calc(-1 * var(--sidebar-width) - 1rem);
        z-index: 1060;
        transition: left 0.25s ease;
        box-shadow: var(--app-shadow-md);
    }

    .app-sidebar.open {
        left: 0;
    }

    .nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 1055;
        border: 0;
        background: rgba(17, 24, 39, 0.5);
    }

    body.nav-open .nav-overlay {
        display: block;
    }

    .app-topbar,
    .page-shell,
    .site-footer {
        left: 0;
        margin-left: 0;
    }

    .app-topbar {
        display: block;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .page-shell {
        padding-top: calc(var(--topbar-height) + 1.25rem);
    }

    .site-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 860px) {
    .container {
        padding: 0 1.25rem;
    }

    .page-header,
    .panel-header,
    .action-row,
    .pot-inline-head,
    .pot-inline-meta,
    .summary-list div,
    .planner-summary,
    .checkbox-row,
    .modal-head,
    .auth-card-header,
    .auth-meta-row,
    .site-footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-card-header {
        grid-template-columns: 1fr;
    }

    .auth-card-header > :last-child {
        max-width: none;
        justify-self: start;
        text-align: left;
    }

    .header-actions,
    .form-actions {
        width: 100%;
    }

    .header-actions .button,
    .form-actions .button,
    .form-actions .button-secondary {
        width: 100%;
    }

    .user-meta {
        display: none;
    }
}

@media (max-width: 640px) {
    .page-shell {
        padding-top: calc(var(--topbar-height) + 0.85rem);
        padding-bottom: 1.5rem;
    }

    .app-sidebar {
        padding: 1rem 0.8rem 1.2rem;
    }

    .sidebar-brand {
        padding: 0.3rem 0.55rem 1rem;
    }

    .sidebar-user,
    .sidebar-footer {
        margin-left: 0.25rem;
        margin-right: 0.25rem;
    }

    .sidebar-link {
        margin-left: 0.2rem;
        margin-right: 0.2rem;
        padding: 0.8rem 0.9rem;
    }

    th,
    td {
        padding: 0.75rem 0.8rem;
    }

    .modal-backdrop {
        padding: 0.75rem;
    }

    .modal-card,
    .panel,
    .stat-card,
    .auth-card {
        padding: 1rem;
    }
}

@media (max-width: 720px) {
    .four-up,
    .three-up,
    .dashboard-grid,
    .two-column,
    .three-column,
    .page-section,
    .form-grid,
    .setup-grid,
    .settings-overview,
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .panel,
    .stat-card,
    .auth-card,
    .modal-card {
        padding: 1.25rem;
    }

    .monzo-status-strip-grid {
        grid-template-columns: 1fr;
    }

    .user-menu {
        width: min(92vw, 320px);
    }

    .settings-subnav {
        position: static;
    }
}

@media (max-width: 560px) {
    .container {
        padding: 0 1rem;
    }

    .app-topbar {
        padding: 0.75rem 1rem 0;
    }

    .app-topbar-inner {
        padding: 0.75rem 0.85rem;
    }

    .site-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}


.sidebar-hub-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    margin-top: 0.9rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.7rem;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 700;
}

.sidebar-hub-link:hover {
    background: #ffffff;
    color: #111111;
}
