:root {
  color-scheme: light;
  --ink: #162228;
  --muted: #64727a;
  --paper: #f5f7f6;
  --surface: #ffffff;
  --line: #dce3e1;
  --deep: #123d42;
  --teal: #0f6a70;
  --teal-light: #dff0ef;
  --amber: #d39c43;
  --amber-light: #f8edd9;
  --danger: #a63b35;
  --shadow: 0 18px 54px rgba(21, 47, 48, .09);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 76px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 12px clamp(18px, 4vw, 56px); border-bottom: 1px solid rgba(18,61,66,.1); background: rgba(245,247,246,.92); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; width: fit-content; }
.brand-mark, .login-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px 13px 13px 4px; background: var(--deep); color: #fff; font-weight: 750; font-size: 1.22rem; }
.brand strong, .brand small { display: block; line-height: 1.15; }
.brand small { color: var(--muted); margin-top: 3px; font-size: .76rem; }
.nav { display: flex; gap: 4px; padding: 4px; background: #e9eeec; border-radius: 999px; }
.nav-button { border: 0; border-radius: 999px; padding: 9px 18px; background: transparent; cursor: pointer; color: var(--muted); }
.nav-button.active { background: var(--surface); color: var(--deep); box-shadow: 0 3px 12px rgba(18,61,66,.08); }
.icon-button { justify-self: end; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); cursor: pointer; font-size: 1.25rem; }
.main-shell { width: min(1120px, calc(100% - 36px)); margin: 0 auto; padding: 56px 0 96px; }
.view { display: none; }
.view.active { display: block; animation: reveal .28s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.4rem, 5vw, 4.7rem); font-weight: 500; line-height: .98; letter-spacing: -.035em; color: var(--deep); }
h2 { color: var(--deep); line-height: 1.15; }
h3 { font-size: 1rem; color: var(--deep); }
.eyebrow { margin-bottom: 9px; text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 800; color: var(--teal); }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 42px; }
.summary-card { position: relative; overflow: hidden; display: grid; text-align: left; min-height: 230px; padding: 28px; border: 0; border-radius: 26px; cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.summary-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.summary-card::after { content: ""; position: absolute; right: -50px; bottom: -90px; width: 220px; height: 220px; border: 52px solid rgba(255,255,255,.18); border-radius: 50%; }
.debt-card { background: var(--deep); color: #fff; }
.asset-card { background: var(--amber-light); color: var(--deep); }
.summary-label { align-self: start; font-weight: 700; }
.summary-card strong { align-self: end; font-family: Georgia, serif; font-size: 4.6rem; line-height: .85; font-weight: 500; }
.summary-card > span:last-child { align-self: end; opacity: .77; }
.workspace-note { display: grid; grid-template-columns: auto 1fr; gap: 22px; margin-top: 24px; padding: 26px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); }
.note-index { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--teal-light); color: var(--teal); font-weight: 800; }
.workspace-note h2 { margin-bottom: 8px; }
.workspace-note p { margin-bottom: 0; max-width: 720px; color: var(--muted); }
.button { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 750; cursor: pointer; transition: transform .15s ease, opacity .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--deep); color: #fff; }
.secondary { background: #e9eeec; color: var(--deep); }
.danger { background: var(--danger); color: #fff; }
.record-list { display: grid; gap: 14px; }
.empty-state { padding: 60px 28px; text-align: center; border: 1px dashed #b9c5c2; border-radius: 24px; color: var(--muted); background: rgba(255,255,255,.48); }
.empty-state h2 { margin-bottom: 7px; }
.record-card { display: grid; grid-template-columns: 1fr auto; gap: 22px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 4px 18px rgba(21,47,48,.035); }
.record-title { margin-bottom: 7px; font-size: 1.22rem; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; margin-bottom: 10px; color: var(--muted); font-size: .91rem; }
.record-amount { font-size: 1.65rem; font-family: Georgia, serif; color: var(--deep); }
.record-breakdown { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { padding: 5px 9px; border-radius: 999px; background: #eff3f2; color: #4b5f61; font-size: .78rem; }
.pill.accent { background: var(--amber-light); color: #77551d; }
.explanation { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 16px; }
.explanation > div { padding: 14px; border-radius: 14px; background: #f4f7f6; }
.explanation strong { display: block; margin-bottom: 5px; font-size: .83rem; color: var(--teal); }
.explanation p { margin: 0; white-space: pre-wrap; color: #4e6064; }
.record-actions { display: flex; align-items: flex-start; gap: 7px; }
.text-button { border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; background: #fff; cursor: pointer; }
.attachments { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); }
.attachment-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 7px; }
.attachment-link { color: var(--teal); font-weight: 650; }
.upload-label { display: inline-flex; margin-top: 10px; cursor: pointer; color: var(--teal); font-weight: 700; font-size: .88rem; }
.upload-label input { position: absolute; opacity: 0; pointer-events: none; }
.modal { width: min(820px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 24px; background: transparent; }
.modal::backdrop, .confirm-dialog::backdrop { background: rgba(9, 25, 27, .54); backdrop-filter: blur(5px); }
.modal-card { max-height: calc(100dvh - 24px); overflow-y: auto; padding: clamp(22px, 4vw, 36px); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.modal-head h2 { margin: 0; font-family: Georgia, serif; font-size: 2.1rem; font-weight: 500; }
.close-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: #edf1f0; cursor: pointer; font-size: 1.7rem; }
.form-section { padding: 22px 0; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.accent-section { margin: 0 -14px; padding: 22px 14px; border-radius: 17px; background: #f1f7f6; border-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
label { display: grid; gap: 7px; color: #43575a; font-size: .9rem; font-weight: 700; }
label.wide { grid-column: 1 / -1; }
input, select, textarea { width: 100%; border: 1px solid #c9d3d0; border-radius: 11px; padding: 11px 12px; background: #fff; color: var(--ink); font-size: 1rem; font-weight: 450; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,106,112,.12); }
textarea { resize: vertical; line-height: 1.45; }
.check-label { display: flex; align-items: center; align-self: end; gap: 10px; min-height: 46px; }
.check-label input { width: 21px; height: 21px; }
.form-error { min-height: 1.4em; margin: 2px 0 10px; color: var(--danger); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-dialog { width: min(440px, calc(100% - 24px)); border: 0; border-radius: 20px; padding: 0; }
.confirm-card { padding: 28px; }
.confirm-card p { color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 12px; background: var(--deep); color: #fff; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.login-body { min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 78% 18%, #d9ece9 0, transparent 29%), var(--paper); }
.login-shell { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.login-mark { width: 52px; height: 52px; margin-bottom: 28px; }
.login-shell h1 { font-size: 2.55rem; }
.login-copy { margin: 15px 0 26px; color: var(--muted); }
.login-form { display: grid; gap: 16px; }
.login-form .button { margin-top: 2px; }
@media (max-width: 720px) {
  .topbar { grid-template-columns: 1fr auto; gap: 12px; padding: 10px 16px; }
  .nav { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; justify-content: stretch; box-shadow: 0 12px 36px rgba(9,25,27,.22); }
  .nav-button { flex: 1; padding: 11px 6px; }
  .icon-button { grid-column: 2; }
  .main-shell { width: min(100% - 28px, 1120px); padding: 38px 0 96px; }
  .page-head { align-items: center; }
  .page-head h1 { font-size: 2.9rem; }
  .summary-grid { grid-template-columns: 1fr; margin-top: 30px; }
  .summary-card { min-height: 190px; }
  .workspace-note { grid-template-columns: 1fr; }
  .record-card { grid-template-columns: 1fr; }
  .record-actions { grid-row: 1; justify-content: flex-end; }
  .form-grid, .explanation { grid-template-columns: 1fr; }
  label.wide { grid-column: auto; }
}
@media (max-width: 470px) {
  .brand small { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-head .button { width: 100%; }
  .record-card { padding: 18px; }
  .modal-actions .button { flex: 1; }
  .login-shell { padding: 28px 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

