.brand-full {
  display: block;
  object-fit: contain;
}

[data-theme="light"] .brand-full { filter: invert(1); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .brand-full { filter: invert(1); }
}

#login:not([hidden]) {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 20px;
}

.login-box {
  width: min(100%, 410px);
  padding: clamp(24px, 6vw, 44px);
  border-radius: 36px;
  background: radial-gradient(ellipse at top left, color-mix(in srgb, var(--a) 17%, transparent), transparent 75%),
    radial-gradient(ellipse at bottom right, color-mix(in srgb, var(--b) 22%, transparent), transparent 75%),
    var(--sf);
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 70px #0003;
}
.login-box .brand-full { width: min(100%, 255px); margin: 0 auto 32px; }
#loginForm { grid-template-columns: minmax(0, 1fr); gap: 20px; }
.login-field { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--mu); }
.login-field:focus-within { border-color: var(--a); }
.login-field > span { color: var(--a); }
.login-field input { border: 0; background: transparent; border-radius: 0; width: 100%; }
.login-actions { display: grid; gap: 12px; margin-top: 8px; }
.login-actions button { justify-content: center; }
.login-actions button[hidden] { display: none; }
.login-actions .btn { min-height: 48px; }
.login-signup { border: 0; background: none; color: var(--tx); font: inherit; cursor: pointer; min-height: 38px; }
.login-signup:hover { color: var(--a); }
#loginStatus { margin: 0; color: var(--mu); }
#loginStatus:empty { display: none; }
button.cat { font: inherit; color: inherit; }

#application {
  --sidebar-width: 240px;
  max-width: 1700px;
  padding-left: calc(var(--sidebar-width) + 24px);
  padding-right: 24px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 2;
  width: var(--sidebar-width);
  padding: 42px 18px 24px;
  overflow: auto;
  background: color-mix(in srgb, var(--a) 16%, var(--bg));
  border-right: 1px solid var(--bd);
}
.sidebar .brand-refresh { display: block; width: min(100%, 190px); margin: 0 auto 52px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.sidebar .brand-refresh .brand-full { width: 100%; margin: 0; }
.sidebar .brand-refresh:focus-visible { outline: 2px solid var(--a); outline-offset: 4px; border-radius: 5px; }
.sidebar nav { width: 100%; flex-direction: column; background: transparent; border: 0; margin: 0; }
.sidebar nav button { display: flex; align-items: center; gap: 10px; text-align: left; min-height: 42px; }
.sidebar nav .i { width: 18px; height: 18px; display: block; }
.app-header { min-height: 84px; justify-content: space-between; margin-bottom: 28px; }
.app-header .month { margin: 0; gap: 8px; }
.app-header .month b { min-width: auto; }
.header-actions { display: flex; gap: 10px; }
.header-actions .mini { height: 46px; min-width: 46px; padding-inline: 13px; justify-content: center; font-size: 14px; }
.cardc { position: relative; }
.card-remove { position: absolute; z-index: 1; top: 5px; right: 7px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: white; font-size: 21px; cursor: pointer; }
.card-remove:hover { background: #0003; }
.movement-edit { display: grid; place-items: center; flex: 0 0 26px; min-height: 28px; padding: 0; }
.movement-edit:hover { color: var(--a); }
.movement-edit .i { width: 16px; height: 16px; }
#planDialog {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(1000px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  padding: 42px 24px 24px;
  color: var(--tx);
}
#planClose {
  position: absolute;
  inset: 16px 20px auto auto;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 0;
  color: var(--mu);
  font: inherit;
  font-size: 28px;
  cursor: pointer;
}
#planDialog h2 { margin: 0; text-align: center; font-size: clamp(24px, 7vw, 36px); line-height: 1.15; letter-spacing: -.035em; }
#planDialog #planState { margin-top: 4px; text-align: center; color: var(--a); font-size: 23px; }
#planDialog p, #planExpiry { color: var(--mu); }
#planExpiry { display: block; text-align: center; }
#planMessage:not(:empty) { margin-top: 12px; }
#planDialog [hidden] { display: none; }
#planPackages { display:grid; grid-template-columns:repeat(3,minmax(210px,1fr)); gap:12px; padding:4px 3px 12px; margin-top:24px; overflow-x:auto; scroll-snap-type:x mandatory; }
.plan-package { display:flex; flex-direction:column; min-width:0; padding:18px; border:1px solid var(--bd); background:var(--sf); border-radius:16px; scroll-snap-align:start; }
.plan-package .btn,.plan-current { align-self:flex-start; margin-top:auto; }
.plan-package .btn { min-height:40px; height:auto; }
.plan-enterprise { background:color-mix(in srgb,var(--ok) 20%,var(--bg)); border-color:color-mix(in srgb,var(--ok) 45%,var(--bd)); }
.plan-package.plan-enterprise strong { color:var(--ok); }
.plan-enterprise .btn { background:linear-gradient(135deg,#087d59,#168050); }
#planCancel { margin-top:8px; }
.plan-package h3 { font-size: 19px; margin-bottom: 10px; }
.plan-package strong { color: var(--a); font-size: 23px; }
.plan-package p { margin-top: 8px; font-size: 12px; }
.plan-package ul { padding-left: 20px; line-height: 1.6; }
.paid-lock { width: 14px; height: 14px; flex: none; }

@media (max-width: 760px) {
  #application { padding: 12px 12px 50px; }
  .sidebar { position: static; width: auto; background: transparent; padding: 6px 0; border: 0; overflow: visible; }
  .sidebar .brand-refresh { width: 138px; margin: 0 0 12px; }
  .sidebar nav { flex-direction: row; }
  .app-header { min-height: 0; margin: 12px 0 18px; }
  .header-actions { gap: 5px; }
  .header-actions .mini { min-width: 42px; height: 42px; padding-inline: 9px; }
}

#settings {
  zoom: .7;
  width: min(478px, calc((100vw - 24px) / .7));
  max-height: calc((100dvh - 24px) / .7);
  overflow: auto;
  position: fixed;
  inset: 0;
  margin: auto;
  color: var(--tx);
}

#settings::backdrop {
  background: #0b0b14a0;
}

