.accounting-journal {
  --aj-ink: #173b3b;
  --aj-muted: #527674;
  --aj-line: #d5e6e2;
  --aj-card: rgba(255,255,255,.9);
  --aj-mint: #dff5ed;
  --aj-accent: #188a70;
  --aj-danger: #a53d48;
  width: min(1180px, 100%);
  min-height: 100%;
  margin-inline: auto;
  padding: clamp(12px, 2vw, 26px);
  color: var(--aj-ink);
  font: inherit;
  direction: rtl;
}
.accounting-journal * { box-sizing: border-box; }
#app #messages:has(> .accounting-journal) { display:block!important;padding:12px!important;overflow-anchor:none; }
#app #messages > .accounting-journal { box-sizing:border-box; }
@media(max-width:640px){
  #app #messages:has(> .accounting-journal) { padding:10px 8px!important; }
  #app #messages > .accounting-journal { padding:0 0 calc(92px + env(safe-area-inset-bottom)); }
}
.accounting-journal [data-aj-voucher-date] { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.accounting-journal .aj-date-hint { color: var(--aj-muted); font-size: 11px; line-height: 1.8; }
.accounting-journal .aj-date-error { color: var(--aj-danger-ink, #a13e45); font-size: 12px; line-height: 1.8; }
.accounting-journal [data-aj-voucher-date][aria-invalid="true"] { border-color: var(--aj-danger-ink, #a13e45); }
.aj-header, .aj-brand, .aj-nav, .aj-card > header, .aj-entry-footer, .aj-lines-heading, .aj-form-top, .aj-inline-form { display: flex; align-items: center; }
.aj-header { justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.aj-brand { gap: 12px; }
.aj-header-tools { display: flex; align-items: center; gap: 8px; }
.aj-header-tools button { min-height: 42px; border: 1px solid var(--aj-line); border-radius: 12px; background: #fff; color: var(--aj-ink); padding: 8px 12px; cursor: pointer; font: inherit; font-weight: 750; }
.aj-workspace-switch { display: flex; align-items: center; gap: 8px; color: var(--aj-muted); font-size: 12px; font-weight: 800; }
.aj-workspace-switch select { min-width: 190px; max-width: min(34vw, 320px); min-height: 42px; border: 1px solid var(--aj-line); border-radius: 12px; background: #fff; color: var(--aj-ink); padding: 7px 10px; font: inherit; }
.aj-brand img { width: 48px; height: 48px; object-fit: contain; padding: 6px; border-radius: 15px; background: var(--aj-mint); border: 1px solid #b8dfd2; }
.aj-brand small, .aj-card header small, .aj-welcome small { color: var(--aj-accent); font-weight: 800; }
.aj-brand h1, .aj-card h2, .aj-welcome h2 { margin: 2px 0; color: var(--aj-ink); }
.aj-header > button, .aj-nav button, .aj-nav summary, .aj-card header button, .aj-lines-heading button, .aj-secondary { border: 1px solid var(--aj-line); border-radius: 12px; background: #fff; color: var(--aj-ink); padding: 9px 13px; cursor: pointer; font: inherit; }
.aj-header > button { width: 44px; height: 44px; font-size: 24px; }
.aj-nav { position: relative; z-index: 12; flex-wrap: wrap; gap: 7px; overflow: visible; padding: 7px; margin-bottom: 16px; border: 1px solid var(--aj-line); border-radius: 16px; background: rgba(242,249,247,.9); }
.aj-nav button, .aj-nav summary { min-height: 40px; white-space: nowrap; border-color: transparent; background: transparent; font-weight: 750; }
.aj-nav-home { margin-inline-end: 3px; }
.aj-nav-group { position: relative; }
.aj-nav-group > summary { display: flex; align-items: center; gap: 10px; list-style: none; }
.aj-nav-group > summary::-webkit-details-marker { display: none; }
.aj-nav-group > summary::after { content: ''; width: 7px; height: 7px; border-inline-end: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .16s ease; }
.aj-nav-group[open] > summary::after { transform: rotate(225deg) translate(-1px,-1px); }
.aj-nav-group.has-active > summary, .aj-nav-group[open] > summary { background: var(--aj-mint); color: var(--aj-accent); border-color: var(--aj-line); }
.aj-nav-menu { position: absolute; inset-block-start: calc(100% + 7px); inset-inline-start: 0; display: grid; gap: 4px; min-width: 220px; max-width: min(280px, calc(100vw - 36px)); padding: 7px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-card); box-shadow: 0 12px 30px rgba(20,55,50,.18); }
.aj-nav-menu button { width: 100%; text-align: start; }
.aj-nav button.active { background: #fff; color: var(--aj-accent); border-color: #b8dfd2; box-shadow: 0 3px 12px rgba(28,83,73,.1); }
.aj-nav-menu button.active { background: var(--aj-mint); border-color: var(--aj-line); box-shadow: none; }
.aj-nav { gap: 6px; padding: 8px; border-radius: 19px; background: linear-gradient(135deg,rgba(248,253,251,.97),rgba(231,245,240,.92)); box-shadow: 0 8px 22px rgba(20,65,58,.075); }
.aj-nav-caption { display: flex; align-items: center; gap: 9px; padding: 0 12px 0 8px; margin-inline-end: 3px; border-inline-end: 1px solid var(--aj-line); }
.aj-nav-caption-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(145deg,#188a70,#48b69a); color: #fff; font-size: 11px; font-weight: 900; box-shadow: 0 4px 12px rgba(24,138,112,.2); }
.aj-nav-caption b, .aj-nav-caption small { display: block; white-space: nowrap; }
.aj-nav-caption b { font-size: 12px; }.aj-nav-caption small { margin-top: 2px; color: var(--aj-muted); font-size: 10px; }
.aj-nav .aj-nav-home, .aj-nav-group > summary { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 7px 11px; border: 1px solid transparent; border-radius: 13px; transition: .18s ease; }
.aj-nav .aj-nav-home { margin: 0; }
.aj-nav-icon { display: inline-grid; place-items: center; flex: 0 0 25px; width: 25px; height: 25px; border-radius: 8px; background: rgba(24,138,112,.09); color: var(--aj-accent); font-size: 17px; line-height: 1; }
.aj-nav-group > summary::after { margin-inline-start: 2px; }
.aj-nav-group.has-active > summary { border-color: color-mix(in srgb,var(--aj-accent),var(--aj-line) 70%); }
.aj-nav .aj-nav-home.active { background: linear-gradient(135deg,#e4f6ef,#d5f0e6); border-color: #b4ddcf; box-shadow: 0 3px 12px rgba(28,83,73,.09); }
.aj-nav-group[open] { z-index: 3; }
.aj-nav-menu { z-index: 20; min-width: 245px; padding: 8px; border-radius: 16px; }
.aj-mobile-nav { display: none; }
.aj-welcome { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: clamp(18px,3vw,30px); border: 1px solid #c9e5dc; border-radius: 22px; background: linear-gradient(125deg,#fafffd,#e5f5ef 66%,#d8f0e8); box-shadow: 0 10px 28px rgba(29,76,68,.08); }
.aj-welcome h2 { font-size: clamp(20px,3vw,29px); }
.aj-welcome p, .aj-card header p { max-width: 720px; margin: 8px 0 0; color: var(--aj-muted); line-height: 1.8; }
.aj-primary { border: 1px solid #13745f; border-radius: 13px; padding: 11px 18px; background: linear-gradient(135deg,#1b9275,#12745f); color: #fff; font: inherit; font-weight: 800; white-space: nowrap; cursor: pointer; box-shadow: 0 5px 14px rgba(20,121,97,.2); }
.aj-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; margin: 14px 0; }
.aj-metrics article { min-width: 0; padding: 16px; border: 1px solid var(--aj-line); border-radius: 17px; background: var(--aj-card); box-shadow: 0 5px 16px rgba(26,67,61,.06); }
.aj-ledger-totals { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 12px 0; }
.aj-ledger-totals article { min-width: 0; padding: 12px 14px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-soft); }
.aj-ledger-totals small, .aj-ledger-opening td:first-child { display: block; color: var(--aj-muted); font-size: 12px; }
.aj-ledger-totals b { display: block; margin-top: 6px; color: var(--aj-ink); }
.aj-account-ledger { margin-top: 14px; scroll-margin-top: 16px; }
.aj-account-ledger .aj-table-wrap small { display: block; color: var(--aj-muted); margin-top: 3px; }
.aj-ledger-opening td { background: var(--aj-soft); font-weight: 800; }
.aj-ledger-pager { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; }
.aj-metrics small, .aj-metrics em { display: block; color: var(--aj-muted); font-size: 12px; font-style: normal; }
.aj-metrics strong { display: block; margin: 8px 0 5px; font-size: clamp(17px,2vw,23px); direction: rtl; unicode-bidi: plaintext; }
.aj-metrics .is-warning { border-color: #e6c995; background: #fff9ec; }
.aj-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
/* TASK 692: dashboard previews are summaries, not full scrolling ledgers. */
.accounting-journal .aj-overview { overflow-anchor:none; }
.accounting-journal .aj-overview-lists { align-items:start; }
.accounting-journal .aj-overview-lists > .aj-card { min-width:0; }
.accounting-journal .aj-recent-list,.accounting-journal .aj-overview-accounts { list-style:none;padding:0;margin:0; }
.accounting-journal .aj-recent-list > li { display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 12px;padding:13px 0;border-bottom:1px solid var(--aj-line); }
.accounting-journal .aj-recent-list > li:last-child,.accounting-journal .aj-overview-accounts > li:last-child { border-bottom:0; }
.accounting-journal .aj-recent-meta { display:flex;align-items:center;gap:5px 12px;flex-wrap:wrap;min-width:0;font-size:12px; }
.accounting-journal .aj-recent-meta time { color:var(--aj-muted);font-size:11px; }
.accounting-journal .aj-recent-list p { grid-column:1;margin:0;font-size:12px;line-height:1.9;color:var(--aj-muted);overflow-wrap:anywhere; }
.accounting-journal .aj-recent-value { grid-column:2;grid-row:1/span 2;align-self:center;display:grid;gap:3px;text-align:end;font-variant-numeric:tabular-nums; }
.accounting-journal .aj-recent-value small { font-size:10px;color:var(--aj-muted); }
.accounting-journal .aj-recent-value strong { font-size:13px;color:var(--aj-ink);overflow-wrap:anywhere; }
.accounting-journal .aj-overview-accounts > li { display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 0;border-bottom:1px solid var(--aj-line); }
.accounting-journal .aj-overview-accounts > li > div { min-width:0;overflow-wrap:anywhere; }
.accounting-journal .aj-overview-accounts b,.accounting-journal .aj-overview-accounts small { display:block;font-size:12px;line-height:1.8; }
.accounting-journal .aj-overview-accounts small { font-size:10px;color:var(--aj-muted); }
.accounting-journal .aj-overview-accounts strong { font-size:13px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;text-align:end; }
@media(max-width:600px){
  .accounting-journal .aj-overview .aj-welcome { padding:16px;gap:12px;box-shadow:none; }
  .accounting-journal .aj-overview .aj-welcome h2 { font-size:18px;line-height:1.8; }
  .accounting-journal .aj-overview .aj-welcome p { font-size:12px; }
  .accounting-journal .aj-overview .aj-metrics { gap:8px; }
  .accounting-journal .aj-overview .aj-metrics article { padding:11px;box-shadow:none; }
  .accounting-journal .aj-overview .aj-metrics strong { font-size:16px;line-height:1.8;overflow-wrap:anywhere; }
  .accounting-journal .aj-overview .aj-metrics small,.accounting-journal .aj-overview .aj-metrics em { font-size:11px;line-height:1.8; }
  .accounting-journal .aj-overview-lists { grid-template-columns:minmax(0,1fr);gap:12px; }
  .accounting-journal .aj-recent-vouchers { grid-row:1; }
  .accounting-journal .aj-overview-lists > .aj-card > header { align-items:flex-start; }
  .accounting-journal .aj-overview-lists h3 { font-size:16px; }
  .accounting-journal .aj-recent-list > li { gap:6px 8px;padding:12px 0; }
  .accounting-journal .aj-recent-meta { align-items:flex-start;flex-direction:column;gap:3px; }
  .accounting-journal .aj-recent-list p { grid-column:1/-1;font-size:12px; }
  .accounting-journal .aj-recent-value { grid-row:1;max-width:165px; }
}
.aj-card { min-width: 0; margin-bottom: 14px; padding: clamp(14px,2vw,22px); border: 1px solid var(--aj-line); border-radius: 20px; background: var(--aj-card); box-shadow: 0 7px 22px rgba(26,67,61,.07); }
.aj-card > header { justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.aj-card h2 { font-size: clamp(20px,2.6vw,27px); }
.aj-card h3 { margin: 3px 0; }
.aj-card header button { color: var(--aj-accent); font-weight: 700; }
.aj-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--aj-line); border-radius: 14px; background: rgba(255,255,255,.85); }
.aj-trial-balance .aj-table-wrap { max-height: 360px; overflow: auto; }
.aj-trial-total th { position: sticky; bottom: 0; z-index: 1; background: #e3f3ed; color: var(--aj-ink); font-weight: 900; }
.aj-trial-status { margin: 9px 2px 0; padding: 9px 11px; border: 1px solid var(--aj-line); border-radius: 11px; font-size: 12px; font-weight: 800; }
.aj-trial-status.is-balanced { border-color: #8bcab5; background: #e8f7f0; color: #17684f; }
.aj-trial-status.is-unbalanced { border-color: #e0a2a2; background: #fff0f0; color: #9d3030; }
.aj-table-wrap table { width: 100%; border-collapse: collapse; text-align: right; min-width: 620px; }
.aj-table-wrap th, .aj-table-wrap td { padding: 11px 12px; border-bottom: 1px solid #e5efec; white-space: nowrap; }
.aj-table-wrap th { background: #edf7f3; color: #315c56; font-size: 12px; }
.aj-table-wrap td { color: #173b3b; font-size: 13px; }
.aj-table-wrap tr:last-child td { border-bottom: 0; }
.aj-table-wrap td b { font-weight: 800; }
.aj-amount { font-variant-numeric: tabular-nums; direction: rtl; unicode-bidi: plaintext; }
.aj-empty, .aj-loading { padding: 24px; text-align: center; color: var(--aj-muted); }
.aj-loading { display: flex; align-items: center; justify-content: center; gap: 8px; }
.aj-loading i { width: 8px; height: 8px; border-radius: 50%; background: var(--aj-accent); animation: aj-pulse .8s infinite alternate; }
.aj-loading i:nth-child(2) { animation-delay: .2s; }.aj-loading i:nth-child(3) { animation-delay: .4s; }
@keyframes aj-pulse { to { opacity: .3; transform: translateY(-4px); } }
.aj-entry > header { align-items: start; }
.aj-form-top { align-items: end; gap: 12px; margin: 16px 0; }
.aj-quick-entry { margin-top: 18px; padding: clamp(14px,2.2vw,24px); border: 1px solid #c4e3d8; border-radius: 18px; background: linear-gradient(145deg,#f7fffc,#eaf7f2); }
.aj-quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.aj-quick-grid label { display: grid; gap: 7px; min-width: 0; color: var(--aj-muted); font-size: 13px; font-weight: 800; }
.aj-quick-hint { margin: 13px 0 0; padding: 10px 12px; border-radius: 11px; background: rgba(24,138,112,.09); color: var(--aj-ink); font-size: 13px; line-height: 1.8; }
.aj-advanced-entry { margin-top: 18px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-card); }
.aj-advanced-entry > summary { padding: 13px 16px; color: var(--aj-muted); font-weight: 800; cursor: pointer; }
.aj-advanced-entry[open] > form { padding: 0 16px 16px; }
.accounting-journal [hidden] { display: none !important; }
.aj-dialog-backdrop { position: fixed; inset: 0; z-index: 10050; display: grid; place-items: center; padding: 18px; background: rgba(12,28,34,.58); backdrop-filter: blur(5px); }
.aj-dialog { width: min(480px,100%); max-height: min(90dvh,720px); overflow: auto; padding: 24px; border: 1px solid #b9d8cf; border-radius: 20px; background: #f8fcfb; color: #173b3b; box-shadow: 0 24px 80px rgba(5,26,30,.32); direction: rtl; font: inherit; }
.aj-dialog h2 { margin: 0 0 10px; color: #173b3b; font-size: 20px; }
.aj-dialog p { margin: 0; color: #527674; line-height: 1.9; }
.aj-dialog-phrase { display: grid; gap: 8px; margin-top: 16px; color: #315c56; font-size: 13px; }
.aj-dialog-phrase b { color: #a53d48; direction: rtl; }
.aj-dialog-phrase input { min-height: 44px; width: 100%; border: 1px solid #abcac0; border-radius: 11px; padding: 9px 11px; background: #fff; color: #173b3b; font: inherit; }
.aj-dialog-actions { display: flex; justify-content: flex-start; gap: 9px; margin-top: 20px; }
.aj-dialog-actions button { min-height: 42px; }
.aj-dialog-actions button:disabled { cursor: not-allowed; opacity: .5; }
html[data-theme="dark"] .aj-dialog { border-color: #42645e; background: #142728; color: #e4f2ee; }
html[data-theme="dark"] .aj-dialog h2 { color: #e4f2ee; }
html[data-theme="dark"] .aj-dialog p, html[data-theme="dark"] .aj-dialog-phrase { color: #b5d0c9; }
html[data-theme="dark"] .aj-dialog-phrase input { border-color: #42645e; background: #20393a; color: #e4f2ee; }
html[data-theme="dark"] .aj-dialog .aj-danger-action { border-color: #895d5d; background: #432d30; color: #ffd9d9; }
.aj-voucher-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.aj-report-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 12px; margin: 14px 0 20px; padding: 16px; border: 1px solid var(--aj-line); border-radius: 16px; background: rgba(237,248,244,.8); }
.aj-report-filters label { display: grid; gap: 6px; color: var(--aj-muted); font-size: 12px; font-weight: 800; }
.aj-report-filters button { grid-column: 1 / -1; }
.aj-report-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 14px 0 22px; }
.aj-report-metrics article { min-width: 0; padding: 13px 15px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-card); }
.aj-report-metrics small { display: block; color: var(--aj-muted); }
.aj-report-metrics strong { display: block; margin-top: 7px; overflow-wrap: anywhere; font-size: clamp(15px,2vw,21px); }
.aj-report-metrics .is-warning { border-color: #dfb8a6; background: #fff1ea; }
.aj-report-note { padding: 10px 12px; border-radius: 10px; background: #fff5df; color: #694f20; font-size: 12px; }
.aj-form-top label, .aj-inline-form label, .aj-line label { display: grid; gap: 6px; min-width: 0; color: var(--aj-muted); font-size: 12px; font-weight: 700; }
.aj-form-top .aj-grow { flex: 1; }
.accounting-journal input, .accounting-journal select { width: 100%; min-height: 42px; border: 1px solid #c8dcd6; border-radius: 11px; padding: 8px 10px; background: #fff; color: #173b3b; font: inherit; font-size: 14px; }
.aj-lines-heading { justify-content: space-between; margin: 18px 0 9px; font-weight: 800; }
.aj-lines { display: grid; gap: 9px; }
.aj-line { display: grid; grid-template-columns: 1.5fr 1.1fr 1fr .8fr .8fr 1.2fr 36px; gap: 8px; align-items: end; padding: 12px; border: 1px solid var(--aj-line); border-radius: 14px; background: #f7fbfa; }
.aj-line button { width: 34px; height: 40px; border: 1px solid #e1c5c8; border-radius: 10px; background: #fff6f6; color: var(--aj-danger); font-size: 21px; cursor: pointer; }
.aj-entry-footer { justify-content: space-between; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--aj-line); color: var(--aj-danger); font-weight: 700; }
.aj-entry-footer .is-balanced { color: var(--aj-accent); }
.aj-inline-form { flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 18px; padding: 14px; border-radius: 15px; background: #f1f8f5; }
.aj-inline-form label { flex: 1 1 180px; }
.aj-inline-form.aj-person-form, .aj-account-create > .aj-inline-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 12px; }
.aj-inline-form.aj-person-form > label, .aj-account-create > .aj-inline-form > label { min-width: 0; }
.aj-inline-form.aj-person-form > .aj-person-extra { grid-column: 1 / -1; min-width: 0; }
.aj-inline-form.aj-person-form > button, .aj-account-create > .aj-inline-form > button { min-height: 42px; }
.aj-quick-grid label { min-width: 0; }
.aj-quick-discount input { border-color: #70b99f; background: #f0fbf6; }
.aj-quick-discount[hidden] { display: none !important; }
.aj-person-extra { flex: 1 1 100%; overflow: hidden; border: 1px solid var(--aj-line); border-radius: 12px; background: var(--aj-card); }
.aj-person-extra > summary { padding: 10px 12px; color: var(--aj-muted); font-weight: 750; cursor: pointer; }
.aj-person-extra > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 12px; border-top: 1px solid var(--aj-line); }
.aj-person-extra > div label { flex: initial; }
.aj-account-create, .aj-account-group, .aj-opening-tools { margin-top: 12px; overflow: hidden; border: 1px solid var(--aj-line); border-radius: 15px; background: var(--aj-card); }
.aj-account-create > summary, .aj-account-group > summary, .aj-opening-tools > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 11px 15px; color: var(--aj-ink); font-weight: 800; cursor: pointer; list-style: none; }
.aj-account-create > summary::-webkit-details-marker, .aj-account-group > summary::-webkit-details-marker, .aj-opening-tools > summary::-webkit-details-marker { display: none; }
.aj-account-create > summary::after, .aj-account-group > summary::after, .aj-opening-tools > summary::after { content: '＋'; color: var(--aj-accent); font-size: 18px; }
.aj-account-create[open] > summary::after, .aj-account-group[open] > summary::after, .aj-opening-tools[open] > summary::after { content: '−'; }
.aj-account-create[open] > summary, .aj-account-group[open] > summary, .aj-opening-tools[open] > summary { border-bottom: 1px solid var(--aj-line); background: var(--aj-mint); }
.aj-account-group > summary > span { margin-inline-start: auto; color: var(--aj-muted); font-size: 12px; font-weight: 650; }
.aj-account-create > .aj-inline-form { margin: 0; border-radius: 0; }
.aj-account-group > .aj-table-wrap { width: calc(100% - 20px); margin: 10px; }
.aj-opening-tools { border-style: dashed; }
.aj-opening-tools > div { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.aj-opening-tools button { border: 1px solid #acd6c9; border-radius: 11px; padding: 9px 12px; background: #fff; color: var(--aj-ink); font: inherit; cursor: pointer; }
.aj-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; color: #7d5315; background: #fff2d6; font-size: 12px; font-weight: 800; }
.aj-note { margin-top: 18px; padding: 14px 16px; border-right: 4px solid #dbab56; border-radius: 10px; background: #fff8e9; color: #604a2a; }
.aj-note p { margin: 5px 0 0; line-height: 1.8; }
.aj-issue-list { display: grid; gap: 10px; }
.aj-issue-list article { display: flex; gap: 12px; padding: 14px; border: 1px solid #ead7b4; border-radius: 14px; background: #fffaf0; }
.aj-issue-mark { flex: 0 0 28px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #f4dfb8; color: #77510e; font-weight: 900; }
.aj-issue-list p { margin: 4px 0; line-height: 1.75; }.aj-issue-list small { color: var(--aj-muted); }
.aj-voucher-details { display: grid; gap: 8px; margin-top: 12px; }
.aj-voucher-details details { padding: 12px; border: 1px solid var(--aj-line); border-radius: 13px; background: #fbfefd; }
.aj-voucher-details summary { cursor: pointer; font-weight: 800; }
.aj-voucher-details .aj-table-wrap { margin: 10px 0; }
.aj-party-list { display: grid; gap: 9px; }
.aj-party-row { overflow: hidden; border: 1px solid var(--aj-line); border-radius: 14px; background: rgba(255,255,255,.7); }
.aj-party-row > summary { display: grid; grid-template-columns: minmax(130px,1.4fr) repeat(3,minmax(125px,1fr)) minmax(95px,auto); align-items: center; gap: 12px; padding: 14px; cursor: pointer; list-style: none; }
.aj-party-row > summary::-webkit-details-marker { display: none; }
.aj-party-row > summary > span { display: grid; gap: 4px; }.aj-party-row > summary small { color: var(--aj-muted); font-size: 11px; }
.aj-party-row .aj-party-net b { font-size: 14px; font-variant-numeric: tabular-nums; }
.aj-party-row .aj-party-net.is-positive b { color: #08785f; }
.aj-party-row .aj-party-net.is-negative b { color: #b33b4a; }
.aj-party-row .aj-party-net.is-zero b { color: var(--aj-muted); }
.aj-party-row .aj-party-count { justify-self: end; color: var(--aj-accent); font-size: 12px; font-weight: 800; }
.aj-party-row > .aj-table-wrap { width: calc(100% - 20px); margin: 0 10px 10px; }
.aj-party-row .aj-table-wrap td small { display: block; margin-top: 4px; color: var(--aj-muted); white-space: normal; }
.aj-secondary { margin-top: 4px; }
.aj-error { padding: 18px; border-radius: 12px; background: #fff0f0; color: var(--aj-danger); }
.aj-bulk-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 12px 0 8px; padding: 11px 13px; border: 1px solid var(--aj-line); border-radius: 13px; background: var(--aj-mint); color: var(--aj-ink); }
.aj-bulk-toolbar label, .aj-voucher-select { display: inline-flex; align-items: center; gap: 8px; color: var(--aj-ink); font-size: 12px; font-weight: 750; cursor: pointer; }
.accounting-journal input[type="checkbox"] { width: 18px; min-height: 18px; margin: 0; accent-color: #159879; }
.aj-voucher-entry { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 10px; align-items: start; }
.aj-voucher-details .aj-voucher-entry details { min-width: 0; }
.aj-voucher-select { min-height: 42px; padding: 8px; border: 1px solid var(--aj-line); border-radius: 11px; background: var(--aj-card); }
.aj-voucher-protected { justify-content: center; color: var(--aj-muted); cursor: default; font-size: 10px; }
.aj-record-finder { margin-bottom: 14px; }
.aj-record-finder form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.aj-record-finder label { flex: 1 1 160px; display: grid; gap: 7px; min-width: 0; }
.aj-record-finder [data-aj-record-results] { display: flex; flex-wrap: wrap; gap: 8px; }
.aj-voucher-editable { justify-content: center; border-color: color-mix(in srgb, var(--aj-accent) 45%, var(--aj-line)); background: color-mix(in srgb, var(--aj-accent) 12%, var(--aj-card)); color: var(--aj-ink); cursor: default; font-size: 10px; }
.aj-danger-action { min-height: 40px; border: 1px solid #d99b9b; border-radius: 11px; padding: 8px 13px; background: #fff0f0; color: #8b2929; font: inherit; font-weight: 800; cursor: pointer; }
.aj-danger-action:disabled { opacity: .48; cursor: not-allowed; }
.aj-backup-card, .aj-reset-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 15px; padding: 16px; border: 1px solid var(--aj-line); border-radius: 15px; background: var(--aj-card); }
.aj-backup-card h3, .aj-reset-card h3 { margin: 0 0 5px; }
.aj-backup-card p, .aj-reset-card p { margin: 0; color: var(--aj-muted); line-height: 1.8; font-size: 13px; }
.aj-backup-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.aj-backup-actions button:disabled { opacity: .5; cursor: not-allowed; }
.aj-reset-card { border-color: #e5b7b7; background: #fff8f7; }
html[data-theme="dark"] .accounting-journal .aj-reset-card { border-color: #754d4d; background: #332729; }
html[data-theme="dark"] .accounting-journal .aj-danger-action { border-color: #895d5d; background: #432d30; color: #ffd9d9; }

html[data-theme="dark"] .accounting-journal { --aj-ink: #e0f1ed; --aj-muted: #a7c6bf; --aj-line: #365a54; --aj-card: rgba(24,43,45,.96); --aj-mint: #234f47; --aj-accent: #73d5b5; color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal .aj-nav, html[data-theme="dark"] .accounting-journal .aj-lines-heading, html[data-theme="dark"] .accounting-journal .aj-line, html[data-theme="dark"] .accounting-journal .aj-inline-form, html[data-theme="dark"] .accounting-journal .aj-voucher-details details { background: #1d3435; }
html[data-theme="dark"] .accounting-journal .aj-welcome { background: linear-gradient(120deg,#203b3a,#234e45); border-color: #426a5e; }
html[data-theme="dark"] .accounting-journal .aj-table-wrap, html[data-theme="dark"] .accounting-journal .aj-nav button.active { background: #21393a; }
html[data-theme="dark"] .accounting-journal .aj-party-row { background: #1d3435; }
html[data-theme="dark"] .accounting-journal .aj-opening-tools, html[data-theme="dark"] .accounting-journal .aj-account-create, html[data-theme="dark"] .accounting-journal .aj-account-group { background: #1d3435; border-color: #426a5e; }
html[data-theme="dark"] .accounting-journal .aj-person-extra { background: #1d3435; border-color: #426a5e; }
html[data-theme="dark"] .accounting-journal .aj-account-create[open] > summary, html[data-theme="dark"] .accounting-journal .aj-account-group[open] > summary, html[data-theme="dark"] .accounting-journal .aj-opening-tools[open] > summary { background: #234f47; }
html[data-theme="dark"] .accounting-journal .aj-opening-tools button { background: #142728; color: #e4f2ee; border-color: #42645e; }
html[data-theme="dark"] .accounting-journal .aj-quick-entry { background: linear-gradient(145deg,#1d3435,#203d38); border-color: #426a5e; }
html[data-theme="dark"] .accounting-journal .aj-quick-hint { background: rgba(115,213,181,.12); color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal .aj-report-filters { background: #1d3435; }
html[data-theme="dark"] .accounting-journal .aj-report-note { background: #3b3220; color: #f4dda7; }
html[data-theme="dark"] .accounting-journal .aj-table-wrap th { background: #2b4947; color: #dbefea; }
html[data-theme="dark"] .accounting-journal .aj-trial-total th { background: #234f47; color: #e0f1ed; }
html[data-theme="dark"] .accounting-journal .aj-trial-status.is-balanced { border-color: #397660; background: #1d3c34; color: #a8e7ce; }
html[data-theme="dark"] .accounting-journal .aj-trial-status.is-unbalanced { border-color: #895d5d; background: #432d30; color: #ffd9d9; }
html[data-theme="dark"] .accounting-journal .aj-table-wrap td, html[data-theme="dark"] .accounting-journal .aj-table-wrap td b, html[data-theme="dark"] .accounting-journal h1, html[data-theme="dark"] .accounting-journal h2, html[data-theme="dark"] .accounting-journal h3 { color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal input, html[data-theme="dark"] .accounting-journal select, html[data-theme="dark"] .accounting-journal .aj-header > button, html[data-theme="dark"] .accounting-journal .aj-secondary, html[data-theme="dark"] .accounting-journal .aj-lines-heading button { background: #142728; color: #e4f2ee; border-color: #42645e; }

@media (max-width: 900px) {
  .aj-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .aj-ledger-totals { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .aj-columns { grid-template-columns: 1fr; }
  .aj-line { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .aj-line .aj-account-field, .aj-line .aj-memo { grid-column: 1 / -1; }
  .aj-line button { grid-column: 1 / -1; justify-self: end; }
}
@media (max-width: 560px) {
  .accounting-journal { padding: 10px; }
  .aj-header { margin-bottom: 10px; }.aj-brand img { width: 40px; height: 40px; }
  .aj-nav { gap: 5px; margin-bottom: 10px; border-radius: 12px; padding: 6px; }.aj-nav button, .aj-nav summary { min-height: 38px; padding: 7px 9px; font-size: 12px; }.aj-nav-menu { min-width: 200px; max-width: calc(100vw - 36px); }
  .aj-welcome { align-items: stretch; flex-direction: column; border-radius: 16px; }
  .aj-primary { width: 100%; }
  .aj-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }.aj-metrics article { padding: 12px; }
  .aj-ledger-totals { grid-template-columns: 1fr 1fr; gap: 7px; }
  .aj-metrics article:last-child { grid-column: 1 / -1; }
  .aj-card { padding: 12px; border-radius: 15px; }.aj-form-top { align-items: stretch; flex-direction: column; }
  .aj-quick-grid { grid-template-columns: 1fr; gap: 10px; }.aj-quick-entry { padding: 12px; }
  .aj-person-extra > div { grid-template-columns: 1fr; }
  .aj-inline-form.aj-person-form, .aj-account-create > .aj-inline-form { grid-template-columns: 1fr; }
  .aj-inline-form.aj-person-form > .aj-person-extra { grid-column: auto; }
  .aj-report-filters { grid-template-columns: 1fr; padding: 12px; }.aj-report-filters button { grid-column: auto; }
  .aj-report-metrics { grid-template-columns: 1fr 1fr; gap: 8px; }
  .aj-entry-footer { align-items: stretch; flex-direction: column; }
  .aj-party-row > summary { grid-template-columns: 1fr 1fr; gap: 10px; }
  .aj-party-row .aj-party-count { justify-self: start; }
  .aj-voucher-entry { grid-template-columns: 1fr; gap: 6px; }
  .aj-voucher-select { width: fit-content; min-height: 34px; }
  .aj-backup-card, .aj-reset-card { align-items: stretch; flex-direction: column; }
  .aj-backup-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .aj-danger-action { width: 100%; }
}
.aj-trade { display:grid; gap:16px; }
.aj-trade-forms { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; align-items:start; }
.aj-trade-forms > .aj-card { display:grid; gap:12px; align-content:start; }
.aj-trade label { display:grid; gap:6px; font-size:.88rem; }
.aj-trade input,.aj-trade select { min-width:0; width:100%; }
.aj-trade .aj-table-wrap { overflow:auto; }
.aj-trade-invoice-head { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.aj-trade-invoice-form [data-aj-stock-hint] { grid-column: 1 / -1; color: var(--aj-muted); line-height: 1.8; overflow-wrap: anywhere; }
.aj-trade-invoice-form [data-aj-stock-hint]:empty { display: none; }
.aj-trade-invoice-form [data-aj-invoice-total] { color: var(--aj-accent); font-weight: 800; font-variant-numeric: tabular-nums; }
.aj-trade-invoice-form [data-aj-trade-hint] { display: block; font-weight: 400; line-height: 1.85; }
.aj-trade-invoice-form, .aj-trade-invoice-form label, .aj-trade-invoice-form input, .aj-trade-invoice-form select { min-width: 0; max-width: 100%; }
.aj-trade-invoice-line { display:grid; grid-template-columns:2fr 1fr 1fr; gap:10px; padding:10px 0; border-bottom:1px solid var(--aj-border,#d8e4e2); }
.aj-trade-report { display:grid; gap:14px; margin-top:20px; }
.aj-trade-settlement { display:grid; gap:12px; }
.aj-trade-settlement form { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)) auto; gap:10px; align-items:end; }
.aj-trade-settlement label { display:grid; gap:6px; }
@media (max-width: 980px) { .aj-trade-forms { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media (max-width: 620px) { .aj-trade-forms,.aj-trade-invoice-head,.aj-trade-settlement form { grid-template-columns:1fr; } .aj-trade-invoice-line { grid-template-columns:1fr 1fr; } .aj-trade-invoice-line label:first-child { grid-column:1/-1; } }

.aj-cheque-form { margin: 12px 0 20px; padding: clamp(14px,2.2vw,22px); border: 1px solid #c5e1d7; border-radius: 18px; background: linear-gradient(145deg,#f8fffc,#eaf6f1); }
.aj-cheque-form .aj-cheque-note { grid-column: 1 / -1; }
.aj-cheque-list { display: grid; gap: 10px; }
.aj-cheque-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--aj-line); border-radius: 16px; background: var(--aj-card); box-shadow: 0 5px 15px rgba(26,67,61,.05); }
.aj-cheque-main { display: grid; gap: 5px; min-width: 0; }
.aj-cheque-direction, .aj-cheque-main small, .aj-cheque-main p, .aj-cheque-voucher { color: var(--aj-muted); font-size: 12px; }
.aj-cheque-main strong { overflow-wrap: anywhere; }
.aj-cheque-amount { color: var(--aj-ink); font-weight: 850; direction: rtl; unicode-bidi: plaintext; }
.aj-cheque-status { padding: 6px 9px; border: 1px solid #dfc99c; border-radius: 999px; background: #fff7e8; color: #75561d; font-size: 11px; font-weight: 800; white-space: nowrap; }
.aj-cheque-row.is-cleared .aj-cheque-status { border-color: #a9d8c3; background: #eaf8f0; color: #176a50; }
.aj-cheque-row.is-returned .aj-cheque-status { border-color: #e6c2c4; background: #fff0f0; color: #963f45; }
.aj-cheque-actions { display: flex; grid-column: 1 / -1; flex-wrap: wrap; gap: 8px; padding-top: 9px; border-top: 1px solid var(--aj-line); }
.aj-cheque-actions button { min-height: 38px; padding: 7px 12px; }
.aj-cheque-voucher { grid-column: 1 / -1; direction: ltr; overflow-wrap: anywhere; }
.aj-cheque-calendar-setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 14px 0; padding: 16px; border: 1px solid var(--aj-line); border-radius: 15px; background: var(--aj-card); }
.aj-cheque-calendar-setting p { margin: 6px 0 0; color: var(--aj-muted); line-height: 1.8; }
.aj-cheque-calendar-setting label { display: flex; align-items: center; gap: 9px; min-width: max-content; font-weight: 800; }
.aj-cheque-calendar-setting input { width: 20px; min-height: 20px; accent-color: var(--aj-accent); }
.aj-collaboration > .aj-inline-form { margin: 14px 0; }
.aj-collaborator-search-field { position: relative; flex: 2 1 300px !important; }
.aj-collaborator-search-field > input { width: 100%; min-height: 42px; box-sizing: border-box; padding: 8px 11px; border: 1px solid var(--aj-line); border-radius: 11px; background: var(--aj-card); color: var(--aj-ink); font: inherit; }
.aj-collaborator-search-field > small { color: var(--aj-muted); font-size: 11px; line-height: 1.7; }
.aj-collaborator-search-results { position: absolute; z-index: 20; inset-inline: 0; top: calc(100% - 20px); display: grid; max-height: 260px; overflow: auto; padding: 5px; border: 1px solid var(--aj-line); border-radius: 12px; background: var(--aj-card); box-shadow: 0 12px 28px rgba(15,40,38,.2); }
.aj-collaborator-search-results[hidden] { display: none !important; }
.aj-collaborator-search-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--aj-ink); text-align: right; font: inherit; cursor: pointer; }
.aj-collaborator-search-option:hover, .aj-collaborator-search-option:focus-visible { outline: none; background: var(--aj-surface-2); }
.aj-collaborator-search-option small, .aj-collaborator-search-empty { color: var(--aj-muted); font-size: 11px; }
.aj-collaborator-search-empty { padding: 12px 10px; line-height: 1.8; }
.aj-role-guide { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 14px 0; }
.aj-role-guide article { display: grid; gap: 6px; padding: 13px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-card); }
.aj-role-guide b { color: var(--aj-accent); }
.aj-role-guide span, .aj-collaboration-list small { color: var(--aj-muted); font-size: 12px; line-height: 1.7; }
.aj-collaboration-list { margin-top: 18px; }
.aj-collaboration-list h3 { margin: 0 0 10px; }
.aj-collaboration-list article { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-card); }
.aj-collaboration-list article > div:first-child { display: grid; gap: 3px; min-width: 0; }
.aj-collaboration-list article > div:last-child { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.aj-collaboration-list [data-aj-member-role] { min-height: 38px; border: 1px solid var(--aj-line); border-radius: 10px; background: #fff; color: var(--aj-ink); padding: 5px 8px; font: inherit; }
.aj-dialog > label { display: grid; gap: 7px; margin-top: 14px; color: var(--aj-muted); font-size: 13px; font-weight: 750; }
.aj-dialog > label input, .aj-dialog > label select { min-height: 43px; border: 1px solid #abcac0; border-radius: 11px; padding: 8px 10px; background: #fff; color: #173b3b; font: inherit; }
html[data-theme="dark"] .aj-cheque-form { border-color: #36594f; background: linear-gradient(145deg,#172e2d,#203b36); }
html[data-theme="dark"] .aj-cheque-row, html[data-theme="dark"] .aj-cheque-calendar-setting { border-color: #36594f; background: #172b2c; color: #e4f2ee; }
html[data-theme="dark"] .aj-cheque-amount { color: #e4f2ee; }
html[data-theme="dark"] .aj-cheque-status { border-color: #6c5932; background: #3b3324; color: #f2dba4; }
html[data-theme="dark"] .aj-cheque-row.is-cleared .aj-cheque-status { border-color: #3b785d; background: #1b3a2e; color: #a6e4c3; }
html[data-theme="dark"] .aj-cheque-row.is-returned .aj-cheque-status { border-color: #75474a; background: #3c292b; color: #ffc8c8; }
html[data-theme="dark"] .aj-dialog > label input, html[data-theme="dark"] .aj-dialog > label select { border-color: #42645e; background: #20393a; color: #e4f2ee; }
html[data-theme="dark"] .aj-workspace-switch select, html[data-theme="dark"] .aj-header-tools button, html[data-theme="dark"] .aj-collaboration-list [data-aj-member-role] { border-color: #42645e; background: #142728; color: #e4f2ee; }
html[data-theme="dark"] .aj-role-guide article, html[data-theme="dark"] .aj-collaboration-list article { border-color: #36594f; background: #172b2c; color: #e4f2ee; }
html[data-theme="dark"] .aj-collaborator-search-field > input, html[data-theme="dark"] .aj-collaborator-search-results { border-color: var(--aj-line); background: var(--aj-control); color: var(--aj-ink); }
html[data-theme="dark"] .aj-collaborator-search-option:hover, html[data-theme="dark"] .aj-collaborator-search-option:focus-visible { background: var(--aj-surface-2); }

/* TASK 683: clear collaborator invitation and member controls. */
.accounting-journal .aj-collaboration > header { align-items: flex-start; }
.accounting-journal .aj-collaboration > header > div { min-width: 0; }
.accounting-journal .aj-collaboration > header p { max-width: 760px; }
.accounting-journal .aj-collaboration-invite { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(190px,.8fr) auto; align-items: end; gap: 12px; padding: 16px; }
.accounting-journal .aj-collaboration-invite > label,
.accounting-journal .aj-collaboration-actions .aj-collaboration-role-field { display: grid; min-width: 0; gap: 7px; color: var(--aj-muted); font-size: 12px; font-weight: 750; }
.accounting-journal .aj-collaborator-search-field { flex: initial !important; }
.accounting-journal .aj-collaborator-search-control { position: relative; display: block; min-width: 0; }
.accounting-journal .aj-collaborator-search-field .aj-collaborator-search-control > input { display: block; width: 100%; min-height: 46px; }
.accounting-journal .aj-collaborator-search-results { top: calc(100% + 5px); }
.accounting-journal .aj-collaboration-invite select,
.accounting-journal .aj-collaboration-actions select { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; border: 1px solid var(--aj-line); border-radius: 11px; padding: 8px 10px; background: var(--aj-card); color: var(--aj-ink); font: inherit; }
.accounting-journal .aj-collaboration-invite-submit { min-height: 44px; }
.accounting-journal .aj-collaboration-list { display: grid; gap: 9px; margin-top: 22px; }
.accounting-journal .aj-collaboration-list h3 { margin: 0 0 2px; padding-bottom: 9px; border-bottom: 1px solid var(--aj-line); }
.accounting-journal .aj-collaboration-list article.aj-collaboration-person { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,auto); align-items: center; gap: 16px; margin: 0; padding: 14px 16px; }
.accounting-journal .aj-collaboration-identity { display: grid; align-content: center; gap: 4px; min-width: 0; }
.accounting-journal .aj-collaboration-identity > b { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 9px; min-width: 0; line-height: 1.7; }
.accounting-journal .aj-collaboration-identity > b small { overflow-wrap: anywhere; font-weight: 500; }
.accounting-journal .aj-collaboration-actions { display: flex; align-items: end; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: 0; }
.accounting-journal .aj-collaboration-actions .aj-collaboration-role-field { width: min(220px,32vw); }
.accounting-journal .aj-collaboration-actions :is(button,select) { min-height: 42px; margin: 0; }
.accounting-journal .aj-collaboration-actions .aj-danger-action { white-space: nowrap; }
.accounting-journal .aj-collaboration-person.is-pending { border-style: dashed; }
.accounting-journal .aj-role-guide article { align-content: start; min-width: 0; }
.accounting-journal .aj-role-guide span { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .accounting-journal .aj-collaboration-invite { grid-template-columns: minmax(0,1fr) minmax(175px,.75fr); }
  .accounting-journal .aj-collaboration-invite-submit { grid-column: 1 / -1; width: 100%; }
  .accounting-journal .aj-collaboration-list article.aj-collaboration-person { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .accounting-journal .aj-collaboration-actions { justify-content: stretch; }
  .accounting-journal .aj-collaboration-actions .aj-collaboration-role-field { flex: 1 1 180px; width: auto; }
}
@media (max-width: 560px) {
  .accounting-journal .aj-collaboration-invite { grid-template-columns: minmax(0,1fr); gap: 11px; padding: 12px; }
  .accounting-journal .aj-collaboration-invite-submit { grid-column: auto; }
  .accounting-journal .aj-collaboration-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 8px; }
  .accounting-journal .aj-collaboration-actions .aj-collaboration-role-field { grid-column: 1 / -1; width: 100%; }
  .accounting-journal .aj-collaboration-actions :is(button,select) { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; white-space: normal; }
  .accounting-journal .aj-collaboration-actions .aj-danger-action { width: 100%; }
  .accounting-journal .aj-collaboration-list article.aj-collaboration-person { padding: 12px; }
}
.calendar-cheque-event { border-style: dashed; }
.calendar-cheque-event::before { background: #178c71; }
.calendar-event-readonly { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid currentColor; border-radius: 9px; color: #527674; }
.calendar-event-origin { display: block; margin-top: 4px; color: #527674; font-size: 10px; }
html[data-theme="dark"] .calendar-event-readonly, html[data-theme="dark"] .calendar-event-origin { color: #b5d0c9; }
@media (max-width: 560px) {
  .aj-header { flex-wrap: wrap; }
  .aj-workspace-switch { order: 3; flex: 1 1 100%; }
  .aj-workspace-switch select { flex: 1; max-width: none; min-width: 0; }
  .aj-header-tools { margin-inline-start: auto; }
  .aj-role-guide { grid-template-columns: 1fr; }
  .aj-collaboration-list article { align-items: stretch; flex-direction: column; }
  .aj-cheque-row { grid-template-columns: minmax(0,1fr) auto; gap: 9px; }
  .aj-cheque-status { grid-column: 1 / -1; justify-self: start; }
  .aj-cheque-amount { grid-column: 2; grid-row: 1; }
  .aj-cheque-calendar-setting { align-items: stretch; flex-direction: column; }
  .aj-cheque-calendar-setting label { min-width: 0; }
  .aj-cheque-actions { flex-direction: column; }
}

.aj-fiscal-years { display: grid; gap: 16px; }
.aj-fiscal-year-list { display: grid; gap: 8px; margin-block: 12px 18px; }
.aj-fiscal-year-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-card); }
.aj-fiscal-year-row > div { display: grid; gap: 4px; }
.aj-fiscal-year-row span, .aj-fiscal-year-row small { color: var(--aj-muted); font-size: 12px; }
.aj-fiscal-status { padding: 5px 10px; border-radius: 999px; background: #e5f5ec; color: #17664f !important; font-weight: 700; }
.aj-fiscal-status.closed { background: #edf0f2; color: #59646c !important; }
.aj-fiscal-form { display: grid; gap: 12px; }
.aj-fiscal-form p { margin: 0; color: var(--aj-muted); line-height: 1.8; }
.aj-fiscal-form label { display: grid; gap: 6px; }
.aj-fiscal-form input, .aj-fiscal-years select { width: 100%; min-height: 42px; border: 1px solid var(--aj-line); border-radius: 11px; padding: 8px 11px; background: var(--aj-card); color: var(--aj-ink); }
.aj-fiscal-close { border-color: color-mix(in srgb, var(--aj-danger), transparent 50%); }
html[data-theme="dark"] .aj-fiscal-status { background: #24493e; color: #c5f1de !important; }
html[data-theme="dark"] .aj-fiscal-status.closed { background: #354044; color: #e0e7e9 !important; }
html[data-theme="dark"] .aj-fiscal-form input, html[data-theme="dark"] .aj-fiscal-years select { border-color: #42645e; background: #20393a; color: #e4f2ee; }
@media (max-width: 560px) { .aj-fiscal-year-row { align-items: flex-start; } }

/* Accounting UI audit: centralized surfaces, resilient controls and legible data. */
.accounting-journal {
  --aj-text: var(--aj-ink);
  --aj-border: var(--aj-line);
  --aj-surface: var(--aj-control);
  --aj-soft: #eef6f3;
  --aj-surface-2: #f6faf8;
  --aj-control: #fff;
  --aj-table-head: #e8f3ef;
  --aj-row-hover: #f0f8f5;
  --aj-focus: #087f68;
  --aj-success-bg: #e8f7f0;
  --aj-success-ink: #17684f;
  --aj-warning-bg: #fff6df;
  --aj-warning-ink: #694f20;
  --aj-danger-bg: #fff0f0;
  --aj-danger-ink: #8b2929;
  --aj-shadow: 0 8px 24px rgba(26,67,61,.08);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* TASK 672: compact record lookup and a clear, responsive editing workspace. */
.accounting-journal .aj-record-finder { padding: 14px 18px; border-inline-start: 3px solid var(--aj-accent); }
.accounting-journal .aj-record-finder form { display: grid; grid-template-columns: minmax(140px,1fr) minmax(160px,2fr) auto; align-items: end; gap: 12px; }
.accounting-journal .aj-record-finder label { min-width: 0; margin: 0; }
.accounting-journal .aj-record-finder :is(input,select,button) { min-height: 44px; }
.accounting-journal [data-aj-record-results]:not(:empty) { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 12px; }
.accounting-journal .aj-advanced-entry[open] > summary { padding-block: 14px; border-bottom: 1px solid var(--aj-line); margin-bottom: 16px; color: var(--aj-ink); }
.accounting-journal .aj-entry-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-surface-2); color: var(--aj-muted); }
.accounting-journal .aj-quick-grid { align-items: start; }
.accounting-journal [data-aj-balance] { flex: 1 1 250px; padding: 10px 12px; border-radius: 10px; background: var(--aj-warning-bg); color: var(--aj-warning-ink); font-variant-numeric: tabular-nums; }
.accounting-journal [data-aj-balance].is-balanced { background: var(--aj-success-bg); color: var(--aj-success-ink); }
.accounting-journal [aria-busy="true"] [type="submit"] { cursor: progress; opacity: .6; }
.accounting-journal .aj-card > header { flex-wrap: wrap; gap: 10px; }
.accounting-journal .aj-line { min-width: 0; }
.accounting-journal .aj-line > label { min-width: 0; }
.accounting-journal .aj-line :is(input,select) { width: 100%; min-width: 0; }
.accounting-journal .aj-line input:disabled, .accounting-journal .aj-line select:disabled { opacity: 1; color: var(--aj-muted); background: var(--aj-soft); cursor: not-allowed; }
.accounting-journal .aj-assistant-consent input { width: 18px; height: 18px; min-height: 18px; }
.accounting-journal .aj-table-wrap { max-width: 100%; overscroll-behavior-inline: contain; }
.accounting-journal .aj-table-wrap th { white-space: nowrap; }
.accounting-journal .aj-error { background: var(--aj-danger-bg); color: var(--aj-danger-ink); }
@media (max-width: 640px) {
  .accounting-journal .aj-record-finder { padding: 12px; }
  .accounting-journal .aj-record-finder form { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .accounting-journal .aj-record-finder button[type="submit"] { grid-column: 1 / -1; width: 100%; }
  .accounting-journal .aj-entry-footer { padding: 12px; }
  .accounting-journal .aj-entry-footer { align-items: stretch; flex-direction: column; }
  .accounting-journal [data-aj-balance] { flex: 0 0 auto; }
  .accounting-journal .aj-entry-footer button { flex: 0 0 auto; width: 100%; min-height: 44px; }
}
.accounting-journal :is(button, input, select, textarea, summary, a) { -webkit-tap-highlight-color: transparent; }
.accounting-journal :is(button, input, select, textarea) { transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.accounting-journal :is(button, input, select, textarea, summary, a):focus-visible { outline: 3px solid color-mix(in srgb, var(--aj-focus), transparent 64%); outline-offset: 2px; }
.accounting-journal :is(button, input, select, textarea) { accent-color: var(--aj-accent); }
.accounting-journal :is(input, select, textarea) { background: var(--aj-control); color: var(--aj-ink); }
.accounting-journal :is(input, select, textarea)::placeholder { color: var(--aj-muted); opacity: .78; }
.accounting-journal :is(button, input, select, textarea):disabled { cursor: not-allowed; opacity: .58; filter: saturate(.7); }
.accounting-journal button:not(:disabled):active { transform: translateY(1px); }
.accounting-journal :is(.aj-secondary, .aj-nav button, .aj-nav summary, .aj-header-tools button, .aj-opening-tools button):hover:not(:disabled) { border-color: color-mix(in srgb, var(--aj-accent), var(--aj-line) 42%); background: var(--aj-soft); }
.accounting-journal .aj-primary:hover:not(:disabled) { filter: brightness(1.06); box-shadow: 0 7px 18px rgba(20,121,97,.26); }
.accounting-journal .aj-card { box-shadow: var(--aj-shadow); }
.accounting-journal .aj-table-wrap { background: var(--aj-control); scrollbar-gutter: stable; }
.accounting-journal .aj-table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-inline: contain; }
.accounting-journal .aj-table-wrap table { color: var(--aj-ink); }
.accounting-journal .aj-table-wrap th { position: sticky; top: 0; z-index: 1; background: var(--aj-table-head); color: var(--aj-ink); }
.accounting-journal .aj-table-wrap :is(th, td):first-child { position: sticky; inset-inline-start: 0; box-shadow: -5px 0 8px -7px rgba(17,48,54,.45); }
.accounting-journal .aj-table-wrap thead th:first-child { z-index: 3; background: var(--aj-table-head); }
.accounting-journal .aj-table-wrap tbody td:first-child { z-index: 2; background: var(--aj-control); }
.accounting-journal .aj-table-wrap td { border-color: var(--aj-line); color: var(--aj-ink); }
.accounting-journal .aj-table-wrap tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--aj-soft), transparent 28%); }
.accounting-journal .aj-table-wrap tbody tr:nth-child(even) td:first-child { background: color-mix(in srgb, var(--aj-soft), var(--aj-control) 28%); }
.accounting-journal .aj-table-wrap tbody tr:hover td { background: var(--aj-row-hover); }
.accounting-journal .aj-table-wrap tbody tr:hover td:first-child { background: var(--aj-row-hover); }
.accounting-journal .aj-table-wrap :is(th, td) { line-height: 1.55; }
.accounting-journal .aj-line, .accounting-journal .aj-inline-form { background: var(--aj-surface-2); }
.accounting-journal .aj-voucher-details details, .accounting-journal .aj-party-row { color: var(--aj-ink); }
.accounting-journal .aj-error { border: 1px solid color-mix(in srgb, var(--aj-danger), transparent 65%); background: var(--aj-danger-bg); color: var(--aj-danger-ink); }
.accounting-journal .aj-note, .accounting-journal .aj-report-note { border: 1px solid color-mix(in srgb, #b48732, transparent 60%); background: var(--aj-warning-bg); color: var(--aj-warning-ink); }
.accounting-journal .aj-trial-status.is-balanced, .accounting-journal .aj-fiscal-status:not(.closed) { background: var(--aj-success-bg); color: var(--aj-success-ink); }
.accounting-journal .aj-danger-action { background: var(--aj-danger-bg); color: var(--aj-danger-ink); }
.accounting-journal .aj-dialog-backdrop { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.accounting-journal .aj-dialog { max-height: min(88dvh, 720px); overscroll-behavior: contain; }
.accounting-journal .aj-dialog-actions { flex-wrap: wrap; }
.aj-dialog-backdrop { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.aj-dialog { max-height: min(88dvh, 720px); overscroll-behavior: contain; }
.aj-dialog-actions { flex-wrap: wrap; }
.accounting-journal .aj-metrics strong, .accounting-journal .aj-report-metrics strong, .accounting-journal .aj-ledger-totals b { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.accounting-journal .aj-cheque-status, .accounting-journal .aj-fiscal-status, .accounting-journal .aj-badge { min-height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.accounting-journal .aj-cheque-actions button, .accounting-journal .aj-voucher-actions button { min-height: 42px; }
.accounting-journal .aj-row-color-control { display: inline-flex; align-items: center; gap: 5px; margin: 3px; color: var(--aj-muted); font-size: 11px; white-space: nowrap; }
.accounting-journal .aj-row-color-control select { width: auto; min-width: 94px; min-height: 32px; padding: 4px 7px; font-size: 11px; }
.accounting-journal .aj-account-row-tools, .accounting-journal .aj-party-row-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.accounting-journal .aj-row-number { color: var(--aj-muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.accounting-journal .aj-party-name { display: inline-flex; align-items: center; gap: 8px; }
.accounting-journal .aj-party-name .aj-row-number { display: inline-grid; place-items: center; min-width: 26px; min-height: 26px; border: 1px solid var(--aj-line); border-radius: 8px; background: var(--aj-surface-2); }
.accounting-journal { --aj-row-mint: rgba(32, 171, 131, .13); --aj-row-blue: rgba(48, 130, 214, .13); --aj-row-violet: rgba(133, 94, 214, .13); --aj-row-amber: rgba(218, 157, 42, .16); --aj-row-rose: rgba(218, 89, 122, .13); --aj-row-slate: rgba(109, 126, 139, .15); }
.accounting-journal tr.aj-row-tint-mint > td, .accounting-journal .aj-party-row.aj-row-tint-mint > summary { background: var(--aj-row-mint) !important; }
.accounting-journal tr.aj-row-tint-blue > td, .accounting-journal .aj-party-row.aj-row-tint-blue > summary { background: var(--aj-row-blue) !important; }
.accounting-journal tr.aj-row-tint-violet > td, .accounting-journal .aj-party-row.aj-row-tint-violet > summary { background: var(--aj-row-violet) !important; }
.accounting-journal tr.aj-row-tint-amber > td, .accounting-journal .aj-party-row.aj-row-tint-amber > summary { background: var(--aj-row-amber) !important; }
.accounting-journal tr.aj-row-tint-rose > td, .accounting-journal .aj-party-row.aj-row-tint-rose > summary { background: var(--aj-row-rose) !important; }
.accounting-journal tr.aj-row-tint-slate > td, .accounting-journal .aj-party-row.aj-row-tint-slate > summary { background: var(--aj-row-slate) !important; }
html[data-theme="dark"] .accounting-journal { --aj-row-mint: rgba(66, 200, 157, .18); --aj-row-blue: rgba(80, 159, 237, .19); --aj-row-violet: rgba(163, 123, 239, .19); --aj-row-amber: rgba(226, 175, 76, .19); --aj-row-rose: rgba(235, 112, 147, .18); --aj-row-slate: rgba(158, 176, 189, .16); }
.accounting-journal .aj-fiscal-year-row, .accounting-journal .aj-cheque-row, .accounting-journal .aj-collaboration-list article { min-width: 0; }
@media (max-width: 900px) {
  .accounting-journal .aj-card > header { align-items: flex-start; flex-wrap: wrap; }
  .accounting-journal .aj-line button { min-height: 42px; }
}
@media (max-width: 560px) {
  .accounting-journal { padding: 10px max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left)); }
  .accounting-journal .aj-header { align-items: flex-start; gap: 10px; }
  .accounting-journal .aj-workspace-switch { flex-wrap: wrap; }
  .accounting-journal .aj-workspace-switch select { flex-basis: 100%; }
  .accounting-journal .aj-nav-group { flex: 1 1 auto; min-width: 0; }
  .accounting-journal .aj-nav-group[open] { flex-basis: 100%; }
  .accounting-journal .aj-nav-menu { position: static; width: 100%; min-width: 0; max-width: none; margin-top: 4px; box-shadow: none; }
  .accounting-journal .aj-nav-menu button { white-space: normal; text-align: start; }
  .accounting-journal .aj-metrics article:last-child { grid-column: auto; }
  .accounting-journal .aj-card > header { gap: 8px; }
  .accounting-journal .aj-card > header button { max-width: 100%; white-space: normal; }
  .accounting-journal .aj-cheque-actions button, .accounting-journal .aj-backup-actions button { width: 100%; }
  .accounting-journal .aj-dialog { width: 100%; padding: 18px; border-radius: 16px; }
  .accounting-journal .aj-dialog-actions { display: grid; grid-template-columns: 1fr; }
  .accounting-journal .aj-dialog-actions button { width: 100%; }
  .aj-dialog { width: 100%; padding: 18px; border-radius: 16px; }
  .aj-dialog-actions { display: grid; grid-template-columns: 1fr; }
  .aj-dialog-actions button { width: 100%; }
  .accounting-journal .aj-fiscal-year-row { align-items: flex-start; flex-direction: column; }
  .accounting-journal .aj-table-wrap { max-width: 100%; overscroll-behavior-inline: contain; }
}
@media (prefers-reduced-motion: reduce) {
  .accounting-journal *, .accounting-journal *::before, .accounting-journal *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
html[data-theme="dark"] .accounting-journal {
  --aj-soft: #203a38;
  --aj-surface-2: #1b3333;
  --aj-control: #142728;
  --aj-table-head: #294542;
  --aj-row-hover: #24413e;
  --aj-focus: #8ae0c4;
  --aj-success-bg: #1d3c34;
  --aj-success-ink: #a8e7ce;
  --aj-warning-bg: #3b3220;
  --aj-warning-ink: #f4dda7;
  --aj-danger-bg: #432d30;
  --aj-danger-ink: #ffd9d9;
  --aj-shadow: 0 9px 26px rgba(0,0,0,.2);
}
html[data-theme="dark"] .accounting-journal :is(.aj-header-tools button, .aj-workspace-switch select, .aj-secondary, .aj-nav button, .aj-nav summary, .aj-card header button, .aj-lines-heading button, .aj-opening-tools button, .aj-collaboration-list [data-aj-member-role]) { border-color: var(--aj-line); background: var(--aj-control); color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal :is(.aj-nav, .aj-inline-form, .aj-line, .aj-advanced-entry, .aj-voucher-details details, .aj-party-row, .aj-table-wrap, .aj-report-filters, .aj-quick-entry, .aj-cheque-form, .aj-reset-card, .aj-role-guide article, .aj-collaboration-list article, .aj-fiscal-year-row) { border-color: var(--aj-line); background: var(--aj-surface-2); color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal :is(.aj-table-wrap td, .aj-table-wrap td b, .aj-ledger-totals b, .aj-metrics strong, .aj-report-metrics strong, .aj-fiscal-year-row b, .aj-cheque-main strong) { color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal :is(.aj-table-wrap td, .aj-table-wrap th, .aj-entry-footer) { border-color: var(--aj-line); }
html[data-theme="dark"] .accounting-journal .aj-table-wrap tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--aj-soft), transparent 20%); }
html[data-theme="dark"] .accounting-journal .aj-table-wrap tbody tr:nth-child(even) td:first-child { background: color-mix(in srgb, var(--aj-soft), var(--aj-control) 20%); }
html[data-theme="dark"] .accounting-journal .aj-table-wrap tbody tr:hover td { background: var(--aj-row-hover); }
html[data-theme="dark"] .accounting-journal .aj-table-wrap tbody tr:hover td:first-child { background: var(--aj-row-hover); }
html[data-theme="dark"] .accounting-journal :is(.aj-dialog, .aj-dialog > label input, .aj-dialog > label select, .aj-dialog-phrase input) { border-color: var(--aj-line); background: var(--aj-control); color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal :is(.aj-dialog h2, .aj-dialog p, .aj-dialog-phrase, .aj-dialog-phrase b) { color: var(--aj-ink); }
html[data-theme="dark"] .accounting-journal :is(.aj-note, .aj-report-note, .aj-metrics .is-warning, .aj-report-metrics .is-warning, .aj-cheque-status) { border-color: color-mix(in srgb, var(--aj-warning-ink), transparent 62%); background: var(--aj-warning-bg); color: var(--aj-warning-ink); }
.aj-company-profile { margin-block: 16px; }
.aj-company-profile > header { justify-content: space-between; margin-bottom: 14px; }
.aj-company-logo-row { display: flex; align-items: center; gap: 16px; padding: 14px; margin-bottom: 16px; border: 1px solid var(--aj-line); border-radius: 14px; background: var(--aj-surface-2, rgba(220,240,235,.45)); }
.aj-company-logo-row > div:last-of-type { display: grid; gap: 7px; }
.aj-company-logo-preview { display: grid; place-items: center; width: 104px; height: 84px; flex: 0 0 auto; overflow: hidden; border: 1px dashed var(--aj-accent); border-radius: 12px; color: var(--aj-muted); background: var(--aj-card); }
.aj-company-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.aj-company-logo-row small { color: var(--aj-muted); }
.aj-company-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.aj-company-fields label { display: grid; gap: 6px; min-width: 0; }
.aj-company-fields input, .aj-company-fields textarea { width: 100%; min-height: 42px; border: 1px solid var(--aj-line); border-radius: 10px; padding: 9px 11px; color: var(--aj-ink); background: var(--aj-control, var(--aj-card)); font: inherit; }
.aj-company-fields textarea { resize: vertical; }
.aj-company-address { grid-column: 1 / -1; }
.aj-company-profile .aj-entry-footer { margin-top: 14px; }
@media (max-width: 640px) {
  .aj-company-fields { grid-template-columns: minmax(0, 1fr); }
  .aj-company-address { grid-column: auto; }
  .aj-company-logo-row { align-items: flex-start; flex-wrap: wrap; }
  .aj-company-profile .aj-entry-footer { align-items: stretch; flex-direction: column; }
  .aj-company-profile .aj-entry-footer button { width: 100%; }
}
.aj-quick-party-transfer { display: grid; gap: 6px; }
.aj-cheque-history { width: 100%; margin-top: 8px; border-top: 1px solid var(--aj-line); padding-top: 8px; color: var(--aj-ink); }
.aj-cheque-history summary { cursor: pointer; color: var(--aj-accent); font-weight: 700; }
.aj-cheque-history ol { display: grid; gap: 7px; margin: 10px 0 2px; padding-inline-start: 24px; }
.aj-cheque-history li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; font-size: .88em; }
.aj-cheque-history li > span { font-weight: 700; }
.aj-cheque-history li > time, .aj-cheque-history li > small { color: var(--aj-muted); }
.aj-workspace-delete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 13px 15px; border: 1px solid color-mix(in srgb, #c94d57, transparent 68%); border-radius: 14px; background: color-mix(in srgb, #c94d57, transparent 94%); }
.aj-workspace-delete p { margin: 0; color: var(--aj-muted); font-size: .82rem; line-height: 1.8; }
.aj-workspace-delete code { direction: ltr; }
.aj-dialog-backdrop { overflow-y: auto; overscroll-behavior: contain; padding-block: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-bottom)); }
.aj-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.aj-dialog-error { border: 1px solid currentColor; border-radius: 10px; padding: 10px 12px; background: var(--aj-danger-bg, #fff1f1); color: var(--aj-danger-ink, #9d2736); line-height: 1.8; }
.aj-load-error { padding: 20px; border: 1px solid var(--aj-line); border-radius: 16px; background: var(--aj-card); }
.accounting-journal :is(button, summary, input, select, textarea):focus-visible, .aj-dialog :is(button, input, select):focus-visible { outline: 2px solid var(--aj-focus, #188a70); outline-offset: 3px; }
.accounting-journal .aj-table-wrap td { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .accounting-journal .aj-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px 8px; }
  .accounting-journal .aj-brand { min-width: 0; gap: 8px; }
  .accounting-journal .aj-brand h1 { font-size: 20px; line-height: 1.5; }
  .accounting-journal .aj-brand small { font-size: 10px; }
  .accounting-journal .aj-brand img { width: 36px; height: 36px; }
  .accounting-journal .aj-header-tools { grid-column: 2; grid-row: 1; margin: 0; gap: 5px; }
  .accounting-journal .aj-header-tools button { min-height: 40px; padding: 7px 9px; font-size: 12px; }
  .accounting-journal .aj-workspace-switch { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .accounting-journal .aj-workspace-switch select { width: 100%; min-width: 0; max-width: none; }
  .accounting-journal .aj-card p { font-size: 13px; line-height: 1.85; }
  .accounting-journal .aj-card > h2 { font-size: 21px; }
  .accounting-journal :is(input, select, textarea), .aj-dialog :is(input, select, textarea) { font-size: 16px; }
}
@media(max-width:620px) { .aj-workspace-delete { align-items: stretch; flex-direction: column; } }
.aj-assistant-link-card{display:grid;grid-template-columns:minmax(0,1.25fr) minmax(260px,.9fr);align-items:center;gap:20px;margin:18px 0;padding:20px;border:1px solid color-mix(in srgb,var(--aj-accent) 32%,var(--aj-line));border-radius:18px;background:linear-gradient(135deg,color-mix(in srgb,var(--aj-accent) 9%,var(--aj-card)),var(--aj-card));box-shadow:0 8px 24px rgba(24,67,59,.07)}
.aj-assistant-link-card>div>small{color:var(--aj-accent);font-weight:800}.aj-assistant-link-card h3{margin:5px 0 8px;color:var(--aj-ink)}.aj-assistant-link-card p{margin:0;color:var(--aj-muted);font-size:.84rem;line-height:1.9}.aj-assistant-link-card form{display:grid;gap:12px;padding:15px;border:1px solid var(--aj-line);border-radius:14px;background:var(--aj-card)}.aj-assistant-link-card form>label:first-child{display:grid;gap:7px;color:var(--aj-ink);font-size:.85rem;font-weight:700}.aj-assistant-link-card select{min-height:42px;padding:8px 10px;border:1px solid var(--aj-line);border-radius:10px;background:var(--aj-card);color:var(--aj-ink);font:inherit}.aj-assistant-consent{display:flex;align-items:flex-start;gap:8px;color:var(--aj-muted);font-size:.75rem;line-height:1.8}.aj-assistant-consent input{flex:0 0 auto;margin-top:5px;accent-color:var(--aj-accent)}
@media(max-width:760px){.aj-assistant-link-card{grid-template-columns:minmax(0,1fr);gap:14px;padding:15px}.aj-assistant-link-card form{min-width:0}}
.aj-entry-select{display:flex;align-items:stretch;gap:.4rem;width:100%}.aj-entry-select select{flex:1;min-width:0}.aj-entry-favorite{flex:0 0 2.35rem;min-width:2.35rem;border:1px solid var(--aj-border,#c9dbd8);border-radius:.7rem;background:var(--aj-surface,#fff);color:var(--aj-muted,#66817d);font-size:1.25rem;line-height:1;cursor:pointer;transition:background .16s ease,color .16s ease,border-color .16s ease}.aj-entry-favorite:hover,.aj-entry-favorite.is-active{border-color:var(--aj-accent,#13967f);background:color-mix(in srgb,var(--aj-accent,#13967f) 12%,var(--aj-surface,#fff));color:var(--aj-accent,#087765)}.aj-entry-favorite:disabled{opacity:.45;cursor:not-allowed}.aj-entry-preferences{display:flex;align-items:center;justify-content:space-between;gap:.75rem;flex-wrap:wrap;padding:.8rem 0;border-top:1px solid var(--aj-border,#d5e2df)}.aj-entry-preferences>label{display:flex;align-items:center;gap:.5rem;color:var(--aj-text,#23413d);font-size:.9rem}.aj-entry-preferences input[type=checkbox]{accent-color:var(--aj-accent,#13967f);width:1.05rem;height:1.05rem}.aj-entry-preferences button{font-size:.88rem}
.aj-balance-chip { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; padding: 7px 10px; border: 1px solid color-mix(in srgb,var(--aj-accent),var(--aj-line) 78%); border-radius: 11px; background: linear-gradient(110deg,color-mix(in srgb,var(--aj-accent) 8%,var(--aj-card)),var(--aj-card)); color: var(--aj-muted); font-size: .78rem; line-height: 1.6; }
.aj-balance-chip[hidden] { display: none; }
.aj-balance-chip b { color: var(--aj-ink); font-size: .86rem; font-weight: 850; }
.aj-balance-chip b.is-positive { color: #087a62; }.aj-balance-chip b.is-negative { color: #a54850; }
.aj-balance-chip em { color: var(--aj-muted); font-size: .72rem; font-style: normal; }
.aj-entry-preferences { justify-content: flex-start; }
.aj-entry-preferences > label { min-height: 38px; padding: 6px 10px; border: 1px solid var(--aj-line); border-radius: 999px; background: var(--aj-soft,#f4faf8); font-size: .8rem; }
.aj-entry-preferences > button { margin-inline-start: auto; }
@media (max-width: 640px) {
  .accounting-journal { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .accounting-journal > .aj-nav { display: none; }
  .accounting-journal > .aj-mobile-nav { position: fixed; z-index: 120; inset-inline: max(8px,env(safe-area-inset-left)) max(8px,env(safe-area-inset-right)); inset-block-end: max(8px,env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); align-items: stretch; gap: 4px; padding: 6px; border: 1px solid color-mix(in srgb,var(--aj-accent),var(--aj-line) 72%); border-radius: 19px; background: color-mix(in srgb,var(--aj-card),transparent 5%); box-shadow: 0 10px 34px rgba(12,42,39,.2); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  .accounting-journal .aj-mobile-nav > button, .accounting-journal .aj-mobile-more > summary { display: flex; min-width: 0; min-height: 54px; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 4px 2px; border: 1px solid transparent; border-radius: 14px; background: transparent; color: var(--aj-muted); font: inherit; cursor: pointer; }
  .accounting-journal .aj-mobile-icon { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; background: color-mix(in srgb,var(--aj-accent) 9%,var(--aj-card)); color: var(--aj-accent); font-size: 20px; font-weight: 800; line-height: 1; }
  .accounting-journal .aj-mobile-nav small { font-size: 10px; font-weight: 750; line-height: 1.2; }
  .accounting-journal .aj-mobile-nav > button.active { border-color: color-mix(in srgb,var(--aj-accent),var(--aj-line) 75%); background: color-mix(in srgb,var(--aj-accent) 11%,var(--aj-card)); color: var(--aj-accent); }
  .accounting-journal .aj-mobile-nav > button.active .aj-mobile-icon { background: var(--aj-accent); color: #fff; }
  .accounting-journal .aj-mobile-more { position: relative; min-width: 0; }
  .accounting-journal .aj-mobile-more > summary { list-style: none; }
  .accounting-journal .aj-mobile-more > summary::-webkit-details-marker { display: none; }
  .accounting-journal .aj-mobile-more[open] > summary, .accounting-journal .aj-mobile-more.has-active > summary { background: color-mix(in srgb,var(--aj-accent) 11%,var(--aj-card)); color: var(--aj-accent); }
  .accounting-journal .aj-mobile-sheet { position: absolute; inset-inline-end: 0; inset-block-end: calc(100% + 12px); display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; width: min(360px,calc(100vw - 24px)); max-height: min(64dvh,540px); overflow: auto; padding: 12px; border: 1px solid var(--aj-line); border-radius: 20px; background: var(--aj-card); box-shadow: 0 16px 44px rgba(12,42,39,.24); }
  .accounting-journal .aj-mobile-sheet > b, .accounting-journal .aj-mobile-sheet > span { grid-column: 1/-1; }
  .accounting-journal .aj-mobile-sheet > b { padding: 2px 5px 7px; color: var(--aj-ink); font-size: .95rem; }
  .accounting-journal .aj-mobile-sheet > span { margin-top: 5px; padding: 5px 8px; border-radius: 8px; background: var(--aj-soft); color: var(--aj-accent); font-size: .73rem; font-weight: 850; }
  .accounting-journal .aj-mobile-sheet > button { min-height: 42px; padding: 8px; border: 1px solid var(--aj-line); border-radius: 11px; background: var(--aj-card); color: var(--aj-ink); font: inherit; font-size: .78rem; text-align: start; }
  .accounting-journal .aj-mobile-sheet > button.active { border-color: var(--aj-accent); background: var(--aj-mint); color: var(--aj-accent); font-weight: 850; }
  .accounting-journal .aj-entry-preferences { align-items: stretch; }
  .accounting-journal .aj-entry-preferences > label { flex: 1 1 calc(50% - .5rem); justify-content: flex-start; border-radius: 12px; font-size: .74rem; }
  .accounting-journal .aj-entry-preferences > button { flex: 1 1 100%; margin: 0; }
}
html[data-theme="dark"] .accounting-journal .aj-balance-chip { border-color: var(--aj-line); background: var(--aj-surface-2); }
html[data-theme="dark"] .accounting-journal .aj-balance-chip b.is-positive { color: #6fe0ba; }
html[data-theme="dark"] .accounting-journal .aj-balance-chip b.is-negative { color: #ff9aa0; }
html[data-theme="dark"] .accounting-journal .aj-mobile-nav { border-color: var(--aj-line); background: color-mix(in srgb,var(--aj-surface-2),transparent 4%); }
