:root {
  --bg: radial-gradient(1200px 680px at 18% 10%, #0e2450 0%, transparent 55%),
    radial-gradient(1100px 560px at 82% 84%, #1f4f87 0%, transparent 58%),
    linear-gradient(150deg, #050c1f 0%, #091739 40%, #071022 100%);
  --surface: linear-gradient(145deg, rgba(12, 32, 77, 0.42), rgba(9, 23, 48, 0.26));
  --surface-strong: linear-gradient(145deg, rgba(19, 40, 85, 0.58), rgba(9, 21, 40, 0.36));
  --surface-border: rgba(147, 223, 255, 0.2);
  --surface-gloss: linear-gradient(145deg, rgba(197, 238, 255, 0.17), rgba(127, 180, 255, 0.01));
  --text: #eaf4ff;
  --text-soft: #bdd3ee;
  --muted: #8da9d0;
  --line: rgba(160, 200, 244, 0.16);
  --primary: #48c7f8;
  --primary-dark: #34b0ea;
  --primary-strong: #77e2ff;
  --income: #4ef2be;
  --expense: #ff6d83;
  --shadow-soft: 0 24px 48px rgba(1, 8, 20, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  --shadow-strong: 0 34px 68px rgba(0, 18, 45, 0.52), 0 0 0 1px rgba(160, 230, 255, 0.22);
  --shadow: var(--shadow-soft);
  --radius: 16px;
  --pointer-x: 0;
  --pointer-y: 0;
  font-family:
    "Pretendard",
    "Noto Sans KR",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    "Inter",
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

body {
  min-height: 100dvh;
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(
      1100px 300px at calc(50% + (var(--pointer-x) * 54px)) calc(15% - (var(--pointer-y) * 26px)),
      rgba(124, 205, 255, 0.26),
      transparent 76%
    ),
    radial-gradient(500px 290px at 12% 14%, rgba(104, 190, 255, 0.32), transparent 70%),
    radial-gradient(640px 460px at 88% 8%, rgba(89, 137, 255, 0.24), transparent 69%),
    var(--bg);
  position: relative;
  overflow-x: hidden;
  transition: background-position 220ms ease;
}

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

body::before {
  background:
    radial-gradient(circle at 34% 36%, rgba(168, 246, 255, 0.19), transparent 60%),
    linear-gradient(120deg, transparent 45%, rgba(255, 255, 255, 0.1) 48%, transparent 58%);
  mix-blend-mode: screen;
  opacity: 0.76;
}

body::after {
  background-image:
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.03) 0 1px,
      transparent 1px 26px
    ),
    linear-gradient(85deg, rgba(255, 255, 255, 0.07), transparent 36%);
  opacity: 0.2;
}

.glass-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px) saturate(190%) brightness(110%);
  -webkit-backdrop-filter: blur(20px) saturate(190%) brightness(110%);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0.01) 45%,
      rgba(255, 255, 255, 0.02) 45%,
      transparent
    );
  opacity: 0.65;
}

.glass-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: var(--surface-gloss);
  opacity: 0;
  transition: opacity 180ms ease;
}

.glass-card:hover::after {
  opacity: 1;
}

.tilt-card {
  --card-tilt-x: 0deg;
  --card-tilt-y: 0deg;
  transform: perspective(1250px) rotateX(var(--card-tilt-x)) rotateY(var(--card-tilt-y));
  transition:
    transform 250ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 250ms ease,
    border-color 220ms ease;
  transform-style: preserve-3d;
}

.tilt-card:hover {
  box-shadow: var(--shadow-strong);
  border-color: rgba(169, 232, 255, 0.34);
}

.glow {
  box-shadow:
    inset 0 0 0 1px rgba(188, 238, 255, 0.2),
    0 0 0 1px rgba(70, 175, 255, 0.17),
    0 0 50px rgba(70, 196, 255, 0.2);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: rgba(9, 22, 50, 0.95);
  color: #ecf5ff;
  border: 1px solid rgba(151, 230, 255, 0.34);
  padding: 10px 14px;
  border-radius: 10px;
  white-space: nowrap;
}

.skip-link:not(:focus-visible) {
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  padding: 0;
}

.skip-link:focus-visible {
  width: auto;
  height: auto;
  clip: auto;
  clip-path: none;
}

.app-shell {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 54px;
  position: relative;
}

