:root {
    --emerald-800: #006c49;
    --emerald-700: #087a56;
    --emerald-500: #10b981;
    --emerald-100: #adedd3;
    --emerald-50: #e7faf2;
    --ink: #121c2a;
    --ink-soft: #3c4a42;
    --muted: #6c7a71;
    --outline: #bbcabf;
    --outline-soft: #dbe5dd;
    --surface: #f8f9ff;
    --surface-blue: #eff4ff;
    --surface-blue-strong: #dee9fc;
    --surface-white: #ffffff;
    --amber: #e29100;
    --amber-soft: #ffedda;
    --red: #ba1a1a;
    --red-dark: #93000a;
    --red-soft: #ffdad6;
    --shadow-soft: 0 4px 20px rgba(18, 28, 42, 0.06);
    --shadow-raised: 0 12px 32px rgba(18, 28, 42, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --topbar-height: 68px;
    --sidebar-width: 252px;
    --bottom-nav-height: 82px;
    --content-max: 1120px;
    color-scheme: light;
}

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

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--surface);
    color: var(--ink);
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body,
button,
input,
select,
textarea {
    font-family: "Inter", system-ui, sans-serif;
}

button,
input,
select,
textarea {
    font-size: 1rem;
}

button,
select,
summary,
input[type="checkbox"],
input[type="radio"],
input[type="file"] {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

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

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

h1,
h2,
h3,
.money {
    font-family: "Manrope", "Inter", sans-serif;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    line-height: 1.18;
    letter-spacing: -0.025em;
}

h2 {
    margin-bottom: 6px;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    line-height: 1.3;
}

h3 {
    margin-bottom: 4px;
    font-size: 1.05rem;
    line-height: 1.35;
}

small {
    font-size: 0.78rem;
}

:focus-visible {
    outline: 3px solid rgba(0, 108, 73, 0.3);
    outline-offset: 3px;
}

::selection {
    background: var(--emerald-100);
    color: #003824;
}

.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    line-height: 1;
    vertical-align: middle;
}

.is-active > .material-symbols-outlined,
.brand__mark,
.status-badge .material-symbols-outlined {
    font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

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

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    transform: translateY(-160%);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: white;
    font-weight: 700;
}

.skip-link:focus {
    transform: translateY(0);
}

/* Application shell */

.topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 max(20px, env(safe-area-inset-left));
    border-bottom: 1px solid rgba(187, 202, 191, 0.55);
    background: rgba(248, 249, 255, 0.94);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    color: var(--emerald-800);
}

.brand__mark {
    display: block;
    width: 30px;
    height: 30px;
}

.brand__name {
    font-family: "Manrope", sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.topbar__account {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar__user {
    display: none;
    max-width: 180px;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 0.875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

.icon-button {
    display: inline-grid;
    width: 48px;
    height: 48px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--emerald-800);
    transition: background 160ms ease, transform 160ms ease;
}

.icon-button:hover {
    background: var(--emerald-50);
}

.icon-button:active {
    transform: scale(0.94);
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    display: none;
}

.app-main {
    min-width: 0;
    min-height: 100vh;
    padding: calc(var(--topbar-height) + 24px) 20px calc(var(--bottom-nav-height) + 36px);
}

.bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 90;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: var(--bottom-nav-height);
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    border: 1px solid rgba(187, 202, 191, 0.75);
    border-bottom: 0;
    border-radius: 18px 18px 0 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -4px 20px rgba(18, 28, 42, 0.06);
}

.bottom-nav__item {
    display: flex;
    min-width: 0;
    min-height: 58px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: 0.69rem;
    font-weight: 500;
    transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.bottom-nav__item .material-symbols-outlined {
    font-size: 24px;
}

.bottom-nav__item.is-active {
    background: var(--emerald-100);
    color: var(--emerald-800);
    font-weight: 700;
}

.bottom-nav__item:active {
    transform: scale(0.94);
}

.message-stack {
    display: grid;
    width: min(100%, var(--content-max));
    gap: 10px;
    margin: 0 auto 20px;
}

.message {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-soft);
    color: var(--ink-soft);
}

.message--success {
    border-color: #8ed9ba;
    background: #ecfbf5;
    color: #07583e;
}

.message--warning {
    border-color: #f2c577;
    background: #fff8e9;
    color: #6c4300;
}

.message--error {
    border-color: #f1aaa3;
    background: #fff2f0;
    color: var(--red-dark);
}

.message__text {
    min-width: 0;
}

.message__close {
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: currentColor;
}

.message__close:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* Shared layout and controls */

.page {
    width: min(100%, var(--content-max));
    margin: 0 auto;
}

.page--form {
    max-width: 760px;
}

.page--narrow {
    max-width: 680px;
}

.page-header,
.context-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

.page-header__subtitle {
    max-width: 650px;
    margin-bottom: 0;
    color: var(--ink-soft);
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--emerald-800);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.context-header {
    align-items: center;
}

.context-header--title {
    justify-content: flex-start;
}

.context-header--title > div {
    flex: 1;
    text-align: center;
}

.context-header--title h1 {
    margin-bottom: 0;
    font-size: clamp(1.45rem, 4vw, 1.9rem);
}

.back-link {
    display: inline-flex;
    min-height: 48px;
    align-items: center;
    gap: 7px;
    border-radius: var(--radius-sm);
    color: var(--emerald-800);
    font-size: 0.9rem;
    font-weight: 700;
}

.back-link:hover,
.text-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.button {
    display: inline-flex;
    min-height: 48px;
    padding: 10px 18px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.button:hover {
    box-shadow: 0 6px 18px rgba(18, 28, 42, 0.1);
}

.button:active {
    transform: scale(0.97);
    box-shadow: none;
}

.button--primary {
    background: var(--emerald-500);
    color: white;
}

.button--primary:hover {
    background: #0ca875;
}

.button--secondary {
    border-color: var(--outline);
    background: white;
    color: var(--emerald-800);
}

.button--secondary:hover {
    border-color: var(--emerald-800);
    background: var(--emerald-50);
}

.button--ghost {
    background: transparent;
    color: var(--ink-soft);
}

.button--ghost:hover {
    background: var(--surface-blue);
}

.button--danger,
.button--danger-ghost {
    color: white;
    background: var(--red);
}

.button--danger-ghost {
    border-color: #efb4ae;
    background: white;
    color: var(--red-dark);
}

.button--danger-ghost:hover {
    border-color: var(--red);
    background: var(--red-soft);
}

.button--large {
    min-height: 56px;
    padding-inline: 24px;
    font-size: 1rem;
}

.button--full {
    width: 100%;
}

.button__short-label {
    display: none;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.button.is-loading,
.icon-button.is-loading,
.card-action.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
    --spinner-color: var(--emerald-800);
}

.button--primary.is-loading,
.button--danger.is-loading {
    --spinner-color: white;
}

.button--danger-ghost.is-loading {
    --spinner-color: var(--red-dark);
}

.button.is-loading::after,
.icon-button.is-loading::after,
.card-action.is-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid var(--spinner-color);
    border-right-color: transparent;
    border-radius: 999px;
    animation: button-spin 650ms linear infinite;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

.text-link {
    color: var(--emerald-800);
    font-size: 0.88rem;
    font-weight: 700;
}

.muted-text {
    color: var(--muted);
}

.surface-card,
.content-section,
.form-card,
.filter-panel {
    border: 1px solid rgba(187, 202, 191, 0.5);
    border-radius: var(--radius-lg);
    background: var(--surface-white);
    box-shadow: var(--shadow-soft);
}

.content-section {
    padding: 20px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.section-heading h2,
.section-heading p {
    margin-bottom: 0;
}

.status-badge {
    display: inline-flex;
    min-height: 30px;
    padding: 5px 10px;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    background: var(--emerald-100);
    color: #135d45;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-badge--neutral {
    background: var(--surface-blue-strong);
    color: #48564e;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--emerald-500);
}

.status-badge--neutral .status-dot {
    background: var(--muted);
}

.money {
    margin-bottom: 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.025em;
}

.money--display {
    font-size: clamp(2rem, 7vw, 2.75rem);
    font-weight: 700;
    line-height: 1.15;
}

.money--medium {
    font-size: clamp(1.35rem, 4vw, 1.65rem);
    font-weight: 700;
}

/* Dashboard */

.metric-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 28px;
}

.metric-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid rgba(187, 202, 191, 0.45);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-soft);
}

