/*
 * LIO / 머니플랜 공통 디자인 시스템.
 * §03 프론트-설계서.md §3 "디자인 시스템(그대로 이관)"의 CSS 변수를 그대로 유지한다.
 */
:root {
  --blue: #4361ee;
  --blue-dark: #2b4acb;
  --blue-light: #eef0fd;
  --green: #2dc08d;
  --red: #e63946;
  --orange: #f4a261;
  --text: #1c1f2e;
  --text-sub: #6b7280;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  --page-bg: #eef0f5;
  --card-bg: #ffffff;
  --line: #eef0f4;
  --font: "Pretendard", "Apple SD Gothic Neo", sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.mono {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ---------- login ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 30px 30px;
  text-align: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
}

.login-card h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .03em;
}

.acronym {
  margin: 3px 0 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--blue);
}

.login-tagline {
  margin: 12px 0 28px;
  color: var(--text-sub);
  font-size: 13px;
}

.login-message {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
}

.login-message.error {
  background: #fde8e9;
  color: var(--red);
}

.login-message.info {
  background: var(--blue-light);
  color: var(--blue-dark);
}

.g-btn {
  box-sizing: border-box;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid #dcdfe6;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  text-decoration: none;
}

.g-btn:hover {
  background: #fafafa;
}

.g-mark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
  background: conic-gradient(#4285F4 0 25%, #34A853 25% 50%, #FBBC05 50% 75%, #EA4335 75% 100%);
}

.login-foot {
  margin-top: 22px;
  font-size: 11.5px;
  color: #9aa0ac;
}

/* ---------- hub ---------- */
.hub-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 40px;
  min-height: 100vh;
}

.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 2px 6px;
}

.hub-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hub-header .brand-mark {
  width: 36px;
  height: 36px;
  font-size: 15px;
  margin: 0;
  border-radius: 10px;
}

.hub-header h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .03em;
}

.logout-link {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-sub);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  padding: 0;
}

.hub-greeting {
  padding: 4px 2px 22px;
}

.hub-greeting .hi {
  font-size: 12.5px;
  color: var(--text-sub);
}

.hub-greeting .q {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
  text-wrap: balance;
}

.notes-page-desc {
  margin: 4px 4px 16px;
  font-size: 12.5px;
  color: var(--text-sub);
  text-wrap: balance;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-sub);
  letter-spacing: .02em;
}

.add-fab-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.add-fab-sm:hover {
  filter: brightness(1.08);
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-tile {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  color: inherit;
  border: none;
  width: 100%;
  text-align: left;
}

.menu-tile.available:hover {
  box-shadow: 0 4px 18px rgba(67, 97, 238, 0.18);
}

.menu-tile.soon {
  opacity: 0.55;
  cursor: default;
}

.tile-icon {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--blue-light);
}

.menu-tile.soon .tile-icon {
  background: #f1f2f5;
}

.tile-body {
  flex: 1;
  min-width: 0;
}

.tile-title {
  font-size: 15.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tile-desc {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 3px;
}

.tile-badge {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
}

.tile-badge.available {
  background: #e3f8f0;
  color: var(--green);
}

.tile-badge.soon {
  background: #f1f2f5;
  color: var(--text-sub);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- budget app shell ---------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 12px 96px;
}

.topbar-sticky {
  position: sticky;
  top: 0;
  background: var(--page-bg);
  z-index: 10;
  padding-top: 12px;
}

.topbar-back-row {
  padding: 0 4px;
}

.topbar-back {
  display: inline-block;
  color: var(--text-sub);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 2px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 10px;
  flex-wrap: wrap;
}

.cycle-arrow {
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-sub);
  font-size: 16px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.cycle-label {
  font-weight: 800;
  font-size: 14.5px;
  flex: 1;
  text-align: center;
}

.dday-inline {
  color: var(--blue-dark);
  font-weight: 700;
  margin-left: 4px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 14px;
  margin-bottom: 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 800;
}

.card-total {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-sub);
}

.salary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.salary-row .label {
  font-size: 12.5px;
  color: var(--text-sub);
  font-weight: 500;
}

.salary-value {
  font-size: 19px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.salary-value input {
  font-size: 19px;
  font-weight: 800;
  width: 130px;
  border: none;
  border-bottom: 2px dashed #dcdfe6;
  color: var(--text);
  background: transparent;
  padding: 0;
}

.edit-btn {
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  background: var(--blue-light);
  padding: 4px 9px;
  border-radius: 999px;
  border: none;
}

.progress-bar {
  height: 8px;
  background: #eef0f4;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
  transition: width .25s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
}

.progress-meta .pct {
  color: var(--blue-dark);
}

.progress-meta .unalloc {
  color: var(--text-sub);
}

.progress-meta .unalloc.negative {
  color: var(--red);
}

.projected-banner {
  display: none;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
}

.projected-banner.show {
  display: block;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.item-row:last-child {
  border-bottom: none;
}

.item-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  color: inherit;
}

.item-name {
  font-weight: 700;
  font-size: 13.5px;
}

.item-account {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 1px;
}

.item-amount {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
}

.item-controls {
  display: flex;
  gap: 2px;
  flex: none;
}

.item-controls button {
  cursor: pointer;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b6bac4;
  font-size: 10px;
  border-radius: 6px;
  background: none;
  border: none;
}

.item-controls button:hover {
  background: #f4f5f8;
  color: var(--text-sub);
}

.item-controls .delete-btn:hover {
  color: var(--red);
}

.empty-state {
  display: none;
  padding: 18px 4px;
  text-align: center;
}

.empty-state.show {
  display: block;
}

.empty-state p {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--text-sub);
}