.app-shell::before {
  content: "";
  position: absolute;
  inset: 0 -22px;
  pointer-events: none;
  border-radius: 28px;
  border: 1px solid rgba(130, 208, 255, 0.14);
  background: linear-gradient(120deg, rgba(130, 208, 255, 0.09), rgba(40, 89, 160, 0));
  z-index: -1;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 14px;
}

.auth-card {
  width: min(470px, 100%);
  padding: 28px 24px 28px;
  text-align: center;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(22, 50, 93, 0.72), rgba(8, 22, 54, 0.5)),
    radial-gradient(circle at 84% 18%, rgba(123, 226, 255, 0.22), transparent 60%);
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2.35rem);
  letter-spacing: -0.01em;
}

.auth-message {
  margin-top: 10px;
  color: var(--muted);
  min-height: 22px;
}

.auth-message:empty {
  min-height: 0;
  display: none;
}

.google-signin-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0 2px;
}

#google-signin-button {
  transform: translateZ(0);
}

#google-signin-button iframe {
  border-radius: 12px !important;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  color: var(--text);
}

h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
}

h2 {
  font-size: 1.14rem;
}

.header-actions,
.filters,
.form-actions,
.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.month-picker {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select {
  min-height: 44px;
  width: 100%;
  border: 1px solid rgba(161, 208, 248, 0.36);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(16, 39, 82, 0.75), rgba(10, 27, 57, 0.58));
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 140ms ease;
  backdrop-filter: blur(10px);
}

select option {
  background: #081c3f;
  color: #e4f0ff;
}

input::placeholder {
  color: rgba(192, 214, 240, 0.68);
}

input:focus,
select:focus,
button:focus-visible,
.file-button:focus-within {
  border-color: var(--primary-strong);
  box-shadow: 0 0 0 4px rgba(87, 208, 255, 0.16);
}

input:focus,
select:focus {
  transform: translateY(-1px);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(153, 208, 255, 0.38);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 50, 93, 0.84), rgba(10, 24, 52, 0.68));
  color: var(--text);
  backdrop-filter: blur(10px);
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(181, 233, 255, 0.5);
  box-shadow: 0 10px 24px rgba(32, 144, 232, 0.28);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 6px 12px;
  border: 1px solid rgba(167, 222, 255, 0.32);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(27, 59, 102, 0.7), rgba(16, 37, 74, 0.55));
  backdrop-filter: blur(10px);
}

.user-chip img {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(180, 230, 255, 0.6);
}

.user-chip-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.user-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
}

.user-chip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  color: var(--muted);
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card,
.entry-panel,
.analysis-panel,
.transactions-section {
  background: var(--surface-strong);
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px) saturate(170%);
  -webkit-backdrop-filter: blur(16px) saturate(170%);
}

.metric-card {
  display: grid;
  gap: 6px;
  min-height: 124px;
  padding: 18px;
}

.metric-card.accent {
  border-color: rgba(78, 236, 190, 0.25);
  background: linear-gradient(145deg, rgba(31, 87, 147, 0.72), rgba(7, 24, 56, 0.46));
}

.metric-label,
.metric-card small {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-card strong {
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.entry-panel,
.analysis-panel,
.transactions-section {
  padding: 20px;
}

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

form {
  display: grid;
  gap: 14px;
}

form label {
  display: grid;
  gap: 6px;
  color: var(--text-soft);
  font-size: 0.86rem;
  font-weight: 700;
}

.field-row > label {
  flex: 1;
  min-width: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(150, 211, 253, 0.34);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(20, 42, 83, 0.7), rgba(10, 23, 54, 0.58));
}

.segmented-control label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 40px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 6px;
  transition:
    background 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease;
}

.segmented-control input:checked + span {
  background: linear-gradient(180deg, rgba(58, 172, 255, 0.2), rgba(42, 113, 194, 0.2));
  color: var(--text);
  box-shadow:
    inset 0 0 0 1px rgba(156, 227, 255, 0.48),
    0 10px 24px rgba(11, 37, 79, 0.5);
}

