:root {
  color-scheme: dark;
  --bg: #070c19;
  --bg-soft: #0b1226;
  --panel: rgba(20, 28, 54, 0.58);
  --panel-strong: rgba(28, 36, 66, 0.7);
  --panel-muted: rgba(34, 43, 72, 0.42);
  --field: rgba(49, 58, 90, 0.42);
  --field-strong: rgba(62, 75, 123, 0.52);
  --line: rgba(95, 132, 210, 0.28);
  --line-strong: rgba(119, 154, 255, 0.42);
  --text: #f7f8ff;
  --muted: #aeb7d0;
  --quiet: #7c879f;
  --purple: #5f7cff;
  --purple-2: #8ca2ff;
  --cyan: #65cfff;
  --green: #79dfaa;
  --amber: #f5c96a;
  --rose: #f47f9d;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.26), 0 0 38px rgba(87, 123, 255, 0.08);
  --glow: 0 0 0 1px rgba(107, 145, 255, 0.08), 0 0 46px rgba(86, 124, 255, 0.14);
  --radius: 24px;
  --radius-sm: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(77, 111, 190, 0.105) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 111, 190, 0.095) 1px, transparent 1px),
    radial-gradient(circle at 28% 0%, rgba(83, 83, 175, 0.26), transparent 30%),
    radial-gradient(circle at 82% 6%, rgba(65, 102, 210, 0.3), transparent 34%),
    radial-gradient(circle at 66% 60%, rgba(65, 207, 255, 0.1), transparent 28%),
    linear-gradient(145deg, #040812 0%, #0d1329 45%, #07101f 100%);
  background-size: 72px 72px, 72px 72px, auto, auto, auto;
  letter-spacing: 0;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    linear-gradient(114deg, transparent 0 38%, rgba(79, 101, 255, 0.26) 39.5%, rgba(119, 175, 255, 0.08) 41%, transparent 45%),
    linear-gradient(132deg, transparent 0 54%, rgba(105, 179, 255, 0.22) 56%, transparent 60%),
    linear-gradient(99deg, transparent 0 76%, rgba(90, 128, 255, 0.22) 78%, transparent 82%);
  filter: blur(1.4px);
}

body::after {
  background-image:
    radial-gradient(circle, rgba(101, 207, 255, 0.48) 0 1.4px, transparent 1.8px),
    linear-gradient(35deg, transparent 0 49%, rgba(101, 207, 255, 0.12) 50%, transparent 51%);
  background-size: 230px 188px, 380px 300px;
  opacity: 0.54;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 28px 24px 24px;
}

.app-topbar {
  position: sticky;
  top: 18px;
  z-index: 30;
  max-width: 1440px;
  min-height: 64px;
  margin: 0 auto 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(99, 132, 214, 0.34);
  background: rgba(10, 15, 31, 0.64);
  box-shadow: var(--glow), 0 18px 70px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(26px);
}

.top-brand,
.top-nav,
.top-cta {
  color: var(--text);
}

.top-brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  background: transparent;
  min-width: 190px;
}

.top-brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px 14px 14px 18px;
  background:
    linear-gradient(145deg, #65efff 0%, #1584ff 48%, #063dcc 100%);
  box-shadow: 0 0 24px rgba(18, 125, 255, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.top-brand-mark::after {
  content: "";
  position: absolute;
  inset: 9px 7px 7px 11px;
  border-radius: 999px 999px 999px 3px;
  background: rgba(5, 11, 31, 0.78);
  box-shadow: inset 0 0 14px rgba(19, 127, 255, 0.42);
}

.brand-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  color: #f7f9ff;
  font-weight: 880;
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: lowercase;
}

.brand-wordmark span:last-child {
  color: #1176ff;
}

.brand-logo {
  display: block;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 0 14px rgba(16, 108, 255, 0.14));
  user-select: none;
  pointer-events: none;
}

.brand-logo-top {
  width: 188px;
  height: 50px;
}

.brand-logo-hero {
  width: min(620px, 100%);
  height: auto;
  margin: -24px 0 -10px;
}

