:root {
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
}

html {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-feature-settings: "ss06", "tnum";
}

[x-cloak] { display: none !important; }

.phone-frame {
  min-height: 100vh;
}
@media (min-width: 768px) {
  .phone-frame {
    min-height: 820px;
    height: 88vh;
    max-height: 880px;
  }
}

/* =========================================================
   TYPOGRAPHY SCALE
   ========================================================= */

.text-display {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.text-month-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.text-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.text-section {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.text-item-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.text-body {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.55;
}
.text-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.text-input {
  font-size: 14.5px;
  font-weight: 500;
}
.text-button {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.text-button-sm {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.text-meta {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.text-meta-strong {
  font-size: 12.5px;
  font-weight: 600;
}
.text-caption {
  font-size: 11px;
  font-weight: 500;
}
.text-overline {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.text-chip {
  font-size: 10px;
  font-weight: 600;
}
.text-chip-strong {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.text-weekday {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.text-daynum {
  font-size: 13px;
  font-weight: 600;
}
.text-money-hero {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.035em;
}
.text-money-section {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.text-money-item {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.text-money-input {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.text-amount-cell {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.text-toast {
  font-size: 13px;
  font-weight: 500;
}

/* =========================================================
   FORM — iOS date input fix
   ========================================================= */

.form-input,
.form-date {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background-clip: padding-box;
}

input.form-date::-webkit-date-and-time-value {
  text-align: left;
  min-width: 0;
}
input.form-date::-webkit-calendar-picker-indicator {
  margin-left: 4px;
  padding: 0;
  opacity: 0.55;
}

.form-row {
  min-width: 0;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

.cal-cell:active { transform: scale(0.92); }

.expense-item { animation: slideUp 0.3s ease-out backwards; }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cat-row { animation: fadeIn 0.5s ease-out backwards; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.fab { animation: fabIn 0.4s ease-out; }
@keyframes fabIn {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.cat-tile:active { transform: scale(0.96); }

/* Primary save button — emphasized */
.btn-primary-save {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 4px 12px -2px rgba(37, 99, 235, 0.4), 0 2px 4px -1px rgba(37, 99, 235, 0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}
.btn-primary-save:hover {
  filter: brightness(1.05);
  box-shadow: 0 6px 16px -2px rgba(37, 99, 235, 0.5), 0 3px 6px -1px rgba(37, 99, 235, 0.25);
}
.btn-primary-save:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px -1px rgba(37, 99, 235, 0.35);
}

/* =========================================================
   MODAL FOOTER — 저장하기를 취소보다 넓게 (2:1 비율)
   부모 컨테이너가 grid-cols-2 든 flex 든 상관없이 강제로 flex 전환 후
   저장 버튼에 더 큰 flex-grow를 줘서 시각적으로 더 중요한 CTA로 만든다.
   ========================================================= */
*:has(> .btn-primary-save) {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 0.625rem;
  align-items: stretch;
}
*:has(> .btn-primary-save) > .btn-primary-save {
  flex: 2 1 0% !important;
  min-width: 0;
}
*:has(> .btn-primary-save) > :not(.btn-primary-save) {
  flex: 1 1 0% !important;
  min-width: 0;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="date"] {
  font-family: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

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