.btn-add {
  box-sizing: border-box;
  width: 100%;
  cursor: pointer;
  text-align: center;
  margin-top: 10px;
  padding: 9px;
  border-radius: 10px;
  border: 1.5px dashed #cdd2dd;
  color: var(--blue);
  font-weight: 700;
  font-size: 12.5px;
  background: none;
}

.btn-add:hover {
  background: var(--blue-light);
  border-color: var(--blue);
}

.btn-copy {
  box-sizing: border-box;
  width: 100%;
  cursor: pointer;
  text-align: center;
  padding: 9px;
  border-radius: 10px;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-weight: 700;
  font-size: 12.5px;
  border: none;
}

.account-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.account-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.account-list li:last-child {
  border-bottom: none;
}

.account-list li span:first-child {
  font-weight: 600;
}

.empty-note {
  color: var(--text-sub);
  font-size: 12.5px;
  padding: 6px 0;
}

.btn-ghost-sm {
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-sub);
  background: #f4f5f8;
  padding: 5px 10px;
  border-radius: 999px;
  border: none;
}

.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.note-row:last-child {
  border-bottom: none;
}

.note-date {
  font-size: 11px;
  color: var(--text-sub);
  width: 40px;
  flex: none;
}

.note-desc {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.note-amt {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}

.note-row.income .note-amt {
  color: var(--green);
}

.note-row.expense .note-amt {
  color: var(--red);
}

.note-del {
  cursor: pointer;
  color: #cdd2dd;
  font-size: 11px;
  padding: 4px;
  background: none;
  border: none;
}

.note-del:hover {
  color: var(--red);
}

.data-bar {
  display: flex;
  gap: 8px;
  margin: 4px 0 8px;
}

.btn-ghost {
  flex: 1;
  box-sizing: border-box;
  cursor: pointer;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-sub);
  border: none;
}

.btn-ghost-danger {
  color: var(--red);
}

.fab {
  cursor: pointer;
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  box-shadow: 0 6px 18px rgba(67, 97, 238, 0.4);
  z-index: 20;
  border: none;
}

/* ---------- bottom sheet ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 30, 0.45);
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.overlay.active {
  display: flex;
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--card-bg);
  border-radius: 20px 20px 0 0;
  padding: 10px 20px 24px;
  max-height: 86vh;
  overflow-y: auto;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: #e2e4ea;
  border-radius: 999px;
  margin: 0 auto 16px;
}

.sheet h3 {
  margin: 0 0 16px;
  font-size: 16.5px;
  font-weight: 800;
}

.sheet-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.sheet-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.sheet-field input, .sheet-field select {
  box-sizing: border-box;
  width: 100%;
  background: #f7f8fa;
  border: 1.5px solid transparent;
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
}

.sheet-field input:focus, .sheet-field select:focus {
  border-color: var(--blue);
  background: #fff;
}

.toggle-pair {
  display: flex;
  gap: 8px;
}

.toggle-pair button {
  flex: 1;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  padding: 10px;
  border-radius: 10px;
  background: #f7f8fa;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-sub);
  border: none;
}

.toggle-pair button.active.income {
  background: #e3f8f0;
  color: var(--green);
}

.toggle-pair button.active.expense {
  background: #fde8e9;
  color: var(--red);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-cancel, .btn-save {
  flex: 1;
  box-sizing: border-box;
  text-align: center;
  cursor: pointer;
  padding: 12px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13.5px;
  border: none;
}

.btn-cancel {
  background: #f4f5f8;
  color: var(--text-sub);
}

.btn-save {
  background: var(--blue);
  color: #fff;
}

.btn-delete-item {
  background: #fde8e9;
  color: var(--red);
  flex: none;
  padding: 12px 16px;
}

.calc-result {
  background: var(--blue-light);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  margin: 4px 0 18px;
}

.calc-result .amt {
  font-size: 22px;
  font-weight: 800;
  color: var(--blue-dark);
}

.calc-result .desc {
  font-size: 11.5px;
  color: var(--text-sub);
  margin-top: 4px;
}

.sheet-account-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.sheet-account-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
}

.sheet-account-list li:last-child {
  border-bottom: none;
}

.sheet-account-list button {
  cursor: pointer;
  color: #cdd2dd;
  font-size: 11px;
  background: none;
  border: none;
}

.sheet-account-list button:hover {
  color: var(--red);
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill, .toast, .menu-tile {
    transition: none;
  }
}
