/*
 * UMMIGO Chart of accounts (resources/views/filament/pages/chart-of-accounts.blade.php): the five
 * levels side by side with the account details, from the Chart of Accounts design. Light and dark
 * follow the panel's theme (html.dark).
 */
.coa {
    --bg: #F5F5F2; --card: #FFFFFF; --bd: #E8E8E2; --line: #EFEFEA; --bd2: #E2E2DB; --bd3: #D6D6CF;
    --fg: #111111; --fg2: #3A3A36; --mut: #6B6B66; --mut2: #9A9A94; --hdr: rgba(245, 245, 242, .86);
    --red: #C2372B; --redBg: #FDE8E5; --lime: #4D7C0F; --sel: #EAF0FF; --hi: #2F5FE0; --hiFg: #FFFFFF; --colBd: #CFCFC6;
    min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--fg);
    font-family: 'Geist', 'Satoshi', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
.dark .coa {
    --bg: #0A0A0B; --card: #141416; --bd: #1F1F22; --line: #1C1C1F; --bd2: #232326; --bd3: #2A2A2D;
    --fg: #F2F2EE; --fg2: #C9C9C3; --mut: #8E8E88; --mut2: #5E5E59; --hdr: rgba(10, 10, 11, .86);
    --red: #FF8A7E; --redBg: #2A1614; --lime: #A4E635; --sel: rgba(107, 149, 255, .12); --hi: #3B6CF6; --hiFg: #FFFFFF; --colBd: #34343A;
}
html body.fi-body:has(.coa) { background: var(--bg, #F5F5F2) !important; }
.fi-page:has(.coa) { padding: 0 !important; }
.fi-page:has(.coa) > section, .fi-page:has(.coa) .fi-page-content { padding: 0 !important; gap: 0 !important; row-gap: 0 !important; }
.fi-page:has(.coa) .fi-header { display: none !important; }
.coa button, .coa input, .coa select { font-family: inherit; color: inherit; }
.coa button { cursor: pointer; }
.coa input::placeholder { color: var(--mut2); }
.coa * { scrollbar-width: thin; scrollbar-color: var(--bd3) transparent; }
.coa [x-cloak] { display: none !important; }
.coa input:not([type=checkbox]) { box-shadow: none !important; }
.coa .num { font-variant-numeric: tabular-nums; }

/* Header */
.coa-hdr { position: sticky; top: 0; z-index: 30; height: 64px; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 24px; background: var(--hdr); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.coa-hdr-l { display: flex; align-items: center; gap: 14px; min-width: 0; }
.coa-back { flex-shrink: 0; display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--bd2); background: var(--card); font-size: 13px; font-weight: 500; color: var(--fg) !important; text-decoration: none; transition: background .2s; }
.coa-back:hover { background: var(--line); }
.coa-sep { width: 1px; height: 22px; background: var(--bd2); }
.coa-logo { display: flex; align-items: center; gap: 10px; }
.coa-mark { width: 30px; height: 30px; border-radius: 50%; background: #111; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.coa-mark span { width: 18px; height: 18px; border-radius: 50%; border: 4px solid #A4E635; box-sizing: border-box; }
.coa-logo b { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.coa-tag { font-size: 12px; font-weight: 500; color: var(--mut); border: 1px solid var(--bd3); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.coa-find { position: relative; flex: 0 1 420px; min-width: 0; }
.coa-find > div:first-child { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--bd2); background: var(--card); }
.coa-find input { flex: 1; min-width: 0; border: none !important; outline: none !important; background: transparent !important; font-size: 13px; padding: 0 !important; }
.coa-res { position: absolute; top: 46px; left: 0; right: 0; z-index: 40; background: var(--card); border: 1px solid var(--bd3); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .2); padding: 6px; max-height: 420px; overflow: auto; }
.coa-res button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 12px; border: none; border-radius: 12px; background: transparent; text-align: left; }
.coa-res button:hover, .coa-res button.on { background: var(--line); }
.coa-res .t { display: flex; align-items: baseline; gap: 10px; width: 100%; }
.coa-res .c { font-size: 12px; color: var(--mut); white-space: nowrap; }
.coa-res .n { font-size: 13.5px; font-weight: 500; }
.coa-res .p { font-size: 12px; color: var(--mut); }
.coa-res .none { padding: 14px 12px; font-size: 13px; color: var(--mut); }
.coa-theme { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--bd2); background: var(--card); flex-shrink: 0; }
.coa-theme button { width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent; color: var(--mut); display: flex; align-items: center; justify-content: center; }
.coa-theme button.on { background: #A4E635; color: #0A0A0B; }

/* Body */
.coa-main { flex: 1; display: flex; flex-direction: column; gap: 20px; padding: 28px 24px 24px; box-sizing: border-box; min-width: 0; }
.coa-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.coa-top small { font-size: 13px; color: var(--mut); }
.coa-top h1 { margin: 6px 0 0; font-size: 32px; font-weight: 600; letter-spacing: -0.04em; line-height: 1.1; }
.coa-legend { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.coa-legend > div, .coa-legend > a { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--bd2); background: var(--card); font-size: 12px; color: var(--mut); white-space: nowrap; text-decoration: none; flex-shrink: 0; }
.coa-legend b { font-weight: 600; color: var(--fg); }
.coa-legend a:hover { background: var(--line); }
.coa-wrap { display: flex; gap: 16px; flex-wrap: wrap; align-items: stretch; flex: 1; min-height: 0; }
.coa-cols { flex: 1 1 760px; min-width: 0; height: calc(100vh - 210px); min-height: 480px; background: var(--card); border: 1px solid var(--colBd); border-radius: 20px; overflow-x: auto; overflow-y: hidden; }
.coa-grid { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); height: 100%; min-width: 1050px; }
.coa-col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--colBd); }
.coa-col:last-child { border-right: none; }
.coa-col-h { padding: 16px 14px 10px 16px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--colBd); }
.coa-col-t { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 28px; }
.coa-col-t span { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coa-add { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; border: 1px solid var(--bd3); background: transparent; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.coa-add:hover { background: var(--line); }
.coa-add:disabled { opacity: .35; cursor: default; }
.coa-q { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--bd); }
.coa-q svg { color: var(--mut); flex-shrink: 0; }
.coa-q input { flex: 1; min-width: 0; border: none !important; outline: none !important; background: transparent !important; font-size: 12.5px; padding: 0 !important; }
.coa-q button { flex-shrink: 0; border: none; background: transparent; font-size: 11.5px; font-weight: 500; color: var(--mut); padding: 0 2px; white-space: nowrap; }
.coa-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.coa-it { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: none; border-radius: 10px; background: transparent; text-align: left; transition: background .15s; }
.coa-it:hover { background: var(--line); }
.coa-it .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.coa-it .nm { font-size: 13.5px; font-weight: 500; color: var(--fg); letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coa-it .cd { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--mut); }
.coa-it .ch { color: var(--mut2); flex-shrink: 0; display: flex; }
.coa-it.off .nm { color: var(--mut); }
.coa-it.on { background: var(--sel); }
.coa-it.on .nm { font-weight: 600; }
.coa-it.on .ch { color: var(--hi); }
.coa-it.deep, .coa-it.deep:hover { background: var(--hi); }
.coa-it.deep .nm { color: var(--hiFg); font-weight: 600; }
.coa-it.deep .cd { color: rgba(255, 255, 255, .75); }
.coa-it.deep .ch { color: var(--hiFg); }
.coa-badge { font-family: 'Geist', sans-serif; font-size: 10.5px; font-weight: 600; color: var(--red); background: var(--redBg); padding: 1px 6px; border-radius: 999px; }
.coa-empty { padding: 24px 10px; font-size: 13px; line-height: 1.5; color: var(--mut2); text-align: center; text-wrap: pretty; }
.coa-new { display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-bottom: 6px; border-radius: 12px; border: 1px solid var(--hi); background: var(--sel); }
.coa-new .cd { font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--mut); }
.coa-new input, .coa-new select { height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--bd3); background: var(--card); outline: none; font-size: 13px; }
.coa-new > div { display: flex; gap: 6px; justify-content: flex-end; }
.coa-new button { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--bd3); background: var(--card); font-size: 12px; font-weight: 500; }
.coa-new button.go { border: none; background: #A4E635; color: #0A0A0B; font-weight: 600; padding: 0 14px; }

/* Details */
.coa-det { flex: 0 1 340px; min-width: 280px; background: var(--card); border: 1px solid var(--colBd); border-radius: 12px; box-sizing: border-box; display: flex; flex-direction: column; align-self: flex-start; overflow: hidden; }
.coa-det-h { padding: 14px 20px; border-bottom: 1px solid var(--colBd); font-size: 13px; font-weight: 600; }
.coa-det-b { padding: 6px 20px 20px; display: flex; flex-direction: column; }
.coa-row { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.coa-row span:first-child { color: var(--mut); }
.coa-row span:last-child { font-weight: 500; font-variant-numeric: tabular-nums; }
.coa-lab { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.coa-lab span { font-size: 12px; font-weight: 500; color: var(--mut); }
.coa-lab input { height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--bd3); background: var(--card); outline: none; font-size: 13.5px; }
.coa-lab input:focus { border-color: var(--hi); }
.coa-chk { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 13.5px; cursor: pointer; }
.coa-chk input { width: 16px; height: 16px; margin: 0; accent-color: var(--hi); }
.coa-acts { display: flex; gap: 8px; margin-top: 20px; }
.coa-acts button { flex: 1; height: 38px; border-radius: 8px; font-size: 13px; white-space: nowrap; padding: 0 12px; }
.coa-up { border: none; background: var(--line); color: var(--mut2); font-weight: 600; cursor: default !important; }
.coa-up.on { background: var(--hi); color: #FFFFFF; cursor: pointer !important; }
.coa-sub { border: 1px solid var(--bd3); background: transparent; font-weight: 500; }
.coa-sub:hover { background: var(--line); }
.coa-full { margin-top: 12px; font-size: 12.5px; color: var(--mut) !important; text-decoration: underline; text-underline-offset: 3px; align-self: flex-start; }
.coa-none { padding: 20px; font-size: 13.5px; color: var(--mut); }
.coa-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; padding: 12px 20px; border-radius: 999px; background: var(--fg); color: var(--bg); font-size: 13px; font-weight: 500; box-shadow: 0 12px 40px rgba(0, 0, 0, .25); white-space: nowrap; }

@media (max-width: 760px) {
    .coa-hdr { padding: 0 14px; gap: 10px; }
    .coa-tag, .coa-sep, .coa-logo b { display: none; }
    .coa-main { padding: 20px 14px; }
    .coa-det { flex-basis: 100%; }
}