.metric-card--featured {
    padding: 24px;
    background: linear-gradient(135deg, white 50%, #f0fcf7);
}

.metric-card__heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 13px;
    color: var(--ink-soft);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.075em;
    text-transform: uppercase;
}

.metric-card__icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 999px;
    background: var(--emerald-100);
    color: var(--emerald-800);
    font-size: 20px;
}

.metric-card__icon--blue {
    background: var(--surface-blue-strong);
    color: #254c75;
}

.metric-card__icon--amber {
    background: var(--amber-soft);
    color: #805000;
}

.metric-card__hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.setup-callout {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 28px;
    padding: 18px;
    border: 1px solid #9edcc4;
    border-radius: var(--radius-lg);
    background: var(--emerald-50);
}

.setup-callout__icon {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 12px;
    background: white;
    color: var(--emerald-800);
}

.setup-callout h2 {
    margin-bottom: 4px;
    font-size: 1.1rem;
}

.setup-callout p {
    margin-bottom: 0;
    color: var(--ink-soft);
}

.setup-callout .button-row {
    grid-column: 1 / -1;
}

.dashboard-columns {
    display: grid;
    gap: 22px;
}

.compact-list {
    overflow: hidden;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: white;
}

.compact-transaction {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 12px;
    border-bottom: 1px solid var(--outline-soft);
    transition: background 160ms ease;
}

.compact-transaction:last-child {
    border-bottom: 0;
}

.compact-transaction:hover {
    background: var(--surface-blue);
}

.compact-transaction__body,
.compact-transaction__value {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.compact-transaction__body strong,
.compact-transaction__body span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-transaction__body strong {
    color: var(--ink);
    font-size: 0.92rem;
}

.compact-transaction__body span,
.compact-transaction__value time {
    color: var(--muted);
    font-size: 0.75rem;
}

.compact-transaction__value {
    align-items: flex-end;
    text-align: right;
}

.compact-transaction__value strong {
    font-family: "Manrope", sans-serif;
    font-size: 0.98rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.category-icon {
    --category: var(--emerald-800);
    --category-soft: var(--emerald-50);
    display: inline-grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 999px;
    background: var(--category-soft);
    color: var(--category);
}

.category-icon--large {
    width: 48px;
    height: 48px;
}

[data-category="material"] {
    --category: #9a5f00;
    --category-soft: #fff0d6;
}

[data-category="combustivel"] {
    --category: #007b58;
    --category-soft: #dff8ed;
}

[data-category="alimentacao"] {
    --category: #8a4d0a;
    --category-soft: #ffe3c4;
}

[data-category="transporte"] {
    --category: #275d8c;
    --category-soft: #e2efff;
}

[data-category="ferramenta"] {
    --category: #5f4b8b;
    --category-soft: #eee7ff;
}

[data-category="servico_terceiro"] {
    --category: #8f3847;
    --category-soft: #ffe7eb;
}

[data-category="outros"],
[data-category="sem_categoria"] {
    --category: #536159;
    --category-soft: #edf1ee;
}

.project-mini-grid {
    display: grid;
    gap: 12px;
}

.project-mini-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    transition: border-color 160ms ease, transform 160ms ease;
}

.project-mini-card:hover {
    border-color: var(--project-color, var(--emerald-500));
    transform: translateY(-2px);
}

.project-mini-card__icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--project-color, var(--emerald-500)) 14%, white);
    color: var(--project-color, var(--emerald-800));
    font-variation-settings: "FILL" 1;
}

