* { 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; }
.journal-nav { display: flex; flex-wrap: wrap; align-items: end; gap: 5px 10px; margin-bottom: 15px; }
.journal-nav label { font-size: .85rem; }
.journal-nav select { display: block; width: min(225px,72vw); }
.journal-nav .ghost,.login .ghost,.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: 9px; margin: 12px 0; }
.workspace-form label, .admin-form label { display: grid; gap: 4px; 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; }
#product-dialog { overflow: auto; }
#product-content > .notice { margin-top: 10px; }
#purchase-preview p { margin: 5px 0; }
.admin-form { padding: 12px; }
.admin-form #fields { display: grid; gap: 7px; 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; }
#management > label { display: inline-grid; margin: 0 8px 8px 0; }
@media (min-width: 980px) {
  #dashboard { display: grid; grid-template-columns: 162px minmax(0,1fr); gap: 0 18px; align-items: start; }
  #dashboard > :not(.journal-nav) { grid-column: 2; }
  #dashboard .journal-nav { grid-column: 1; grid-row: 1 / span 5; display: grid; align-items: stretch; gap: 4px; padding: 12px; border-radius: 7px; background: #3e4635; color: #fff9eb; }
  #dashboard .journal-nav button { width: 100%; text-align: left; border-color: #788265; color: #fff9eb; }
  #dashboard .journal-nav button:hover { background: #505b44; }
  #dashboard .journal-nav select { width: 100%; margin: 4px 0 7px; }
  .offline-setting p { color: #e4e3d5; }
}
@media (max-width: 500px) {
  .journal-nav { gap: 5px; }
  .journal-nav select { width: 100%; }
  .journal-nav > label:first-child { flex: 1 0 100%; }
}

.ghost { min-height: 36px; border: 1px solid #657581; border-radius: 8px; background: transparent; color: #f4f8fa; padding: 5px 10px; }
.top-inner .status { margin-left: auto; }
.login { max-width: 540px; margin: 24px auto; padding: clamp(17px, 5vw, 34px); }
.login h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.1; }
.login > p:not(.context) { color: var(--muted); }
.login form, .login label { display: grid; gap: 6px; }
.login form { gap: 12px; }
.login-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.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; }
.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; }
