:root {
  --ice: #a1d6e2;
  --glacier: #1995ad;
  --ink: #15202b;
  --muted: #75808d;
  --mist: #f1f1f2;
  --warm-gray: #bcbabe;
  --line: #e8edf0;
  --card: #ffffff;
}

* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 50% 0, #f8fcfd 0, var(--mist) 57%, #e5eff1 100%); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; }
.app-shell { width: min(100%, 430px); min-height: 100vh; margin: 0 auto; padding: 14px 16px 92px; background: rgba(255, 255, 255, .72); }
.topbar { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; min-height: 40px; }
.topbar h1 { margin: 0; text-align: center; font-size: 16px; letter-spacing: .06em; }
.back-link { color: #334052; font-size: 22px; font-weight: 600; line-height: 1; text-decoration: none; }
.back-link { font-size: 32px; font-weight: 400; }
.topbar-spacer { display: block; }
.logout-form { justify-self: end; }
.logout-form button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; font-weight: 700; }
.notice { margin: 8px 0 12px; padding: 10px 12px; border-radius: 10px; background: #e7f6f9; color: #107e94; font-weight: 700; }

.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px 20px; }
.login-card { width: 100%; padding: 34px 27px 28px; border-radius: 20px; background: var(--card); box-shadow: 0 16px 40px rgba(36, 92, 108, .15); text-align: center; }
.login-mark { display: grid; width: 55px; height: 55px; place-items: center; margin: 0 auto 13px; border-radius: 17px; background: linear-gradient(135deg, #1497af, #25abc2); box-shadow: 0 9px 18px rgba(25, 149, 173, .22); color: white; font-size: 28px; font-weight: 800; }
.login-eyebrow { margin: 0; color: var(--glacier); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.login-card h1 { margin: 8px 0; font-size: 21px; }
.login-card > p:not(.login-eyebrow):not(.login-error) { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-form { display: grid; gap: 8px; margin-top: 23px; text-align: left; }
.login-form label { color: var(--ink); font-size: 12px; font-weight: 700; }
.login-form .primary-action { margin-top: 8px; }
.login-error { margin: 15px 0 -5px; padding: 9px 10px; border-radius: 9px; background: #fff1f1; color: #b74242; font-size: 11px; font-weight: 700; line-height: 1.5; text-align: left; }

.month-switcher { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 7px 0 13px; }
.month-switcher a { padding: 4px 7px; color: #52606d; font-size: 24px; line-height: 1; text-decoration: none; }
.month-switcher strong { padding: 9px 16px; border-radius: 9px; background: var(--card); box-shadow: 0 4px 16px rgba(32, 72, 82, .06); font-size: 13px; }
.month-switcher strong span { padding-left: 6px; color: var(--muted); }
.month-switcher.compact { margin-top: 8px; }

.summary-card, .section-block, .expense-form, .method-card, .month-filter, .entry-tabs { border-radius: 14px; background: var(--card); box-shadow: 0 8px 26px rgba(36, 92, 108, .09); }
.summary-card { padding: 17px 18px; }
.card-title { margin: 0 0 8px; color: #445161; font-size: 12px; font-weight: 700; }
.home-summary-card { padding-bottom: 14px; }
.summary-line { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 0 1px 9px; }
.summary-line span { color: #364554; font-weight: 700; }
.summary-line strong, .total-card strong { color: var(--glacier); font-size: 23px; letter-spacing: -.035em; }
.summary-note, .total-card span { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.total-card { text-align: left; padding: 21px; }
.total-card strong { display: block; font-size: 30px; }

.section-block { margin-top: 11px; padding: 17px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 14px; }
.section-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; }
.section-heading a { color: var(--glacier); font-size: 11px; font-weight: 700; text-decoration: none; }
.category-breakdown { display: grid; grid-template-columns: 104px 1fr; align-items: center; gap: 17px; }
.donut { position: relative; display: grid; width: 98px; height: 98px; place-items: center; border-radius: 50%; background: var(--chart); }
.donut::after { position: absolute; width: 55px; height: 55px; border-radius: 50%; background: white; content: ""; }
.donut span { position: relative; z-index: 1; color: var(--muted); font-size: 10px; font-weight: 700; }
.category-list, .expense-list { margin: 0; padding: 0; list-style: none; }
.category-list li { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto auto; align-items: center; gap: 7px; padding: 5px 0; }
.category-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--category-color); }
.category-name { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.category-list strong { font-size: 11px; white-space: nowrap; }
.category-list small { min-width: 25px; color: var(--muted); font-size: 10px; text-align: right; }
.category-list.bars li { grid-template-columns: 9px 50px minmax(35px, 1fr) auto auto; gap: 7px; padding: 8px 0; }
.category-bar { display: block; height: 6px; overflow: hidden; border-radius: 99px; background: #eaf2f4; }
.category-bar i { display: block; height: 100%; border-radius: inherit; background: var(--category-color); }

.expense-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.expense-list li:last-child { border-bottom: 0; }
.expense-list div:first-child { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 8px; min-width: 0; }
.expense-list time { grid-row: 1 / span 2; color: var(--muted); font-size: 11px; }
.expense-list strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.expense-list b { align-self: center; color: #253444; font-size: 13px; white-space: nowrap; }
.tag { display: inline-block; width: max-content; padding: 2px 6px; border-radius: 99px; background: #e8f5f7; color: #49616b; font-size: 9px; font-weight: 700; }
.expense-list small { grid-column: 2; color: var(--muted); }
.empty-state { margin: 6px 0; padding: 19px 2px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }
.floating-action { position: fixed; z-index: 2; right: max(17px, calc((100vw - 430px) / 2 + 17px)); bottom: 74px; display: grid; width: 48px; height: 48px; place-items: center; border-radius: 50%; background: linear-gradient(135deg, #1497af, #11a6bd); box-shadow: 0 8px 17px rgba(25, 149, 173, .32); color: white; font-size: 31px; font-weight: 300; line-height: 1; text-decoration: none; }

.method-intro { padding: 19px 5px 12px; text-align: center; }
.method-intro h2 { margin: 0; font-size: 20px; }
.method-intro p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.method-list { display: grid; gap: 14px; }
.method-card { display: grid; grid-template-columns: 70px minmax(0, 1fr) 18px; align-items: center; min-height: 132px; padding: 18px; color: var(--ink); text-decoration: none; }
.method-card.disabled { opacity: .62; }
.method-icon { display: grid; width: 59px; height: 59px; place-items: center; border-radius: 50%; background: #eaf6f8; color: var(--glacier); font-size: 31px; }
.method-card h2 { margin: 0 0 7px; color: var(--glacier); font-size: 15px; }
.method-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.method-next { color: var(--glacier); font-size: 25px; }

.entry-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin-top: 12px; padding: 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.entry-tabs span { padding: 9px 4px; border-radius: 8px; }
.entry-tabs .selected { background: linear-gradient(100deg, #1595ac, #25abc2); color: white; }
.expense-form { display: grid; gap: 16px; margin-top: 12px; padding: 18px; }
.expense-form > label { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
.expense-form label > span:first-child { font-size: 12px; }
.category-field { display: grid; gap: 7px; min-width: 0; margin: 0; padding: 0; border: 0; }
.category-field legend { padding: 0; color: var(--ink); font-size: 12px; font-weight: 700; }
.expense-form em { margin-left: 4px; color: var(--glacier); font-size: 10px; font-style: normal; }
.expense-form i { margin-left: 4px; color: var(--muted); font-size: 10px; font-style: normal; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); padding: 11px; outline-color: var(--glacier); }
textarea { resize: vertical; }
.currency-input { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.currency-input span { padding-left: 12px; color: var(--muted); }
.currency-input input { border: 0; }
.category-options { display: flex; flex-wrap: wrap; gap: 7px; }
.category-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.category-options label { min-width: 61px; padding: 8px 10px; border: 1px solid #edf0f2; border-radius: 99px; background: #f9fbfc; color: #4e5a66; font-size: 11px; font-weight: 700; text-align: center; }
.category-options input:checked + label { border-color: var(--glacier); background: var(--glacier); color: white; }
.field-error { color: #c45050; font-size: 11px; }
.primary-action { display: flex; align-items: center; justify-content: center; min-height: 45px; border: 0; border-radius: 9px; background: linear-gradient(100deg, #1595ac, #25abc2); box-shadow: 0 7px 14px rgba(25, 149, 173, .19); color: white; cursor: pointer; font-weight: 800; text-decoration: none; }

.month-filter { margin-top: 12px; padding: 12px 15px; }
.month-filter form, .month-filter label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; }
.month-filter input { width: auto; padding: 7px; }
.history-block { margin-top: 12px; }
.expense-actions { display: grid; align-content: center; justify-items: end; gap: 4px; }
.expense-actions form { margin: 0; }
.expense-actions button { border: 0; background: transparent; color: #a66a6a; cursor: pointer; font-size: 11px; }
.bottom-nav { position: fixed; z-index: 3; bottom: 0; left: 50%; display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, 430px); min-height: 64px; transform: translateX(-50%); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .96); box-shadow: 0 -5px 18px rgba(42, 77, 88, .05); }
.bottom-nav a { display: grid; align-content: center; justify-items: center; gap: 2px; color: #6f7d8d; font-size: 9px; font-weight: 700; text-decoration: none; }
.bottom-nav span { font-size: 20px; font-weight: 400; line-height: 1; }
.bottom-nav a.active { color: var(--glacier); }

@media (min-width: 560px) { .app-shell { min-height: calc(100vh - 28px); margin-top: 14px; margin-bottom: 14px; border-radius: 24px; box-shadow: 0 20px 60px rgba(32, 80, 93, .14); } .login-shell { min-height: calc(100vh - 28px); } .bottom-nav { bottom: 14px; border-radius: 0 0 24px 24px; } }
@media (max-width: 360px) { .app-shell { padding-right: 11px; padding-left: 11px; } .section-block, .expense-form { padding: 14px; } .category-breakdown { grid-template-columns: 88px 1fr; gap: 9px; } .donut { width: 82px; height: 82px; } .category-list.bars li { grid-template-columns: 8px 42px minmax(25px, 1fr) auto; } .category-list.bars small { display: none; } }