.project-mini-card__body,
.project-mini-card__total {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.project-mini-card__body strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-mini-card__body span,
.project-mini-card__total small {
    color: var(--muted);
    font-size: 0.75rem;
}

.project-mini-card__total {
    grid-column: 2;
}

.project-mini-card__total strong {
    font-family: "Manrope", sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Empty states */

.empty-state {
    display: flex;
    min-height: 310px;
    padding: 36px 20px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--outline);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.62);
    text-align: center;
}

.empty-state > .material-symbols-outlined {
    display: grid;
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    place-items: center;
    border-radius: 18px;
    background: var(--emerald-50);
    color: var(--emerald-800);
    font-size: 34px;
}

.empty-state p {
    max-width: 480px;
    margin-bottom: 20px;
    color: var(--muted);
}

.empty-state--compact {
    min-height: 230px;
    border: 0;
    background: var(--surface-blue);
}

.empty-state--compact > .material-symbols-outlined {
    width: 52px;
    height: 52px;
    margin-bottom: 12px;
    font-size: 28px;
}

.empty-state--setup {
    background: white;
    box-shadow: var(--shadow-soft);
}

/* Tabs, projects and people */

.tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 24px;
    border-bottom: 1px solid var(--outline-soft);
}

.tabs__item {
    position: relative;
    min-height: 52px;
    padding: 14px 18px;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}

.tabs__item::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 3px;
    content: "";
    background: transparent;
}

.tabs__item.is-active {
    color: var(--emerald-800);
}

.tabs__item.is-active::after {
    background: var(--emerald-800);
}

.project-grid,
.people-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.project-card,
.person-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid rgba(187, 202, 191, 0.45);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-soft);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.project-card:hover,
.person-card:hover {
    border-color: color-mix(in srgb, var(--project-color, var(--emerald-500)) 45%, var(--outline));
    box-shadow: var(--shadow-raised);
    transform: translateY(-2px);
}

.project-card--completed {
    opacity: 0.86;
}

.project-card__header,
.project-card__title,
.person-card__header {
    display: flex;
    align-items: center;
}

.project-card__header,
.person-card__header {
    justify-content: space-between;
    gap: 12px;
}

.project-card__title {
    min-width: 0;
    gap: 12px;
}

.project-card__title h2 {
    overflow: hidden;
    margin: 0;
    font-size: 1.25rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-dot {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--project-color, var(--emerald-500));
}

.project-card__meta {
    display: grid;
    gap: 9px;
    margin: 18px 0;
    color: var(--ink-soft);
}

.project-card__meta > span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.project-card__meta .material-symbols-outlined {
    color: var(--muted);
    font-size: 20px;
}

.project-card__footer,
.person-card__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--outline-soft);
}

.project-card__footer span,
.person-card__footer small {
    color: var(--muted);
    font-size: 0.78rem;
}

