/* Money Health design system (documents/DESIGN.md).
   Placeholder tokens until the brand identity lands: use only these --mh-* variables, never loose
   colours or fonts. Light is the default theme; dark is opt-in via <html data-theme="dark">. */

/* 1. Tokens ===================================================================================== */
/* Brand v1 (documents/Money Health — Apresentação da Marca.pdf; static/brand/tokens-v1.css).
   Fonts are self-hosted (static/fonts, OFL): loading them from Google would hand every visitor's IP
   to a third party (LGPD). */
@font-face { font-family: "Sora"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("../fonts/sora-latin-wght-normal.0d0e5e4d2f9f.woff2") format("woff2-variations"), url("../fonts/sora-latin-wght-normal.0d0e5e4d2f9f.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("../fonts/sora-latin-ext-wght-normal.adf7c421da62.woff2") format("woff2-variations"), url("../fonts/sora-latin-ext-wght-normal.adf7c421da62.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 300 800; font-display: swap; src: url("../fonts/dm-sans-latin-wght-normal.7c87a648293f.woff2") format("woff2-variations"), url("../fonts/dm-sans-latin-wght-normal.7c87a648293f.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 300 800; font-display: swap; src: url("../fonts/dm-sans-latin-ext-wght-normal.49935c4b6235.woff2") format("woff2-variations"), url("../fonts/dm-sans-latin-ext-wght-normal.49935c4b6235.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  color-scheme: light;
  /* Brand palette (primitives). Proportion: Névoa dominates, Floresta structures, greens mark,
     Âmbar only punctuates. Use the semantic tokens below in components, not these. */
  --mh-floresta: #0b2e2a;
  --mh-verde-vital: #0c7f5b;
  --mh-verde-broto: #3ddc97;
  --mh-nevoa: #f3f6f1;
  --mh-ambar: #f2b33d;
  --mh-superficie: #fbfcfa;
  /* Data colours: every value also carries a sign and a label; colour never speaks alone. */
  --mh-receita: #0c7f5b;
  --mh-despesa: #e4684e;
  --mh-investimento: #3b6fd8;
  --mh-patrimonio: #f2b33d;
  --mh-neutro: #8a9a94;

  /* Surfaces and text */
  --mh-bg: var(--mh-nevoa);
  --mh-surface: var(--mh-superficie);
  --mh-surface-2: #f6f8f5;
  --mh-surface-3: #eaf0ec;
  --mh-text: var(--mh-floresta);
  --mh-muted: #4a5d57;
  --mh-subtle: #5c6d67; /* the brand's #6B7C76 is below 4.5:1 for small text */
  --mh-border: #dce5e0;
  --mh-border-strong: #c3d1ca;
  /* Brand roles */
  --mh-primary: var(--mh-verde-vital);
  --mh-primary-hover: #0a6a4c;
  --mh-primary-soft: #e1f1e9;
  --mh-primary-text: #ffffff;
  --mh-accent: var(--mh-floresta);
  --mh-highlight: var(--mh-verde-broto);
  /* Semantic. Coral and âmbar are for fills and icons; their text tones are darker for AA. */
  --mh-success: var(--mh-verde-vital);
  --mh-success-soft: #e1f1e9;
  --mh-warning: #8a5a00;
  --mh-warning-soft: #fdf0d6;
  --mh-danger: #b6442c;
  --mh-danger-soft: #fce9e4;
  --mh-info: #2f5fc4;
  --mh-info-soft: #e6edfb;
  --mh-income: var(--mh-receita);
  --mh-expense: var(--mh-despesa);
  --mh-invest: var(--mh-investimento);
  --mh-goal: var(--mh-ambar);
  /* Shape and depth */
  --mh-radius-sm: 10px;
  --mh-radius: 16px;
  --mh-radius-lg: 24px;
  --mh-radius-pill: 999px;
  --mh-shadow-sm: 0 1px 2px rgb(11 46 42 / 6%);
  --mh-shadow: 0 1px 2px rgb(11 46 42 / 5%), 0 6px 18px rgb(11 46 42 / 5%);
  --mh-shadow-md: 0 2px 4px rgb(11 46 42 / 6%), 0 14px 32px rgb(11 46 42 / 10%);
  --mh-shadow-lg: -12px 0 48px rgb(11 46 42 / 20%);
  --mh-overlay: rgb(11 46 42 / 50%);
  --mh-ring: 0 0 0 3px color-mix(in srgb, var(--mh-primary) 28%, transparent);
  /* Type: Sora for titles and numbers, DM Sans for text and interface */
  --mh-font-display: "Sora", "DM Sans", Arial, sans-serif;
  --mh-font: "DM Sans", Arial, sans-serif;
  --mh-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --mh-fs-xs: .8125rem; /* 13px: legenda */
  --mh-fs-sm: .875rem;
  --mh-fs-md: 1rem;     /* 16px: corpo */
  --mh-fs-lg: 1.125rem;
  --mh-fs-xl: 1.375rem;
  --mh-fs-2xl: 2rem;    /* 32px: título */
  --mh-fs-3xl: 2.25rem;
  --mh-fs-display: 3.5rem; /* 56px: display */
  /* QR codes stay dark on light in both themes, so every authenticator app can scan them. */
  --mh-qr-bg: #ffffff;
  --mh-qr-fg: #000000;
  /* Category colours (apps/categories/styles.py); chips tint them over the surface. */
  --mh-cat-green: #0c7f5b;
  --mh-cat-teal: #0f766e;
  --mh-cat-blue: #2f5fc4;
  --mh-cat-indigo: #4a48c9;
  --mh-cat-purple: #7e22ce;
  --mh-cat-pink: #be185d;
  --mh-cat-red: #b6442c;
  --mh-cat-orange: #b8541c;
  --mh-cat-amber: #8a5a00;
  --mh-cat-brown: #8a5a3b;
  --mh-cat-slate: #4a5d57;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  /* Dark follows the brand's negative version: Floresta background, Verde Broto as highlight with
     Floresta text on top. */
  --mh-bg: #082421;
  --mh-surface: var(--mh-floresta);
  --mh-surface-2: #0f3833;
  --mh-surface-3: #14423c;
  --mh-text: var(--mh-nevoa);
  --mh-muted: #a9bdb5;
  --mh-subtle: #87a097;
  --mh-border: #1c4a43;
  --mh-border-strong: #2a5d55;
  --mh-primary: var(--mh-verde-broto);
  --mh-primary-hover: #6ae6b0;
  --mh-primary-soft: #12463a;
  --mh-primary-text: var(--mh-floresta);
  --mh-accent: #061c19;
  --mh-success: var(--mh-verde-broto);
  --mh-success-soft: #12463a;
  --mh-warning: var(--mh-ambar);
  --mh-warning-soft: #3a3016;
  --mh-danger: #f08a73;
  --mh-danger-soft: #42261f;
  --mh-info: #7fa6f2;
  --mh-info-soft: #18304f;
  --mh-income: var(--mh-verde-broto);
  --mh-expense: #f08a73;
  --mh-invest: #7fa6f2;
  --mh-shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
  --mh-shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 6px 18px rgb(0 0 0 / 22%);
  --mh-shadow-md: 0 2px 4px rgb(0 0 0 / 30%), 0 14px 32px rgb(0 0 0 / 35%);
  --mh-shadow-lg: -12px 0 48px rgb(0 0 0 / 50%);
  --mh-overlay: rgb(0 0 0 / 62%);
  --mh-cat-green: #3ddc97;
  --mh-cat-teal: #4fd1c5;
  --mh-cat-blue: #7fa6f2;
  --mh-cat-indigo: #a5b4fc;
  --mh-cat-purple: #d2a8ff;
  --mh-cat-pink: #f9a8d4;
  --mh-cat-red: #f08a73;
  --mh-cat-orange: #fdba74;
  --mh-cat-amber: #f2b33d;
  --mh-cat-brown: #d6a77a;
  --mh-cat-slate: #a9bdb5;
}

/* 2. Base ======================================================================================= */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--mh-bg); color: var(--mh-text); font-family: var(--mh-font); font-size: var(--mh-fs-md); line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { font-family: var(--mh-font-display); line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: var(--mh-fs-2xl); font-weight: 650; }
h2 { font-size: var(--mh-fs-lg); font-weight: 600; }
h3 { font-size: var(--mh-fs-md); font-weight: 600; }
a { color: var(--mh-primary); text-underline-offset: 3px; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 3px solid var(--mh-primary); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--mh-primary) 25%, transparent); }
.mh-muted { color: var(--mh-muted); }
.mh-error { color: var(--mh-danger); }
.mh-ok { color: var(--mh-success); }
.mh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mh-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mh-stack > * + * { margin-top: 20px; }
.mh-code { font-family: var(--mh-font-mono); letter-spacing: .05em; word-break: break-all; }
[hidden] { display: none !important; }