.primary-button,
.secondary-button,
.ghost-button,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 800;
  background-clip: padding-box;
  transition:
    transform 150ms ease,
    background 150ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.primary-button {
  flex: 1;
  color: #f8fbff;
  background: linear-gradient(135deg, #2f9fff 0%, #2fd5f8 100%);
  border-color: rgba(196, 245, 255, 0.4);
  box-shadow: 0 12px 24px rgba(46, 165, 246, 0.24);
}

.primary-button:hover {
  background: linear-gradient(135deg, #38b4ff 0%, #34e7ff 100%);
  transform: translateY(-1px);
  border-color: rgba(206, 252, 255, 0.56);
}

.secondary-button,
.ghost-button,
.table-action {
  background: linear-gradient(180deg, rgba(24, 49, 89, 0.8), rgba(11, 29, 63, 0.68));
  color: var(--text);
  border-color: rgba(136, 193, 255, 0.34);
}

.secondary-button:hover,
.ghost-button:hover,
.table-action:hover {
  border-color: rgba(198, 241, 255, 0.55);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(44, 118, 214, 0.26);
}

.ghost-button {
  min-height: 38px;
  padding: 8px 12px;
  color: #c0e9ff;
}

.chart-area {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}

.donut-wrap {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.donut {
  --expense-share: 0%;
  display: grid;
  place-items: center;
  width: 188px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--expense) var(--expense-share), var(--income) 0);
  position: relative;
  box-shadow: inset 0 0 0 10px rgba(3, 17, 39, 0.45), 0 8px 30px rgba(24, 88, 171, 0.35);
}

.donut::after {
  content: "";
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: linear-gradient(150deg, rgba(15, 41, 84, 0.62), rgba(5, 18, 42, 0.46));
}

.donut span {
  position: relative;
  z-index: 1;
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--text);
}

.legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
}

.expense-dot {
  background: var(--expense);
}

.income-dot {
  background: var(--income);
}

.category-list {
  display: grid;
  gap: 12px;
}

.category-row {
  display: grid;
  gap: 6px;
}

.category-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}

.category-meta strong {
  color: var(--text);
}

.category-meta span {
  color: var(--muted);
  white-space: nowrap;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(141, 188, 245, 0.16);
}

.bar span {
  display: block;
  width: var(--bar-width);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ce8b6, #35c3ff);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  max-width: 220px;
  border: 1px solid rgba(140, 212, 255, 0.24);
  border-radius: 999px;
  background: rgba(41, 129, 201, 0.17);
  color: #d2edff;
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.transactions-heading {
  align-items: flex-start;
}

.filters {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-field {
  position: relative;
}

.search-field svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  width: min(280px, 100%);
  padding-left: 40px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(13, 33, 70, 0.45), rgba(6, 22, 48, 0.42));
  box-shadow: var(--shadow-soft);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(154, 205, 255, 0.14);
  vertical-align: middle;
}

th {
  color: #c7ddf7;
  font-size: 0.78rem;
  text-transform: uppercase;
  background: linear-gradient(180deg, rgba(42, 86, 146, 0.58), rgba(24, 47, 95, 0.28));
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: rgba(70, 170, 255, 0.08);
}

.amount-col,
.amount-cell {
  text-align: right;
}

.amount-cell {
  font-weight: 900;
  white-space: nowrap;
}

.amount-cell.expense {
  color: var(--expense);
}

.amount-cell.income {
  color: var(--income);
}

.type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.type-badge.expense {
  background: rgba(255, 104, 129, 0.17);
  color: #ffe2e5;
}

.type-badge.income {
  background: rgba(78, 237, 192, 0.2);
  color: #d7fff1;
}

.actions-col,
.actions-cell {
  width: 116px;
  text-align: right;
}

.actions-cell {
  white-space: nowrap;
}

.table-action {
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
}

.table-action.delete {
  color: #ff97a8;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 36px 16px 20px;
  color: var(--muted);
  text-align: center;
  border-top: 1px dashed rgba(144, 200, 255, 0.19);
}

.empty-state svg {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.empty-state strong {
  color: var(--text);
}

@media (max-width: 980px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid,
  .chart-area {
    grid-template-columns: 1fr;
  }

  .chart-area {
    gap: 16px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1220px);
    padding-top: 20px;
  }

  .app-header,
  .transactions-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions,
  .filters,
  .field-row {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .user-chip {
    max-width: 100%;
    width: 100%;
  }

  .month-picker {
    flex: 1 0 100%;
  }

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

  .search-field input,
  .filters select,
  .month-picker input {
    width: 100%;
  }

  .entry-panel,
  .analysis-panel,
  .transactions-section {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
}