.project-card__footer strong,
.person-card__total strong {
    font-family: "Manrope", sans-serif;
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.toolbar {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
}

.search-form {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.search-form__icon {
    position: absolute;
    top: 50%;
    left: 15px;
    z-index: 1;
    color: var(--muted);
    transform: translateY(-50%);
}

.search-form input {
    width: 100%;
    min-height: 52px;
    padding: 10px 14px 10px 48px;
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    background: white;
    color: var(--ink);
}

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 5px;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chip {
    display: inline-flex;
    min-height: 36px;
    padding: 7px 15px;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--surface-blue-strong);
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

.chip.is-active {
    background: var(--emerald-500);
    color: white;
}

.person-card {
    display: flex;
    flex-direction: column;
}

.person-card--inactive {
    opacity: 0.76;
}

.person-card__header {
    align-items: flex-start;
}

.person-card__identity {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.person-card__identity strong {
    overflow: hidden;
    font-family: "Manrope", sans-serif;
    font-size: 1.16rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.person-card__identity a:hover {
    color: var(--emerald-800);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.person-card__identity > span {
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.avatar {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--outline);
    border-radius: 999px;
    background: var(--emerald-50);
    color: var(--emerald-800);
    font-family: "Manrope", sans-serif;
    font-weight: 700;
}

.avatar--large {
    width: 52px;
    height: 52px;
}

.avatar--xlarge {
    width: 78px;
    height: 78px;
    font-size: 1.35rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar--picker {
    width: 44px;
    height: 44px;
    font-size: 0.82rem;
}

.field--choice-picker {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.field--choice-picker legend {
    margin-bottom: 8px;
    padding: 0;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 700;
}

.choice-picker {
    display: grid;
    gap: 10px;
}

.choice-picker__option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 10px 14px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, transform 160ms ease;
}

.choice-picker__option:hover {
    border-color: color-mix(in srgb, var(--project-color, var(--emerald-500)) 55%, var(--outline));
    transform: translateY(-1px);
}

.choice-picker__option:has(input:checked) {
    border-color: var(--project-color, var(--emerald-800));
    background: color-mix(in srgb, var(--project-color, var(--emerald-500)) 10%, white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--project-color, var(--emerald-800)) 18%, transparent);
}

.choice-picker__option:has(input:focus-visible) {
    border-color: var(--project-color, var(--emerald-800));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--project-color, var(--emerald-800)) 22%, transparent);
}

.choice-picker__checkbox-badge {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border: 2px solid var(--outline);
    border-radius: 6px;
    background: white;
    color: transparent;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.choice-picker__checkbox-badge .material-symbols-outlined {
    font-size: 16px;
    font-weight: 700;
}

.choice-picker__option:has(input:checked) .choice-picker__checkbox-badge {
    border-color: var(--emerald-600);
    background: var(--emerald-500);
    color: white;
    transform: scale(1.05);
}

.choice-picker__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice-picker__swatch {
    display: grid;
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--project-color, var(--emerald-500)) 16%, white);
    color: var(--project-color, var(--emerald-800));
}

.choice-picker__swatch .material-symbols-outlined {
    font-size: 24px;
}

.choice-picker__meta {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.choice-picker__meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.98rem;
}

.choice-picker__meta small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.field.has-error .choice-picker__option {
    border-color: #f0c4bf;
}

.field.has-error .choice-picker__option:has(input:checked) {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.12);
}

.person-card__projects,
.person-card__total {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.person-card__total {
    align-items: flex-end;
}

.project-pills {
    display: flex;
    padding-left: 6px;
}

.project-pill {
    display: grid;
    width: 27px;
    height: 27px;
    margin-left: -6px;
    place-items: center;
    border: 2px solid white;
    border-radius: 999px;
    background: var(--project-color, var(--emerald-500));
    color: white;
    font-size: 0.66rem;
    font-weight: 700;
}

.project-pill--more {
    width: auto;
    min-width: 27px;
    padding-inline: 5px;
    background: var(--surface-blue-strong);
    color: var(--ink-soft);
}

.person-card__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
}

.card-action {
    display: inline-flex;
    min-height: 40px;
    padding: 6px 10px;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.card-action:hover {
    background: var(--surface-blue);
    color: var(--emerald-800);
}

.card-action .material-symbols-outlined {
    font-size: 19px;
}

/* Detail views */

.profile-summary,
.project-summary,
.expense-summary {
    margin-bottom: 24px;
    padding: 24px;
}

.profile-summary {
    display: grid;
    gap: 22px;
}

.profile-summary__identity {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-summary__identity p {
    margin-bottom: 0;
    color: var(--ink-soft);
}

.title-with-status {
    display: flex;
    align-items: center;
    gap: 12px;
}

.title-with-status h1 {
    margin-bottom: 0;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
}

.summary-stats > div {
    display: flex;
    padding: 14px;
    flex-direction: column;
}

.summary-stats > div + div {
    border-left: 1px solid var(--outline-soft);
}

.summary-stats span {
    color: var(--muted);
    font-size: 0.78rem;
}

.summary-stats strong {
    font-family: "Manrope", sans-serif;
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

.page--detail > .content-section + .content-section,
.page--detail > .notice + .content-section,
.page--detail > .detail-primary-action + .content-section {
    margin-top: 22px;
}

.related-grid {
    display: grid;
    gap: 10px;
}

.related-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
}

.related-card:hover {
    border-color: var(--project-color, var(--emerald-500));
    background: var(--surface-blue);
}

.related-card__icon {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--project-color, var(--emerald-500)) 14%, white);
    color: var(--project-color, var(--emerald-800));
    font-variation-settings: "FILL" 1;
}

.related-card > span:not(.material-symbols-outlined) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.related-card small {
    color: var(--muted);
}

.related-card__arrow {
    color: var(--muted);
}

.project-summary {
    border-top: 4px solid var(--project-color, var(--emerald-500));
}

.project-summary__top,
.project-summary__bottom,
.project-summary__identity,
.participant-summary {
    display: flex;
    align-items: center;
}

.project-summary__top,
.project-summary__bottom {
    justify-content: space-between;
    gap: 18px;
}

.project-summary__identity {
    gap: 16px;
    margin: 22px 0;
    padding: 20px 0;
    border-top: 1px solid var(--outline-soft);
    border-bottom: 1px solid var(--outline-soft);
}

.project-summary__identity h1 {
    margin-bottom: 3px;
}

.project-summary__identity p {
    margin-bottom: 0;
    color: var(--ink-soft);
}

.project-summary__folder {
    display: grid;
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--project-color, var(--emerald-500)) 14%, white);
    color: var(--project-color, var(--emerald-800));
    font-size: 30px;
    font-variation-settings: "FILL" 1;
}

.participant-summary {
    min-width: 0;
    gap: 10px;
    color: var(--ink-soft);
}

.participant-summary > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.participant-summary small {
    color: var(--muted);
}

.participant-summary strong {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.detail-primary-action {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 22px;
}

.notice {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    padding: 13px 15px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: white;
    color: var(--ink-soft);
}

.notice p {
    margin: 0;
}

.notice--neutral .material-symbols-outlined {
    color: var(--emerald-800);
}

.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.breakdown-card {
    --category: var(--emerald-800);
    --category-soft: var(--emerald-50);
    padding: 15px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
}

.breakdown-card__heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 8px;
    color: var(--ink-soft);
    font-weight: 700;
}

.breakdown-card__heading .category-icon {
    width: 36px;
    height: 36px;
}

.breakdown-card > strong {
    display: block;
    font-family: "Manrope", sans-serif;
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

.breakdown-card > small {
    color: var(--muted);
}

.progress {
    grid-column: 1 / -1;
    width: 100%;
    height: 5px;
    margin-top: 11px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface-blue-strong);
}

.progress > span {
    display: block;
    width: min(var(--progress, 0%), 100%);
    height: 100%;
    border-radius: inherit;
    background: var(--category, var(--emerald-500));
}

.person-breakdown-list {
    display: grid;
    gap: 10px;
}

.person-breakdown {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
}

.person-breakdown:hover {
    border-color: var(--emerald-500);
    background: var(--surface-blue);
}

.person-breakdown > .material-symbols-outlined {
    color: var(--muted);
}

.person-breakdown strong {
    font-family: "Manrope", sans-serif;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.person-breakdown .progress > span {
    background: var(--emerald-500);
}

/* Forms */

.entity-form,
.expense-form,
.stack-form {
    display: grid;
    gap: 18px;
}

.form-card {
    display: grid;
    gap: 18px;
    padding: 22px;
}

.form-card__heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--outline-soft);
}

.form-card__heading > .material-symbols-outlined {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 11px;
    background: var(--emerald-50);
    color: var(--emerald-800);
}

