:root {
  --bg-top: #fff7ef;
  --bg-bottom: #eef4ff;
  --surface: rgba(255, 252, 247, 0.82);
  --text: #1f2430;
  --muted: #68707d;
  --line: rgba(31, 36, 48, 0.1);
  --brand: #ee7a47;
  --brand-deep: #b34d23;
  --accent: #3f78d7;
  --positive: #2f8d66;
  --warning: #b95b2f;
  --shadow: 0 22px 54px rgba(104, 73, 43, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Gowun Dodum", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.94), transparent 26%),
    radial-gradient(circle at bottom right, rgba(110, 158, 255, 0.16), transparent 24%),
    linear-gradient(135deg, var(--bg-top) 0%, #fffdf8 48%, var(--bg-bottom) 100%);
}

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

button {
  cursor: pointer;
}

.app-shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 34px 22px 48px;
}

.session-bar,
.session-pills,
.hero,
.main-grid,
.summary-grid,
.panel-header,
.plan-top,
.plan-item {
  display: flex;
}

.session-bar {
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.session-pills {
  flex-wrap: wrap;
  gap: 10px;
}

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

.back-link,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(104, 73, 43, 0.08);
}

.soft-pill {
  color: var(--muted);
}

.storage-mode,
.sync-status,
.user-pill,
.toolbar-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(104, 73, 43, 0.08);
}

.storage-mode {
  color: var(--text);
  font-weight: 700;
}

.sync-status.is-error {
  color: var(--warning);
  border-color: rgba(185, 91, 47, 0.24);
  background: rgba(255, 241, 232, 0.96);
}

.auth-link-button {
  justify-content: center;
}

#logoutButton[hidden] {
  display: none;
}

.hero {
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.hero-copy,
.hero-panel,
.panel,
.summary-card,
.category-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-panel,
.panel {
  padding: 28px;
}

.hero-copy {
  flex: 1.15;
}

.hero-panel {
  flex: 0.85;
}

.eyebrow,
.panel-label {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.hero h1,
.panel h2,
.summary-card h3,
.plan-title {
  margin: 12px 0 0;
}

.hero h1 {
  font-size: clamp(2rem, 3.6vw, 4rem);
  line-height: 1.04;
}

.hero-text,
.summary-copy,
.plan-note,
#salaryMemoDisplay,
#progressCaption {
  color: var(--muted);
  line-height: 1.7;
}

.hero-text {
  margin: 18px 0 0;
}

.hero-metrics,
.summary-grid,
.category-grid {
  display: grid;
}

.hero-metrics {
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.86);
}

.metric-card span {
  color: var(--muted);
  font-size: 0.94rem;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.25rem;
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.main-grid {
  gap: 22px;
  align-items: flex-start;
}

.form-panel {
  width: min(380px, 100%);
  flex: 0 0 380px;
}

.content-stack {
  flex: 1;
  display: grid;
  gap: 18px;
}

.panel-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.compact-header h2 {
  font-size: 1.5rem;
}

.stack-form {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.field span {
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  outline: none;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.bank-category-tools {
  margin-top: 18px;
}

.bank-category-field {
  max-width: 100%;
}

.bank-category-input-row {
  display: flex;
  gap: 10px;
}

.bank-category-input-row input {
  flex: 1;
}

.divider {
  height: 1px;
  margin: 22px 0 4px;
  background: linear-gradient(90deg, transparent, rgba(31, 36, 48, 0.12), transparent);
}

.primary-button,
.secondary-button,
.ghost-button,
.delete-button {
  border: 0;
  border-radius: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 14px 16px;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--brand) 0%, #ff9f6c 100%);
  box-shadow: 0 16px 30px rgba(238, 122, 71, 0.24);
}

.secondary-button {
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, #76a0ff 100%);
  box-shadow: 0 16px 30px rgba(63, 120, 215, 0.22);
}

.ghost-button {
  background: rgba(31, 36, 48, 0.06);
  color: var(--muted);
}

.delete-button {
  padding: 10px 14px;
  background: rgba(185, 91, 47, 0.1);
  color: var(--warning);
}

.progress-meta {
  margin-top: 18px;
}

.progress-meta strong {
  display: block;
  font-size: 1.08rem;
}

.progress-track {
  margin-top: 16px;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(31, 36, 48, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--positive) 0%, #59b38e 100%);
}

.progress-fill.is-over {
  background: linear-gradient(135deg, var(--warning) 0%, #db8760 100%);
}

.category-grid {
  margin-top: 18px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.category-card {
  padding: 18px;
}

.category-card strong,
.category-card span {
  display: block;
}

.category-card strong {
  margin-top: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.12rem;
}

.category-card span:last-child {
  margin-top: 8px;
  color: var(--muted);
}

.bank-category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.bank-category-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.bank-category-chip-copy {
  display: grid;
  gap: 4px;
}

.bank-category-chip-copy strong {
  font-size: 1rem;
}

.bank-category-chip-copy span {
  color: var(--muted);
  font-size: 0.9rem;
}

.bank-category-remove {
  white-space: nowrap;
}

.salary-note-box {
  margin-top: 18px;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.plan-list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.plan-item {
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.plan-main {
  min-width: 0;
  flex: 1;
}

.compact-plan-main {
  display: grid;
  gap: 4px;
}

.plan-top {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.compact-plan-top {
  gap: 8px;
}

.plan-title {
  font-size: 1.08rem;
  line-height: 1.25;
}

.plan-category-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(238, 122, 71, 0.12);
  color: var(--brand-deep);
  font-size: 0.8rem;
}

.plan-note {
  margin: 0;
  font-size: 0.92rem;
}

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

.compact-plan-side {
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 10px 12px;
}

.done-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.done-check input {
  width: 18px;
  height: 18px;
}

.compact-done-check {
  flex: 0 0 auto;
  min-width: fit-content;
}

.plan-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-action-row {
  flex-wrap: nowrap;
}

.edit-button {
  padding: 9px 12px;
}

.plan-item.is-complete {
  background: rgba(244, 252, 247, 0.88);
  border-color: rgba(47, 141, 102, 0.18);
}

.plan-item.is-complete .plan-title {
  color: var(--positive);
}

.plan-amount {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.plan-percent {
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.empty-state {
  margin-top: 18px;
  padding: 24px;
  border-radius: 24px;
  border: 1px dashed rgba(31, 36, 48, 0.18);
  background: rgba(255, 255, 255, 0.54);
  color: var(--muted);
  line-height: 1.7;
}

.empty-state[hidden] {
  display: none;
}

@media (max-width: 1120px) {
  .hero,
  .main-grid {
    flex-direction: column;
  }

  .form-panel {
    width: 100%;
    flex: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 20px 14px 36px;
  }

  .hero-copy,
  .hero-panel,
  .panel,
  .summary-card,
  .category-card,
  .plan-item {
    border-radius: 24px;
  }

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

  .panel-header,
  .plan-item,
  .session-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .plan-side {
    justify-items: stretch;
  }

  .plan-action-row {
    justify-content: stretch;
  }

  .compact-plan-side {
    grid-template-columns: 1fr;
  }

  .bank-category-input-row,
  .bank-category-chip {
    flex-direction: column;
    align-items: stretch;
  }
}
