:root {
  color-scheme: light;
  --bg: #f7f4ee;
  --paper: rgba(255, 255, 255, 0.86);
  --paper-solid: #fffdf8;
  --glass: rgba(255, 255, 255, 0.2);
  --glass-strong: rgba(255, 255, 255, 0.32);
  --ink: #132033;
  --muted: #697386;
  --line: rgba(35, 50, 71, 0.12);
  --aegean: #1767a8;
  --aegean-deep: #0f3f73;
  --sky: #d8ecf7;
  --olive: #65784f;
  --terracotta: #c66a45;
  --sand: #eadbc2;
  --mint: #dce9dc;
  --rose: #f3d4cc;
  --shadow-soft: 0 22px 70px rgba(31, 44, 63, 0.14);
  --shadow-card: 0 16px 36px rgba(31, 44, 63, 0.1);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(216, 236, 247, 0.92), rgba(247, 244, 238, 0.4) 40rem),
    linear-gradient(225deg, rgba(198, 106, 69, 0.14), transparent 34rem),
    linear-gradient(180deg, #fbf7ee, var(--bg));
  color: var(--ink);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(19, 32, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 32, 51, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, black, transparent 78%);
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.42), transparent 24%, transparent 76%, rgba(255, 255, 255, 0.28)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 48%);
  mix-blend-mode: soft-light;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border: 1px solid var(--line);
}

button {
  cursor: pointer;
}

main,
.topbar {
  width: min(1160px, 100%);
  margin: 0 auto;
  padding: 16px;
}

main {
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 22px;
  animation: fadeUp 420ms ease both;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
}

.sync-status {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(23, 103, 168, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--aegean-deep);
  box-shadow:
    0 8px 18px rgba(31, 44, 63, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
  backdrop-filter: blur(16px) saturate(1.16);
}

.sync-status.offline {
  border-color: rgba(198, 103, 64, 0.2);
  color: var(--terracotta);
}

.notify-toggle {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(23, 103, 168, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.44);
  color: var(--aegean-deep);
  box-shadow:
    0 8px 18px rgba(31, 44, 63, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  font-size: 0.72rem;
  font-weight: 950;
  backdrop-filter: blur(16px) saturate(1.16);
}

.notify-toggle.enabled {
  border-color: rgba(101, 120, 79, 0.28);
  color: var(--olive);
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(247, 244, 238, 0.76), rgba(216, 236, 247, 0.88)),
    rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(18px);
}

.auth-card {
  position: relative;
  overflow: hidden;
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.64)),
    url("../assets/greece-hero.png") center 34% / cover;
  box-shadow: var(--shadow-soft);
  animation: fadeUp 360ms ease both;
}

.auth-card::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.38) 56%, rgba(13, 67, 116, 0.18)),
    rgba(255, 255, 255, 0.18);
}

.auth-card h2 {
  max-width: none;
  margin: 6px 0 8px;
  font-size: clamp(2.45rem, 10vw, 3.65rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.auth-card > span {
  display: block;
  max-width: 24ch;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 1.02rem;
  font-weight: 780;
  line-height: 1.28;
}

.auth-sent > span {
  max-width: 28ch;
}

.auth-notice {
  margin: -8px 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(199, 99, 61, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 247, 240, 0.84), rgba(255, 255, 255, 0.56)),
    rgba(255, 255, 255, 0.48);
  color: var(--terracotta);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
  font-weight: 850;
  line-height: 1.28;
}

.mail-steps {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.mail-steps span {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
  font-weight: 850;
}

.mail-status {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 26px 0;
}

.mail-status span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--aegean);
  box-shadow: 0 6px 18px rgba(14, 107, 177, 0.28);
  animation: mailPulse 900ms ease-in-out infinite;
}

.mail-status span:nth-child(2) {
  animation-delay: 120ms;
}

.mail-status span:nth-child(3) {
  animation-delay: 240ms;
}

.otp-input {
  text-align: center;
  font-size: 1.45rem !important;
  letter-spacing: 0.18em !important;
}