.form-card__heading h2 {
    margin-bottom: 2px;
    font-size: 1.08rem;
}

.form-card__heading p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.field > label,
.period-picker legend {
    color: var(--ink-soft);
    font-size: 0.85rem;
    font-weight: 700;
}

.required-mark {
    color: var(--red);
}

.field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.field select,
.field textarea,
.stack-form input {
    width: 100%;
    min-height: 52px;
    padding: 11px 13px;
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    background: white;
    color: var(--ink);
    line-height: 1.4;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.stack-form input:focus {
    border-color: var(--emerald-800);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 108, 73, 0.14);
}

.field input::placeholder,
.field textarea::placeholder,
.stack-form input::placeholder {
    color: #89968e;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea,
.amount-card.has-error input {
    border-color: var(--red);
}

.field__help,
.file-feedback {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.field__error {
    margin: 0;
    color: var(--red-dark);
    font-size: 0.79rem;
    font-weight: 600;
}

.form-alert {
    display: flex;
    gap: 10px;
    padding: 14px;
    border: 1px solid #efaaa3;
    border-radius: var(--radius-md);
    background: #fff1ef;
    color: var(--red-dark);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 180ms ease-in, transform 180ms ease-in, margin 180ms ease-in;
    animation: alert-enter 220ms ease-out, alert-pulse 1.2s ease-out 220ms 1;
}

.form-alert p:last-child {
    margin-bottom: 0;
}

.form-alert--inline {
    margin-top: 12px;
    padding: 10px 14px;
    font-size: 0.85rem;
}

.form-alert--leaving {
    opacity: 0;
    transform: translateY(-6px);
    margin-bottom: -1px;
}

@keyframes alert-enter {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes alert-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(186, 26, 26, 0.25);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(186, 26, 26, 0);
    }
}

.message--error,
.message--warning {
    animation: alert-pulse 1.2s ease-out 1;
}

@keyframes field-shake {
    0%, 100% {
        transform: translateX(0);
    }
    20% {
        transform: translateX(-4px);
    }
    40% {
        transform: translateX(4px);
    }
    60% {
        transform: translateX(-3px);
    }
    80% {
        transform: translateX(3px);
    }
}

.field-shake {
    animation: field-shake 350ms ease-in-out;
}

.check-field {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: var(--surface-blue);
}

.check-field input,
.confirmation-check input,
.private-file-current input {
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--emerald-800);
}

.check-field label {
    display: flex;
    flex-direction: column;
}

.check-field label span {
    color: var(--muted);
    font-size: 0.78rem;
}

.upload-layout,
.receipt-upload {
    display: flex;
    align-items: center;
    gap: 15px;
}

.upload-control,
.receipt-upload > div {
    min-width: 0;
    flex: 1;
}

.field input[type="file"] {
    max-width: 100%;
    padding: 8px;
    border: 1px dashed var(--outline);
    border-radius: var(--radius-sm);
    background: var(--surface-blue);
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.field input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 8px 11px;
    border: 0;
    border-radius: 7px;
    background: var(--emerald-800);
    color: white;
    font-weight: 700;
}

.private-file-current {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-blue);
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.private-file-current label {
    cursor: pointer;
    font-weight: 600;
}

.upload-preview {
    position: relative;
}

.upload-preview img[hidden],
.receipt-upload img[hidden] {
    display: none;
}

.color-control {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    background: white;
}

.color-control input[type="color"] {
    width: 48px;
    height: 42px;
    padding: 2px;
    border: 0;
    border-radius: 8px;
    background: transparent;
}

.color-control__preview {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: var(--selected-color, var(--emerald-500));
}

.color-control > span:last-child {
    color: var(--muted);
    font-size: 0.78rem;
}

.choice-list > div,
.choice-list > ul,
.choice-list #id_participantes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.choice-list label {
    display: flex;
    min-height: 48px;
    padding: 10px 12px;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.choice-list label:hover {
    border-color: var(--emerald-500);
    background: var(--emerald-50);
}

.choice-list input {
    width: 19px;
    height: 19px;
    accent-color: var(--emerald-800);
}

.inline-empty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--surface-blue);
}

.inline-empty p {
    flex: 1 1 220px;
    margin: 0;
    color: var(--ink-soft);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Expense filters and list */

.filter-panel {
    margin-bottom: 18px;
    padding: 18px;
}

.filter-panel__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}

.filter-panel__heading > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-panel__heading h2 {
    margin: 0;
    font-size: 1.05rem;
}

.filter-panel__heading .material-symbols-outlined {
    color: var(--emerald-800);
}

.filter-form {
    display: grid;
    gap: 16px;
}

.period-picker {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.period-picker legend {
    margin-bottom: 8px;
}

.period-picker__options {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 2px 2px 5px;
    scrollbar-width: none;
}

.period-picker__options::-webkit-scrollbar {
    display: none;
}

.period-chip {
    flex: 0 0 auto;
}

.period-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.period-chip span {
    display: inline-flex;
    min-height: 36px;
    padding: 7px 14px;
    align-items: center;
    border-radius: 999px;
    background: var(--surface-blue-strong);
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 700;
}

.period-chip input:checked + span {
    background: var(--emerald-500);
    color: white;
}

.period-chip input:focus-visible + span {
    outline: 3px solid rgba(0, 108, 73, 0.3);
    outline-offset: 2px;
}

.filter-grid,
.custom-period {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.custom-period[hidden] {
    display: none;
}

.filter-form__actions {
    display: flex;
    justify-content: flex-end;
}

.list-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--emerald-50);
    color: var(--ink-soft);
}

.list-summary > div {
    display: flex;
    flex-direction: column;
}

.list-summary strong {
    color: var(--ink);
    font-family: "Manrope", sans-serif;
    font-size: 1.25rem;
    font-variant-numeric: tabular-nums;
}

.list-summary > span {
    font-size: 0.82rem;
}

.transaction-groups {
    display: grid;
    gap: 24px;
}

