* { box-sizing: border-box; }
:root { font-family: "Segoe UI", system-ui, sans-serif; color: #182733; background: #eef2f5; --ink: #162631; --muted: #50616e; --line: #dce4e9; --accent: #c6ef76; }
body { margin: 0; min-width: 280px; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #537bce; outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .55; }
[hidden] { display: none !important; }
.top { background: #101c27; color: #f4f8fa; }
.top-inner { max-width: 1232px; padding: 16px 28px; margin: auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; color: inherit; text-decoration: none; }
.logo { flex: none; width: 34px; height: 34px; border-radius: 9px; }
.status { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 14px; font-size: .875rem; color: #c5d4de; }
#connection::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 7px; }
#connection.offline::before { background: #ffd17e; }
main { max-width: 1232px; margin: auto; padding: 36px 28px 48px; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; }
.context { margin: 0 0 5px; color: #435969; font-weight: 650; }
h1 { margin: 0; font-size: clamp(2.45rem, 6vw, 4rem); letter-spacing: -.06em; line-height: 1; }
.subtitle { margin: 10px 0 0; color: var(--muted); }
.primary { border: none; border-radius: 10px; padding: 12px 17px; min-height: 44px; color: #16251c; background: var(--accent); font-weight: 750; }
.primary:hover { background: #b8e762; }
.notice { background: #e2ebf1; color: #263e50; padding: 10px 14px; border-radius: 8px; font-size: .9rem; margin-bottom: 16px; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric, .panel { border-radius: 14px; background: #fff; border: 1px solid var(--line); min-width: 0; }
.metric { padding: 18px; }
.metric h2 { margin: 0 0 8px; font-size: .95rem; font-weight: 650; }
.metric strong { font-size: clamp(1.55rem, 3vw, 2.2rem); letter-spacing: -.045em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric p { margin: 7px 0 0; color: var(--muted); font-size: .875rem; }
.featured { background: #192c38; border-color: #192c38; color: #eff7fa; }
.featured strong { color: #d4f59a; }
.featured p { color: #bed1dc; }
.columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; gap: 16px; }
aside { display: grid; gap: 16px; }
.panel { overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.panel h2, dialog h2 { font-size: 1.15rem; margin: 0; letter-spacing: -.02em; }
select, input { width: 100%; min-height: 43px; border: 1px solid #c6d3db; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); }
select { padding-right: 24px; }
.panel select { width: auto; min-height: 36px; font-size: .9rem; max-width: 100%; }
.entry, .wallet { display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; align-items: center; width: 100%; text-align: left; padding: 12px 16px; border: 0; background: transparent; color: inherit; gap: 9px; }
.entry:hover { background: #f0f6f9; }
.entry + .entry, .wallet + .wallet, .method + .method { border-top: 1px solid var(--line); }
.symbol { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 9px; background: #e7eef4; font-weight: 700; color: #2d536d; }
.entry[data-type="income"] .symbol { color: #2c5935; background: #e4f2df; }
.entry-title { display: block; font-weight: 650; overflow-wrap: anywhere; }
.meta { display: block; color: var(--muted); font-size: .875rem; margin-top: 3px; overflow-wrap: anywhere; }
.money { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; overflow-wrap: anywhere; max-width: 30vw; }
.method { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 16px; }
.empty { padding: 0 16px; color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 15px; color: var(--ink); max-height: 90dvh; width: min(620px, calc(100% - 20px)); padding: 20px; }
dialog::backdrop { background: #0b1726a8; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head { margin-bottom: 14px; }
.close, .danger { border: solid 1px var(--line); background: #fff; border-radius: 8px; min-height: 42px; padding: 6px 12px; color: inherit; }
.close { font-size: 1.25rem; }
.danger, .error { color: #a32934; }
#editor[open] { display: flex; flex-direction: column; height: min(760px, 90dvh); overflow: hidden; padding: 0; }
#editor-form { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.editor-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 16px clamp(12px, 3vw, 20px); }
.editor-section { margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fcf8ef; }
.editor-section h3 { margin: 0 0 8px; font-size: .9rem; }
.editor-section .rate-hint { min-height: 2.7em; line-height: 1.35; }
.editor-footer, #editor .dialog-head { flex-shrink: 0; margin: 0; padding: 10px clamp(12px, 3vw, 20px); background: #fff; }
#editor .dialog-head { border-bottom: 1px solid var(--line); }
.editor-footer { border-top: 1px solid var(--line); }
#editor .dialog-actions { flex-wrap: wrap; gap: 8px; margin: 0; }
#form-error { margin: 0 0 8px; }
.dialog-close { flex: 0 0 44px; display: grid; place-items: center; height: 44px; padding: 0; font-size: 1.65rem; line-height: 1; background: #eef2f5; }
.dialog-close:hover { background: #e2ebf1; }
#discard-dialog { max-width: 370px; }
#discard-dialog .dialog-actions { flex-wrap: wrap; }
#discard-dialog .secondary { border: 1px solid var(--line); background: #eef2f5; border-radius: 8px; min-height: 42px; padding: 6px 12px; color: inherit; }
.dialog-actions .primary { margin-left: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-grid label, .currency-field { display: grid; align-content: start; min-width: 0; gap: 4px; font-size: .9rem; font-weight: 650; }
.form-grid label > span { display: inline; }
.form-grid input:not([type="hidden"]), .form-grid select { display: block; min-width: 0; max-width: 100%; font-size: 1rem; font-weight: 400; }
.form-grid input[type="date"] { appearance: none; }
.form-grid input[type="date"]::-webkit-date-and-time-value { min-height: 1.25em; text-align: left; }
.form-grid small { color: var(--muted); font-size: .83rem; font-weight: 400; }
#currency-button { min-height: 43px; padding: 8px 10px; width: 100%; background: #fff; color: var(--ink); border: 1px solid #c6d3db; border-radius: 8px; text-align: left; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#currency-button:disabled { opacity: 1; cursor: default; background: #eef2f5; }
.currency-picker { width: min(420px, calc(100% - 20px)); }
#currency-results { margin-top: 6px; max-height: min(18rem, 52dvh); overflow: auto; }
#currency-results > button { width: 100%; border: 0; padding: 8px; min-height: 40px; background: transparent; color: var(--ink); text-align: left; font-weight: 400; }
#currency-results > button:hover, #currency-results > button[aria-pressed="true"] { background: #edf4f7; }
#currency-results > p { margin: 6px; color: var(--muted); }
.wide { grid-column: 1 / -1; }
.error:empty { display: none; }
.dialog-actions { margin-top: 16px; }
@media (max-width: 760px) {
  .top-inner { padding: 12px 16px; }
  main { padding: 23px 14px 32px; }
  .columns { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 500px) {
  .intro { align-items: stretch; flex-direction: column; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .featured { grid-column: 1 / -1; }
  .metric { padding: 12px; }
  .status { font-size: .8rem; flex-direction: column; gap: 2px; align-items: flex-end; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .entry, .wallet { padding: 12px; }
}

/* The diary uses a paper background, a ruled journal and a concise budget summary. */
:root { background: #f2ecdf; color: #292d23; --ink: #292d23; --muted: #5c5d4c; --line: #d9cfb8; --accent: #e6d7a8; }
.top { background: #384230; }
.primary:hover { background: #dbcb99; }
.panel,.metric { background: #fcf8ed; }
.metric.featured { background: #3e4937; border-color: #3e4937; }
.featured strong { color: #f3e6b9; }
.featured p { color: #ebe6cc; }
.intro h1 { font-family: Georgia,serif; font-weight: 500; }
.journal { background: repeating-linear-gradient(#fcf8ed 0 26px,#efe7d5 26px 27px); }
.journal .panel-head { background: #fcf8ed; }
.journal-day { margin: 0; padding: 8px 16px; border-bottom: 1px solid var(--line); color: #843f35; font: 600 17px Georgia,serif; }
.journal .entry { background: #fcf8eddd; }
.journal .entry:hover { background: #eee4cd; }
.site-footer { border-top: 1px solid var(--line); }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 24px; max-width: 1232px; margin: auto; padding: 14px 16px; }
.site-footer a, .help-page a { color: #3e523e; text-underline-offset: .2em; }
.site-footer a { padding: 6px 0; }
.help-page { max-width: 860px; }
.help-page h1 { margin: 12px 0 18px; font-family: Georgia, serif; font-weight: 500; }
.help-index { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 20px; }
.help-index a { padding: 4px 0; }
.help-section { margin-bottom: 14px; padding: clamp(14px, 3vw, 24px); border: 1px solid var(--line); border-radius: 8px; background: #fcf8ed; line-height: 1.55; }
.help-section h2 { margin: 0 0 10px; font-family: Georgia, serif; font-weight: 500; line-height: 1.2; }
.help-section h3 { margin: 0 0 8px; font-size: 1rem; }
.help-section p, .help-section ul, .help-section ol { margin: 0 0 12px; }
.help-section p:last-child, .help-section ul:last-child, .help-section ol:last-child { margin-bottom: 0; }
.help-section ul, .help-section ol { padding-inline-start: 22px; }
.help-section li + li { margin-top: 7px; }
.install-platform { display: grid; gap: 4px; max-width: 260px; margin-bottom: 14px; font-weight: 650; }
.install-guides { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 12px; margin-bottom: 14px; }
.install-guide { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 7px; }
.entry-conversion { display: block; margin-top: 5px; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.entry-overpaid { color: #843f35; }
.entry-saved { color: #365d39; }
.entry-conversion strong { font-variant-numeric: tabular-nums; }
.workspace-form .ghost,.detail-list .ghost { color: var(--ink); }
.offline-choice { display: flex !important; align-items: center; gap: 7px; align-self: center; }
.offline-choice input { width: auto; min-height: auto; }
.offline-setting { flex: 0 0 100%; min-width: 0; margin-top: 5px; }
.offline-setting p { max-width: 48ch; margin: 4px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.4; }
#journal-search { width: min(100%, 250px); }
.workspace-form { display: grid; gap: 12px; margin: 12px 0; }
.workspace-form label, .admin-toolbar label { display: grid; gap: 5px; min-width: 0; }
.workspace-form button { justify-self: start; }
.workspace-form fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: 8px; min-width: 0; }
.workspace-form fieldset p { margin: 0 0 8px; }
.country-picker { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.country-picker select { min-width: 0; }
.country-picker button:disabled { cursor: default; }
.country-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; padding: 0; list-style: none; }
.country-tags:empty { display: none; }
.country-tags li { display: flex; align-items: center; gap: 4px; max-width: 100%; padding-left: 9px; border: 1px solid var(--line); border-radius: 8px; background: #f2ecdf; }
.country-tags span { min-width: 0; overflow-wrap: anywhere; }
.country-tags button { flex: 0 0 34px; min-height: 34px; border: 0; background: transparent; color: var(--ink); }
.detail-list { padding-left: 18px; overflow-wrap: anywhere; }
.detail-list li { margin-bottom: 5px; }
.share-line { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 8px; margin-block: 4px; }
.shared-totals { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,110px),1fr)); gap: 8px; margin: 0 0 14px; }
.shared-totals div { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.shared-totals dt, .shared-hint { color: var(--muted); }
.shared-totals dd { margin: 3px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.shared-spending li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.shared-spending span { overflow-wrap: anywhere; }
.shared-hint { margin: 0; }
.invite-output { display: grid; gap: 8px; max-width: 620px; margin-top: 12px; }
.invite-row { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.invite-row label { display: grid; gap: 5px; flex: 1 1 240px; min-width: 0; font-weight: 650; }
.invite-row input { min-width: 0; font-weight: 400; }
.invite-row button { min-height: 43px; }
.invite-output p { margin: 0; }
.residence-controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: end; margin: 0 0 14px; }
.residence-controls label { display: grid; gap: 4px; font-weight: 650; }
.residence-controls p { flex: 1 1 240px; margin: 0; }
.card-balances { padding: 12px 0; border-bottom: 1px solid var(--line); }
.card-balances dl { margin: 6px 0 0; }
.card-balances dl div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 4px 0; }
.card-balances dd { margin: 0; }
.card-settings [data-card-extra] { display: grid; gap: 8px; margin-top: 8px; }
.card-currency-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: end; margin: 8px 0; }
.card-currency-row strong { align-self: center; }
.card-currency-row label { flex: 1 1 130px; }
.workspace-main { min-width: 0; }
.workspace-heading { margin: 18px 0; }
.workspace-heading h1 { margin-bottom: 4px; }
.workspace-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.workspace-list { display: grid; gap: 10px; padding: 0; list-style: none; }
.workspace-list > li, .workspace-editor { min-width: 0; padding: clamp(12px,3vw,20px); }
.workspace-item-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 5px 15px; }
.workspace-item-heading h2 { margin: 0; overflow-wrap: anywhere; }
.workspace-item-heading p { margin: 0; }
.workspace-list .workspace-actions { margin: 10px 0 0; }
.workspace-balances { margin: 10px 0 0; }
.workspace-balances > div { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.workspace-balances dd { margin: 0; }
.wallet-account-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.statement-preview { max-height: 55vh; overflow: auto; }
.statement-preview .offline-choice { align-items: start; }
.shared-add { margin: 14px 0; }
.shared-add summary, .workspace-editor summary { cursor: pointer; }
#product-error:empty, #product-message:empty { display: none; }
#product-content > .notice { margin-top: 10px; }
#purchase-preview p { margin: 5px 0; }
.admin-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: 12px; }
.admin-toolbar .close { min-height: 43px; }
.admin-form { padding: 16px; }
.admin-form #fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit,minmax(min(200px,100%),1fr)); }
#rows { overflow: auto; margin: 12px 0; }
#rows table { border-collapse: collapse; background: #fcf8ed; }
#rows th,#rows td { text-align: left; vertical-align: top; border: 1px solid var(--line); padding: 6px 8px; overflow-wrap: anywhere; }
.admin-main > .notice:empty { display: none; }
@media (max-width: 500px) {
  .admin-toolbar { grid-template-columns: minmax(0, 1fr); }
  .admin-toolbar .close { justify-self: start; }
}

.ghost { min-height: 36px; border: 1px solid #657581; border-radius: 8px; background: transparent; color: #f4f8fa; padding: 5px 10px; }
.top-inner .status { margin-left: auto; }
.admin-login { display: grid; gap: 16px; max-width: 540px; margin: 24px auto; padding: clamp(17px, 5vw, 34px); }
.admin-login h1 { margin-bottom: 3px; font: 500 clamp(1.8rem, 5vw, 2.55rem)/1.1 Georgia, serif; letter-spacing: -.04em; }
.admin-login label { display: grid; gap: 6px; font-weight: 650; }
.admin-login input { font-weight: 400; }
.admin-login .primary { justify-self: start; }
.admin-login .auth-feedback { margin: 0; }

.auth-book {
  display: grid;
  grid-template-columns: minmax(0, 242px) minmax(0, 1fr);
  width: min(100%, 735px);
  margin: clamp(20px, 5vw, 62px) auto;
  overflow: hidden;
  border: 1px solid #d7cdb7;
  border-radius: 12px;
  background: #fdf9ee;
  box-shadow: 0 16px 36px #4039240b;
}
.auth-cover {
  position: relative;
  overflow: hidden;
  padding: 39px 28px;
  border-left: 6px solid #303a2b;
  border-right: 3px double #8e9474;
  color: #f5efd9;
  background: repeating-linear-gradient(0deg, transparent 0 29px, #ecdfb90b 29px 30px), #3e4937;
}
.auth-cover p {
  position: relative;
  z-index: 1;
  margin: 0;
  font: italic 400 clamp(1.65rem, 3vw, 2.35rem)/1.08 Georgia, serif;
  letter-spacing: -.045em;
}
.auth-route { position: absolute; inset: auto 19px 40px 19px; height: 168px; color: #d1c49a; }
.auth-route::before, .auth-route::after {
  position: absolute;
  content: '';
  border: 1px dashed currentColor;
}
.auth-route::before { inset: 25% 18% 25% 16%; border-top: 0; border-right: 0; border-bottom-left-radius: 55px; }
.auth-route::after { inset: 25% 18% 25% 52%; border-bottom: 0; border-left: 0; border-top-right-radius: 45px; }
.auth-route span {
  position: absolute;
  width: 9px;
  height: 9px;
  transform: translate(-50%, -50%);
  border: 1px solid currentColor;
  border-radius: 50%;
  background: #3e4937;
}
.auth-route span:nth-child(1) { top: 25%; left: 16%; }
.auth-route span:nth-child(2) { top: 25%; left: 52%; }
.auth-route span:nth-child(3) { top: 75%; left: 82%; }
.auth-page { min-width: 0; padding: 40px clamp(26px, 5vw, 60px) 36px; }
.auth-heading { margin-bottom: 24px; }
.auth-heading h1 { font: 500 clamp(2rem, 4.2vw, 3.05rem)/1.07 Georgia, serif; letter-spacing: -.055em; }
.auth-heading p { margin: 9px 0 0; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.auth-form { display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; }
.auth-form label { font-size: .875rem; line-height: 1.35; font-weight: 650; }
.auth-form input {
  min-height: 46px;
  margin-top: 6px;
  border-color: #beb6a1;
  border-radius: 6px;
  padding-inline: 12px;
  background: #fffcf4;
  font-size: 1rem;
}
.auth-page :is(input,button,a):focus-visible { outline-color: #526848; }
.password-field { position: relative; margin-top: 6px; }
.auth-form .password-field input { display: block; margin-top: 0; padding-inline-end: 48px; }
.password-field input::-ms-reveal { display: none; }
.password-toggle {
  position: absolute;
  inset: 1px 1px 1px auto;
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #42543a;
}
.password-toggle:hover { background: #eee9d9; }
.auth-page .password-toggle:focus-visible { outline-offset: -3px; }
.password-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-field input[type="password"] + .password-toggle .password-toggle-slash { display: none; }
.auth-field-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 12px; margin-top: 21px; }
.auth-link {
  justify-self: start;
  min-height: 36px;
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: #42543a;
  font-size: .875rem;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
}
.auth-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-field-heading .auth-link { position: relative; min-height: 0; padding: 0; }
.auth-field-heading .auth-link::after { position: absolute; inset: -19px -3px -5px; content: ''; }
.auth-submit {
  margin-top: 19px;
  min-height: 46px;
  padding: 10px 14px;
  border: 0;
  border-radius: 7px;
  background: #3e4937;
  color: #fff9ea;
  font-weight: 700;
}
.auth-submit:hover { background: #303b2a; }
.auth-register {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 9px;
  margin-top: 18px;
  padding-top: 9px;
  border-top: 1px solid #e2dac8;
  color: var(--muted);
  font-size: .875rem;
}
.auth-resend { margin-top: 1px; }
.auth-feedback {
  margin: 0 0 16px;
  padding: 9px 11px;
  border-inline-start: 2px solid #657656;
  background: #f0efdf;
  font-size: .875rem;
  line-height: 1.45;
}
.auth-feedback:empty { display: none; }
.auth-feedback[data-kind="error"] { border-color: #8d4539; background: #f7ebe4; color: #753c31; }
.auth-page #test-link { display: inline-block; margin: 0 0 14px; }
#auth-back { margin-top: 12px; }
@media (max-width: 650px) {
  .auth-book { grid-template-columns: minmax(0, 1fr); max-width: 480px; margin-block: 10px 24px; }
  .auth-cover { min-height: 86px; padding: 23px 22px; border-right: 0; border-bottom: 3px double #8e9474; }
  .auth-cover p { font-size: 1.6rem; }
  .auth-cover-break { display: none; }
  .auth-route { inset: 9px 12px auto auto; height: 72px; width: 97px; opacity: .48; }
  .auth-page { padding: 24px clamp(17px, 5vw, 30px) 21px; }
  .auth-heading { margin-bottom: 19px; }
  .auth-link { min-height: 44px; }
}
@media (max-width: 355px) {
  .auth-route { display: none; }
  .auth-register { gap: 0 7px; }
}

.sync-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-bottom: 16px; }
.sync-bar .notice { margin: 0; flex: 1 1 235px; display: flex; align-items: center; }
#conflict { margin-top: 14px; }
#conflict p { margin-top: 0; }

.journal-nav { position: relative; display: flex; gap: 4px; padding: 6px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fcf8ed; }
.journal-nav .journal-tab, .journal-option {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 44px;
  border: 0; border-radius: 8px; background: transparent; color: #3e4937; font-weight: 650; text-align: left;
}
.journal-more > summary { cursor: pointer; list-style: none; }
.journal-more > summary::-webkit-details-marker { display: none; }
.journal-nav svg, .journal .symbol svg { flex: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.journal-nav .journal-tab:hover, .journal-option:hover { background: #f0e7d2; }
.journal-nav [aria-current=page], .journal-more:has([aria-current=page]) > summary, .journal-more[open] > summary { background: #e6ebda; color: #273c29; }
.journal-menu {
  position: absolute; z-index: 3; inset: calc(100% + 6px) 0 auto auto; width: min(310px, calc(100vw - 26px));
  max-height: min(58dvh, 420px); overflow: auto; padding: 8px; border: 1px solid #c7c1ab;
  border-radius: 12px; background: #fcf8ed; box-shadow: 0 12px 35px #2a301a26;
}
.journal-menu > .journal-option { width: 100%; }
.journal-menu > label { display: grid; gap: 4px; padding: 8px 12px; font-size: .82rem; color: var(--muted); }
.journal-menu .offline-setting { margin: 6px 4px 0; padding: 10px 8px 4px; border-top: 1px solid var(--line); font-size: .88rem; }
.journal-cover {
  position: relative; isolation: isolate; display: block; overflow: hidden; margin-bottom: 12px; min-height: 136px;
  padding: clamp(14px, 3vw, 30px); color: #fffaf0; border-radius: 14px; background:
    repeating-linear-gradient(0deg, transparent 0 27px, #efefd811 27px 28px), linear-gradient(135deg, #3e4937 12%, #505e40 100%);
}
.journal-cover-content { position: relative; z-index: 1; max-width: 56ch; }
.journal-cover h1 { font-size: clamp(1.9rem, 5vw, 3.7rem); overflow-wrap: anywhere; line-height: 1.05; }
.journal-cover .context, .journal-cover .subtitle { color: #f1e8ca; font-size: .88rem; }
.journal-cover .subtitle { margin-top: 6px; overflow-wrap: anywhere; }
.journal-cover .journal-route { inset: 14% 2% 10% auto; display: block; width: min(36%, 340px); height: auto; opacity: .5; }
#open-trips { margin: 8px 0 -4px; padding: 6px 8px; min-height: 44px; border: 0; border-radius: 7px; background: #e9dbb7; color: #2d3827; font-weight: 650; }
#open-trips:hover { background: #f4e7be; }
#open-trips span { margin-left: 4px; }
.selected-trip { border-color: #aab49a; background: #e9eedf; }
.selected-trip .context { color: #405336; font-size: .86rem; }
.trips-list .workspace-item-heading { margin-bottom: 10px; }
#trip-summary { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
#trip-summary .metric { padding: 12px 14px; }
#trip-summary .featured { grid-column: auto; }
#journal-view[data-mode="residence"] .featured { grid-column: 1 / -1; }
.trip-insights { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px; background: #fcf8ed; }
.trip-insights > summary, .editor-details > summary { min-height: 44px; padding: 11px 12px; color: #3e4937; font-weight: 650; cursor: pointer; }
.trip-insight-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding: 0 8px 8px; }
.journal-day { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; background: #f1e9d7; }
.journal-day-total { color: #405336; font: 650 .86rem/1.4 "Segoe UI",system-ui,sans-serif; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.entry-reference { display: block; margin-top: 4px; color: var(--muted); font-size: .83rem; font-weight: 400; }
.entry .symbol-food { background: #f6e5d8; color: #843f2a; }
.entry .symbol-ride { background: #e4ebf8; color: #294e88; }
.entry .symbol-stay { background: #e3eee3; color: #315b45; }
.entry .symbol-shopping { background: #ece4f5; color: #643e7b; }
.journal-add { position: sticky; bottom: 12px; z-index: 1; display: flex; justify-content: flex-end; margin-top: 12px; pointer-events: none; }
.journal-add button { pointer-events: auto; color: #fffaf0; background: #3e4937; box-shadow: 0 4px 16px #292d2340; }
.journal-add button:hover { background: #516043; }
.sync-bar { margin-bottom: 10px; }
.sync-bar .notice { flex-basis: 12em; }
#sync-now { min-height: 36px; font-size: .83rem; }

summary:focus-visible { outline: 3px solid #537bce; outline-offset: 2px; }
.editor-primary-fields { align-items: start; }
.purchase-amount input, .editor-primary-fields #currency-button { min-height: 52px; }
.form-grid .purchase-amount input { font-size: 1.55rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.purchase-estimate { margin: -4px 0 1px; color: var(--muted); font-size: .85rem; }
.editor-details { margin-top: 12px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fcf8ed; }
.editor-details > summary { margin-inline: -12px; }
.editor-details[open] { padding-bottom: 12px; }
#editor[open]:has(.editor-details:not([open])) { height: fit-content; }

@media (min-width: 800px) {
  #dashboard { display: grid; grid-template-columns: minmax(178px, 18%) minmax(0,1fr); gap: 0 18px; align-items: start; }
  .journal-nav { position: sticky; top: 12px; display: grid; grid-template-columns: minmax(0,1fr); max-height: calc(100dvh - 24px); overflow-y: auto; }
  .journal-nav .journal-more > summary { display: none; }
  .journal-menu {
    position: static; display: grid; grid-template-columns: minmax(0,1fr); gap: 4px; width: auto; max-height: none; overflow: visible;
    padding: 0; border: 0; box-shadow: none;
  }
  .journal-menu > label { margin-top: 4px; border-top: 1px solid var(--line); }
  .journal-menu select { min-width: 0; }
  .journal-nav .journal-tab { width: 100%; }
}
@media (650px < width < 800px) {
  .journal-nav > * { flex: none; }
  .journal-nav > .journal-tab, .journal-nav > .journal-option, .journal-nav .journal-more > summary {
    padding-inline: 8px; white-space: nowrap;
  }
}
@media (max-width: 650px) {
  html:has(#dashboard:not([hidden])) { scroll-padding-bottom: calc(124px + env(safe-area-inset-bottom)); }
  body:has(#dashboard:not([hidden])) { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  body:has(#journal-view:not([hidden]) .journal-add:not([hidden])):has(#dashboard:not([hidden])) { padding-bottom: calc(119px + env(safe-area-inset-bottom)); }
  .journal-nav {
    position: fixed; z-index: 3; inset: auto 0 0; display: flex; justify-content: center; gap: 1px;
    margin: 0; padding: 4px 5px calc(4px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 0;
  }
  .journal-nav > * { flex: 1 1 0; min-width: 0; max-width: 135px; }
  .journal-nav .journal-tab { flex-direction: column; justify-content: center; gap: 3px; padding: 4px 0; width: 100%; min-height: 49px; font-size: .74rem; text-align: center; }
  .journal-menu { inset: auto 8px calc(100% + 6px) auto; }
  .journal-add { position: fixed; inset: auto 0 calc(57px + env(safe-area-inset-bottom)); margin: 0; padding: 6px 14px; justify-content: center; }
  .journal-add button { width: min(100%, 460px); }
  .journal-cover .journal-route { opacity: .29; }
  .journal .panel-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; padding: 12px; }
  .journal .panel-head h2 { grid-column: 1 / -1; }
  .journal .panel-head select, #journal-search { width: 100%; min-width: 0; min-height: 44px; font-size: 1rem; }
  .journal .panel-head select { padding-inline: 5px 18px; font-size: .86rem; }
  .editor-primary-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sync-bar .notice { padding: 8px 10px; font-size: .82rem; }
  #sync-now { padding-inline: 8px; }
  #editor[open] { inset: auto 0 0; width: 100%; max-width: none; margin: 0; border-radius: 16px 16px 0 0; }
  #editor:has(.editor-details:not([open])) .dialog-actions .primary { width: 100%; }
  .editor-footer { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