.auth-card label {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  color: var(--aegean-deep);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-card input {
  width: 100%;
  padding: 15px 16px;
  border-color: rgba(23, 103, 168, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 10px 24px rgba(31, 44, 63, 0.08);
  font-size: 1.04rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
}

.auth-card .primary-button {
  border-radius: 18px;
  background:
    linear-gradient(135deg, #1978bb, #0d4d87),
    var(--aegean);
  box-shadow:
    0 18px 40px rgba(15, 63, 115, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.ghost-button {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(23, 103, 168, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--aegean-deep);
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  overflow-wrap: anywhere;
  font-size: clamp(1.55rem, 7vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.08rem;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--aegean);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero-panel .eyebrow,
.hero-panel .muted {
  color: rgba(255, 255, 255, 0.84);
}

.muted,
.hint,
small {
  color: var(--muted);
}

.hero-panel {
  position: relative;
  display: grid;
  min-height: clamp(250px, 36vh, 390px);
  gap: 22px;
  align-content: center;
  justify-items: center;
  overflow: hidden;
  padding: clamp(22px, 6vw, 42px);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(8, 21, 35, 0.22), rgba(8, 21, 35, 0.74)),
    url("../assets/greece-hero.png") center / cover;
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.42);
  isolation: isolate;
  animation: panelRise 560ms ease both;
}

.hero-panel::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(120deg, rgba(15, 63, 115, 0.54), rgba(15, 63, 115, 0.08) 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 42%);
}

.hero-total {
  width: min(100%, 360px);
  text-align: center;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(6, 18, 32, 0.34)),
    rgba(6, 18, 32, 0.28);
  box-shadow:
    0 18px 45px rgba(0, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
  backdrop-filter: blur(22px) saturate(1.25);
}

.mega {
  display: block;
  margin: 4px 0 0;
  color: white;
  font-size: clamp(2.35rem, 12vw, 4.45rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.hero-total small {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button,
.icon-button {
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0 16px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.66)),
    var(--paper-solid);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  border-color: transparent;
  background: linear-gradient(135deg, var(--aegean), var(--aegean-deep));
  color: white;
  box-shadow: 0 16px 34px rgba(23, 103, 168, 0.28);
  font-weight: 900;
}

.icon-button {
  width: 46px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 28px rgba(31, 44, 63, 0.08);
  font-size: 1.35rem;
}

.primary-button:hover,
.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 30px rgba(31, 44, 63, 0.14);
}

.full {
  width: 100%;
}

.tabs {
  position: fixed;
  right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 18;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  width: min(500px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.25)),
    rgba(255, 255, 255, 0.18);
  box-shadow:
    0 14px 38px rgba(31, 44, 63, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(24px) saturate(1.22);
}

.tab {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 48px;
  place-items: center;
  gap: 2px;
  padding: 6px 4px;
  border: 0;
  border-radius: 999px;
  color: var(--aegean-deep);
  background: transparent;
  box-shadow: none;
  font-size: 1.05rem;
  font-weight: 850;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.tab span,
.tab small {
  pointer-events: none;
}

.tab span {
  line-height: 1;
}

.tab small {
  max-width: 100%;
  overflow: hidden;
  color: inherit;
  font-size: 0.62rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab.active {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.22)),
    rgba(255, 255, 255, 0.18);
  color: var(--aegean-deep);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.54),
    0 8px 18px rgba(31, 44, 63, 0.07);
}

.tab.active::after {
  position: absolute;
  right: 28%;
  bottom: 5px;
  left: 28%;
  height: 3px;
  border-radius: 999px;
  content: "";
  background: rgba(23, 103, 168, 0.7);
}

.tab-add-button {
  position: relative;
  display: grid;
  width: 58px;
  height: 58px;
  place-self: center;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.22) 24%, transparent 38%),
    linear-gradient(145deg, rgba(79, 152, 207, 0.96), rgba(15, 82, 139, 0.94) 58%, rgba(12, 42, 72, 0.96));
  color: white;
  box-shadow:
    0 16px 34px rgba(15, 82, 139, 0.32),
    0 0 0 7px rgba(255, 255, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -14px 24px rgba(7, 31, 53, 0.22);
  font-size: 0;
  transform: translateY(-9px);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease,
    background 160ms ease;
  backdrop-filter: blur(20px) saturate(1.26);
}

.tab-add-button::before {
  position: absolute;
  width: 22px;
  height: 22px;
  content: "";
  background:
    linear-gradient(currentColor, currentColor) center / 100% 3px no-repeat,
    linear-gradient(currentColor, currentColor) center / 3px 100% no-repeat;
  border-radius: 2px;
}

.tab-add-button::after {
  position: absolute;
  inset: 6px 10px auto;
  height: 34%;
  border-radius: 999px;
  content: "";
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent);
  opacity: 0.34;
  pointer-events: none;
}