.transaction-group > h2 {
    margin: 0 0 10px 8px;
    color: var(--muted);
    font-family: "Inter", sans-serif;
    font-size: 0.78rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.transaction-list {
    display: grid;
    gap: 10px;
}

.transaction-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 16px;
    border: 1px solid rgba(187, 202, 191, 0.45);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-soft);
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.transaction-card:hover {
    border-color: var(--emerald-500);
    box-shadow: var(--shadow-raised);
    transform: translateY(-2px);
}

.transaction-card__body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.transaction-card__amount {
    font-family: "Manrope", sans-serif;
    font-size: 1.22rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.transaction-card__description {
    overflow: hidden;
    color: var(--ink);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.tag {
    display: inline-flex;
    max-width: 180px;
    padding: 3px 7px;
    overflow: hidden;
    border-radius: 5px;
    background: var(--surface-blue);
    color: var(--ink-soft);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transaction-card__time {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 0.74rem;
}

.transaction-card__time .material-symbols-outlined {
    color: var(--emerald-500);
    font-size: 17px;
}

.transaction-card__arrow {
    color: var(--outline);
}

.pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding: 12px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-soft);
}

.pagination__link {
    display: inline-flex;
    min-height: 44px;
    padding: 8px 11px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: var(--radius-sm);
    color: var(--emerald-800);
    font-size: 0.82rem;
    font-weight: 700;
}

.pagination__link:last-child {
    justify-self: end;
}

.pagination__link:hover:not(.is-disabled) {
    background: var(--emerald-50);
}

.pagination__link.is-disabled {
    color: #9ba59f;
    cursor: not-allowed;
}

.pagination__status {
    color: var(--muted);
    font-size: 0.78rem;
    text-align: center;
    white-space: nowrap;
}

/* Expense form and detail */

.amount-card {
    display: flex;
    padding: 24px;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-soft);
}

.amount-card > label {
    color: var(--ink-soft);
    font-weight: 700;
}

.amount-input {
    display: flex;
    width: min(100%, 440px);
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.amount-input > span {
    color: var(--emerald-500);
    font-family: "Manrope", sans-serif;
    font-size: clamp(2.2rem, 8vw, 3rem);
    font-weight: 700;
}

.amount-input input {
    width: min(70%, 280px);
    min-width: 0;
    padding: 5px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font-family: "Manrope", sans-serif;
    font-size: clamp(2.2rem, 8vw, 3rem);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    text-align: center;
}

.amount-input input:focus {
    border-bottom-color: var(--emerald-500);
    outline: 0;
}

.optional-details {
    overflow: hidden;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-lg);
    background: white;
    box-shadow: var(--shadow-soft);
}

.optional-details summary {
    display: flex;
    min-height: 58px;
    padding: 14px 18px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--emerald-800);
    font-weight: 700;
    list-style: none;
}

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

.optional-details summary > span:first-child {
    display: flex;
    align-items: center;
    gap: 9px;
}

.optional-details__chevron {
    transition: transform 180ms ease;
}

.optional-details[open] .optional-details__chevron {
    transform: rotate(180deg);
}

.optional-details__body {
    display: grid;
    gap: 18px;
    padding: 18px;
    border-top: 1px solid var(--outline-soft);
}