/* 3. Cards and sections ========================================================================= */
.mh-container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.mh-card { background: var(--mh-surface); border: 1px solid var(--mh-border); border-radius: var(--mh-radius-lg); padding: 24px; box-shadow: var(--mh-shadow); }
.mh-card > h2:first-child { margin-top: 0; }
.mh-card + .mh-card { margin-top: 16px; }
:is(.mh-summaries, .mh-goal-grid, .mh-ccard-grid, .mh-member-grid, .mh-dash, .mh-dash-side, .mh-settings-grid) > .mh-card, .mh-member-grid .mh-card { margin-top: 0; }
.mh-narrow { max-width: min(440px, calc(100% - 32px)); margin: 48px auto; }
/* A card header: icon chip, title and a short description, with an optional action on the right. */
.mh-card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.mh-card-head > div { flex: 1; min-width: 0; }
.mh-card-head h2, .mh-card-head h3 { margin: 0; }
.mh-card-head p { margin: 4px 0 0; color: var(--mh-muted); font-size: var(--mh-fs-sm); }
.mh-section + .mh-section, .mh-list + .mh-section, .mh-summaries + .mh-section { margin-top: 36px; }
.mh-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mh-section-head .mh-section-title { margin: 0; }
.mh-section-title { margin: 0 0 12px; font-size: var(--mh-fs-lg); }
.mh-divider { height: 1px; margin: 20px 0; background: var(--mh-border); border: 0; }

/* 4. Buttons ==================================================================================== */
.mh-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; background: var(--mh-primary); color: var(--mh-primary-text); border: 1px solid transparent; border-radius: var(--mh-radius-sm); padding: 9px 18px; font: inherit; font-size: var(--mh-fs-sm); font-weight: 650; letter-spacing: .005em; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--mh-shadow-sm); transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s; }
.mh-btn:hover { background: var(--mh-primary-hover); }
.mh-btn:active { transform: translateY(1px); }
.mh-btn .mh-icon { width: 18px; height: 18px; }
.mh-btn-secondary { background: var(--mh-surface); color: var(--mh-text); border-color: var(--mh-border-strong); }
.mh-btn-secondary:hover { background: var(--mh-surface-2); border-color: var(--mh-muted); }
.mh-btn-ghost { background: transparent; color: var(--mh-muted); box-shadow: none; }
.mh-btn-ghost:hover { background: var(--mh-surface-3); color: var(--mh-text); }
.mh-btn-danger { background: var(--mh-danger); color: var(--mh-surface); }
.mh-btn-danger:hover { background: var(--mh-danger); filter: brightness(.92); }
.mh-btn-danger-soft { background: var(--mh-danger-soft); color: var(--mh-danger); box-shadow: none; }
.mh-btn-danger-soft:hover { background: var(--mh-danger-soft); border-color: var(--mh-danger); }
.mh-btn-sm { min-height: 34px; padding: 6px 12px; font-size: var(--mh-fs-xs); }
.mh-btn-sm .mh-icon { width: 16px; height: 16px; }
.mh-btn-block { width: 100%; }
.mh-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; background: none; border: 1px solid transparent; border-radius: var(--mh-radius-sm); color: var(--mh-muted); cursor: pointer; text-decoration: none; }
.mh-icon-btn:hover { background: var(--mh-surface-3); color: var(--mh-text); }
.mh-link-danger { color: var(--mh-danger); font-weight: 600; }
.mh-link-button { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 8px 0; font: inherit; font-weight: 600; cursor: pointer; }
.mh-flip .mh-icon { transform: scaleX(-1); }

/* 5. Badges, chips and tags ===================================================================== */
.mh-chip { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--mh-primary-soft); color: var(--mh-primary); }
.mh-chip--sm { width: 30px; height: 30px; border-radius: 9px; }
.mh-chip--sm .mh-icon { width: 17px; height: 17px; }
.mh-chip--lg { width: 52px; height: 52px; border-radius: 16px; }
.mh-chip--lg .mh-icon { width: 26px; height: 26px; }
.mh-chip--danger { background: var(--mh-danger-soft); color: var(--mh-danger); }
.mh-chip--warning { background: var(--mh-warning-soft); color: var(--mh-warning); }
.mh-chip--info { background: var(--mh-info-soft); color: var(--mh-info); }
.mh-chip--neutral { background: var(--mh-surface-3); color: var(--mh-muted); }
.mh-chip--income { background: color-mix(in srgb, var(--mh-income) 14%, var(--mh-surface)); color: var(--mh-income); }
.mh-chip--expense { background: color-mix(in srgb, var(--mh-expense) 16%, var(--mh-surface)); color: var(--mh-danger); }
.mh-chip--invest { background: color-mix(in srgb, var(--mh-invest) 14%, var(--mh-surface)); color: var(--mh-info); }
.mh-chip--goal { background: color-mix(in srgb, var(--mh-goal) 22%, var(--mh-surface)); color: var(--mh-warning); }
.mh-eyebrow { margin: 0 0 8px; font-size: var(--mh-fs-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--mh-primary); }
/* Status pill: short state labels (On, Owner, Over the limit...). */
.mh-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--mh-radius-pill); background: var(--mh-surface-3); color: var(--mh-muted); font-size: var(--mh-fs-xs); font-weight: 650; line-height: 1.5; white-space: nowrap; vertical-align: middle; }
.mh-status .mh-icon { width: 14px; height: 14px; stroke-width: 2.2; }
.mh-status--primary { background: var(--mh-primary-soft); color: var(--mh-primary); }
.mh-status--success { background: var(--mh-success-soft); color: var(--mh-success); }
.mh-status--warning { background: var(--mh-warning-soft); color: var(--mh-warning); }
.mh-status--danger { background: var(--mh-danger-soft); color: var(--mh-danger); }
.mh-status--info { background: var(--mh-info-soft); color: var(--mh-info); }
.mh-tag-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.mh-tag { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px 6px 10px; border: 1px solid var(--mh-border); border-radius: var(--mh-radius-pill); background: var(--mh-surface); color: var(--mh-text); font-weight: 500; text-decoration: none; }
.mh-tag .mh-icon { width: 16px; height: 16px; color: var(--mh-muted); }
a.mh-tag:hover { border-color: var(--mh-muted); background: var(--mh-surface-2); }
.mh-tag--sm { min-height: 0; padding: 1px 10px; font-size: var(--mh-fs-xs); }
/* Brand badges (apps/core/brands.py): colours come from the brand catalog, not the theme. */
.mh-badge { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--badge-bg); color: var(--badge-fg); font-size: .72rem; font-weight: 800; letter-spacing: -.01em; line-height: 1; text-align: center; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.mh-badge--logo { background: var(--mh-surface); object-fit: contain; padding: 4px; border: 1px solid var(--mh-border); box-shadow: none; }
/* Category tint */
.mh-cat { --cat: var(--mh-cat-slate); background: color-mix(in srgb, var(--cat) 14%, var(--mh-surface)); color: var(--cat); }
.mh-cat--green { --cat: var(--mh-cat-green); } .mh-cat--teal { --cat: var(--mh-cat-teal); } .mh-cat--blue { --cat: var(--mh-cat-blue); } .mh-cat--indigo { --cat: var(--mh-cat-indigo); } .mh-cat--purple { --cat: var(--mh-cat-purple); } .mh-cat--pink { --cat: var(--mh-cat-pink); } .mh-cat--red { --cat: var(--mh-cat-red); } .mh-cat--orange { --cat: var(--mh-cat-orange); } .mh-cat--amber { --cat: var(--mh-cat-amber); } .mh-cat--brown { --cat: var(--mh-cat-brown); } .mh-cat--slate { --cat: var(--mh-cat-slate); }