.brand-logo-mobile {
  width: min(190px, 44vw);
  height: auto;
  margin: -7px 0 -4px;
}

.top-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.top-nav button,
.top-cta {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(159, 176, 230, 0.13);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.top-nav button.is-active {
  color: white;
  border-color: rgba(120, 154, 255, 0.95);
  background: rgba(80, 110, 220, 0.18);
  box-shadow: 0 0 0 2px rgba(95, 124, 255, 0.24), 0 0 24px rgba(69, 119, 255, 0.28), inset 0 0 18px rgba(95, 124, 255, 0.18);
}

.top-cta {
  min-height: 42px;
  padding-inline: 24px;
  color: white;
  background: rgba(74, 104, 218, 0.2);
  border-color: rgba(120, 154, 255, 0.72);
  box-shadow: 0 0 26px rgba(79, 118, 255, 0.16), inset 0 0 20px rgba(95, 124, 255, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: 88px minmax(370px, 430px) minmax(430px, 1fr);
  gap: 22px;
  max-width: 1440px;
  margin: 0 auto;
}

.view-mobile .workspace {
  grid-template-columns: 88px minmax(370px, 430px);
  max-width: 560px;
}

.view-web .workspace {
  grid-template-columns: minmax(720px, 1fr);
  max-width: 1280px;
}

.view-mobile .desktop-panel,
.view-web .phone,
.view-web .rail {
  display: none;
}

.rail,
.desktop-panel,
.phone {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(25, 33, 60, 0.58), rgba(11, 17, 34, 0.66)),
    radial-gradient(circle at 100% 0%, rgba(91, 124, 255, 0.16), transparent 30%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(30px);
}

.rail {
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 10px;
  gap: 14px;
}

.brand-mark,
.nav-btn,
.icon-btn,
.shortcut-icon,
.fab {
  display: grid;
  place-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  overflow: hidden;
  padding: 3px;
  background: rgba(5, 11, 31, 0.78);
  box-shadow: 0 18px 36px rgba(21, 132, 255, 0.2);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-stack {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.rail-switch {
  margin-top: auto;
  width: 100%;
}

.nav-btn {
  width: 52px;
  height: 52px;
  border-radius: 19px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.032);
  border: 1px solid rgba(255, 255, 255, 0.055);
  transition: 180ms ease;
}

.nav-btn:hover,
.nav-btn.is-active {
  color: white;
  border-color: rgba(120, 154, 255, 0.54);
  background: rgba(95, 124, 255, 0.14);
  box-shadow: inset 0 0 22px rgba(95, 124, 255, 0.12);
}

.phone {
  position: sticky;
  top: 24px;
  min-height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  overflow: hidden auto;
  border-radius: 42px;
  padding: 22px 18px 102px;
}

.phone::-webkit-scrollbar,
.desktop-panel::-webkit-scrollbar {
  width: 0;
}

.phone-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.menu-btn,
.bell-btn {
  width: 54px;
  height: 54px;
  border-radius: 19px;
  color: white;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
}

.bell-btn {
  position: relative;
}

.dot {
  position: absolute;
  top: 12px;
  right: 13px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--purple-2);
  box-shadow: 0 0 14px var(--purple-2);
}

.title h1,
.desktop-title h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.05;
  font-weight: 760;
}

.title h1.brand-wordmark {
  font-size: 34px;
  font-weight: 900;
}

.desktop-title h2 .brand-wordmark {
  font-size: 62px;
}

.title p,
.desktop-title p,
.card-subtitle,
.muted {
  color: var(--muted);
}

.title p {
  margin: 8px 0 0;
  font-size: 16px;
}

.title strong {
  color: var(--purple-2);
  font-weight: 700;
}

.shortcuts {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 0 0 18px;
}

.shortcut {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  background: transparent;
}

.shortcut-icon {
  width: 58px;
  height: 58px;
  border-radius: 999px;
  color: white;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.shortcut.is-active .shortcut-icon {
  background: rgba(84, 113, 225, 0.34);
  border-color: rgba(120, 154, 255, 0.72);
  box-shadow: 0 0 26px rgba(79, 118, 255, 0.2), inset 0 0 24px rgba(95, 124, 255, 0.18);
}

.shortcut span {
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  white-space: nowrap;
}

.shortcut.is-active span {
  color: var(--purple-2);
}

.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(22, 31, 58, 0.58), rgba(13, 20, 41, 0.66)),
    radial-gradient(circle at 100% 0%, rgba(95, 124, 255, 0.14), transparent 34%);
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 16px 46px rgba(0, 0, 0, 0.18);
}