#settingsContent {
  display: grid;
  gap: 12px;
}

#settingsContent form {
  grid-template-columns: minmax(0, 1fr);
}

#settingsContent .mini {
  margin-top: 8px;
}

#settingsStatus:empty {
  display: none;
}

.profile-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
}
#settingsContent input[type="file"][hidden], .nav-short { display: none; }

@media (max-width: 760px) {
  #application:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 16px 8px;
    padding: 21px 16px 50px;
  }
  #application .sidebar, #application .app-header { display: contents; }
  #application .sidebar .brand-refresh { width: min(100%, 112px); margin: 0; grid-area: 1 / 1; }
  .app-header .header-actions { grid-area: 1 / 2; align-items: center; }
  .app-header .header-actions .mini { min-width: 35px; height: 35px; padding: 0 8px; border-radius: 13px; font-size: 12px; font-weight: 650; white-space: nowrap; }
  .app-header .header-actions .i { width: 16px; height: 16px; }
  #application .sidebar nav {
    grid-area: 2 / 1 / 3 / -1; display: flex; padding: 4px; gap: 3px;
    background: var(--sf); border: 1px solid var(--bd); border-radius: 17px;
    scrollbar-width: none;
  }
  #application .sidebar nav button { min-height: 35px; padding: 6px 9px; gap: 5px; font-size: 12px; font-weight: 650; flex-shrink: 0; }
  #application .sidebar nav .i { width: 14px; height: 14px; }
  .nav-full { display: none; }
  .nav-short { display: inline; }
  #application .app-header .month {
    grid-area: 3 / 1 / 4 / -1; justify-content: space-between;
    border: 1px solid var(--bd); border-radius: 17px; background: var(--sf); padding: 8px 11px;
  }
  #application .month b { font-size: 18px; }
  #application .month .arr { width: 34px; height: 34px; }
  #main { grid-area: 4 / 1 / 5 / -1; min-width: 0; }
  #main .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #main .kpi { min-width: 0; padding: 13px; border-radius: 20px; }
  #main .kpi .v { font-size: clamp(15px, 4.8vw, 23px); overflow-wrap: anywhere; }
  #main .dashboard-kpis > .kpi:first-child { grid-column: 1 / -1; padding: 18px; }
  #main .dashboard-kpis > .kpi:first-child .v { font-size: clamp(25px, 8vw, 39px); }
  #main .business-kpis > .kpi:last-child { grid-column: 1 / -1; }
}