/* 6. Forms ====================================================================================== */
.mh-form { max-width: 600px; }
.mh-field { display: block; margin-bottom: 18px; }
.mh-field > label, .mh-field-label { display: block; margin-bottom: 6px; font-weight: 600; font-size: var(--mh-fs-sm); }
.mh-field input:not([type="checkbox"], [type="radio"]), .mh-field select, .mh-field textarea { display: block; width: 100%; min-height: 46px; margin-top: 6px; padding: 10px 13px; border: 1px solid var(--mh-border-strong); border-radius: var(--mh-radius-sm); background: var(--mh-surface); color: var(--mh-text); font: inherit; transition: border-color .15s, box-shadow .15s; }
.mh-field > label + input, .mh-field > label + select, .mh-field > label + textarea, .mh-field > label + .mh-input-group { margin-top: 0; }
.mh-field input:hover, .mh-field select:hover { border-color: var(--mh-muted); }
.mh-field input:focus, .mh-field select:focus, .mh-field textarea:focus { border-color: var(--mh-primary); box-shadow: var(--mh-ring); outline: none; }
.mh-field input:focus-visible, .mh-field select:focus-visible { outline: none; }
.mh-field input[aria-invalid="true"], .mh-field select[aria-invalid="true"], .mh-field:has(.mh-error) input, .mh-field:has(.mh-error) select { border-color: var(--mh-danger); }
.mh-field input[type="file"] { padding: 8px; min-height: 0; }
.mh-help { display: block; margin-top: 6px; color: var(--mh-muted); font-size: var(--mh-fs-sm); }
.mh-field .mh-error { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: var(--mh-fs-sm); font-weight: 550; }
.mh-optional { color: var(--mh-subtle); font-weight: 500; }
.mh-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 16px; }
.mh-form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 8px; }
.mh-form-actions form { margin: 0; }
.mh-drawer .mh-form > .mh-form-actions:last-child { position: sticky; bottom: 0; margin: 8px -32px 0; padding: 14px 32px; background: var(--mh-surface); border-top: 1px solid var(--mh-border); }
/* Input with a prefix, like "R$" before amounts */
.mh-input-group { position: relative; display: flex; align-items: stretch; }
.mh-input-group .mh-input-prefix { position: absolute; left: 1px; top: 1px; bottom: 1px; display: flex; align-items: center; padding: 0 10px 0 13px; color: var(--mh-muted); font-weight: 600; font-size: var(--mh-fs-sm); pointer-events: none; }
.mh-field .mh-input-group input { margin-top: 0; padding-left: 44px; font-variant-numeric: tabular-nums; }
/* Password with a show/hide button */
.mh-password { position: relative; }
.mh-password input { padding-right: 48px !important; }
.mh-password button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.mh-check { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; cursor: pointer; }
.mh-check input { width: 18px; height: 18px; accent-color: var(--mh-primary); }
.mh-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.mh-fieldset > legend { margin-bottom: 8px; padding: 0; font-weight: 600; font-size: var(--mh-fs-sm); }
.mh-fieldset.mh-field { margin-bottom: 18px; }
/* Segmented control (radios or links) */
.mh-segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--mh-border); border-radius: calc(var(--mh-radius-sm) + 4px); background: var(--mh-surface-3); }
.mh-segmented label, .mh-segmented a { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: var(--mh-radius-sm); color: var(--mh-muted); font-weight: 600; font-size: var(--mh-fs-sm); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color .15s, color .15s; }
.mh-segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mh-segmented label:hover, .mh-segmented a:hover { color: var(--mh-text); }
.mh-segmented label:has(input:checked), .mh-segmented a[aria-current="page"] { background: var(--mh-surface); color: var(--mh-primary); box-shadow: var(--mh-shadow-sm); }
.mh-segmented label:has(input:focus-visible) { outline: 3px solid var(--mh-primary); outline-offset: 2px; }
.mh-segmented .mh-icon { width: 18px; height: 18px; }
.mh-segmented--3 { display: grid; grid-auto-columns: 1fr; width: 100%; margin-bottom: 22px; }
/* Pills (radio or checkbox chips) */
.mh-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.mh-pill { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--mh-border-strong); border-radius: var(--mh-radius-pill); background: var(--mh-surface); color: var(--mh-text); font-weight: 500; font-size: var(--mh-fs-sm); cursor: pointer; transition: border-color .15s, background-color .15s; }
.mh-pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mh-pill:hover { border-color: var(--mh-muted); }
.mh-pill:has(input:checked) { border-color: var(--mh-primary); background: var(--mh-primary-soft); color: var(--mh-primary); font-weight: 650; }
.mh-pill:has(input:checked)::before { content: ""; width: 14px; height: 14px; margin-left: -4px; background: currentColor; -webkit-mask: var(--mh-check-mask) center / contain no-repeat; mask: var(--mh-check-mask) center / contain no-repeat; }
.mh-pill:has(input:focus-visible) { outline: 3px solid var(--mh-primary); outline-offset: 2px; }
:root { --mh-check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); --mh-chevron-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E"); }

/* 7. Alerts and flash messages ================================================================== */
.mh-messages { max-width: 960px; margin: 16px auto 0; padding: 0 16px; display: grid; gap: 8px; }
.mh-message { display: flex; align-items: flex-start; gap: 12px; margin: 0; padding: 12px 14px; border-radius: var(--mh-radius); border: 1px solid color-mix(in srgb, var(--mh-success) 30%, transparent); background: var(--mh-success-soft); color: var(--mh-text); box-shadow: var(--mh-shadow-sm); animation: mh-fade-in .25s ease-out; }
.mh-message > .mh-icon { margin-top: 1px; color: var(--mh-success); }
.mh-message-text { flex: 1; margin: 0; font-weight: 500; }
.mh-message p { margin: 0; }
.mh-message .mh-icon-btn { width: 28px; height: 28px; margin: -3px -4px -3px 0; }
.mh-message--error { border-color: color-mix(in srgb, var(--mh-danger) 35%, transparent); background: var(--mh-danger-soft); }
.mh-message--error > .mh-icon { color: var(--mh-danger); }
.mh-message--warning { border-color: color-mix(in srgb, var(--mh-warning) 35%, transparent); background: var(--mh-warning-soft); }
.mh-message--warning > .mh-icon { color: var(--mh-warning); }
.mh-message--info { border-color: color-mix(in srgb, var(--mh-info) 30%, transparent); background: var(--mh-info-soft); }
.mh-message--info > .mh-icon { color: var(--mh-info); }
.mh-message.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity .2s, transform .2s; }
@keyframes mh-fade-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
/* Inline notice inside cards and forms */
.mh-notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--mh-radius); background: var(--mh-info-soft); color: var(--mh-text); font-size: var(--mh-fs-sm); }
.mh-notice > .mh-icon { color: var(--mh-info); margin-top: 1px; }
.mh-notice p { margin: 0; }
.mh-notice--warning { background: var(--mh-warning-soft); }
.mh-notice--warning > .mh-icon { color: var(--mh-warning); }

/* 8. Panel shell: sidebar on wide screens, drawer menu and tab bar on phones (static/js/panel.js) = */
.mh-skip { position: absolute; left: 16px; top: -48px; z-index: 30; padding: 8px 16px; background: var(--mh-surface); color: var(--mh-text); border-radius: var(--mh-radius-sm); box-shadow: var(--mh-shadow); }
.mh-skip:focus { top: 8px; }
.mh-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 264px minmax(0, 1fr); grid-template-areas: "nav main"; }
.mh-appbar { display: none; }
.mh-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--mh-text); font-weight: 750; font-size: 1.05rem; letter-spacing: -.01em; text-decoration: none; }
.mh-symbol { flex: none; }
.mh-brand .mh-symbol { width: 34px; height: 34px; }
/* Wordmark: "money" light, "health" bold in Verde Vital (Verde Broto on dark backgrounds). */
.mh-wordmark { font-family: var(--mh-font-display); font-size: 1.3rem; letter-spacing: -.035em; line-height: 1; color: var(--mh-text); }
.mh-wordmark span { font-weight: 300; }
.mh-wordmark strong { font-weight: 700; color: var(--mh-verde-vital); }
:root[data-theme="dark"] .mh-wordmark strong, .mh-auth-aside .mh-wordmark strong { color: var(--mh-verde-broto); }
.mh-brand-endorse { display: block; margin-top: 2px; font-size: var(--mh-fs-xs); color: var(--mh-subtle); letter-spacing: 0; }
.mh-sidebar { grid-area: nav; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; background: var(--mh-surface); border-right: 1px solid var(--mh-border); }
.mh-sidebar-brand { padding: 4px 10px; }
.mh-sidebar-cta { width: 100%; }
.mh-space-name, .mh-space-switcher { margin: 0; padding: 10px 12px; background: var(--mh-surface-2); border: 1px solid var(--mh-border); border-radius: var(--mh-radius); }
.mh-space-name, .mh-space-switcher summary { display: flex; align-items: center; gap: 10px; }
.mh-space-name > span:last-child, .mh-space-switcher summary > span:last-of-type { min-width: 0; }
.mh-space-label { display: block; font-size: var(--mh-fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--mh-muted); }
.mh-space-name strong, .mh-space-switcher summary strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-space-switcher summary { cursor: pointer; list-style: none; }
.mh-space-switcher summary::-webkit-details-marker { display: none; }
.mh-space-switcher summary .mh-caret { margin-left: auto; color: var(--mh-muted); transition: transform .15s; }
.mh-space-switcher[open] summary .mh-caret { transform: rotate(90deg); }
.mh-space-switcher ul { list-style: none; margin: 8px 0 0; padding: 0; }
.mh-space-switcher button { width: 100%; text-align: left; padding: 8px; background: none; border: 0; border-radius: var(--mh-radius-sm); color: var(--mh-text); font: inherit; cursor: pointer; }
.mh-space-switcher button:hover:not(:disabled) { background: var(--mh-bg); }
.mh-space-switcher button:disabled { font-weight: 650; cursor: default; color: var(--mh-primary); }
.mh-nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mh-nav-group + .mh-nav-group { margin-top: 14px; }
.mh-nav-label { margin: 0 0 6px; padding: 0 12px; font-size: var(--mh-fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--mh-subtle); }
.mh-nav a, .mh-nav button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--mh-radius-sm); background: none; color: var(--mh-muted); font: inherit; font-size: .95rem; font-weight: 550; text-align: left; text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s; }
.mh-nav a:hover, .mh-nav button:hover { background: var(--mh-surface-3); color: var(--mh-text); }
.mh-nav a[aria-current="page"] { background: var(--mh-primary-soft); color: var(--mh-primary); font-weight: 650; }
.mh-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--mh-primary); }
.mh-nav form { margin: 0; }
.mh-sidebar-footer { margin-top: auto; display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--mh-border); }
.mh-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; min-width: 0; border-radius: var(--mh-radius); color: var(--mh-text); text-decoration: none; transition: background-color .15s; }
.mh-user:hover { background: var(--mh-surface-3); }
.mh-user[aria-current="page"] { background: var(--mh-primary-soft); }
.mh-user .mh-caret { margin-left: auto; color: var(--mh-subtle); }
.mh-user-text { min-width: 0; font-size: var(--mh-fs-sm); line-height: 1.3; }
.mh-user-text strong, .mh-user-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--mh-primary-soft); color: var(--mh-primary); font-weight: 750; text-transform: uppercase; }
.mh-avatar--img { object-fit: cover; background: var(--mh-border); }
.mh-avatar--lg { width: 56px; height: 56px; font-size: 1.3rem; }
.mh-avatar--xl { width: 96px; height: 96px; font-size: 2.2rem; box-shadow: 0 0 0 4px var(--mh-surface), var(--mh-shadow); }
.mh-main { grid-area: main; min-width: 0; width: 100%; max-width: 1600px; padding: 32px 40px 64px; }
.mh-main:focus { outline: none; }
.mh-main .mh-messages { margin: 0 0 20px; padding: 0; max-width: none; }
.mh-page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px 16px; margin-bottom: 26px; }
.mh-page-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mh-page-title > div { min-width: 0; }
.mh-page-head h1 { margin: 0; }
.mh-page-head p { margin: 4px 0 0; }
.mh-page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mh-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; color: var(--mh-muted); text-decoration: none; font-weight: 550; font-size: var(--mh-fs-sm); }
.mh-back:hover { color: var(--mh-text); }
.mh-tabbar, .mh-appbar-user { display: none; }