.energy-card {
  padding: 22px;
  margin-bottom: 18px;
}

.card-row,
.payment-row,
.budget-row,
.stat-row,
.section-head,
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.card-title {
  margin: 0;
  font-size: 19px;
  font-weight: 760;
}

.card-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
}

.metric {
  margin: 26px 0 4px;
  font-size: 46px;
  line-height: 0.92;
  font-weight: 780;
}

.metric span {
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
}

.trend {
  color: #b9c6ff;
  font-size: 14px;
}

.chart-wrap {
  position: relative;
  height: 196px;
  margin-top: 18px;
}

.chart-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.axis-label {
  position: absolute;
  right: 0;
  color: var(--quiet);
  font-size: 12px;
}

.axis-label.top {
  top: 12px;
}

.axis-label.mid {
  top: 78px;
}

.axis-label.bottom {
  bottom: 20px;
}

.chart-note {
  position: absolute;
  left: 54%;
  top: 10px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 14px;
  color: white;
  font-size: 13px;
  background: rgba(10, 13, 22, 0.78);
  border: 1px solid var(--line-strong);
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mini-card {
  min-height: 178px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.mini-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.mini-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ring {
  width: 116px;
  height: 116px;
  margin: 20px auto 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background:
    radial-gradient(circle, rgba(22, 24, 32, 1) 49%, transparent 50%),
    conic-gradient(var(--purple-2) 0 75%, rgba(255, 255, 255, 0.08) 75% 100%);
  box-shadow: 0 12px 38px rgba(117, 104, 255, 0.24);
}

.ring strong {
  font-size: 30px;
}

.status-orb {
  width: 104px;
  height: 104px;
  margin: 18px auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--green);
  background: radial-gradient(circle, rgba(115, 230, 162, 0.2), rgba(13, 15, 22, 1) 62%);
  box-shadow: 0 0 36px rgba(115, 230, 162, 0.22);
}

.weather-temp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  font-size: 36px;
  font-weight: 780;
  color: var(--purple-2);
}

