:root {
  color-scheme: light;
  --ink: #182745;
  --subtle: #52617a;
  --blue: #254dca;
  --navy: #1b3472;
  --paper: #fff;
  --bed: #eef2f8;
  --line: #d9e1ee;
  --soft-blue: #eaf0ff;
  --green: #176b50;
  --orange: #885012;
  font: 16px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bed); color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: var(--blue); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #456deb;
  outline-offset: 3px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.15rem); letter-spacing: -.065em; line-height: 1.06; margin: 0 0 22px; }
h2 { font-size: 1.28rem; letter-spacing: -.035em; line-height: 1.25; }
h3 { font-size: 1rem; }
small { font-size: .82rem; }
.muted { color: var(--subtle); }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1056px; padding: 0 28px; margin: auto; min-height: 70px; display: flex; gap: 44px; align-items: center; }
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-size: 1.08rem; font-weight: 800; letter-spacing: -.04em; }
.brand-mark { position: relative; background: var(--blue); width: 31px; height: 31px; border-radius: 9px; }
.brand-mark::after { content: ""; position: absolute; left: 9px; top: 8px; width: 11px; height: 8px; border: solid white; border-width: 0 0 2px 2px; transform: rotate(-45deg); }
nav { align-self: stretch; display: flex; gap: 20px; }
nav button { background: none; border: 0; border-bottom: 3px solid transparent; font-weight: 650; font-size: .93rem; color: var(--subtle); padding: 3px 2px 0; }
nav button[aria-current] { color: var(--blue); border-bottom-color: var(--blue); }
.account { display: flex; align-items: center; gap: 9px; margin-left: auto; border: 0; background: transparent; padding: 6px 0 6px 6px; font-size: .9rem; font-weight: 650; }
#initial { width: 32px; height: 32px; display: grid; place-content: center; border-radius: 50%; background: var(--soft-blue); color: var(--blue); }
.caret { color: var(--subtle); align-self: start; }
.shell { max-width: 1056px; padding: 39px 28px 58px; margin: auto; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1.58fr) minmax(0, 1fr); gap: 20px; }
.balance { position: relative; min-width: 0; background: var(--navy); border-radius: 21px; padding: 30px 34px; min-height: 257px; color: white; display: flex; flex-direction: column; align-items: flex-start; overflow: hidden; isolation: isolate; }
.balance::after { content: ""; z-index: -1; position: absolute; right: -77px; bottom: -162px; width: 400px; aspect-ratio: 1; border: 1px solid #5270ac; border-radius: 50%; box-shadow: 0 0 0 26px #26417f, 0 0 0 27px #5270ac, 0 0 0 53px #26417f, 0 0 0 54px #5270ac; }
.balance-label { display: flex; align-items: center; gap: 8px; font-size: .93rem; font-weight: 620; color: #e6eeff; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #89e1c8; flex: none; }
.balance-value { margin: 10px 0 3px; font-size: clamp(2.45rem, 6.2vw, 3.95rem); line-height: 1.11; letter-spacing: -.068em; font-weight: 670; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.balance-value span { font-size: .66em; color: #bcd0ff; }
.balance-date { color: #d7e3ff; font-size: .88rem; margin-bottom: 15px; }
.balance-action { margin-top: auto; background: #314c8a; border: 1px solid #5974ad; border-radius: 8px; color: white; padding: 8px 12px; text-align: left; font-weight: 650; font-size: .85rem; }
.balance-action:hover { background: #405c9a; }
.actions { border: 1px solid var(--line); border-radius: 18px; background: var(--paper); padding: 19px 20px 11px; }
.actions h2 { margin: 0 0 8px 2px; font-size: 1rem; letter-spacing: -.02em; }
.actions > button { display: flex; width: 100%; align-items: center; gap: 12px; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; padding: 11px 2px; font-weight: 685; line-height: 1.22; }
.actions > button:first-of-type { border-top: 0; }
.actions > button:hover { color: var(--blue); }
.action-icon { flex: none; display: grid; place-content: center; width: 37px; height: 37px; background: var(--soft-blue); border-radius: 10px; color: var(--blue); font-size: 1.3rem; }
.actions small { display: block; color: var(--subtle); font-weight: 450; margin-top: 3px; }
.actions i { margin-left: auto; color: var(--subtle); font-size: 1.3rem; font-style: normal; padding: 0 3px; }
.activity { margin-top: 31px; }
.section-heading, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.page-heading { margin-bottom: 22px; }
.page-heading h1 { margin: 0; }
.search { width: min(235px, 52%); }
.search input { padding: 8px 12px; min-height: 38px; background: #f9fbff; }
.filters { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin: 13px 0; }
.filters button { background: transparent; border: 1px solid transparent; color: var(--subtle); border-radius: 8px; padding: 7px 10px; font-size: .84rem; font-weight: 650; }
.filters button[aria-pressed="true"] { background: var(--paper); border-color: var(--line); color: var(--blue); }
.filters span:not(:empty) { background: #dfe7fa; border-radius: 5px; padding: 1px 5px; margin-left: 2px; }
.entry-list { list-style: none; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 0; margin: 0; overflow: hidden; }
.entry-list li + li { border-top: 1px solid var(--line); }
.entry-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 15px 16px; background: none; border: 0; text-align: left; }
.entry-row:hover { background: #f6f8fe; }
.entry-row:focus-visible { outline-offset: -4px; }
.entry-row .title { display: block; font-size: .98rem; font-weight: 700; overflow-wrap: anywhere; }
.entry-row .detail { display: block; font-size: .79rem; color: var(--subtle); margin-top: 3px; }
.entry-row .money { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.entry-row .positive { color: var(--green); }
.entry-row .right { text-align: right; }
.status { display: inline-block; font-size: .73rem; font-weight: 680; padding: 2px 7px; margin-top: 4px; border-radius: 5px; color: var(--subtle); background: #edf1f6; }
.status.pending, .status.missing, .status.due { background: #fff0d9; color: var(--orange); }
.status.confirmed, .status.active { background: #e2f4ed; color: var(--green); }
.empty { border: 1px dashed #becbe0; border-radius: 13px; padding: 27px 17px; color: var(--subtle); text-align: center; }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }
.more { display: block; margin: 16px auto 0; }
.auth { max-width: 428px; margin: 28px auto; padding: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 17px; }
.auth h1 { font-size: 2.05rem; margin-bottom: 8px; }
.auth > p { margin-bottom: 18px; }
form { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
form label, .link-field { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; font-weight: 650; min-width: 0; }
form .full, .dialog-actions, .form-error, .form-intro { grid-column: 1/-1; }
input, select, textarea { width: 100%; border: 1px solid #c0cce0; border-radius: 8px; min-height: 43px; background: white; padding: 8px 10px; }
textarea { min-height: 65px; resize: vertical; }
input[type="checkbox"] { min-height: auto; width: auto; accent-color: var(--blue); }
form label.check { flex-direction: row; align-items: center; gap: 7px; }
.form-help, .form-intro { font-size: .83rem; color: var(--subtle); font-weight: 450; }
.form-error { color: #8e2337; background: #feebee; border-radius: 7px; padding: 10px; font-size: .88rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; }
.primary, .secondary, .danger { font-weight: 690; font-size: .91rem; border-radius: 8px; padding: 9px 14px; min-height: 41px; border: 1px solid transparent; text-decoration: none; }
.primary { background: var(--blue); color: white; }
.primary:hover { background: #1c3ea9; }
.secondary { background: var(--paper); border-color: #bfcbe0; color: var(--blue); }
.secondary:hover { background: #f1f5ff; }
.danger { background: #fff3f4; border-color: #e8c7ce; color: #8a293c; }
.icon-button { flex: none; display: grid; place-content: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #f7f9fc; font-size: 1.4rem; line-height: 1; }
dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 21px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--paper); box-shadow: 0 16px 60px #111e4138; overflow: auto; }
dialog::backdrop { background: #111e415f; }
.dialog-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 14px; }
.dialog-top h2 { margin-top: 6px; overflow-wrap: anywhere; }
.facts { display: grid; font-size: .9rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.28fr); gap: 8px; margin: 12px 0 14px; }
.facts dt { color: var(--subtle); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.history { font-size: .83rem; color: var(--subtle); margin-top: 16px; }
.history summary { cursor: pointer; font-weight: 620; }
.history li { margin: 5px 0; }
.toast { position: fixed; z-index: 1; bottom: 20px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 30px); background: var(--ink); padding: 11px 15px; color: white; border-radius: 9px; box-shadow: 0 8px 20px #111e4138; font-size: .92rem; }
.settings-section + .settings-section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 16px; }
.settings-section p { margin: 6px 0 10px; }
.sub-list { list-style: none; padding: 0; margin: 10px 0 18px; border: 1px solid var(--line); background: var(--paper); border-radius: 13px; }
.sub-list li + li { border-top: 1px solid var(--line); }
.calendar { background: white; border: 1px solid var(--line); border-radius: 13px; padding: 16px; margin-top: 20px; }
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.calendar-nav h2 { text-align: center; font-size: 1.08rem; }
.calendar-nav h2::first-letter { text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; text-align: center; }
.cal-grid > span, .cal-grid > button { color: var(--subtle); padding: 6px 3px; min-width: 0; }
.cal-grid > button { border: 0; background: var(--soft-blue); border-radius: 7px; font-weight: 740; color: var(--blue); }
.cal-grid .today { outline: 1px solid var(--blue); outline-offset: -1px; border-radius: 7px; }
.cal-grid .selected { background: var(--blue); color: white; }
#cal-detail { margin-top: 12px; }
#crop-preview { width: 100%; height: 240px; object-fit: contain; border: 1px solid var(--line); background: var(--bed); border-radius: 8px; }
.crop-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; }
.crop-controls input { min-height: 25px; padding: 0; }
.renewal-links { display: grid; gap: 6px; padding: 0; list-style: none; margin: 12px 0; }
.renewal-links input { width: auto; min-height: auto; }
.renewal-links label { display: flex; flex-direction: row; padding: 7px 0; }
.renewal-history-list { list-style: none; padding: 0; margin: 8px 0; }
.renewal-history-list li { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 6px 0; }
.renewal-history-list button { font-size: .78rem; min-height: 36px; padding: 5px 8px; }

@media (max-width: 700px) {
  .topbar-inner { min-height: 60px; padding: 0 16px; gap: 20px; }
  .shell { padding: 26px 16px 40px; }
  .dashboard { grid-template-columns: 1fr; gap: 10px; }
  .balance { padding: 22px; min-height: 193px; border-radius: 18px; }
  .balance::after { right: -160px; bottom: -240px; }
  .actions { padding: 12px; }
  .actions h2 { margin-left: 1px; }
  .actions > button { padding: 8px 2px; }
  .activity { margin-top: 24px; }
  .entry-row { padding: 12px 10px; gap: 8px; }
  .entry-row .money { font-size: .86rem; }
  .entry-row .action-icon { width: 31px; height: 31px; font-size: 1.05rem; }
}
@media (max-width: 500px) {
  #account-name, .caret { display: none; }
  .brand-mark { width: 27px; height: 27px; }
  .brand-mark::after { top: 7px; left: 7px; }
  nav { gap: 12px; }
  nav button { font-size: .85rem; }
  .topbar-inner { gap: 16px; }
  .page-heading .primary { font-size: .78rem; padding: 8px; }
  .auth { padding: 20px; }
  .balance-value { font-size: clamp(2rem, 9vw, 3rem); }
  .form-grid { gap: 10px; }
}
@media (max-width: 340px) {
  .topbar-inner { gap: 9px; padding-inline: 11px; }
  .shell { padding-inline: 10px; }
  .brand { gap: 5px; }
  .page-heading { flex-wrap: wrap; }
}