.tab-add-button:hover {
  filter: saturate(1.1) brightness(1.02);
  transform: translateY(-11px) scale(1.035);
  box-shadow:
    0 20px 40px rgba(15, 82, 139, 0.38),
    0 0 0 9px rgba(255, 255, 255, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    inset 0 -16px 26px rgba(7, 31, 53, 0.2);
}

.tab-add-button:active {
  transform: translateY(-5px) scale(0.93);
  box-shadow:
    0 10px 24px rgba(15, 82, 139, 0.28),
    0 0 0 14px rgba(255, 255, 255, 0.12),
    inset 0 3px 12px rgba(7, 31, 53, 0.26);
}

.tab:hover {
  transform: translateY(-2px);
}

.section {
  padding: 28px 0 8px;
  scroll-margin-top: 82px;
  animation: fadeUp 420ms ease both;
}

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

.metric-grid + .section-title {
  margin-top: 26px;
}

.personal-panel {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(23, 103, 168, 0.16), rgba(255, 255, 255, 0.48)),
    rgba(255, 255, 255, 0.34);
  box-shadow:
    var(--shadow-card),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(22px) saturate(1.18);
}

.personal-panel h2 {
  margin-top: 2px;
  font-size: clamp(1.35rem, 6vw, 2rem);
}

.personal-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.personal-stats span {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.personal-stats b {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-title > span {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.metric-card,
.expense-card,
.settlement-card,
.category-list {
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.32)),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    var(--shadow-card),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px) saturate(1.18);
}

.metric-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  min-height: 108px;
  overflow: hidden;
  padding: 12px;
  animation: cardIn 460ms ease both;
}

.metric-card::after {
  position: absolute;
  right: -30px;
  bottom: -42px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  content: "";
  background: rgba(23, 103, 168, 0.08);
}

.metric-card.credit::after {
  background: rgba(96, 131, 72, 0.16);
}

.metric-card.debt::after {
  background: rgba(198, 103, 64, 0.16);
}

.metric-card strong {
  grid-column: 1 / -1;
  position: relative;
  display: block;
  margin-top: 10px;
  font-size: 1.55rem;
  line-height: 1.05;
}

.metric-card > div {
  display: grid;
  align-content: center;
  min-width: 0;
}

.metric-card > div > span {
  overflow: hidden;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card > div > small {
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-card.debt strong,
.negative {
  color: var(--terracotta);
}

.metric-card.credit strong,
.positive {
  color: var(--olive);
}

.filters,
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.expenses-toolbar {
  display: block;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.34)),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    var(--shadow-card),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px) saturate(1.18);
}

.expenses-toolbar strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.expenses-toolbar span {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-field {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.28)),
    rgba(255, 255, 255, 0.2);
  box-shadow:
    0 8px 20px rgba(31, 44, 63, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(16px) saturate(1.16);
}

.search-field span {
  color: var(--muted);
  font-size: 1rem;
}

.search-field input {
  min-height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 1rem;
  font-weight: 760;
}

.search-field input:focus {
  box-shadow: none;
}

.chip-filter {
  display: flex;
  gap: 7px;
  margin: 0 -16px 8px;
  padding: 0 16px 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chip-filter::-webkit-scrollbar {
  display: none;
}

.chip-filter button {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 32px;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.24)),
    rgba(255, 255, 255, 0.18);
  color: var(--aegean-deep);
  box-shadow:
    0 5px 14px rgba(31, 44, 63, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
  font-weight: 760;
  backdrop-filter: blur(14px) saturate(1.14);
}