@media (max-width: 899px) {
  :root { --mh-appbar-h: 56px; --mh-tabbar-h: 64px; }
  .mh-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "bar" "main"; }
  .mh-appbar { grid-area: bar; display: flex; align-items: center; gap: 8px; height: calc(var(--mh-appbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0; background: color-mix(in srgb, var(--mh-surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--mh-border); position: sticky; top: 0; z-index: 15; }
  .mh-appbar .mh-brand { font-size: 1rem; }
  .mh-appbar .mh-brand .mh-symbol { width: 30px; height: 30px; }
  .mh-appbar .mh-wordmark { font-size: 1.15rem; }
  .mh-appbar-user { display: inline-flex; margin-left: auto; border-radius: 50%; text-decoration: none; }
  .mh-sidebar { position: static; height: auto; grid-area: main; border-right: 0; border-bottom: 1px solid var(--mh-border); }
  .mh-sidebar-brand { display: none; }
  .mh-nav a[aria-current="page"]::before { display: none; }
  .js .mh-sidebar { display: none; position: fixed; top: calc(var(--mh-appbar-h) + env(safe-area-inset-top)); right: 0; bottom: 0; left: 0; z-index: 16; height: auto; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
  .js .mh-sidebar.is-open { display: flex; }
  html:not(.js) .mh-shell { grid-template-rows: auto auto 1fr; grid-template-areas: "bar" "nav" "main"; }
  html:not(.js) .mh-sidebar { grid-area: nav; }
  html:not(.js) .mh-menu-btn { display: none; }
  .mh-main { padding: 20px 16px calc(var(--mh-tabbar-h) + 36px + env(safe-area-inset-bottom)); }
  h1 { font-size: var(--mh-fs-xl); }
  .mh-tabbar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 14; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: stretch; height: calc(var(--mh-tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--mh-surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--mh-border); box-shadow: 0 -2px 12px rgb(0 0 0 / 5%); }
  .mh-tabbar a, .mh-tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 0; background: none; border: 0; color: var(--mh-muted); font: inherit; font-size: .7rem; font-weight: 650; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mh-tabbar .mh-icon { width: 24px; height: 24px; }
  .mh-tabbar a[aria-current="page"] { color: var(--mh-primary); }
  .mh-tabbar a[aria-current="page"] .mh-icon { stroke-width: 2.2; }
  .mh-tabbar .mh-tabbar-fab span:first-child { display: inline-flex; align-items: center; justify-content: center; width: 50px; height: 50px; margin-top: -22px; border-radius: 50%; background: var(--mh-primary); color: var(--mh-primary-text); box-shadow: 0 0 0 4px var(--mh-surface), var(--mh-shadow-md); }
  .mh-tabbar .mh-tabbar-fab .mh-icon { width: 26px; height: 26px; stroke-width: 2.2; }
  .mh-page-head .mh-btn { min-height: 40px; padding: 8px 14px; }
  .mh-page-head .mh-page-title .mh-chip { display: none; }
  .mh-card { padding: 18px; border-radius: var(--mh-radius); }
}

/* 9. Summaries, lists and amounts =============================================================== */
.mh-summaries { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 28px; }
.mh-summaries .mh-amount--big { font-size: clamp(1.5rem, 2.1vw, var(--mh-fs-3xl)); }
.mh-summaries--fill { display: flex; flex-wrap: wrap; }
.mh-summaries--fill > .mh-tile { flex: 1 1 210px; } /* each row stretches: no empty slot */
.mh-worth-split { font-size: var(--mh-fs-sm); }
.mh-summaries--3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.mh-tile { display: grid; gap: 6px; align-content: start; }
.mh-tile p { margin: 0; }
.mh-tile-head { display: flex; align-items: center; gap: 12px; }
.mh-tile-title { margin: 0; font-size: var(--mh-fs-sm); font-weight: 600; color: var(--mh-muted); }
.mh-tile-link { margin-top: 6px !important; font-weight: 650; font-size: var(--mh-fs-sm); }
.mh-tile-link a { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.mh-tile-link a:hover { text-decoration: underline; }
.mh-tile-link .mh-icon { width: 16px; height: 16px; }
.mh-amount { margin: 0; font-family: var(--mh-font-display); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; letter-spacing: -.02em; }
.mh-amount--big { font-size: var(--mh-fs-3xl); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }
.mh-amount--negative { color: var(--mh-danger); }
.mh-amount--positive { color: var(--mh-income); }
.mh-meter { height: 8px; border-radius: var(--mh-radius-pill); background: var(--mh-surface-3); overflow: hidden; }
.mh-meter span { display: block; height: 100%; border-radius: inherit; background: var(--mh-primary); transition: width .4s ease-out; }
.mh-meter--lg { height: 10px; }
.mh-list { list-style: none; margin: 0; padding: 0; background: var(--mh-surface); border: 1px solid var(--mh-border); border-radius: var(--mh-radius-lg); box-shadow: var(--mh-shadow); overflow: hidden; }
.mh-list-item { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; transition: background-color .15s; }
.mh-list-item + .mh-list-item { border-top: 1px solid var(--mh-border); }
.mh-list-item:has(a.mh-list-title):hover { background: var(--mh-surface-2); }
/* Clickable rows get a chevron (rows with actions keep their buttons instead). */
.mh-list-item:has(> .mh-list-main a.mh-list-title):not(:has(.mh-list-actions))::after { content: ""; flex: none; width: 18px; height: 18px; margin-left: -6px; background: var(--mh-subtle); -webkit-mask: var(--mh-chevron-mask) center / contain no-repeat; mask: var(--mh-chevron-mask) center / contain no-repeat; }
.mh-list-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mh-list-main > div { min-width: 0; }
.mh-list-title { font-weight: 650; color: var(--mh-text); }
a.mh-list-title { text-decoration: none; }
a.mh-list-title::after { content: ""; position: absolute; inset: 0; }
a.mh-list-title:focus-visible { outline: none; }
a.mh-list-title:focus-visible::after { outline: 3px solid var(--mh-primary); outline-offset: -3px; border-radius: var(--mh-radius-sm); }
.mh-list-meta { margin: 2px 0 0; font-size: var(--mh-fs-sm); }
.mh-list-figure, .mh-list-item > .mh-amount { margin-left: auto; text-align: right; }
.mh-list-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; }
.mh-list-actions form { margin: 0; }
.mh-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 52px 24px; }
.mh-empty h2, .mh-empty h3 { margin: 10px 0 0; }
.mh-empty p { max-width: 48ch; margin: 0 0 10px; }
.mh-empty .mh-chip { width: 60px; height: 60px; border-radius: 18px; }
.mh-empty .mh-chip .mh-icon { width: 28px; height: 28px; }
/* Investments -------------------------------------------------------------------------------- */
.mh-alloc--stocks { --alloc: var(--mh-cat-blue); }
.mh-alloc--fiis { --alloc: var(--mh-cat-teal); }
.mh-alloc--etfs { --alloc: var(--mh-cat-purple); }
.mh-alloc--fixed_income { --alloc: var(--mh-cat-green); }
.mh-alloc--crypto { --alloc: var(--mh-cat-amber); }
.mh-portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.mh-portfolio-card { display: grid; gap: 6px; align-content: start; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.mh-portfolio-card:hover { border-color: var(--mh-primary); }
.mh-portfolio-card:focus-visible { outline: 3px solid var(--mh-primary); outline-offset: 2px; }
.mh-portfolio-card .mh-card-head { margin-bottom: 6px; }
.mh-portfolio-card h2 { font-size: var(--mh-fs-lg); }
.mh-portfolio-card p { margin: 0; }
.mh-portfolio-result { font-weight: 650; font-size: var(--mh-fs-sm); }
.mh-alloc-bar { display: flex; height: 8px; margin-top: 10px; border-radius: var(--mh-radius-pill); overflow: hidden; background: var(--mh-surface-3); }
.mh-alloc-bar span { background: var(--alloc); }
.mh-alloc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--mh-fs-xs); }
.mh-alloc-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mh-alloc-legend i, .mh-alloc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--alloc); }
.mh-alloc-dot { margin-right: 7px; vertical-align: 1px; }
.mh-alloc-meter { position: relative; overflow: visible; margin: 8px 0 6px; }
.mh-alloc-meter span { background: var(--alloc); }
.mh-alloc-meter b { position: absolute; top: -4px; width: 2px; height: 16px; margin-left: -1px; border-radius: 1px; background: var(--mh-text); }
.mh-alloc-list .mh-compact-text strong { white-space: normal; }
.mh-section-card + .mh-section-card { margin-top: 20px; }
.mh-section-card { padding: 20px; }
.mh-alloc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 24px; margin: 0; }
.mh-compact.mh-alloc-list li + li { border-top: 0; }
.mh-bench { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 0; padding: 0; }
.mh-bench li { display: grid; gap: 2px; }
.mh-bench span { font-size: var(--mh-fs-xs); color: var(--mh-muted); font-weight: 600; }
.mh-bench strong { font-family: var(--mh-font-display, inherit); font-size: var(--mh-fs-lg); }
.mh-bench-since { font-size: var(--mh-fs-xs); }
.mh-table-wrap { overflow-x: auto; }
.mh-table { width: 100%; border-collapse: collapse; font-size: var(--mh-fs-sm); }
.mh-table th, .mh-table td { padding: 10px 8px; text-align: left; border-top: 1px solid var(--mh-border); vertical-align: top; white-space: nowrap; }
.mh-table thead th { border-top: 0; color: var(--mh-muted); font-size: var(--mh-fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.mh-table tbody th { font-weight: 400; }
.mh-table tbody th a { text-decoration: none; }
.mh-table tbody th span, .mh-table td span { display: block; font-size: var(--mh-fs-xs); }
.mh-table .mh-num { text-align: right; font-variant-numeric: tabular-nums; }
.mh-target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.mh-chart { margin: 4px 0 0; }
.mh-chart svg { display: block; width: 100%; height: 180px; overflow: visible; }
.mh-chart polyline { stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.mh-chart-up { stroke: var(--mh-income); }
.mh-chart-down { stroke: var(--mh-danger); }
.mh-chart figcaption { margin-top: 8px; font-size: var(--mh-fs-xs); }
.mh-asset-price p { margin: 0 0 6px; }
.mh-asset-logo { width: 56px; height: 56px; border-radius: 16px; }
.mh-disclaimer { margin: 28px 0 0; font-size: var(--mh-fs-xs); color: var(--mh-muted); }
.mh-op-delete { margin-top: 12px; }
/* Mastermind and method verdicts */
.mh-verdict { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--mh-surface-3); box-shadow: inset 0 0 0 1px var(--mh-border); }
.mh-verdict--within { background: var(--mh-success); box-shadow: none; }
.mh-verdict--neutral { background: var(--mh-warning); box-shadow: none; }
.mh-verdict--outside { background: var(--mh-danger); box-shadow: none; }
.mh-mind { list-style: none; margin: 0 -8px; padding: 0; }
.mh-mind > li + li { border-top: 1px solid var(--mh-border); }
.mh-mind summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 8px; cursor: pointer; list-style: none; border-radius: var(--mh-radius-sm); }
.mh-mind summary::-webkit-details-marker { display: none; }
.mh-mind summary:hover { background: var(--mh-surface-2); }
.mh-mind summary:focus-visible { outline: 3px solid var(--mh-primary); outline-offset: -3px; }
.mh-mind summary strong { min-width: 70px; }
.mh-mind summary > .mh-icon { margin-left: auto; width: 18px; height: 18px; color: var(--mh-subtle); transition: transform .15s; }
.mh-mind details[open] summary > .mh-icon { transform: rotate(90deg); }
.mh-mind-chips { display: inline-flex; gap: 4px; }
.mh-mind-text { font-size: var(--mh-fs-sm); }
.mh-mind .mh-compact { margin: 0 0 8px; padding-left: 8px; }
.mh-mind .mh-compact li { align-items: flex-start; }
.mh-mind .mh-compact-text strong, .mh-alloc-list .mh-compact-text span { white-space: normal; }
.mh-compact .mh-status { flex: none; min-width: 74px; justify-content: center; }
.mh-method-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 24px; margin: 0; }
.mh-method-list li { flex-direction: column; align-items: flex-start; gap: 6px; }
.mh-compact.mh-method-list li + li { border-top: 0; }
.mh-method-list .mh-status { align-self: flex-start; }
.mh-method-list .mh-compact-text strong, .mh-method-list .mh-compact-text span { white-space: normal; }
.mh-mind-note { margin: 10px 0 0; font-size: var(--mh-fs-xs); }
.mh-inline-form .mh-input-group { flex: 1 1 160px; }
.mh-inline-form .mh-input-group input { width: 100%; padding-left: 40px; }
.mh-review-text p { margin: 0 0 10px; max-width: 75ch; }
.mh-review-text p:first-line { font-weight: 650; }
.mh-review-wait { display: flex; align-items: center; gap: 10px; margin: 0; }
.mh-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--mh-border); border-top-color: var(--mh-primary); animation: mh-spin .8s linear infinite; }
@keyframes mh-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .mh-spinner { animation-duration: 3s; } }
.mh-review form { margin-top: 12px; }