.receipt-upload {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border: 1.5px dashed var(--outline);
    border-radius: var(--radius-md);
    background: var(--surface-blue, #f8fafc);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.receipt-upload:focus-within,
.receipt-upload:hover {
    border-color: var(--emerald-800, #0f766e);
}

.receipt-upload__preview-box {
    position: relative;
    width: 80px;
    height: 80px;
    flex: 0 0 80px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--emerald-50, #f0fdf4);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.receipt-upload__trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 4px;
    color: var(--emerald-800, #0f766e);
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.15s ease;
    padding: 4px;
}

.receipt-upload__trigger:hover {
    background: rgba(15, 118, 110, 0.08);
}

.receipt-upload__trigger .material-symbols-outlined {
    font-size: 28px;
}

.receipt-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.receipt-upload__controls {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.receipt-upload__controls input[type="file"]:not(.sr-only) {
    display: none;
}

.receipt-upload__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.button--danger-text {
    color: #dc2626 !important;
}

.button--danger-text:hover {
    background: rgba(220, 38, 38, 0.08) !important;
}

.file-feedback-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.3;
    transition: all 0.2s ease;
}

.file-feedback-badge__icon {
    font-size: 18px;
    flex-shrink: 0;
}

.file-feedback-badge--info {
    background: rgba(100, 116, 139, 0.08);
    color: var(--ink-soft, #475569);
    border: 1px solid rgba(100, 116, 139, 0.15);
}

.file-feedback-badge--success {
    background: rgba(16, 185, 129, 0.1);
    color: #047857;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.file-feedback-badge--success .file-feedback-badge__icon {
    color: #10b981;
}

.file-feedback-badge--error {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.25);
    animation: fieldShake 0.4s ease;
}

.file-feedback-badge--error .file-feedback-badge__icon {
    color: #ef4444;
}

.form-actions--sticky {
    position: sticky;
    bottom: calc(var(--bottom-nav-height) + 8px);
    z-index: 20;
    margin: 4px -8px -8px;
    padding: 12px;
    border: 1px solid rgba(187, 202, 191, 0.55);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -8px 28px rgba(18, 28, 42, 0.08);
    backdrop-filter: blur(12px);
}

.setup-checklist {
    display: grid;
    width: min(100%, 620px);
    gap: 10px;
    margin-bottom: 18px;
}

.setup-checklist__item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 13px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: white;
    text-align: left;
}

.setup-checklist__item > .material-symbols-outlined {
    color: var(--muted);
}

.setup-checklist__item.is-complete > .material-symbols-outlined {
    color: var(--emerald-500);
    font-variation-settings: "FILL" 1;
}

.setup-checklist__item > span:nth-child(2) {
    display: flex;
    flex-direction: column;
}

.setup-checklist__item small {
    color: var(--muted);
}

.expense-summary {
    text-align: center;
}

.expense-summary__category {
    display: inline-flex;
    margin-bottom: 12px;
    align-items: center;
    gap: 8px;
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 700;
}

.expense-summary__category .category-icon {
    width: 36px;
    height: 36px;
}

.expense-summary h1 {
    margin: 10px auto 5px;
    font-size: clamp(1.25rem, 4vw, 1.65rem);
}

.expense-summary time {
    color: var(--muted);
    font-size: 0.85rem;
}

.detail-facts {
    display: grid;
    gap: 12px;
    margin-bottom: 22px;
}

.fact-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 14px;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: white;
    box-shadow: var(--shadow-soft);
}

.fact-card:hover {
    border-color: var(--emerald-500);
}

.fact-card__icon {
    display: grid;
    width: 43px;
    height: 43px;
    place-items: center;
    border-radius: 11px;
    background: var(--emerald-50);
    color: var(--emerald-800);
}

.fact-card > span:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.fact-card small {
    color: var(--muted);
}

.fact-card strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fact-card > .material-symbols-outlined:last-child {
    color: var(--outline);
}

.fact-card--static {
    cursor: default;
    grid-template-columns: auto minmax(0, 1fr);
}

.fact-card--static:hover {
    border-color: var(--outline-soft);
}

.detail-note > p {
    margin-bottom: 0;
    color: var(--ink-soft);
}

.detail-empty {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.receipt-empty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border: 1px dashed var(--outline);
    border-radius: var(--radius-md);
    background: var(--surface-blue);
}

.receipt-empty > .material-symbols-outlined {
    display: grid;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 12px;
    background: white;
    color: var(--outline);
    font-size: 26px;
}

.receipt-empty > div {
    flex: 1 1 160px;
    min-width: 0;
}

.receipt-empty strong {
    display: block;
    margin-bottom: 2px;
}

.receipt-empty p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.receipt-preview {
    position: relative;
    display: block;
    overflow: hidden;
    border: 1px solid var(--outline-soft);
    border-radius: var(--radius-md);
    background: var(--surface-blue);
}

.receipt-preview img {
    width: 100%;
    max-height: 520px;
    object-fit: contain;
}

.receipt-preview span {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(18, 28, 42, 0.78);
    color: white;
    font-size: 0.74rem;
    font-weight: 700;
}

.danger-zone {
    display: flex;
    margin-top: 22px;
    padding: 18px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid #f0c4bf;
    border-radius: var(--radius-lg);
    background: #fff8f7;
}

.danger-zone h2 {
    margin-bottom: 3px;
    font-size: 1.05rem;
}

.danger-zone p {
    margin-bottom: 0;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.delete-card {
    padding: 26px;
    border: 1px solid #efb8b2;
    border-radius: var(--radius-xl);
    background: white;
    box-shadow: var(--shadow-raised);
    text-align: center;
}

.delete-card__icon {
    display: grid;
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    place-items: center;
    border-radius: 20px;
    background: var(--red-soft);
    color: var(--red-dark);
    font-size: 36px;
}

.delete-card > p:not(.eyebrow) {
    max-width: 510px;
    margin-inline: auto;
    color: var(--ink-soft);
}

.delete-card__summary {
    display: flex;
    margin: 22px 0;
    padding: 16px;
    flex-direction: column;
    border-radius: var(--radius-md);
    background: var(--surface-blue);
}

.delete-card__summary strong {
    font-family: "Manrope", sans-serif;
    font-size: 1.55rem;
    font-variant-numeric: tabular-nums;
}

.delete-card__summary small {
    margin-top: 4px;
    color: var(--muted);
}

.delete-form {
    display: grid;
    gap: 18px;
}

.confirmation-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px;
    border: 1px solid #efb8b2;
    border-radius: var(--radius-md);
    background: #fff7f6;
    color: var(--red-dark);
    font-size: 0.84rem;
    font-weight: 600;
    text-align: left;
}

/* Login */

.auth-body {
    background:
        radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.15), transparent 30%),
        radial-gradient(circle at 90% 90%, rgba(222, 233, 252, 0.8), transparent 35%),
        var(--surface);
}

.auth-main {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-items: center;
}

.login-layout {
    display: grid;
    width: min(100%, 940px);
    overflow: hidden;
    border: 1px solid rgba(187, 202, 191, 0.55);
    border-radius: var(--radius-xl);
    background: white;
    box-shadow: 0 24px 70px rgba(18, 28, 42, 0.14);
}

.login-intro,
.login-card {
    padding: clamp(24px, 6vw, 48px);
}

.login-intro {
    display: none;
    background: linear-gradient(145deg, #00583c, #0c8c63);
    color: white;
}

.login-intro .eyebrow {
    color: #baf4db;
}

.login-intro h1 {
    font-size: clamp(2.6rem, 6vw, 4.4rem);
}

.login-intro__mark {
    display: grid;
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.12);
}

.login-intro__mark img {
    display: block;
    width: 44px;
    height: 44px;
}