.chip-filter button.active {
  border-color: rgba(23, 103, 168, 0.24);
  background:
    linear-gradient(180deg, rgba(216, 236, 247, 0.72), rgba(255, 255, 255, 0.3)),
    rgba(23, 103, 168, 0.12);
  color: var(--aegean-deep);
  box-shadow:
    0 8px 18px rgba(23, 103, 168, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  font-weight: 900;
}

select,
input,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.46)),
    rgba(255, 255, 255, 0.34);
  color: var(--ink);
  box-shadow:
    0 10px 22px rgba(31, 44, 63, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(14px) saturate(1.16);
  font-size: 16px;
  outline: 0;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

select:focus,
input:focus,
textarea:focus {
  border-color: color-mix(in srgb, var(--aegean), white 18%);
  box-shadow: 0 0 0 4px rgba(23, 103, 168, 0.12);
}

textarea {
  resize: vertical;
}

.expense-list,
.settlement-list {
  display: grid;
  gap: 14px;
}

.expense-day-group {
  display: grid;
  gap: 8px;
}

.expense-date-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  color: var(--muted);
}

.expense-date-label span {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 950;
  text-transform: capitalize;
}

.expense-date-label small {
  font-size: 0.78rem;
  font-weight: 820;
}

.expense-card {
  display: grid;
  align-items: center;
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.3)),
    rgba(255, 255, 255, 0.24);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.expense-card:hover {
  border-color: rgba(255, 255, 255, 0.72);
  transform: translateY(-2px);
  box-shadow:
    0 18px 40px rgba(31, 44, 63, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

.expense-main {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.expense-main span:nth-child(2) {
  min-width: 0;
}

.expense-main strong,
.expense-main small,
.expense-main em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-main em {
  margin-top: 3px;
  color: var(--aegean-deep);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.expense-main b {
  grid-column: 2;
  margin-top: 2px;
  color: var(--ink);
  font-size: 1.15rem;
  white-space: nowrap;
}

.category-badge,
.category-dot {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--cat) 16%, white 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

.category-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.category-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.24);
}

.category-row span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.category-row b {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-row small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.compact-category-list {
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
}

.compact-category-list .category-dot {
  width: 32px;
  height: 32px;
}

.detailed-balance-card {
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.3)),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    0 12px 26px rgba(31, 44, 63, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px) saturate(1.18);
}

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

.detailed-balance-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  overflow: hidden;
  position: relative;
  min-height: 86px;
  padding: 15px 15px 15px 18px;
  isolation: isolate;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.detailed-balance-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: 4px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(96, 131, 72, 0.75), rgba(96, 131, 72, 0.34));
  content: "";
}

.detailed-balance-card::after {
  position: absolute;
  inset: auto -36px -48px auto;
  z-index: -1;
  width: 116px;
  height: 116px;
  border-radius: inherit;
  content: "";
  background: rgba(96, 131, 72, 0.1);
  filter: blur(18px);
}

.detailed-balance-card.debt::before {
  background: linear-gradient(180deg, rgba(198, 103, 64, 0.78), rgba(198, 103, 64, 0.36));
}

.detailed-balance-card.debt::after {
  background: rgba(198, 103, 64, 0.1);
}

.detailed-balance-card:hover {
  transform: translateY(-2px);
}

.balance-net {
  color: var(--olive);
  font-size: clamp(1.3rem, 6vw, 1.75rem);
  line-height: 1;
  white-space: nowrap;
}

.detailed-balance-card.debt .balance-net {
  color: var(--terracotta);
}

.detailed-balance-card.parents {
  margin-bottom: 8px;
}

.balance-person {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.balance-person strong {
  color: var(--ink);
  font-size: 1rem;
}

.balance-person span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parents-title {
  margin-top: 24px;
}

.balance-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.2fr) repeat(3, 1fr);
  gap: 8px;
  align-items: center;
  padding: 13px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}

.balance-row:last-child {
  border-bottom: 0;
}