/* Operation form: each field shows only for the kinds it applies to. */
.mh-op-form .mh-field[data-kinds] { display: none; }
.mh-op-form:has(select[name="kind"] option[value="buy"]:checked) .mh-field[data-kinds~="buy"],
.mh-op-form:has(select[name="kind"] option[value="sell"]:checked) .mh-field[data-kinds~="sell"],
.mh-op-form:has(select[name="kind"] option[value="dividend"]:checked) .mh-field[data-kinds~="dividend"],
.mh-op-form:has(select[name="kind"] option[value="jcp"]:checked) .mh-field[data-kinds~="jcp"],
.mh-op-form:has(select[name="kind"] option[value="income"]:checked) .mh-field[data-kinds~="income"],
.mh-op-form:has(select[name="kind"] option[value="split"]:checked) .mh-field[data-kinds~="split"],
.mh-op-form:has(select[name="kind"] option[value="reverse_split"]:checked) .mh-field[data-kinds~="reverse_split"],
.mh-op-form:has(select[name="kind"] option[value="bonus"]:checked) .mh-field[data-kinds~="bonus"] { display: block; }
@media (max-width: 599px) {
  .mh-bench strong { font-size: var(--mh-fs-md, 1rem); }
  .mh-table-wrap { margin: 0 -14px; padding: 0 14px; }
}

/* Legal pages */
.mh-legal-wrap { width: min(100% - 32px, 760px); margin-inline: auto; }
.mh-legal-header { border-bottom: 1px solid var(--mh-border); background: var(--mh-surface); }
.mh-legal-header .mh-legal-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 0; }
.mh-legal-header nav { display: flex; flex-wrap: wrap; gap: 16px; font-weight: 600; font-size: var(--mh-fs-sm); }
.mh-legal-header nav a { text-decoration: none; color: var(--mh-muted); }
.mh-legal-header nav a[aria-current="page"] { color: var(--mh-primary); }
.mh-legal { padding: 40px 0 24px; line-height: 1.65; }
.mh-legal h1 { margin: 0 0 16px; font-family: var(--mh-font-display); font-size: var(--mh-fs-3xl); }
.mh-legal h2 { margin: 32px 0 8px; font-family: var(--mh-font-display); font-size: var(--mh-fs-xl); }
.mh-legal li { margin-bottom: 8px; }
.mh-legal-meta { margin-top: 40px; font-size: var(--mh-fs-sm); color: var(--mh-muted); }
.mh-legal-footer { padding: 24px 0 40px; font-size: var(--mh-fs-xs); color: var(--mh-muted); }
.mh-auth-legal { margin-top: 24px; font-size: var(--mh-fs-xs); color: var(--mh-muted); text-align: center; }
.mh-auth-legal a { color: inherit; }
.mh-forgot { margin: 6px 0 0; text-align: right; }

/* WhatsApp */
.mh-wa-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 20px; padding: 12px 16px; border: 1px solid var(--mh-border); border-radius: var(--mh-radius-lg); background: var(--mh-primary-soft); }
.mh-wa-banner p { flex: 1; margin: 0; font-size: var(--mh-fs-sm); font-weight: 600; }
.mh-wa-confirm { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--mh-border); }
.mh-wa-confirm h3 { margin: 0 0 6px; font-size: var(--mh-fs-md); }
.mh-wa-code { display: inline-block; margin: 4px 0 12px; padding: 8px 14px; border-radius: var(--mh-radius-sm); background: var(--mh-surface-3); font-family: ui-monospace, monospace; font-size: var(--mh-fs-lg); font-weight: 700; letter-spacing: .08em; user-select: all; }
.mh-wa-groups { list-style: none; margin: 0 0 12px; padding: 0; }
.mh-steps + form, .mh-wa-confirm form { margin-top: 16px; }
@media (max-width: 599px) { .mh-wa-banner { flex-wrap: wrap; } }

