.category-tree-grid{align-items:start;gap:18px}.category-tree-card{padding:0;overflow:hidden;min-width:0}.category-tree-group>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:12px;padding:21px 20px 18px;border-radius:var(--control-radius);outline-offset:-4px}.category-tree-group>summary::-webkit-details-marker,.category-nested-group>summary::-webkit-details-marker{display:none}.category-tree-symbol{display:flex;align-items:center;justify-content:center;flex:0 0 27px}.category-tree-heading{flex:1;min-width:0;display:grid;gap:7px}.category-tree-heading>b{font-size:14px;font-weight:450;color:var(--text-secondary);overflow-wrap:anywhere;line-height:1.5}.category-tree-heading>small{color:var(--text-muted);font-size:11px;line-height:1.5}.category-tree-heading>small>span{white-space:nowrap}.category-tree-chevron{display:grid;place-items:center;flex:0 0 29px;height:29px;border:1px solid #dbe5ef;background:#edf3f8;border-radius:10px;color:var(--text-muted)}.category-tree-chevron svg{width:16px;height:16px;transition:transform .2s}.category-tree-group[open]>summary .category-tree-chevron svg{transform:rotate(180deg)}.category-tree-content{padding:0 19px 14px}.category-children-list{border-top:1px solid #e2eaf2}.category-child-row{display:flex;align-items:center;gap:10px;padding:12px 0;border-bottom:1px solid #e6edf4;min-height:51px}.category-child-name{flex:1;min-width:0;font-size:13px;line-height:1.5;color:var(--text-secondary);overflow-wrap:anywhere}.category-registry-actions{display:flex;align-items:center;justify-content:space-between;gap:12px}.category-tree-card>.category-registry-actions{padding:11px 20px;border-top:1px solid #e3eaf2}.category-registry-actions button{display:inline-flex;align-items:center;gap:6px;font-size:11px;min-height:30px;padding:4px;color:var(--text-muted)}.category-registry-actions svg{width:15px;height:15px}.category-child-row>.category-registry-actions{flex:0 0 auto;gap:8px}.category-child-row>.category-registry-actions .text-button>span{display:none}.category-add-child{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:42px;margin-top:12px;padding:9px 12px;border:1px solid #d5e2ed;border-radius:var(--control-radius);background:#eaf1f7;color:var(--text-secondary);font-size:12px;cursor:pointer;transition:background .2s}.category-add-child:hover{background:#e0eaf3}.category-add-child svg{width:16px;height:16px}.category-no-children{font-size:12px;line-height:1.6;color:var(--text-muted);margin:0;padding:13px 0 4px;border-top:1px solid #e2eaf2}.category-nested-group{flex:1;min-width:0}.category-nested-group>summary{list-style:none;display:flex;align-items:center;justify-content:space-between;gap:9px;cursor:pointer;font-size:13px;color:var(--text-secondary)}.category-nested-group>summary svg{width:15px;height:15px}.category-nested-group[open]>summary svg{transform:rotate(180deg)}.category-nested-list{padding-left:12px;margin-top:8px;border-left:1px solid #dde7f0}.category-nested-list .category-child-row:last-child{border-bottom:0}@media(max-width:1000px) and (min-width:701px){.category-tree-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:700px){.category-tree-grid{grid-template-columns:1fr}.category-tree-group>summary{padding:18px}.category-tree-content{padding-inline:18px}}@media (prefers-reduced-motion:reduce) and (max-width:800px){.category-tree-chevron svg,.category-add-child{transition:none}}
.category-chips { align-items: flex-start; --category-chip-width: 126px; }
.category-chips > .category-overview-chip { width: var(--category-chip-width); max-width: 100%; }
.category-chips .category-overview-chip {
 display: flex; align-items: center; gap: 6px; min-width: 0; height: 40px; padding: 0 9px;
 border: 1px solid var(--nexo-control-line,#ccd8e3); border-radius: var(--control-radius);
 background: var(--nexo-control-fill,#f7f9fb); color: var(--option-ink); font-size: 13px;
}
.category-chips .category-overview-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-chips .category-overview-chip > :last-child.nexo-icon { width: 13px; flex-basis: 13px; }
.category-chips .category-overview-group[open] > summary { background: var(--menu-selected); }
.category-overview-children {
 display: grid; gap: 4px; list-style: none; margin: 6px 0 0; padding: 0 0 0 8px;
 border-inline-start: 1px solid var(--option-border);
}
.category-overview-children > li { min-width: 0; }
.category-overview-children > li .category-overview-chip { height: auto; min-height: 36px; padding: 5px 9px; }
.category-overview-children .category-overview-name { white-space: normal; overflow-wrap: anywhere; }

.category-overview-dialog {
 width: min(380px, calc(100% - 30px)); max-height: min(550px, calc(100dvh - 32px)); padding: 18px;
 background: var(--nexo-control-fill,#f7f9fb); border: 1px solid var(--nexo-control-line,#ccd8e3);
}
.category-overview-dialog > form { position: absolute; top: 10px; right: 10px; margin: 0; }
.category-overview-dialog > form button { width: 44px; height: 44px; }
.category-overview-body h2 { display: flex; align-items: center; gap: 8px; margin: 0; padding-right: 44px; font-size: 17px; }
.category-overview-body h2 .category-overview-name { white-space: normal; overflow-wrap: anywhere; }
.category-overview-body p { margin: 5px 0 12px; color: var(--option-ink); font-size: 12px; }
.category-overview-body > ul {
 gap: 0; margin: 0; padding: 0 12px; border: 1px solid var(--nexo-control-line,#ccd8e3);
 border-radius: var(--control-radius); background: #fff;
}
.category-overview-body li + li { border-top: 1px solid #e3ebf2; }
.category-overview-body .category-overview-children .category-overview-chip {
 min-height: 38px; padding: 7px 2px; border: 0; border-radius: 0;
 background: transparent; color: var(--text-primary);
}
.category-overview-body .category-overview-children .category-overview-group[open] > summary {
 background: transparent; color: var(--text-primary);
}
.category-overview-body .category-overview-children .category-overview-children {
 gap: 0; margin: 0 0 7px 7px;
}

@media (max-width: 800px) {
 .category-overview .category-chips {
  display: grid; grid-template-columns: repeat(2,minmax(0,160px)); justify-content: center;
 }
 .category-overview .category-chips > .category-overview-chip { width: 100%; }
}

/* Keep each disclosure marker before its label, with children inset below. */
.category-expense-list .list-row {
 display: grid;
 grid-template-columns: 16px minmax(0, 1fr) auto;
 column-gap: 8px;
 align-items: center;
 min-height: var(--category-row-height);
 border: 0;
}
.category-expense-list .inline-category { grid-column: 2; grid-row: 1; }
.category-expense-list .amount { grid-column: 3; grid-row: 1; text-align: end; white-space: nowrap; }
.category-expense-group > summary > .nexo-icon:last-child { grid-column: 1; grid-row: 1; transform: rotate(-90deg); }
.category-expense-group[open] > summary > .nexo-icon:last-child { transform: rotate(0); }
.category-expense-group > div { border: 0; padding-inline-start: 12px; }
.category-expense-group > div .list-row { color: var(--option-ink); }

.category-tree-group > summary .category-tree-chevron {
 order: -1;
 flex-basis: 16px;
 height: 16px;
 border: 0;
 background: transparent;
}
.category-nested-group > summary { justify-content: flex-start; }
.category-nested-group > summary > svg,
.category-overview-body .category-overview-group > summary > .nexo-icon:last-child,
.control-options .category-expand > .nexo-icon:last-child { order: -1; flex-shrink: 0; }
.category-tree-group > summary .category-tree-chevron > svg,
.category-nested-group > summary > svg,
.category-overview-body .category-overview-group > summary > .nexo-icon:last-child,
.tx-category-disclosure > summary > .nexo-icon:last-child,
.control-options .category-expand > .nexo-icon:last-child { transform: rotate(-90deg); }
.category-tree-group[open] > summary .category-tree-chevron > svg,
.category-nested-group[open] > summary > svg,
.category-overview-body .category-overview-group[open] > summary > .nexo-icon:last-child,
.tx-category-disclosure[open] > summary > .nexo-icon:last-child,
.control-options .category-expand[aria-expanded=true] > .nexo-icon:last-child { transform: rotate(0); }
.control-options .category-expand .option-label .nexo-icon { transform: none; }
.category-children-list, .category-child-row { border: 0; }
.category-children-list { padding-inline-start: 12px; }

@media (prefers-reduced-motion: no-preference) ,(min-width:801px) {
 :is(.category-expense-group,.category-nested-group,.category-overview-group,.tx-category-disclosure) > summary > .nexo-icon:last-child,
 .category-tree-chevron > svg,
 .control-options .category-expand > .nexo-icon:last-child { transition: transform var(--expand-time, 200ms) ease; }
 @supports (interpolate-size: allow-keywords) {
  :is(.category-tree-group,.category-nested-group)::details-content {
   interpolate-size: allow-keywords;
   block-size: 0;
   overflow: clip;
   transition: block-size var(--expand-time) var(--expand-ease), content-visibility var(--expand-time) allow-discrete;
  }
  :is(.category-tree-group,.category-nested-group)[open]::details-content { block-size: auto; }
 }
}

/* Keep the category icon and label in the same columns with or without children. */
.transaction-table .tx-category-disclosure > summary {
 grid-template-columns: 25px minmax(0, 1fr) auto;
 align-items: center;
}
.transaction-table .tx-category-disclosure > summary > span:not(.category-emoji) {
 grid-column: 2;
}
.transaction-table .tx-category-disclosure > summary > .nexo-icon:last-child {
 grid-column: 3;
 width: 14px;
 height: 14px;
 align-self: center;
 margin-top: 0;
}
.transaction-table .tx-subcategory { padding-inline-start: 34px; }