.identity {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 850;
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.segmented button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.segmented .active {
  background: rgba(255, 255, 255, 0.76);
  color: var(--aegean-deep);
  box-shadow: 0 10px 20px rgba(23, 103, 168, 0.12);
}

.settlement-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.3)),
    rgba(255, 255, 255, 0.3);
  box-shadow:
    0 12px 26px rgba(31, 44, 63, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px) saturate(1.18);
}

.settlement-hero > div:first-child {
  display: grid;
  gap: 2px;
}

.settlement-hero span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.settlement-hero strong {
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.settlement-hero .segmented {
  flex: 0 0 auto;
}

.settlement-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
  overflow: hidden;
  min-height: 96px;
  padding: 15px;
  cursor: pointer;
  isolation: isolate;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    border-color 180ms ease;
}

.settlement-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: -1;
  width: 4px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(23, 103, 168, 0.75), rgba(99, 179, 230, 0.54));
  content: "";
}

.settlement-card:hover {
  transform: translateY(-2px);
}

.settlement-card.done {
  opacity: 0.68;
}

.settlement-card.done .settlement-amount {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.settlement-check {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.settlement-transfer {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 8px;
  align-items: center;
  min-width: 0;
}

.transfer-person {
  display: flex;
  min-width: 0;
  align-items: center;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
}

.transfer-person:last-child {
  justify-content: flex-start;
}

.transfer-arrow {
  color: var(--aegean);
  font-size: 1rem;
  font-weight: 900;
}

.settlement-amount {
  color: var(--ink);
  font-size: 1.45rem;
  line-height: 1;
}

.settlement-side {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.settlement-status {
  padding: 6px 10px;
  border: 1px solid rgba(23, 103, 168, 0.12);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.38)),
    rgba(216, 236, 247, 0.34);
  color: var(--aegean-deep);
  box-shadow: 0 6px 14px rgba(23, 103, 168, 0.08);
  font-size: 0.68rem;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.settlement-card.done .settlement-status {
  border-color: rgba(96, 131, 72, 0.16);
  background: rgba(255, 255, 255, 0.5);
  color: var(--olive);
}

.settlement-empty {
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.38);
  color: var(--muted);
  text-align: center;
}

.settlement-empty strong {
  color: var(--ink);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
  letter-spacing: 0.01em;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

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

.check-pill {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.44)),
    rgba(255, 255, 255, 0.32);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
  backdrop-filter: blur(12px);
  font-size: 0.9rem;
  font-weight: 850;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.check-pill input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--aegean);
}

.check-pill:has(input:checked) {
  border-color: rgba(23, 103, 168, 0.28);
  background:
    linear-gradient(180deg, rgba(216, 236, 247, 0.82), rgba(255, 255, 255, 0.52)),
    rgba(255, 255, 255, 0.42);
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  padding: 12px;
  pointer-events: none;
  background: rgba(12, 23, 35, 0);
  transition: background 180ms ease;
}

.sheet.open {
  pointer-events: auto;
  background: rgba(12, 23, 35, 0.38);
  backdrop-filter: blur(6px);
}

.sheet-panel {
  display: grid;
  max-height: 92vh;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.54)),
    rgba(255, 255, 255, 0.44);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
  transform: translateY(110%);
  transition: transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(26px) saturate(1.2);
}

.expense-sheet-hero {
  position: relative;
  display: flex;
  min-height: 96px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  overflow: hidden;
  margin: -4px -4px 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 63, 115, 0.86), rgba(23, 103, 168, 0.48)),
    url("../assets/greece-hero.png") center 36% / cover;
  box-shadow:
    0 16px 34px rgba(15, 63, 115, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
  color: white;
}

.expense-sheet-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(8, 21, 35, 0.38), transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent);
}

.expense-sheet-hero > * {
  position: relative;
  z-index: 1;
}

.expense-sheet-hero .eyebrow {
  color: rgba(255, 255, 255, 0.76);
}

.expense-sheet-hero h2 {
  margin-top: 5px;
  color: white;
  font-size: 1.38rem;
  line-height: 1;
}

.expense-sheet-hero .icon-button {
  background: rgba(255, 255, 255, 0.18);
  color: white;
  backdrop-filter: blur(18px);
}

