:root {
  --sea-900: #10342c;
  --sea-700: #1f5e4f;
  --sea-500: #0f8f67;
  --sea-100: #d7eee4;
  --sand-100: #fff8ec;
  --line: #d7e8df;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--sea-900);
  font-family: "Noto Sans", "Segoe UI", "Arial", sans-serif;
  background:
    radial-gradient(circle at top right, #fef4df 0%, rgba(254, 244, 223, 0) 42%),
    radial-gradient(circle at 10% 15%, #daf5e9 0%, rgba(218, 245, 233, 0) 40%),
    linear-gradient(150deg, #f5fbf8 0%, #edf6f0 45%, #f7fcf9 100%);
}

h1,
h2,
h3,
.font-display {
  font-family: "Noto Sans Display", "Noto Sans", "Segoe UI", "Arial", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(5px);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 10px 28px rgba(18, 58, 46, 0.08);
}

.card-title {
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #4d7468;
}

.stat-value {
  font-family: "Noto Sans Display", "Noto Sans", "Segoe UI", "Arial", sans-serif;
  font-size: 1.9rem;
  line-height: 1.1;
  font-weight: 700;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  border: 1px solid #b9d8c9;
  border-radius: 0.8rem;
  padding: 0.62rem 0.8rem;
  background: #fbfffd;
  color: #10342c;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--sea-500);
  box-shadow: 0 0 0 3px rgba(15, 143, 103, 0.18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 0.8rem;
  border: none;
  padding: 0.6rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(120deg, #0f8f67 0%, #0a7351 100%);
  color: #ffffff;
}

.btn-primary:hover {
  opacity: 0.92;
}

.hint-dismiss-btn {
  padding: 0.34rem 0.7rem;
  font-size: 0.76rem;
  border-radius: 0.66rem;
}

.btn-neutral {
  background: #ecf8f2;
  color: var(--sea-700);
  border: 1px solid #c5e2d4;
}

.btn-expense {
  background: linear-gradient(120deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
}

.btn-income {
  background: linear-gradient(120deg, #15803d 0%, #166534 100%);
  color: #ffffff;
}

.btn-transfer {
  background: linear-gradient(120deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
}

.btn-expense:hover,
.btn-income:hover,
.btn-transfer:hover {
  opacity: 0.92;
}

.sidebar-link,
.mobile-link {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  font-weight: 700;
  color: #285a4e;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link {
  justify-content: flex-start;
  padding: 0.64rem 0.8rem;
}

.sidebar-link:hover,
.mobile-link:hover {
  background: #daf1e6;
}

.sidebar-link.active,
.mobile-link.active {
  color: #ffffff;
  background: linear-gradient(120deg, #0f8f67 0%, #0a7351 100%);
  box-shadow: 0 8px 16px rgba(15, 143, 103, 0.24);
}

.mobile-link {
  flex-direction: column;
  gap: 0.12rem;
  font-size: 0.72rem;
  padding: 0.3rem 0.2rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.7rem 0.55rem;
  border-bottom: 1px solid #e1eee8;
  font-size: 0.92rem;
  text-align: left;
}

.editable-cell {
  cursor: text;
  border-radius: 0.45rem;
  transition: background-color 0.15s ease;
}

.editable-cell:focus {
  outline: 2px solid rgba(15, 143, 103, 0.28);
  background: #f2fbf6;
}

.data-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #4f7a6d;
}

.row-selectable td {
  cursor: pointer;
}

.row-selected td {
  background: #ffecec;
}

.btn-delete-mode {
  background: #fff2f2;
  color: #a12727;
  border: 1px solid #f3c2c2;
}

.btn-delete-mode.is-active {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.74rem;
  padding: 0.12rem 0.56rem;
  font-weight: 700;
}

.type-expense {
  background: #ffe7e2;
  color: #8f2f21;
}

.type-income {
  background: #def7e8;
  color: #15663c;
}

.type-transfer {
  background: #edf2ff;
  color: #344e9e;
}

.empty-state {
  border: 1px dashed #bfdccd;
  border-radius: 0.8rem;
  padding: 0.9rem;
  text-align: center;
  color: #4d766a;
  background: #f7fcfa;
}

.guide-banner {
  border-color: #b5dfcc;
  background: linear-gradient(135deg, rgba(222, 246, 236, 0.85) 0%, rgba(245, 252, 248, 0.95) 100%);
}

.guide-banner-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #1f6b55;
}

.toast {
  position: fixed;
  bottom: 5.25rem;
  right: 1rem;
  z-index: 60;
  background: #10342c;
  color: #ffffff;
  padding: 0.55rem 0.8rem;
  border-radius: 0.7rem;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
  font-size: 0.84rem;
}

.page-main {
  padding-bottom: 5rem;
}

.fab-btn {
  position: fixed;
  right: 1rem;
  bottom: 5.4rem;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(120deg, #0f8f67 0%, #0a7351 100%);
  color: #ffffff;
  font-family: "Noto Sans Display", "Noto Sans", "Segoe UI", "Arial", sans-serif;
  font-size: 1.7rem;
  line-height: 1;
  box-shadow: 0 12px 24px rgba(15, 143, 103, 0.3);
  cursor: pointer;
  z-index: 55;
}

.fab-actions {
  position: fixed;
  right: 1rem;
  bottom: 5.4rem;
  display: flex;
  gap: 0.55rem;
  z-index: 55;
}

.fab-actions .fab-btn {
  position: static;
  right: auto;
  bottom: auto;
}

.fab-btn-danger {
  background: linear-gradient(120deg, #dc2626 0%, #b91c1c 100%);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
}

.fab-btn-danger.is-active {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.24), 0 12px 24px rgba(185, 28, 28, 0.36);
}

.fab-btn:active {
  transform: translateY(1px);
}

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 29, 23, 0.48);
  backdrop-filter: blur(2px);
}

.app-modal.hidden {
  display: none;
}

.app-modal-card {
  width: min(100%, 29rem);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 20px 44px rgba(8, 35, 28, 0.2);
  padding: 1rem;
}

.modal-close-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 999px;
  background: #ecf8f2;
  color: var(--sea-700);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (min-width: 1024px) {
  .page-main {
    padding-bottom: 1.5rem;
  }

  .fab-btn {
    bottom: 1.5rem;
  }

  .fab-actions {
    bottom: 1.5rem;
  }
}

@media (min-width: 768px) {
  .action-buttons {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --sea-900: #d8efe7;
    --sea-700: #9dd6c4;
    --sea-500: #34b788;
    --sea-100: #1f3a33;
    --line: #2a3b47;
  }

  body {
    color: #dbe7ef;
    background:
      radial-gradient(circle at top right, rgba(67, 48, 17, 0.55) 0%, rgba(67, 48, 17, 0) 44%),
      radial-gradient(circle at 12% 14%, rgba(20, 73, 57, 0.56) 0%, rgba(20, 73, 57, 0) 42%),
      linear-gradient(150deg, #0d1822 0%, #101f2b 46%, #0f1a24 100%);
  }

  .card {
    background: rgba(16, 27, 37, 0.9);
    border-color: #2a3b47;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  }

  .card-title {
    color: #93b0a5;
  }

  .form-input,
  .form-select,
  .form-textarea {
    border-color: #3b5567;
    background: #152535;
    color: #e8f2f8;
  }

  .form-input:focus,
  .form-select:focus,
  .form-textarea:focus {
    border-color: #39bb8d;
    box-shadow: 0 0 0 3px rgba(57, 187, 141, 0.24);
  }

  .btn-neutral {
    background: #1a2f3e;
    color: #cfe3f0;
    border-color: #37546a;
  }

  .sidebar-link,
  .mobile-link {
    color: #bdd6e2;
  }

  .sidebar-link:hover,
  .mobile-link:hover {
    background: #203a4b;
  }

  .data-table th,
  .data-table td {
    border-bottom-color: #2a3b47;
  }

  .data-table th {
    color: #92adb9;
  }

  .type-expense {
    background: #5b2624;
    color: #ffc9c1;
  }

  .type-income {
    background: #1e4a34;
    color: #c8f5dd;
  }

  .type-transfer {
    background: #243f6f;
    color: #d4e2ff;
  }

  .row-selected td {
    background: #3a262b;
  }

  .btn-delete-mode {
    border-color: #5a3538;
    background: #2d1f22;
    color: #ffb7b7;
  }

  .btn-delete-mode.is-active {
    background: #b91c1c;
    border-color: #991b1b;
    color: #ffffff;
  }

  .fab-btn-danger {
    background: linear-gradient(120deg, #b91c1c 0%, #991b1b 100%);
  }

  .empty-state {
    border-color: #355061;
    background: #152535;
    color: #b5cbd6;
  }

  .guide-banner {
    border-color: #355061;
    background: linear-gradient(135deg, rgba(20, 49, 66, 0.92) 0%, rgba(16, 31, 43, 0.95) 100%);
  }

  .guide-banner-kicker {
    color: #89d7b5;
  }

  .toast {
    background: #081017;
    color: #e4edf3;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  }

  .app-modal {
    background: rgba(4, 10, 16, 0.72);
  }

  .app-modal-card {
    background: #0f1b27;
    border-color: #2a3b47;
    box-shadow: 0 20px 44px rgba(0, 0, 0, 0.46);
  }

  .modal-close-btn {
    background: #1c2f3d;
    color: #d2e4ee;
  }

  .editable-cell:focus {
    background: #193246;
    outline-color: rgba(52, 183, 136, 0.34);
  }

  .text-slate-500 {
    color: #94aebd !important;
  }

  .text-slate-600 {
    color: #b2c5d1 !important;
  }

  .text-slate-900 {
    color: #eaf4fb !important;
  }

  .text-emerald-700 {
    color: #5fd9aa !important;
  }

  .text-rose-700 {
    color: #ff8f9d !important;
  }

  .text-amber-700 {
    color: #f7cc74 !important;
  }

  .text-amber-800 {
    color: #ffd992 !important;
  }

  .text-amber-900 {
    color: #ffe8bb !important;
  }

  .bg-white\/95,
  .bg-white\/80 {
    background-color: rgba(14, 24, 34, 0.93) !important;
  }

  .bg-slate-100 {
    background-color: #1f3344 !important;
  }

  .border-emerald-100 {
    border-color: #30505f !important;
  }
}