/* Savings pockets, folded under the account that keeps them. */
.mh-pocket-group { border-top: 1px solid var(--mh-border); background: var(--mh-surface-2); }
.mh-pocket-group summary { display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 72px; cursor: pointer; list-style: none; font-size: var(--mh-fs-sm); }
.mh-pocket-group summary::-webkit-details-marker { display: none; }
.mh-pocket-group summary:focus-visible { outline: 3px solid var(--mh-primary); outline-offset: -3px; }
.mh-pocket-group summary > .mh-icon { margin-left: auto; width: 18px; height: 18px; color: var(--mh-subtle); transition: transform .15s; }
.mh-pocket-group details[open] summary > .mh-icon { transform: rotate(90deg); }
.mh-pocket-sum-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--mh-text); }
.mh-pocket-sum-label .mh-icon { width: 18px; height: 18px; color: var(--mh-warning); }
.mh-pockets { list-style: none; margin: 0; padding: 0 0 6px 54px; }
.mh-pockets .mh-list-item { padding: 10px 18px; border-top: 1px solid var(--mh-border); }
.mh-pockets .mh-list-item:hover { background: var(--mh-surface); }
.mh-pocket-amount { margin-left: auto; }
.mh-pocket-add a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; font-weight: 650; font-size: var(--mh-fs-sm); text-decoration: none; }
.mh-pocket-add .mh-icon { width: 16px; height: 16px; }
.mh-form-intro { margin: -6px 0 16px; }
@media (max-width: 599px) {
  .mh-pocket-group summary { padding-left: 18px; flex-wrap: wrap; row-gap: 2px; }
  .mh-pocket-sum-total { order: 3; flex-basis: 100%; }
  .mh-pockets { padding-left: 0; }
  .mh-pockets .mh-list-item { flex-wrap: wrap; }
  .mh-pockets .mh-list-main { flex: 1 1 0; }
  .mh-pockets .mh-list-actions { flex-basis: 100%; }
}
.mh-archived { margin-top: 24px; }
.mh-archived summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 12px; color: var(--mh-muted); font-weight: 600; font-size: var(--mh-fs-sm); }
.mh-archived summary .mh-icon { width: 18px; height: 18px; }
.mh-danger-zone .mh-card-head .mh-chip { background: var(--mh-danger-soft); color: var(--mh-danger); }
.mh-danger-zone h2 { margin-top: 0; font-size: var(--mh-fs-md); }
@media (max-width: 599px) {
  .mh-list-item { padding: 12px 14px; gap: 12px; }
  .mh-list-main .mh-chip:not(.mh-cat), .mh-list-main .mh-badge { width: 34px; height: 34px; }
  .mh-amount--big { font-size: var(--mh-fs-2xl); }
}

/* 10. Side drawer for forms: opens from the right over half the screen (full width on phones) == */
.mh-drawer { position: fixed; inset: 0 0 0 auto; margin: 0; width: max(50vw, 480px); max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; padding: 0; border: 0; border-left: 1px solid var(--mh-border); background: var(--mh-surface); color: var(--mh-text); box-shadow: var(--mh-shadow-lg); }
.mh-drawer::backdrop { background: var(--mh-overlay); backdrop-filter: blur(2px); }
.mh-drawer[open] { animation: mh-drawer-in .24s cubic-bezier(.2, .8, .2, 1); }
@keyframes mh-drawer-in { from { transform: translateX(100%); } to { transform: none; } }
.mh-drawer-body { height: 100%; overflow-y: auto; padding: 0 32px 40px; padding-bottom: max(40px, env(safe-area-inset-bottom)); }
.mh-drawer-bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; margin: 0 -32px 4px; padding: 10px 20px; background: var(--mh-surface); }
.mh-drawer .mh-page-head { margin-bottom: 20px; }
.mh-drawer .mh-card { padding: 0; border: 0; box-shadow: none; border-radius: 0; }
.mh-drawer .mh-form { max-width: none; }
.mh-drawer .mh-danger-zone { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--mh-border); }
.mh-drawer-loading .mh-drawer-body { opacity: .6; pointer-events: none; }
@media (max-width: 899px) {
  .mh-drawer { width: 100vw; border-left: 0; }
  .mh-drawer-body { padding: 0 16px 32px; }
  .mh-drawer-bar { margin: 0 -16px 4px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; }
  .mh-drawer .mh-form > .mh-form-actions:last-child { margin: 8px -16px 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .mh-drawer[open], .mh-message { animation: none; }
  * { transition: none !important; }
}

/* 11. Tabs, toolbar, filters ==================================================================== */
.mh-tabs { display: flex; gap: 4px; margin: -8px 0 22px; border-bottom: 1px solid var(--mh-border); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.mh-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--mh-muted); font-weight: 550; text-decoration: none; white-space: nowrap; }
.mh-tabs a .mh-icon { width: 18px; height: 18px; }
.mh-tabs a:hover { color: var(--mh-text); }
.mh-tabs a[aria-current="page"] { color: var(--mh-primary); border-bottom-color: var(--mh-primary); font-weight: 650; }
.mh-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin: -4px 0 20px; }
.mh-month { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--mh-border); border-radius: calc(var(--mh-radius-sm) + 4px); background: var(--mh-surface); }
.mh-month strong { min-width: 150px; text-align: center; font-size: var(--mh-fs-md); }
.mh-month .mh-icon-btn { width: 36px; height: 36px; }
.mh-scope .mh-icon { width: 18px; height: 18px; }
.mh-filters { margin-bottom: 20px; }
.mh-filters summary { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 6px 14px; border: 1px solid var(--mh-border); border-radius: var(--mh-radius-pill); background: var(--mh-surface); cursor: pointer; color: var(--mh-muted); font-weight: 600; font-size: var(--mh-fs-sm); list-style: none; }
.mh-filters summary::-webkit-details-marker { display: none; }
.mh-filters[open] summary, .mh-filters summary:hover { color: var(--mh-text); border-color: var(--mh-border-strong); }
.mh-filters summary .mh-icon { width: 18px; height: 18px; }
.mh-filters-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; gap: 12px 16px; margin-top: 12px; padding: 16px; background: var(--mh-surface); border: 1px solid var(--mh-border); border-radius: var(--mh-radius); box-shadow: var(--mh-shadow-sm); }
.mh-filters-form label { display: grid; gap: 6px; font-size: var(--mh-fs-sm); font-weight: 600; }
.mh-filters-form select { min-height: 42px; padding: 8px 10px; border: 1px solid var(--mh-border-strong); border-radius: var(--mh-radius-sm); background: var(--mh-surface); color: var(--mh-text); font: inherit; font-weight: 400; }
.mh-filters-form .mh-form-actions { margin: 0; }
@media (max-width: 599px) {
  .mh-toolbar { flex-direction: column; align-items: stretch; }
  .mh-month { justify-content: space-between; }
  .mh-scope { width: 100%; }
}

/* 12. Pickers =================================================================================== */
.mh-picker { margin: 0; padding: 0; border: 0; min-width: 0; }
.mh-picker legend { margin-bottom: 8px; padding: 0; font-weight: 600; font-size: var(--mh-fs-sm); }
.mh-picker-search { display: block; width: 100%; min-height: 42px; margin-bottom: 10px; padding: 9px 12px 9px 38px; border: 1px solid var(--mh-border-strong); border-radius: var(--mh-radius-sm); background: var(--mh-surface) no-repeat 12px center / 18px; color: var(--mh-text); font: inherit; }
.mh-picker-search:focus { border-color: var(--mh-primary); box-shadow: var(--mh-ring); outline: none; }
.mh-picker-search-wrap { position: relative; }
.mh-picker-search-wrap > .mh-icon { position: absolute; left: 12px; top: 12px; width: 18px; height: 18px; color: var(--mh-muted); pointer-events: none; }
.mh-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; padding: 2px; }
.mh-picker-option { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--mh-border); border-radius: var(--mh-radius); background: var(--mh-surface); cursor: pointer; text-align: center; transition: border-color .15s, background-color .15s; }
.mh-picker-option:hover { border-color: var(--mh-muted); background: var(--mh-surface-2); }
.mh-picker-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mh-picker-option:has(input:checked) { border-color: var(--mh-primary); background: var(--mh-primary-soft); box-shadow: inset 0 0 0 1px var(--mh-primary); }
.mh-picker-option:has(input:focus-visible) { outline: 3px solid var(--mh-primary); outline-offset: 2px; }
.mh-picker-label { font-size: .8rem; font-weight: 600; line-height: 1.2; color: var(--mh-text); overflow-wrap: anywhere; }
.mh-picker--compact .mh-picker-grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); max-height: none; }
.mh-picker--compact .mh-picker-option { padding: 6px; }
.mh-picker[aria-invalid="true"] .mh-picker-grid { outline: 1px solid var(--mh-danger); border-radius: var(--mh-radius-sm); }
/* "Other" fields appear only when "other" is chosen; without :has support they always show. */
@supports selector(:has(*)) {
  .mh-field[data-other-of] { display: none; }
  form:has(input[name="institution_code"][value="other"]:checked) .mh-field[data-other-of="institution_code"],
  form:has(input[name="network"][value="other"]:checked) .mh-field[data-other-of="network"] { display: block; }
}