.weather-row {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.pill {
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 8;
  width: min(394px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 28px;
  background: rgba(11, 14, 24, 0.86);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(24px);
}

.tabbar button {
  display: grid;
  justify-items: center;
  gap: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
}

.tabbar button.is-active {
  color: var(--purple-2);
}

.mobile-global-tabbar {
  display: none;
}

.phone-tabbar {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  margin-top: 18px;
}

.phone .stats-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.phone .stat-card {
  min-height: 82px;
  padding: 13px;
}

.phone .stat-card strong {
  font-size: 19px;
}

.phone .utility-grid {
  grid-template-columns: 1fr;
}

  .phone .utility-card {
    min-height: auto;
  }

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

  .fab {
    width: 64px;
  height: 64px;
  margin: -24px auto 0;
  border-radius: 50%;
  color: white;
  background: rgba(95, 124, 255, 0.18);
  border: 1px solid rgba(120, 154, 255, 0.42);
  box-shadow: inset 0 0 28px rgba(95, 124, 255, 0.15), 0 18px 50px rgba(0, 0, 0, 0.28);
}

.desktop-panel {
  min-height: calc(100vh - 136px);
  max-height: calc(100vh - 136px);
  overflow: hidden auto;
  border-radius: 18px;
  padding: 28px;
}

.desktop-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.desktop-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 5px;
  border-radius: 12px;
  background: var(--field);
  border: 1px solid rgba(139, 161, 225, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.view-web .desktop-panel {
  padding: 34px;
  border-radius: 18px;
  border-color: rgba(91, 128, 214, 0.38);
  background:
    linear-gradient(145deg, rgba(17, 25, 51, 0.56), rgba(11, 17, 36, 0.66)),
    radial-gradient(circle at 92% 8%, rgba(95, 124, 255, 0.18), transparent 32%);
  box-shadow: var(--glow), 0 24px 110px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.view-web .desktop-title {
  margin-bottom: 30px;
}

.view-web .desktop-title h2 {
  max-width: 760px;
  font-size: clamp(34px, 4.2vw, 60px);
  line-height: 0.98;
  letter-spacing: 0;
}

.view-switch button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.view-switch button.is-active {
  color: white;
  background: rgba(84, 113, 225, 0.36);
  box-shadow: 0 0 18px rgba(79, 118, 255, 0.18), inset 0 0 18px rgba(95, 124, 255, 0.18);
}

.rail-switch .view-switch {
  grid-template-columns: 1fr;
}

.rail-switch .view-switch button {
  padding: 0 6px;
  font-size: 10px;
}

.desktop-title p {
  max-width: 620px;
  margin: 8px 0 0;
  line-height: 1.5;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 15px;
  color: white;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.primary-btn {
  background: rgba(69, 97, 225, 0.72);
  border-color: rgba(134, 161, 255, 0.66);
  box-shadow: 0 0 28px rgba(76, 116, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.ghost-btn {
  background: var(--field);
  border-color: var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.danger-btn {
  background: rgba(255, 107, 139, 0.12);
  color: #ff9aad;
  border-color: rgba(255, 107, 139, 0.26);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) minmax(260px, 0.85fr);
  gap: 18px;
}

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

.stat-card {
  min-height: 96px;
  padding: 16px;
  border-radius: 18px;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: 0 0 24px rgba(77, 116, 255, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.stat-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  color: white;
  font-size: 22px;
  line-height: 1.05;
}

.stat-card.tone-paid {
  border-color: rgba(115, 230, 162, 0.24);
  background: linear-gradient(145deg, rgba(115, 230, 162, 0.09), rgba(38, 51, 82, 0.38));
}

.stat-card.tone-late {
  border-color: rgba(244, 127, 157, 0.26);
  background: linear-gradient(145deg, rgba(244, 127, 157, 0.09), rgba(38, 51, 82, 0.38));
}

.stat-card.tone-soon {
  border-color: rgba(245, 201, 106, 0.26);
  background: linear-gradient(145deg, rgba(245, 201, 106, 0.09), rgba(38, 51, 82, 0.38));
}

.stat-card.tone-future {
  border-color: rgba(101, 207, 255, 0.28);
  background: linear-gradient(145deg, rgba(101, 207, 255, 0.09), rgba(38, 51, 82, 0.38));
}

.panel-card {
  padding: 20px;
  border-radius: 24px;
  border-color: rgba(96, 126, 205, 0.32);
  background:
    linear-gradient(145deg, rgba(20, 28, 53, 0.58), rgba(15, 22, 43, 0.66)),
    radial-gradient(circle at 90% 0%, rgba(84, 113, 225, 0.11), transparent 28%);
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.summary-number {
  margin: 16px 0 2px;
  font-size: 44px;
  line-height: 1;
  font-weight: 800;
}

.summary-label {
  margin: 0;
  color: var(--muted);
}

.budget-list,
.payments-list,
.reminder-list {
  display: grid;
  gap: 12px;
}

.budget-row,
.payment-row,
.reminder-item {
  padding: 13px;
  border-radius: 16px;
  background: var(--field);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.payment-row {
  position: relative;
  overflow: hidden;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
  cursor: pointer;
}

.payment-row:not(.has-actions) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  column-gap: 12px;
}

.payment-row::before,
.reminder-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cat, var(--purple));
  opacity: 0.85;
}

.payment-row:hover {
  transform: translateY(-2px);
  border-color: rgba(133, 162, 255, 0.4);
  background: var(--field-strong);
  box-shadow: 0 0 28px rgba(80, 122, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.payment-row.has-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 14px;
}

.payment-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.payment-main > div {
  min-width: 0;
  overflow: hidden;
}

.category-dot {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  background: rgba(95, 124, 255, 0.1);
}

.payment-main h4 {
  margin: 0 0 4px;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.payment-main p,
.payment-amount p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.payment-main p {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.payment-amount {
  position: relative;
  z-index: 1;
  text-align: right;
  white-space: nowrap;
  min-width: 112px;
}

.payment-amount strong {
  display: block;
  margin-bottom: 7px;
}

.payment-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  grid-column: 1 / -1;
  width: 100%;
  position: relative;
  z-index: 2;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 17, 0.64);
  backdrop-filter: blur(10px);
}

.detail-modal {
  width: min(1500px, 100%);
  height: min(880px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(410px, 0.78fr) minmax(520px, 1.22fr);
  gap: 14px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(119, 154, 255, 0.34);
  background:
    linear-gradient(145deg, rgba(15, 23, 46, 0.97), rgba(8, 13, 28, 0.98)),
    radial-gradient(circle at 94% 8%, rgba(101, 207, 255, 0.1), transparent 30%);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.46), 0 0 0 1px rgba(107, 145, 255, 0.08);
  overflow: hidden;
}

.detail-info,
.invoice-preview {
  min-width: 0;
  min-height: 0;
  border-radius: 16px;
  border: 1px solid rgba(119, 154, 255, 0.22);
  background: rgba(16, 24, 48, 0.7);
}

.detail-info {
  overflow: hidden auto;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(27, 37, 70, 0.7), rgba(13, 19, 38, 0.72)),
    radial-gradient(circle at 0 0, rgba(95, 124, 255, 0.12), transparent 28%);
}

.detail-head,
.preview-head,
.detail-total {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.detail-head h2 {
  margin: 12px 0 6px;
  font-size: 30px;
  line-height: 1.05;
}

.detail-head p {
  margin: 0;
  color: var(--muted);
}

.icon-btn.detail-close,
.preview-tools .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: white;
  background: var(--field);
  border: 1px solid var(--line);
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.42fr);
  gap: 10px;
  margin: 18px 0;
}

.detail-total,
.detail-reminder {
  align-items: center;
  padding: 16px;
  border-radius: 16px;
  background: rgba(95, 124, 255, 0.12);
  border: 1px solid rgba(120, 154, 255, 0.28);
}

.detail-reminder {
  display: grid;
  gap: 8px;
  background: rgba(101, 207, 255, 0.07);
}

.detail-total span,
.detail-reminder span,
.detail-cell span,
.detail-section-title span,
.preview-head span {
  color: var(--muted);
  font-size: 12px;
}

.detail-total strong {
  font-size: 30px;
}

.detail-reminder select {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  color: white;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(119, 154, 255, 0.24);
  padding: 0 10px;
  outline: none;
}

.detail-reminder select option {
  color: #0b1226;
  background: #eef4ff;
}

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

.detail-cell {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(44, 55, 92, 0.48);
  border: 1px solid rgba(119, 154, 255, 0.18);
}

.detail-cell span,
.detail-cell strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-cell strong {
  margin-top: 7px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.detail-section-title h3 {
  margin: 0;
}

.detail-note {
  margin-top: 14px;
  padding: 13px;
  border-radius: 14px;
  color: var(--muted);
  background: rgba(245, 201, 106, 0.08);
  border: 1px solid rgba(245, 201, 106, 0.18);
}

.invoice-preview {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(17, 23, 43, 0.8), rgba(8, 12, 25, 0.88)),
    radial-gradient(circle at 100% 0, rgba(101, 207, 255, 0.08), transparent 30%);
}

.preview-head {
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(119, 154, 255, 0.18);
}

.preview-head strong,
.preview-head span {
  display: block;
}

.preview-head span {
  margin-top: 4px;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.preview-tools-pdf .ghost-btn {
  min-height: 38px;
  border-radius: 10px;
}

.pdf-page-switch {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(119, 154, 255, 0.18);
}

.pdf-page-switch button,
.pdf-page-switch select {
  height: 30px;
  min-width: 30px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 850;
}

.pdf-page-switch button {
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.pdf-page-switch button.active {
  color: white;
  background: linear-gradient(135deg, var(--accent), #6e7dff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.pdf-page-switch button:disabled {
  opacity: 0.35;
  cursor: default;
}

.pdf-page-switch-select select {
  min-width: 92px;
  padding: 0 8px;
  color: white;
  background: rgba(42, 55, 96, 0.82);
  outline: none;
}

.pdf-page-switch-select select option {
  color: #0b1226;
  background: #eef4ff;
}

.pdf-page-count {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 10px;
  color: white;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(119, 154, 255, 0.18);
  font-weight: 800;
}

.preview-tools span {
  min-width: 46px;
  color: white;
  text-align: center;
  font-weight: 760;
}

.preview-stage,
.preview-scroll {
  min-height: 0;
  overflow: auto;
}

.preview-stage {
  background:
    linear-gradient(135deg, rgba(5, 9, 20, 0.84), rgba(9, 14, 28, 0.9)),
    linear-gradient(rgba(77, 111, 190, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 111, 190, 0.05) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
}

.preview-scroll {
  height: 100%;
  padding: 14px;
  display: grid;
  place-items: start center;
}

.preview-scroll-pdf {
  padding: 12px;
  display: grid;
  place-items: start center;
  overflow: auto;
}

.multi-page-preview {
  gap: 18px;
}

.preview-page {
  width: min(calc(100% * var(--zoom)), 1200px);
  margin: 0;
  display: grid;
  gap: 8px;
}

.preview-page > span {
  justify-self: start;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(119, 154, 255, 0.16);
  font-size: 11px;
}

.preview-document,
.preview-image {
  width: calc(100% * var(--zoom));
  min-height: calc(100% * var(--zoom));
  height: calc(100% * var(--zoom));
  border: 0;
  border-radius: 12px;
  background: white;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28);
}

.preview-scroll-pdf .preview-document {
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: 0;
  box-shadow: none;
}

.pdf-canvas-preview {
  width: min(100%, 1180px);
  min-height: 100%;
  display: grid;
  place-items: start center;
}

.pdf-loading {
  width: 100%;
  min-height: 420px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 30px;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
  background: white;
}

.pdf-loading strong {
  color: #172033;
}

.pdf-loading.error strong {
  color: #a73552;
}

.pdf-page-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  background: white;
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.28);
}

.preview-image {
  width: min(calc(100% * var(--zoom)), 1400px);
  height: auto;
  min-height: 0;
  object-fit: contain;
}

.preview-page .preview-image {
  width: 100%;
}

.preview-empty {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.preview-empty strong {
  color: white;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.status.due {
  color: var(--amber);
  background: rgba(255, 209, 102, 0.08);
  border-color: rgba(255, 209, 102, 0.22);
}

.status.future {
  color: var(--cyan);
  background: rgba(101, 213, 255, 0.08);
  border-color: rgba(101, 213, 255, 0.24);
}

.status.soon {
  color: var(--amber);
  background: rgba(255, 209, 102, 0.09);
  border-color: rgba(255, 209, 102, 0.28);
}

.status.late {
  color: var(--rose);
  background: rgba(255, 107, 139, 0.08);
  border-color: rgba(255, 107, 139, 0.26);
}

.status.paid {
  color: var(--green);
  background: rgba(115, 230, 162, 0.08);
  border-color: rgba(115, 230, 162, 0.22);
}

.status-future {
  border-color: rgba(101, 213, 255, 0.16);
}

.status-soon {
  border-color: rgba(255, 209, 102, 0.22);
}

.status-late {
  border-color: rgba(255, 107, 139, 0.26);
}

.status-paid {
  border-color: rgba(115, 230, 162, 0.2);
}

.reminder-item {
  position: relative;
  overflow: hidden;
}

.reminder-item span,
.reminder-item strong {
  position: relative;
}

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

.utility-card {
  min-width: 0;
  padding: 16px;
  border-radius: 20px;
  background: var(--field);
  border: 1px solid rgba(119, 154, 255, 0.22);
  box-shadow: 0 0 24px rgba(77, 116, 255, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.utility-head,
.utility-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 10px;
}

.utility-head span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--cat);
  font-weight: 760;
  line-height: 1.12;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.utility-head strong {
  min-width: 0;
  color: white;
  font-size: 20px;
  line-height: 1.05;
  text-align: right;
  white-space: normal;
}

.usage-meter {
  height: 10px;
  margin: 18px 0 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(180, 196, 226, 0.12);
}

.usage-meter span {
  display: block;
  width: var(--fill);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cat), rgba(255, 255, 255, 0.72));
  box-shadow: 0 0 22px color-mix(in srgb, var(--cat) 42%, transparent);
}

.utility-foot {
  color: var(--muted);
  font-size: 12px;
}

.utility-foot span,
.utility-foot em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.utility-foot em {
  color: var(--cat);
  font-style: normal;
  text-align: right;
  white-space: normal;
}

.section {
  display: none;
}

.section.is-active {
  display: block;
}

.section-head {
  margin: 8px 0 16px;
}

.section-head h3 {
  margin: 0;
  font-size: 22px;
}

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

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

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  border-radius: 12px;
  color: var(--text);
  background: var(--field);
  border: 1px solid rgba(119, 154, 255, 0.22);
  padding: 0 14px;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(120, 154, 255, 0.62);
  box-shadow: 0 0 0 3px rgba(95, 124, 255, 0.14), 0 0 26px rgba(79, 118, 255, 0.18);
}

.dropzone {
  min-height: 152px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 22px;
  color: var(--muted);
  background: rgba(36, 46, 78, 0.34);
  border: 1px dashed rgba(143, 162, 255, 0.46);
  box-shadow: inset 0 0 34px rgba(80, 110, 220, 0.07);
}

.dropzone input,
.upload-btn input {
  display: none;
}

.dropzone strong {
  display: block;
  margin-top: 10px;
  color: white;
}

.dropzone span {
  display: block;
  max-width: 780px;
  margin: 8px auto 0;
  line-height: 1.4;
}

.upload-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  color: white;
  background: var(--field);
  border: 1px solid rgba(119, 154, 255, 0.24);
  cursor: pointer;
}

.upload-btn:first-child {
  background: rgba(69, 97, 225, 0.58);
  border-color: rgba(120, 154, 255, 0.7);
  box-shadow: 0 0 22px rgba(76, 116, 255, 0.2), inset 0 0 20px rgba(95, 124, 255, 0.14);
}

.scan-progress {
  position: relative;
  height: 10px;
  max-width: 360px;
  margin: 18px auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.scan-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(95, 124, 255, 0.6), rgba(101, 207, 255, 0.72));
  box-shadow: 0 0 24px rgba(95, 124, 255, 0.22);
  animation: scan-progress 1.25s ease-in-out infinite;
}

@keyframes scan-progress {
  0% {
    transform: translateX(-105%);
  }
  55% {
    transform: translateX(92%);
  }
  100% {
    transform: translateX(245%);
  }
}

.ai-result {
  margin-top: 16px;
  display: none;
}

.ai-result.is-visible {
  display: block;
}

.magic-success {
  display: none;
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  color: white;
  background:
    linear-gradient(145deg, rgba(115, 230, 162, 0.14), rgba(38, 51, 82, 0.38)),
    radial-gradient(circle at 92% 10%, rgba(101, 207, 255, 0.16), transparent 34%);
  border: 1px solid rgba(115, 230, 162, 0.28);
  box-shadow: 0 0 34px rgba(115, 230, 162, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.magic-success.is-visible {
  display: grid;
  gap: 14px;
}

.magic-success-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.magic-success-head > span {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #07101f;
  background: var(--green);
  box-shadow: 0 0 24px rgba(115, 230, 162, 0.22);
}

.magic-success-head strong {
  display: block;
  font-size: 18px;
}

.magic-success-head p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.magic-success-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.magic-success-grid div {
  min-width: 0;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(155, 181, 245, 0.16);
}

.magic-success-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.magic-success-grid strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

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

.magic-invoice-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px 12px 12px 15px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(155, 181, 245, 0.16);
}

.magic-invoice-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--cat);
}

.magic-invoice-row div {
  min-width: 0;
}

.magic-invoice-row div:last-child {
  text-align: right;
}

.magic-invoice-row strong,
.magic-invoice-row span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.magic-invoice-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.manual-entry-title {
  margin-top: 2px;
  padding-top: 2px;
  color: white;
}

.scan-error {
  color: var(--rose);
  border-color: rgba(255, 107, 139, 0.26);
  background: rgba(255, 107, 139, 0.08);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(390px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 18px;
  color: white;
  background: rgba(22, 25, 34, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 200ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.empty {
  padding: 26px;
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.hide-desktop {
  display: none;
}

.mobile-active {
  margin-top: 16px;
}

svg.icon {
  width: 22px;
  height: 22px;
  stroke-width: 2;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 78px minmax(350px, 410px) minmax(360px, 1fr);
    gap: 16px;
  }

  .view-mobile .workspace {
    grid-template-columns: 78px minmax(350px, 410px);
  }

  .view-web .workspace {
    grid-template-columns: minmax(420px, 1fr);
    max-width: calc(100vw - 48px);
  }

  .desktop-panel {
    padding: 22px;
  }

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

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

  .detail-modal {
    grid-template-columns: 1fr;
    overflow: hidden auto;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .invoice-preview {
    min-height: 560px;
  }
}

@media (max-width: 860px) {
  .app-topbar {
    display: none;
  }

  .app {
    padding: 0;
  }

  .workspace {
    display: block;
    max-width: none;
  }

  .rail,
  .desktop-panel {
    display: none;
  }

  .phone {
    position: static;
    display: block;
    max-height: none;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    padding: max(18px, env(safe-area-inset-top)) 16px 104px;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
  }

  .view-web .phone,
  .view-mobile .phone,
  .view-both .phone {
    display: block;
  }

  .tabbar {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(394px, calc(100vw - 36px));
  }

  .phone-tabbar {
    display: none;
  }

  .mobile-global-tabbar {
    display: grid;
  }

  .hide-desktop {
    display: block;
  }

  .detail-backdrop {
    padding: 0;
  }

  .detail-modal {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    border: 0;
    grid-template-columns: 1fr;
    padding: 10px;
  }

  .detail-grid,
  .energy-detail-grid {
    grid-template-columns: 1fr;
  }

  .invoice-preview {
    min-height: 520px;
  }
}

@media (max-width: 430px) {
  .title h1 {
    font-size: 28px;
  }

  .menu-btn,
  .bell-btn {
    width: 50px;
    height: 50px;
  }

  .shortcuts {
    gap: 6px;
  }

  .shortcut-icon {
    width: 52px;
    height: 52px;
  }

  .energy-card {
    padding: 18px;
  }

  .metric {
    font-size: 40px;
  }

  .mini-grid {
    gap: 12px;
  }

  .stats-strip,
  .utility-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .utility-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 82px;
    padding: 13px;
  }

  .stat-card strong {
    font-size: 18px;
  }

  .mini-card {
    min-height: 166px;
    padding: 16px;
  }

  .ring {
    width: 104px;
    height: 104px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .payment-row {
    align-items: flex-start;
  }

  .payment-row.has-actions,
  .payment-row:not(.has-actions) {
    grid-template-columns: minmax(0, 1fr);
  }

  .payment-amount {
    min-width: 0;
    text-align: left;
  }

  .payment-row.has-actions .payment-amount {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .payment-actions .ghost-btn,
  .payment-actions .danger-btn {
    flex: 1;
    padding: 0 10px;
  }
}