.amount-focus {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.36)),
    rgba(255, 255, 255, 0.3);
  box-shadow:
    0 14px 30px rgba(31, 44, 63, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.amount-focus label {
  gap: 5px;
}

.amount-focus input {
  min-height: 52px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: clamp(2.1rem, 11vw, 3.55rem);
  font-weight: 900;
  letter-spacing: 0;
}

.amount-focus input:focus {
  box-shadow: none;
}

.amount-focus span {
  padding-bottom: 10px;
  color: var(--aegean-deep);
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.save-expense-button {
  min-height: 54px;
  margin-top: 2px;
  background:
    linear-gradient(135deg, rgba(23, 103, 168, 0.96), rgba(15, 63, 115, 0.92)),
    var(--aegean);
  box-shadow:
    0 16px 32px rgba(23, 103, 168, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.delete-expense-link {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--terracotta);
  font-size: 0.9rem;
  font-weight: 850;
}

.share-preview,
.delete-confirm {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.32)),
    rgba(255, 255, 255, 0.28);
  box-shadow:
    0 12px 26px rgba(31, 44, 63, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.share-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.share-preview-head div,
.share-preview-empty {
  display: grid;
  gap: 4px;
}

.share-preview strong,
.delete-confirm span {
  color: var(--ink);
  font-weight: 950;
}

.share-preview span,
.share-preview-empty span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 780;
}

.share-preview-head b {
  flex: 0 0 auto;
  color: var(--aegean-deep);
  font-size: 0.8rem;
}

.share-preview-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.share-preview-list div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(19, 32, 51, 0.06);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.34);
}

.share-preview-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-preview-list strong {
  font-size: 0.96rem;
}

.delete-confirm {
  border-color: rgba(198, 103, 64, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), rgba(243, 212, 204, 0.32)),
    rgba(255, 255, 255, 0.32);
}

.delete-confirm div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.delete-confirm button {
  min-height: 40px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-weight: 900;
}

.delete-confirm button:last-child {
  border-color: rgba(198, 103, 64, 0.24);
  color: var(--terracotta);
}

.sheet.open .sheet-panel {
  transform: translateY(0);
}

.toast {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 14px;
  left: 14px;
  z-index: 40;
  width: min(420px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.5)),
    rgba(255, 255, 255, 0.38);
  color: var(--ink);
  box-shadow:
    0 14px 34px rgba(31, 44, 63, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-18px);
  backdrop-filter: blur(22px) saturate(1.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  font-weight: 850;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast button {
  min-height: 32px;
  border: 1px solid rgba(23, 103, 168, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--aegean-deep);
  font-size: 0.82rem;
  font-weight: 900;
}

.toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

@keyframes panelRise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mailPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0) scale(0.86);
  }
  50% {
    opacity: 1;
    transform: translateY(-5px) scale(1);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  main,
  .topbar {
    padding-inline: 28px;
  }

  main {
    padding-bottom: calc(122px + env(safe-area-inset-bottom));
  }

  .hero-panel {
    min-height: 330px;
  }

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

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

  .sheet {
    justify-content: end;
    align-items: stretch;
    padding: 20px;
  }

  .sheet-panel {
    width: min(520px, 100vw);
    max-height: none;
    transform: translateX(110%);
  }

  .sheet.open .sheet-panel {
    transform: translateX(0);
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }

  .hero-panel {
    min-height: 280px;
    padding: 24px;
  }

  .tabs {
    right: 10px;
    left: 10px;
    width: calc(100vw - 20px);
    padding: 5px 7px;
  }

  .tab {
    min-height: 48px;
  }

  .category-row {
    grid-template-columns: auto 1fr;
  }

  .balance-row {
    grid-template-columns: 1fr;
  }

  .expense-main {
    grid-template-columns: auto 1fr;
  }

  .expense-main b {
    grid-column: 2;
  }
}

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

@media print {
  .topbar,
  .tabs,
  .primary-button,
  .icon-button,
  .sheet,
  .toast {
    display: none !important;
  }

  body {
    background: white;
  }

  main {
    width: 100%;
  }
}