/* 13. Account pages: profile, security, two-factor ============================================== */
.mh-profile-hero { position: relative; display: flex; align-items: center; gap: 20px; padding: 24px; margin-bottom: 22px; overflow: hidden; background: linear-gradient(135deg, var(--mh-primary-soft), var(--mh-surface) 70%); }
.mh-profile-hero h1 { margin: 0; font-size: var(--mh-fs-xl); }
.mh-profile-hero p { margin: 2px 0 0; }
.mh-profile-hero .mh-status { margin-top: 8px; }
.mh-avatar-edit { position: relative; flex: none; }
.mh-avatar-edit .mh-avatar-camera { position: absolute; right: -2px; bottom: -2px; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--mh-primary); color: var(--mh-primary-text); box-shadow: 0 0 0 3px var(--mh-surface); cursor: pointer; }
.mh-avatar-edit .mh-avatar-camera .mh-icon { width: 17px; height: 17px; }
.mh-avatar-edit input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mh-avatar-edit:has(input:focus-visible) .mh-avatar-camera { outline: 3px solid var(--mh-primary); outline-offset: 2px; }
.mh-settings-grid { display: grid; gap: 16px; }
.mh-settings-grid .mh-form { max-width: none; }
.mh-setting { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.mh-setting + .mh-setting { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--mh-border); }
.mh-setting-text { flex: 1 1 260px; min-width: 0; }
.mh-setting-text h3 { margin: 0; font-size: var(--mh-fs-md); }
.mh-setting-text p { margin: 4px 0 0; color: var(--mh-muted); font-size: var(--mh-fs-sm); }
.mh-qr { display: inline-block; padding: 10px; background: var(--mh-qr-bg); border: 1px solid var(--mh-border); border-radius: var(--mh-radius); line-height: 0; }
.mh-qr svg { width: 200px; height: 200px; }
.mh-qr svg path { fill: var(--mh-qr-fg); }
.mh-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; list-style: none; padding: 16px; margin: 16px 0; background: var(--mh-surface-2); border: 1px dashed var(--mh-border-strong); border-radius: var(--mh-radius); }
.mh-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 22px; }
.mh-steps > li { position: relative; padding-left: 44px; counter-increment: step; }
.mh-steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--mh-primary-soft); color: var(--mh-primary); font-weight: 750; font-size: var(--mh-fs-sm); }
.mh-steps p { margin: 0 0 10px; }

/* 14. Sign-in, sign-up, invitations and other standalone pages ================================== */
.mh-auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.mh-auth-aside { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 44px 52px; overflow: hidden; background: var(--mh-floresta); color: var(--mh-nevoa); isolation: isolate; }
/* The brand's pulse line crossing the dark panel, as in the presentation cover. */
.mh-auth-aside::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 400' preserveAspectRatio='none'%3E%3Cpath d='M0 300H190L220 230L250 330L285 150L340 260L410 120H600' fill='none' stroke='%23F3F6F1' stroke-opacity='.07' stroke-width='14' stroke-linejoin='round'/%3E%3C/svg%3E") center 55% / 100% 60% no-repeat; }
:root[data-theme="dark"] .mh-auth-aside { background-color: #061c19; }
.mh-auth-aside .mh-brand, .mh-auth-aside .mh-wordmark { color: var(--mh-nevoa); }
.mh-auth-pitch .mh-eyebrow { color: var(--mh-verde-broto); }
.mh-auth-pitch h2 { margin: 0 0 14px; font-size: clamp(1.6rem, 2.6vw, 2.2rem); line-height: 1.15; letter-spacing: -.02em; max-width: 18ch; }
.mh-auth-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mh-auth-pitch li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.mh-auth-pitch li .mh-icon { flex: none; padding: 7px; width: 34px; height: 34px; border-radius: 10px; background: rgb(61 220 151 / 14%); color: var(--mh-verde-broto); }
.mh-auth-pitch h2 { font-size: clamp(2rem, 3.4vw, var(--mh-fs-display)); font-weight: 600; letter-spacing: -.03em; max-width: 14ch; color: var(--mh-nevoa); }
.mh-auth-pitch p { max-width: 42ch; color: #b9cdc5; margin: 0 0 22px; }
.mh-auth-pitch li { color: #dfe9e4; }
.mh-auth-foot { margin: 0; font-size: var(--mh-fs-sm); color: #9fb6ad; }
.mh-auth-foot strong { color: var(--mh-nevoa); }
.mh-auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; }
.mh-auth-card { width: 100%; max-width: 420px; }
.mh-auth-card > .mh-chip { margin-bottom: 8px; }
.mh-auth-card h1 { margin: 0 0 6px; font-size: var(--mh-fs-2xl); }
.mh-auth-card > p { margin: 0 0 24px; }
.mh-auth-card .mh-btn-block { min-height: 48px; font-size: var(--mh-fs-md); margin-top: 6px; }
.mh-auth-alt { margin: 22px 0 0; text-align: center; color: var(--mh-muted); font-size: var(--mh-fs-sm); }
.mh-auth-alt a { font-weight: 650; }
.mh-auth-mobile-brand { display: none; margin-bottom: 28px; }
.mh-auth .mh-messages { margin: 0 0 18px; padding: 0; max-width: 420px; width: 100%; }
@media (max-width: 899px) {
  .mh-auth { grid-template-columns: 1fr; }
  .mh-auth-aside { display: none; }
  .mh-auth-main { justify-content: flex-start; padding-top: max(40px, env(safe-area-inset-top)); }
  .mh-auth-mobile-brand { display: inline-flex; }
}

/* 15. Categories ================================================================================ */
.mh-listbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 16px; }
.mh-listbar-actions { display: flex; gap: 4px; }
.mh-search { position: relative; flex: 1 1 320px; max-width: 520px; }
.mh-search > .mh-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--mh-muted); pointer-events: none; }
.mh-search input { width: 100%; min-height: 46px; padding: 10px 14px 10px 44px; border: 1px solid var(--mh-border-strong); border-radius: var(--mh-radius-pill); background: var(--mh-surface); color: var(--mh-text); font: inherit; }
.mh-search input:focus { border-color: var(--mh-primary); box-shadow: var(--mh-ring); outline: none; }
.mh-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 14px; align-items: start; }
.mh-cat-card { padding: 0; overflow: hidden; }
.mh-cat-card + .mh-cat-card { margin-top: 0; }
.mh-cat-card summary { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; list-style: none; transition: background-color .15s; }
.mh-cat-card summary::-webkit-details-marker { display: none; }
.mh-cat-card summary:hover { background: var(--mh-surface-2); }
.mh-cat-card summary:focus-visible { outline: 3px solid var(--mh-primary); outline-offset: -3px; border-radius: var(--mh-radius-lg); }
.mh-cat-card-text { flex: 1; min-width: 0; }
.mh-cat-card-text strong { display: block; font-family: var(--mh-font-display); font-weight: 600; letter-spacing: -.01em; }
.mh-cat-card-text .mh-muted { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--mh-fs-sm); }
.mh-cat-card-figure { text-align: right; line-height: 1.25; }
.mh-cat-card-figure .mh-amount { display: block; font-size: var(--mh-fs-md); }
.mh-cat-card-figure .mh-muted { font-size: var(--mh-fs-xs); }
.mh-cat-card .mh-caret { display: inline-flex; color: var(--mh-subtle); transition: transform .2s; }
.mh-cat-card[open] .mh-caret { transform: rotate(180deg); }
.mh-cat-card[open] summary { border-bottom: 1px solid var(--mh-border); }
.mh-cat-card-body { padding: 8px 10px 14px; }
.mh-cat-subs { list-style: none; margin: 0; padding: 0; }
.mh-cat-subs li { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 8px; border-radius: var(--mh-radius-sm); }
.mh-cat-subs li:hover { background: var(--mh-surface-2); }
.mh-cat-subs a { flex: 1; min-width: 0; color: var(--mh-text); font-weight: 550; text-decoration: none; }
.mh-cat-subs a::after { content: ""; position: absolute; inset: 0; }
.mh-cat-subs a:focus-visible { outline: none; }
.mh-cat-subs li:has(a:focus-visible) { outline: 3px solid var(--mh-primary); outline-offset: -3px; }
.mh-cat-subs span:not(.mh-chip, .mh-amount) { flex: 1; }
.mh-cat-sub-amount { margin-left: auto; font-size: var(--mh-fs-sm); }
.mh-cat-card-body .mh-help { margin: 6px 8px 10px; }
.mh-cat-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 8px 0; padding-top: 12px; border-top: 1px dashed var(--mh-border); }
@media (max-width: 599px) {
  .mh-listbar-actions { width: 100%; justify-content: flex-end; }
  .mh-cat-card summary { padding: 14px; gap: 12px; }
  .mh-cat-card-figure .mh-muted { display: none; }
}
.mh-cat-group + .mh-cat-group { border-top: 1px solid var(--mh-border); }
.mh-cat-children { list-style: none; margin: 0; padding: 0 0 10px; }
.mh-cat-children .mh-list-item { padding: 6px 18px 6px 72px; border: 0; }
.mh-cat-children .mh-list-title { font-weight: 550; }
@media (max-width: 599px) {
  .mh-cat-tree .mh-list-main .mh-chip { display: inline-flex; }
  .mh-cat-children .mh-list-item { padding: 6px 14px 6px 40px; }
}

