/* 04-settings.css — Settings page, company branding, report-template previews, Chart of Accounts 2.0 extras, typed dates.
   Loaded after the files with a smaller number (later rules win). */

/* ---------- Settings & company branding ---------- */
.brand-logo { height: 36px; max-width: 150px; object-fit: contain; border-radius: 8px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.co-logo { max-height: 64px; max-width: 240px; object-fit: contain; display: block; margin: 0 auto .5rem; }
.co-line { margin: .15rem 0 0 !important; }
.report-foot { display: none; }
.logo-tile { border: 1px solid var(--border); border-radius: 16px; padding: .9rem; background: var(--card); height: 100%; }
.logo-box { height: 110px; border-radius: 12px; display: grid; place-items: center; background: repeating-conic-gradient(#f4f5f7 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px dashed var(--border-strong); overflow: hidden; }
.logo-box.is-invalid { border-color: var(--red); }
.logo-box img { max-width: 90%; max-height: 90px; object-fit: contain; }
.logo-empty { color: var(--subtle); font-size: .85rem; display: inline-flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.85); padding: .25rem .6rem; border-radius: 999px; }
.logo-remove { margin-left: .6rem; font-size: .84rem; color: var(--red); display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; }
.tz-now { font-weight: 600; font-size: .9rem; color: var(--blue-dark); background: var(--blue-soft); border-radius: 10px; padding: .5rem .8rem; display: inline-flex; align-items: center; gap: .5rem; }
.settings-side { position: sticky; top: 1rem; }
.settings-col .panel, .settings-side .panel { height: auto; }
.brand-logo { max-width: 92px; }

/* ---------- Report templates (Settings picker + live preview) ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; }
.tpl-card { cursor: pointer; margin: 0; }
.tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-body { display: flex; flex-direction: column; gap: .35rem; padding: .6rem; border: 2px solid var(--border); border-radius: 16px; background: var(--card); transition: border-color .15s, box-shadow .15s, transform .15s; height: 100%; }
.tpl-card:hover .tpl-body { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tpl-card input:checked + .tpl-body { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.tpl-card input:focus-visible + .tpl-body { outline: 2px solid var(--blue); outline-offset: 2px; }
.tpl-name { font-weight: 700; font-size: .92rem; display: flex; align-items: center; justify-content: space-between; }
.tpl-name .bi { color: var(--blue); opacity: 0; transform: scale(.5); transition: .15s; }
.tpl-card input:checked + .tpl-body .tpl-name .bi { opacity: 1; transform: none; }
.tpl-desc { font-size: .76rem; color: var(--muted); line-height: 1.35; }


/* modern */

/* ---------- Chart of Accounts 2.0 ---------- */
.eq-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.eq-row { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .7rem; }
.eq-tile { display: flex; align-items: center; gap: .65rem; padding: .5rem .9rem .5rem .55rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card); min-width: 150px; }
.eq-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 1.05rem; flex: none; }
.eq-k { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--subtle); line-height: 1.1; }
.eq-v { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.eq-op { font-size: 1.5rem; font-weight: 300; color: var(--border-strong); line-height: 1; }
.eq-state { margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 700; border-radius: 999px; padding: .4rem .85rem; }
.eq-state.ok { background: var(--green-soft); color: #1d6b10; }
.eq-state.bad { background: var(--red-soft); color: #a3122b; }
.eq-bar { display: flex; gap: 3px; height: 10px; margin-top: .9rem; border-radius: 999px; overflow: hidden; background: var(--bg); }
.eq-bar span { display: block; height: 100%; border-radius: 3px; transition: width .5s cubic-bezier(.2, .8, .3, 1); }
.eq-legend { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .55rem; font-size: .76rem; color: var(--muted); align-items: center; }
.eq-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; }
.eq-legend em { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: .74rem; }
@media (max-width: 767.98px) { .eq-op { display: none; } .eq-tile { flex: 1 1 calc(50% - .4rem); min-width: 0; } .eq-state { margin-left: 0; } }

.coa-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .9rem; }
.tool-chip { position: relative; display: inline-flex; align-items: center; gap: .4rem; margin: 0; padding: .34rem .8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--muted); font-size: .8rem; font-weight: 600; cursor: pointer; user-select: none; transition: .15s; }
.tool-chip input { position: absolute; opacity: 0; pointer-events: none; }
.tool-chip:hover { border-color: var(--border-strong); color: var(--text); }
.tool-chip:has(input:checked) { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.tool-chip:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.coa-tools .kbd-hints { margin-left: auto; }

.coa-pins { display: flex; align-items: center; gap: .7rem; padding: .55rem 1.1rem; background: #fffbea; border-bottom: 1px solid #f4e7b3; }
.coa-pins[hidden] { display: none; }
.pins-label { font-size: .7rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: #8a6a00; white-space: nowrap; }
.pins-list { display: flex; gap: .4rem; overflow-x: auto; padding: 2px 0; }
.pin-chip { display: inline-flex; align-items: center; background: #fff; border: 1px solid #efdca0; border-radius: 999px; white-space: nowrap; }
.pin-chip button { border: 0; background: none; font-size: .78rem; color: var(--text); }
.pin-chip .go { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .3rem .22rem .65rem; font-weight: 500; }
.pin-chip .go b { font-family: var(--mono); font-size: .68rem; color: var(--muted); font-weight: 600; }
.pin-chip .go em { font-style: normal; font-size: .7rem; color: var(--muted); }
.pin-chip .go:hover { color: var(--blue); }
.pin-chip .x { width: 22px; height: 22px; border-radius: 50%; color: var(--subtle); margin-right: 2px; display: grid; place-items: center; }
.pin-chip .x:hover { background: var(--red-soft); color: var(--red); }
.pin-chip .dot { width: 7px; height: 7px; border-radius: 50%; }

.pin { border: 0; background: none; width: 24px; height: 24px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--subtle); font-size: .8rem; opacity: 0; flex: none; transition: opacity .12s, color .12s, background .12s; }
.coa-row:hover .pin, .pin:focus-visible, .coa-row.pinned .pin { opacity: 1; }
.coa-row.pinned .pin { color: #e0a100; }
.pin:hover { background: var(--amber-soft); color: #c48a00; }
@media (hover: none) { .pin { opacity: 1; } }

.cr-path { display: none; font-size: .72rem; color: var(--subtle); white-space: nowrap; }
.tree-flat .cr-path { display: inline; }
.tree-flat .cr-name { padding-left: 0; }
.tree-flat .coa-row { background: transparent; }

/* balance "share" line under each row, coloured by account type */
.coa-row::after { content: ""; position: absolute; left: 1.1rem; bottom: -1px; height: 2px; width: calc((100% - 2.2rem) * var(--share, 0)); background: var(--tc, var(--blue)); opacity: .55; border-radius: 2px; transition: width .4s cubic-bezier(.2, .8, .3, 1); pointer-events: none; }
.coa-row.is-root::after { opacity: .25; }
.no-share .coa-row::after { display: none; }
.compact .coa-row { padding-top: .12rem; padding-bottom: .12rem; font-size: .86rem; }
.compact .cr-ic { width: 20px; height: 20px; font-size: .72rem; border-radius: 6px; }

/* detail panel additions */
.dp-copy { border: 0; background: none; color: var(--subtle); padding: 0 .3rem; border-radius: 5px; font-size: .75rem; }
.dp-copy:hover { color: var(--blue); background: var(--blue-soft); }
.dp-share { padding: .8rem 1.25rem 0; }
.dp-share .bar { height: 8px; border-radius: 999px; background: var(--bg); margin-top: .35rem; overflow: hidden; }
.dp-share .bar span { display: block; height: 100%; border-radius: 999px; }
.dp-act { padding: 0 1.25rem; }
.dp-act-load, .dp-act-empty { color: var(--muted); font-size: .84rem; padding: .6rem 0; display: flex; align-items: center; gap: .5rem; }
.dp-act-sum { font-size: .82rem; color: var(--muted); margin-bottom: .2rem; }
.dp-act-sum b { color: var(--text); }
.dp-spark { width: 100%; height: auto; max-height: 120px; display: block; margin: .2rem 0 .3rem; }
.dp-act-list { margin-top: .3rem; }
.dp-act-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--border); }
.dp-act-row > div { min-width: 0; }
.dp-act-more { display: inline-flex; align-items: center; gap: .35rem; margin-top: .4rem; font-size: .82rem; font-weight: 600; text-decoration: none; }
.dp-btn-row { flex-wrap: wrap; }

/* ---------- Move ---------- */
.coa-row[draggable="true"] { cursor: grab; }
.coa-row.dragging { opacity: .45; }
.is-dragging .coa-row.is-group { transition: none; }
.coa-row.drop-ok { background: var(--blue-soft) !important; outline: 2px dashed var(--blue); outline-offset: -2px; }
.coa-row.drop-ok::before { content: "Drop to move here"; position: absolute; right: 1.1rem; top: 50%; transform: translateY(-50%); font-size: .7rem; font-weight: 700; color: var(--blue); background: #fff; padding: .1rem .5rem; border-radius: 999px; z-index: 2; pointer-events: none; }

.mv-card { padding: 0; overflow: hidden; }
.mv-head { display: flex; align-items: center; gap: .8rem; padding: 1.1rem 1.2rem .6rem; }
.mv-head .grow { flex: 1; min-width: 0; }
.mv-head h5 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
.mv-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.2rem; color: var(--blue); background: var(--blue-soft); flex: none; }
.mv-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-search { padding: .4rem 1.2rem .6rem; position: relative; }
.mv-search > i { left: 1.9rem; top: 50%; }
.mv-search .form-control { padding-left: 2.4rem; border-radius: 999px; background: var(--bg); border: 0; }
.mv-list { max-height: 320px; overflow-y: auto; padding: 0 .7rem .5rem; }
.mv-opt { width: 100%; display: flex; align-items: center; gap: .55rem; text-align: left; border: 0; background: none; padding: .5rem .6rem .5rem calc(.6rem + var(--ind, 0) * 18px); border-radius: 10px; font-size: .9rem; transition: background .12s; }
.mv-opt:hover:not(:disabled) { background: var(--hover); }
.mv-opt.on { background: var(--blue-soft); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.mv-opt .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mv-opt .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mv-opt small { color: var(--subtle); font-size: .72rem; }
.mv-opt em { font-style: normal; font-size: .7rem; font-weight: 700; color: var(--subtle); background: var(--bg); border-radius: 999px; padding: .1rem .5rem; }
.mv-opt.cur { opacity: .6; cursor: default; }
.mv-empty { padding: 1.5rem; text-align: center; color: var(--muted); }
.mv-note { margin: 0 1.2rem .6rem; padding: .6rem .8rem; border-radius: 12px; font-size: .82rem; background: var(--amber-soft); color: #7a5200; display: flex; gap: .5rem; align-items: flex-start; }
.mv-note[hidden] { display: none; }
.mv-foot { display: flex; justify-content: flex-end; gap: .6rem; padding: .8rem 1.2rem 1.1rem; border-top: 1px solid var(--border); }

/* Detail panel actions: main button full width, the rest in a tidy 2-column grid */
.dp-btn-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.dp-btn-row .btn { flex: none; width: 100%; min-width: 0; padding: .6rem .5rem; overflow: hidden; text-overflow: ellipsis; }
.dp-btn-row .btn:first-child { grid-column: 1 / -1; padding: .7rem 1rem; font-weight: 700; }
.dp-btn-row .btn:last-child:nth-child(even) { grid-column: 1 / -1; }

/* ---------- Hand-written dates ---------- */
.dt-wrap { position: relative; display: block; }
.dt-wrap > .form-control { padding-right: 2.2rem; padding-left: .7rem; min-width: 0; }
.dt-btn { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; font-size: .95rem; }
.dt-btn:hover:not(:disabled) { background: var(--blue-soft); color: var(--blue); }
.dt-btn:disabled { opacity: .45; }
.dt-src { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.dt-wrap.is-invalid ~ .invalid-feedback { display: block; }
.dt-msg { display: none; }
.dt-wrap.is-invalid ~ .dt-msg:not(.show) { display: none; }
.dt-msg.show { display: block; }


.settings-save { position: sticky; bottom: .75rem; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .7rem 1rem; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
/* Settings page: tighter panels, smaller logo boxes, list of links */
.settings-col .panel { padding: 1.1rem 1.2rem; }
.settings-col .logo-tile { padding: .7rem; }
.settings-col .logo-box { height: 84px; }
.settings-col .logo-box img { max-height: 68px; }
.settings-col .tpl-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.settings-col .side-pv { height: 60px; }
.set-links { display: flex; flex-direction: column; }
.set-links > a, .set-links > .sl-note { display: flex; align-items: center; gap: .75rem; padding: .6rem .4rem; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; border-radius: 8px; }
.set-links > :last-child { border-bottom: 0; }
.set-links > a:hover { background: var(--hover); }
.set-links b { display: block; font-size: .9rem; }
.set-links small { display: block; color: var(--muted); font-size: .78rem; }
.set-links > a > .bi-chevron-right { margin-left: auto; color: var(--subtle); }
.sl-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
/* Settings → Receives & Payments, Options: the switch box and the drop-down are the same height */
.opt-box { height: 44px; min-height: 44px; }
.switch-field.opt-box { padding-top: 0; padding-bottom: 0; }

/* Browser tab icon (favicon) tile: the picker on the left, a pretend browser tab on the right */
.fav-row { display: flex; gap: .9rem; align-items: flex-start; }
.fav-box { width: 72px; height: 72px; flex: none; }
.fav-box img { width: 40px; height: 40px; max-width: none; max-height: none; object-fit: contain; image-rendering: auto; }
.fav-box .logo-empty { font-size: 1.4rem; color: var(--muted); }
.fav-preview { display: flex; align-items: flex-end; gap: .6rem; padding: .45rem .6rem 0; border-radius: 10px 10px 0 0; background: #dfe3e8; max-width: 320px; }
.fav-dots { display: flex; gap: 5px; padding-bottom: .55rem; }
.fav-dots i { width: 9px; height: 9px; border-radius: 50%; background: #ff5f57; }
.fav-dots i:nth-child(2) { background: #febc2e; }
.fav-dots i:nth-child(3) { background: #28c840; }
.fav-tab { display: flex; align-items: center; gap: .45rem; min-width: 0; flex: 1; padding: .4rem .6rem; border-radius: 9px 9px 0 0; background: #fff; font-size: .76rem; color: var(--text); }
.fav-tab img { width: 16px; height: 16px; flex: none; object-fit: contain; }
.fav-tab span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-tab .bi-x { color: var(--muted); }