@media (min-width: 761px) {
  #main .dashboard-kpis { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .dashboard-kpis > .kpi { grid-column: span 4; min-width: 0; }
  .personal-kpis > .kpi:nth-child(n+4) { grid-column: span 3; }
  .dashboard-kpis > .kpi:first-child .v { font-size: clamp(28px, 3vw, 38px); }
}

#settings {
  box-sizing: border-box;
  padding: 80px 32px 36px 46px;
}

#settings, #planDialog, #notifications {
  border: 2px solid color-mix(in srgb, var(--mu) 45%, transparent);
  border-radius: 42px;
  background: color-mix(in srgb, var(--bg) 54%, var(--mu) 13%);
  box-shadow: 0 20px 70px #0005;
}

#settings.is-paired { padding: 38px 28px 25px; }
#settings::backdrop, #planDialog::backdrop, #notifications::backdrop { background: #03071242; backdrop-filter: blur(5px); }
#bNotifications { position: relative; }
#notificationDot:not([hidden]) { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--a); top: 7px; right: 7px; }
#notifications { position: fixed; inset: 0; margin: auto; width: min(400px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 24px; color: var(--tx); }
#notifications header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#notifications h2 { font-size: 20px; }
#notificationStatus:not(:empty), #notificationList:not(:empty) { margin-top: 16px; }
#notificationList { list-style: none; padding: 0; }
#notificationList li { padding: 10px 0; border-bottom: 1px solid var(--bd); }
#notificationList time { display: block; font-size: 12px; color: var(--mu); margin-top: 3px; }
#pushPreferences { margin-top: 16px; }
#pushStatus:not(:empty) { margin-top: 8px; color: var(--mu); font-size: 12px; }
@media (max-width: 400px) { #application .header-actions { flex-wrap: wrap; justify-content: flex-end; } }
#settingsTitle { position: absolute; inset: 24px 24px auto auto; margin: 0; }
#settingsTitle > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#closeSettings { background: transparent; border: 0; color: var(--mu); font-size: 21px; }
#settingsContent { gap: 24px; justify-items: start; }
#settingsContent > :not(.profile-exit) { width: 100%; }
#settingsContent h2 { margin: 0; text-align: center; font-size: 18px; }
#settings.is-paired h2 { font-size: 22px; }
#settingsContent form { gap: 12px; }
#settingsContent form label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; min-width: 0; }
#settingsContent label[hidden] { display: none; }
#settingsContent input, #settingsContent select {
  width: 100%; min-width: 0; height: 35px; padding: 0 12px; border-radius: 20px;
  appearance: none; border: 1px solid var(--bd); box-shadow: none;
  color: var(--tx); font: inherit;
  background: color-mix(in srgb, var(--mu) 27%, transparent);
}
#settingsContent :is(input, select):focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
#settingsContent .solo-profile { display: grid; grid-template-columns: minmax(76px, 34%) minmax(0, 1fr); align-items: center; }
.solo-profile > div, .couple-columns > div { display: grid; gap: 9px; }
#settingsContent .solo-invite { border-top: 2px solid color-mix(in srgb, var(--mu) 44%, transparent); padding-top: 20px; }
.solo-invite h2 { margin-bottom: 14px !important; }
.couple-avatar {
  display: block; padding: 0; width: 100%; max-width: 150px; aspect-ratio: 1;
  border-radius: 50%; border: 1px solid var(--bd); background: var(--a); overflow: hidden;
}
button.couple-avatar { cursor: pointer; }
.couple-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.couple-avatars { display: flex; justify-content: center; padding: 12px 0 24px; }
.couple-avatars .couple-avatar { width: min(42%, 150px); }
.couple-avatars .couple-avatar + .couple-avatar { margin-left: -42px; background: #ff5b48; }
.couple-columns { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 8px; }
.couple-columns > div { min-width: 0; padding-right: 15px; }
.couple-columns > div + div { padding: 0 0 0 15px; border-left: 2px solid color-mix(in srgb, var(--mu) 44%, transparent); }
#settingsContent .couple-columns label { text-align: center; }
.couple-footer { display: flex; justify-content: space-between; }
.profile-primary, .profile-exit {
  justify-self: start; min-height: 29px; padding: 2px 19px; border: 1px solid transparent;
  border-radius: 18px; font: inherit; font-weight: 700; cursor: pointer;
}
.profile-primary { background: var(--a); color: #071c26; min-width: 148px; }
.is-paired .profile-primary { min-width: 98px; }
.profile-primary:disabled { opacity: .55; cursor: default; }
.profile-exit { background: #ab423a; color: white; border-color: #ff5b48; padding-inline: 15px; }
.couple-options, .invite-cancel { color: var(--mu); font-size: 12px; }
.couple-options summary { cursor: pointer; }
.couple-options[open] summary, .solo-invite > button { margin-top: 8px; margin-bottom: 8px; }
.invite-cancel { background: none; border: 0; cursor: pointer; }
#welcomeTour {
  position: fixed; inset: auto; margin: 0; z-index: 20;
  width: min(305px, calc(100vw - 20px)); padding: 16px;
  border: 1px solid color-mix(in srgb, var(--a) 55%, var(--bd)); border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 94%, var(--a)); color: var(--tx);
  box-shadow: 0 10px 38px #0005;
}
#welcomeTour h2 { margin: 0 0 7px; font-size: 16px; }
#tourText { margin: 0 0 13px; line-height: 1.4; font-size: 13px; }
.tour-progress { color: var(--mu); margin: 0 0 5px; font-size: 11px; }
.tour-actions { display: flex; justify-content: space-between; gap: 8px; }
.tour-target { outline: 2px solid var(--a); outline-offset: 2px; }
#demoSignup[hidden], #demoLabel[hidden] { display: none; }
#tourSignup[hidden] { display: none; }
#welcomeTour .tour-actions { align-items:center; }
#tourNext { height:auto; min-height:40px; max-width:100%; padding:8px 14px; line-height:1.25; }
#welcomeTour .tour-actions:has(#tourSignup:not([hidden])) {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
}
#tourSignup:not([hidden]) { justify-self:end; height:auto; min-height:32px; padding:6px 10px; line-height:1.25; }
#welcomeTour .tour-actions:has(#tourSignup:not([hidden])) #tourNext { grid-column:1 / -1; }
#demoLabel { margin: 0 0 12px; color: var(--mu); }
.card-entry { margin-top: 14px; grid-template-columns: 1fr 1fr auto; }
@media (max-width: 600px) { .card-entry { grid-template-columns: 1fr; } }
#tourConfetti { position: fixed; inset: 0; pointer-events: none; z-index: 10000; overflow: hidden; }
#tourConfetti i { position: absolute; top: -12px; left: var(--x); width: 7px; height: 12px; border-radius: 2px; animation: tour-confetti var(--duration, 3.2s) var(--delay) linear both; }
@keyframes tour-confetti {
  0% { transform: translate3d(0,0,0) rotate(0); }
  35% { transform: translate3d(var(--drift),36vh,0) rotate(90deg); }
  72% { transform: translate3d(calc(var(--drift) * -.55),75vh,0) rotate(210deg); opacity:1; }
  100% { transform: translate3d(var(--drift),105vh,0) rotate(300deg); opacity:0; }
}
.intelligence-panel { margin-bottom:14px; }
.intelligence-header { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:10px; margin-bottom:14px; }
.intelligence-panel .intelligence-header h3 { display:flex; justify-content:flex-start; align-items:center; gap:8px; margin:0; }
.intelligence-header .i { color:var(--a); }
.intelligence-grid { display:grid; grid-template-columns:minmax(0,3fr) minmax(0,2fr); gap:12px; }
.intelligence-card { min-width:0; padding:14px; border:1px solid var(--bd); border-radius:14px; background:var(--sf); }
.intelligence-card h4 { margin:0 0 8px; }
.intelligence-hint { color:var(--mu); margin:5px 0; }
.intelligence-legend { display:flex; gap:14px; font-size:12px; color:var(--mu); margin-bottom:8px; }
.intelligence-legend span::before { content:""; display:inline-block; width:8px; height:8px; margin-right:5px; border-radius:3px; background:var(--ok); }
.intelligence-legend span + span::before { background:var(--bad); }
.intelligence-months { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.intelligence-months .mini { display:grid; grid-template-columns:minmax(0,1fr); height:auto; padding:6px; background:transparent; border-color:transparent; text-align:center; }
.intelligence-months .mini:is(:hover,[aria-pressed=true]) { background:var(--in); }
.intelligence-months .mini[aria-pressed=true] { border-color:var(--bd); color:var(--a); }
.intelligence-bars { height:94px; width:100%; display:flex; gap:5px; align-items:flex-end; justify-content:center; border-bottom:1px solid var(--bd); }
.intelligence-bars i { width:min(25%,25px); background:var(--ok); border-radius:4px 4px 0 0; }
.intelligence-bars i + i { background:var(--bad); }
.intelligence-details { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:10px 0; font-size:12px; }
.intelligence-details dt { color:var(--mu); }
.intelligence-details dd { margin:2px 0 0; overflow-wrap:anywhere; }
.intelligence-simulation label { display:flex; justify-content:space-between; gap:8px; font-size:12px; }
#intelligence-scenario { width:100%; accent-color:var(--a); margin:4px 0 0; }
#intelligence-projection { display:block; font-size:clamp(20px,3vw,27px); font-weight:750; overflow-wrap:anywhere; }
#intelligence-projection[data-sign=positive] { color:var(--ok); }
#intelligence-projection[data-sign=negative] { color:var(--bad); }
#intelligence-result { margin-top:14px; }
#intelligence-result:empty { display:none; }
.analysis-metrics,.analysis-notes { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.analysis-notes { margin-top:10px; }
.analysis-notes h4 { display:flex; align-items:center; gap:7px; }
.analysis-notes h4 .i { color:var(--a); }
.analysis-notes p { margin:0; overflow-wrap:anywhere; }
.analysis-legend { margin-top:5px; }
.analysis-legend span::before { background:var(--mu); }
.analysis-legend span + span::before { background:var(--a); }
@media (max-width:650px) {
  .intelligence-grid { grid-template-columns:minmax(0,1fr); }
  .intelligence-bars { height:72px; }
  .analysis-metrics,.analysis-notes { grid-template-columns:minmax(0,1fr); }
}
@media (max-width: 390px) {
  #settings, #settings.is-paired { padding-inline: 18px; border-radius: 28px; }
  .couple-columns > div { padding-right: 8px; }
  .couple-columns > div + div { padding-left: 8px; }
}

@media (max-width: 380px) {
  header {
    gap: 6px;
    flex-wrap: wrap;
  }
}