/* 16. Transactions ============================================================================== */
.mh-day + .mh-day { margin-top: 22px; }
.mh-day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 4px 8px; }
.mh-day-title { margin: 0; font-size: var(--mh-fs-sm); font-weight: 650; color: var(--mh-muted); }
.mh-tx-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; }
.mh-split { padding: 16px; margin-bottom: 18px; border: 1px solid var(--mh-border); border-radius: var(--mh-radius); background: var(--mh-surface-2); }
.mh-split .mh-field:last-child { margin-bottom: 0; }
.mh-split .mh-segmented { margin-bottom: 4px; }
@supports selector(:has(*)) {
  .mh-split, .mh-split-custom { display: none; }
  form:has(input[name="owner"][value="shared"]:checked) .mh-split { display: block; }
  form:has(input[name="split_mode"][value="custom"]:checked) .mh-split-custom { display: block; }
  form:has(input[name="split_mode"][value="custom"]:checked) .mh-split-equal { display: none; }
}
.mh-kind-income { color: var(--mh-income); }

/* 17. Home dashboard ============================================================================ */
.mh-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 26px; }
.mh-quick a { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--mh-border); border-radius: var(--mh-radius); background: var(--mh-surface); color: var(--mh-text); font-weight: 650; font-size: var(--mh-fs-sm); text-decoration: none; box-shadow: var(--mh-shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.mh-quick a:hover { border-color: var(--mh-border-strong); box-shadow: var(--mh-shadow); transform: translateY(-1px); }
.mh-quick .mh-chip { width: 36px; height: 36px; border-radius: 10px; }
.mh-dash { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mh-dash > * { min-width: 0; }
.mh-dash .mh-card { padding: 20px; }
.mh-dash .mh-card-head { margin-bottom: 12px; align-items: center; }
.mh-dash .mh-card-head a { font-size: var(--mh-fs-sm); font-weight: 650; text-decoration: none; white-space: nowrap; }
.mh-compact { list-style: none; margin: 0 -8px; padding: 0; }
.mh-compact li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--mh-radius-sm); }
.mh-compact li + li { border-top: 1px solid var(--mh-border); }
.mh-compact .mh-compact-text { flex: 1; min-width: 0; }
.mh-compact .mh-compact-text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mh-compact .mh-compact-text span { display: block; font-size: var(--mh-fs-xs); color: var(--mh-muted); }
.mh-compact .mh-meter { margin-top: 6px; height: 6px; }
.mh-dash-side { display: grid; gap: 20px; }
.mh-dash-side .mh-card + .mh-card { margin-top: 0; }
.mh-empty--inline { padding: 20px 8px; }
.mh-dash .mh-card-head .mh-chip--sm + div h2 { font-size: var(--mh-fs-md); }
@media (max-width: 899px) { .mh-dash { grid-template-columns: 1fr; } }

/* 18. Goals ===================================================================================== */
.mh-goal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.mh-goal { display: grid; gap: 10px; align-content: start; transition: box-shadow .15s, transform .15s; }
.mh-goal:has(a:hover) { box-shadow: var(--mh-shadow-md); }
.mh-goal + .mh-goal { margin-top: 0; }
.mh-goal-title { margin: 0; font-size: var(--mh-fs-md); }
.mh-goal-title a { color: var(--mh-text); text-decoration: none; }
.mh-goal-title a::after { content: ""; position: absolute; inset: 0; }
.mh-goal { position: relative; }
.mh-goal-amounts { margin: 6px 0 0; }
.mh-goal-amounts .mh-amount { font-size: var(--mh-fs-xl); }
.mh-goal-hint { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--mh-fs-sm); color: var(--mh-muted); }
.mh-goal-hint .mh-icon { width: 16px; height: 16px; }
.mh-goal-percent { margin-left: auto; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--mh-text); }
.mh-goal .mh-meter span, .mh-compact .mh-goal-meter span { background: var(--mh-goal); }
.mh-meter--done span, .mh-goal .mh-meter--done span { background: var(--mh-success); }
.mh-budget-body { flex: 1; min-width: 0; }
.mh-list-main:has(.mh-budget-body) { flex: 1; }
.mh-budget .mh-meter { margin-top: 8px; max-width: 460px; }
.mh-budget--warning .mh-meter span { background: var(--mh-goal); }
.mh-budget--over .mh-meter span { background: var(--mh-expense); }
.mh-budget-left { margin: 0; font-size: var(--mh-fs-sm); line-height: 1.35; }

/* 19. Cards (credit) ============================================================================ */
.mh-ccard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.mh-ccard { position: relative; display: grid; gap: 14px; padding: 20px; border-radius: var(--mh-radius-lg); border: 1px solid var(--mh-border); background: var(--mh-surface); box-shadow: var(--mh-shadow); transition: box-shadow .15s; }
.mh-ccard:has(a:hover) { box-shadow: var(--mh-shadow-md); }
.mh-ccard-top { display: flex; align-items: center; gap: 12px; }
.mh-ccard-top > div { min-width: 0; flex: 1; }
.mh-ccard-name { margin: 0; font-size: var(--mh-fs-md); }
.mh-ccard-name a { color: var(--mh-text); text-decoration: none; }
.mh-ccard-name a::after { content: ""; position: absolute; inset: 0; }
.mh-ccard-figures { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.mh-ccard-figures p { margin: 0; }
.mh-ccard-dates { display: flex; gap: 8px; flex-wrap: wrap; }

/* 20. Family ==================================================================================== */
.mh-member-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mh-member { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px; }
.mh-member + .mh-member { margin-top: 0; }
.mh-member > div { min-width: 0; flex: 1; }
.mh-member-name { margin: 0; font-size: var(--mh-fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-member-name a { color: var(--mh-text); text-decoration: none; }
.mh-member-name a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.mh-member:has(a:hover) { box-shadow: var(--mh-shadow-md); }
.mh-member-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mh-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mh-role { display: flex; gap: 12px; padding: 14px; border-radius: var(--mh-radius); background: var(--mh-surface-2); border: 1px solid var(--mh-border); }
.mh-role h3 { margin: 0; font-size: var(--mh-fs-sm); }
.mh-role p { margin: 2px 0 0; font-size: var(--mh-fs-sm); color: var(--mh-muted); }
.mh-invite { align-items: flex-start; }
.mh-invite-main { flex: 1; min-width: 0; }
.mh-invite-link { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mh-invite-link input { flex: 1 1 240px; min-width: 0; min-height: 40px; padding: 8px 12px; border: 1px solid var(--mh-border); border-radius: var(--mh-radius-sm); background: var(--mh-surface-2); color: var(--mh-muted); font: inherit; font-family: var(--mh-font-mono); font-size: var(--mh-fs-xs); }
.mh-invite-card { display: grid; gap: 8px; justify-items: start; }
.mh-invite-card h1 { margin: 8px 0 0; }
.mh-member--add { height: 100%; border-style: dashed; box-shadow: none; color: var(--mh-text); text-decoration: none; background: var(--mh-surface-2); }
.mh-member--add:hover { border-color: var(--mh-primary); background: var(--mh-primary-soft); }
.mh-member--add strong { display: block; }
.mh-member-meta .mh-status { font-size: .72rem; }
.mh-check--inline { margin: 10px 0 0; }
.mh-inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mh-inline-form input { min-height: 42px; padding: 8px 12px; border: 1px solid var(--mh-border-strong); border-radius: var(--mh-radius-sm); background: var(--mh-surface); color: var(--mh-text); font: inherit; width: 180px; }
.mh-inline-form input:focus { border-color: var(--mh-primary); box-shadow: var(--mh-ring); outline: none; }
.mh-card-head h2 .mh-status { margin-left: 6px; }
.mh-ccard-available { font-size: var(--mh-fs-xl); }
.mh-title-icon { display: inline-flex; align-items: center; gap: 10px; }
.mh-title-icon .mh-icon { color: var(--mh-primary); }
.mh-auth-card > .mh-auth-alt { margin: 22px 0 0; }
@media (max-width: 599px) {
  .mh-summaries { grid-template-columns: 1fr 1fr; gap: 10px; }
  .mh-summaries .mh-card { padding: 14px; }
  .mh-summaries--fill > .mh-tile { flex-basis: calc(50% - 5px); }
  .mh-summaries .mh-amount--big { font-size: var(--mh-fs-lg); }
  .mh-summaries .mh-tile-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .mh-summaries .mh-tile-head .mh-chip { width: 32px; height: 32px; border-radius: 10px; }
  .mh-summaries .mh-tile-head .mh-chip .mh-icon { width: 18px; height: 18px; }
  .mh-summaries .mh-muted, .mh-summaries .mh-tile-link { font-size: var(--mh-fs-xs); }
  .mh-quick { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .mh-quick a { flex-direction: column; gap: 6px; padding: 12px 4px; text-align: center; font-size: .7rem; line-height: 1.2; }
  .mh-invite .mh-list-main > .mh-chip { display: none; }
  .mh-page-head .mh-scope { width: 100%; }
}
@media (max-width: 599px) {
  .mh-profile-hero { flex-direction: column; text-align: center; padding: 22px 16px; }
  .mh-profile-hero > div { min-width: 0; max-width: 100%; }
  .mh-profile-hero p { overflow-wrap: anywhere; }
  .mh-profile-hero .mh-status { white-space: normal; }
}
.mh-plan-limits { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 24px; margin: 0; }
.mh-plan-limits li + li { border-top: 0; }