.login-benefits {
    display: grid;
    gap: 11px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.login-benefits li {
    display: flex;
    align-items: center;
    gap: 9px;
}

.login-card {
    align-self: center;
}

.login-card__header {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 24px;
}

.login-card__header > .material-symbols-outlined {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 13px;
    background: var(--emerald-50);
    color: var(--emerald-800);
}

.login-card__header h2,
.login-card__header p {
    margin-bottom: 0;
}

.login-card__header p {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Responsive layout */

@media (min-width: 600px) {
    .topbar__user {
        display: block;
    }

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

    .metric-card--featured {
        grid-column: 1 / -1;
    }

    .setup-callout {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
    }

    .setup-callout .button-row {
        grid-column: auto;
        justify-content: flex-end;
    }

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

    .breakdown-grid,
    .detail-facts,
    .custom-period {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .choice-list > div,
    .choice-list > ul,
    .choice-list #id_participantes {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .profile-summary {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .profile-summary__identity {
        grid-column: 1 / -1;
    }

    .summary-stats {
        min-width: 330px;
    }

    .login-layout {
        grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    }

    .login-intro {
        display: block;
    }
}

@media (min-width: 900px) {
    .topbar {
        padding-inline: 26px;
    }

    .sidebar {
        position: fixed;
        inset: var(--topbar-height) auto 0 0;
        z-index: 50;
        display: flex;
        width: var(--sidebar-width);
        padding: 22px 16px;
        flex-direction: column;
        justify-content: space-between;
        border-right: 1px solid rgba(187, 202, 191, 0.6);
        background: white;
    }

    .sidebar__nav {
        display: grid;
        gap: 7px;
    }

    .nav-link {
        display: flex;
        min-height: 50px;
        padding: 10px 14px;
        align-items: center;
        gap: 12px;
        border-radius: var(--radius-md);
        color: var(--ink-soft);
        font-size: 0.9rem;
        font-weight: 600;
        transition: color 160ms ease, background 160ms ease, transform 160ms ease;
    }

    .nav-link:hover {
        background: var(--surface-blue);
        color: var(--emerald-800);
        transform: translateX(2px);
    }

    .nav-link.is-active {
        background: var(--emerald-100);
        color: var(--emerald-800);
        font-weight: 700;
    }

    .sidebar__tip {
        padding: 14px;
        border-radius: var(--radius-md);
        background: var(--surface-blue);
        color: var(--ink-soft);
        font-size: 0.76rem;
    }

    .sidebar__tip .material-symbols-outlined {
        margin-bottom: 6px;
        color: var(--amber);
    }

    .sidebar__tip p {
        margin-bottom: 0;
    }

    .app-main {
        margin-left: var(--sidebar-width);
        padding: calc(var(--topbar-height) + 34px) 34px 48px;
    }

    .bottom-nav {
        display: none;
    }

    .form-actions--sticky {
        bottom: 16px;
    }

    .dashboard-columns {
        grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
        align-items: start;
    }
}

@media (max-width: 899px) {
    .expense-form-page .bottom-nav {
        display: none;
    }

    .expense-form-page .app-main {
        padding-bottom: 34px;
    }

    .expense-form-page .form-actions--sticky {
        bottom: max(8px, env(safe-area-inset-bottom));
    }
}

@media (max-width: 599px) {
    .page-header {
        align-items: flex-start;
    }

    .page-header .button {
        min-width: 48px;
        padding-inline: 12px;
    }

    .button__wide-label {
        display: none;
    }

    .button__short-label {
        display: inline;
    }

    .back-link span:last-child {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .context-header--title .back-link {
        width: 48px;
        justify-content: center;
    }

    .project-summary__top,
    .project-summary__bottom {
        align-items: flex-start;
        flex-direction: column;
    }

    .project-summary__bottom form,
    .project-summary__bottom .button,
    .detail-primary-action .button {
        width: 100%;
    }

    .detail-primary-action {
        display: block;
    }

    .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

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

    .form-actions--sticky {
        flex-direction: row;
    }

    .form-actions--sticky .button--ghost {
        width: auto;
        flex: 0 0 auto;
    }

    .form-actions--sticky .button--primary {
        min-width: 0;
        flex: 1;
    }

    .search-form .button {
        min-width: 48px;
        padding-inline: 12px;
    }

    .list-summary {
        align-items: flex-start;
    }

    .upload-layout,
    .receipt-upload {
        align-items: flex-start;
    }

    .setup-checklist__item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .setup-checklist__item .button {
        grid-column: 1 / -1;
    }
}

@media (max-width: 420px) {
    .app-main {
        padding-inline: 14px;
    }

    .period-picker__options {
        flex-wrap: wrap;
        overflow-x: visible;
    }

    .bottom-nav {
        padding-inline: 3px;
    }

    .bottom-nav__item {
        font-size: 0.62rem;
    }

    .page-header {
        gap: 10px;
    }

    .page-header .button {
        font-size: 0;
    }

    .page-header .button .material-symbols-outlined {
        font-size: 24px;
    }

    .button__short-label,
    .button__wide-label {
        display: none;
    }

    .content-section,
    .form-card,
    .profile-summary,
    .project-summary,
    .expense-summary,
    .filter-panel {
        padding: 16px;
    }

    .compact-transaction {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .compact-transaction__value {
        grid-column: 2;
        align-items: flex-start;
        flex-direction: row;
        justify-content: space-between;
        gap: 8px;
        text-align: left;
    }

    .compact-transaction__value strong {
        font-size: 0.9rem;
    }

    .transaction-card {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: flex-start;
        padding: 13px;
    }

    .transaction-card__arrow {
        display: none;
    }

    .transaction-card .category-icon--large {
        width: 42px;
        height: 42px;
    }

    .tag {
        max-width: 125px;
    }

    .title-with-status {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-summary__identity {
        align-items: flex-start;
    }

    .amount-card {
        padding-inline: 12px;
    }

    .amount-input {
        gap: 6px;
    }

    .amount-input > span,
    .amount-input input {
        font-size: 2.05rem;
    }

    .form-actions--sticky {
        margin-inline: -4px;
        padding: 8px;
    }

    .form-actions--sticky .button {
        padding-inline: 12px;
        font-size: 0.82rem;
    }

    .delete-card {
        padding: 20px 16px;
    }

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

    .pagination__status {
        grid-column: 1 / -1;
        grid-row: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    .topbar,
    .sidebar,
    .bottom-nav,
    .button,
    .danger-zone,
    .message-stack {
        display: none !important;
    }

    .app-main {
        margin: 0;
        padding: 0;
    }

    body {
        background: white;
    }

    .surface-card,
    .content-section {
        box-shadow: none;
    }
}
