/* Shared bounded grids, including dynamically opened dialogs. */
.content-wrap > .grid, .content-wrap .grid > *, .content-wrap .card { min-width:0; }
.content-wrap > .grid { max-width:100%; }
.table-wrap.viewport-grid { height:var(--grid-height, 320px)!important; max-height:var(--grid-height, 320px)!important; min-height:0!important; overflow:auto!important; overscroll-behavior:contain; scrollbar-gutter:stable; }
.viewport-grid table { margin:0; }
.viewport-grid thead { position:sticky; top:0; z-index:3; background:var(--surface, var(--card, #172332)); }
html[data-theme="light"] .viewport-grid thead { background:#eef2f5; }
.viewport-grid tfoot { position:sticky; bottom:0; background:var(--surface, var(--card, #172332)); }
.viewport-grid:focus-visible { outline:2px solid var(--accent, #10b981); outline-offset:2px; }
.modal__dialog { max-height:calc(100dvh - 24px); }
.modal__body { min-height:0; }

.home-overview { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.home-overview > .home-wide { grid-column:1/-1; }
.home-widget { min-width:0; padding:0!important; overflow:hidden; }
.home-widget__head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px; border-bottom:1px solid var(--stroke); }
.home-widget__head h3 { margin:0; font-size:15px; }
.home-widget__head p { margin:4px 0 0; font-size:12px; }
.home-widget__body { padding:16px 18px; }
.home-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.home-kpi { padding:16px!important; border-left:3px solid var(--home-tone,#10b981)!important; display:flex; flex-direction:column; gap:8px; min-width:0; }
.home-kpi__icon { color:var(--home-tone,#10b981); }
.home-kpi__value { font-size:clamp(18px,1.8vw,28px); line-height:1.3; font-weight:800; overflow-wrap:anywhere; }
.home-kpi small { color:var(--muted); }
.home-kpi a { margin-top:auto; padding-top:10px; font-size:12px; border-top:1px solid var(--stroke); }
.home-overview a { color:inherit; text-decoration:none; }
.home-overview a:hover { color:var(--accent); }
.home-overview .home-kpi a { color:var(--home-tone,var(--accent)); }
.dash-hero > form { max-width:460px; }
.dash-hero > form .input { width:auto; min-width:160px; }
.home-row { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 0; border-bottom:1px solid var(--stroke); }
.home-row:last-child { border-bottom:0; }
.home-row small { display:block; color:var(--muted); margin-top:4px; }
.home-balance { border-radius:10px; padding:18px; background:#0f766e; color:white; }
.home-balance strong { display:block; font-size:28px; margin-top:8px; }
.home-bar { height:7px; background:var(--stroke); border-radius:8px; margin-top:9px; overflow:hidden; }
.home-bar span { display:block; height:100%; background:var(--home-tone,#10b981); border-radius:8px; }
.home-trend { display:flex; gap:5px; align-items:flex-end; height:170px; padding-top:20px; }
.home-trend__day { flex:1; display:flex; align-items:flex-end; gap:2px; height:100%; min-width:0; position:relative; }
.home-trend__day span { flex:1; min-height:2px; background:#10b981; border-radius:3px 3px 0 0; }
.home-trend__day span + span { background:#38bdf8; }
.home-trend__day small { position:absolute; top:100%; left:0; font-size:9px; color:var(--muted); }
.home-agenda { display:grid; grid-template-columns:1.1fr 1fr; gap:16px; }
.home-agenda__week,.home-agenda__grid { display:grid; grid-template-columns:repeat(7,1fr); gap:4px; text-align:center; }
.home-agenda__week { font-size:11px; color:var(--muted); margin-bottom:8px; }
.home-agenda__grid button { background:transparent; color:inherit; border:0; border-radius:8px; padding:10px 2px; position:relative; cursor:pointer; }
.home-agenda__grid button.is-selected { background:#059669; color:white; }
.home-agenda__grid button.has-events::after { content:''; width:4px; height:4px; border-radius:50%; background:#38bdf8; position:absolute; bottom:3px; left:calc(50% - 2px); }
.home-agenda__list { max-height:280px; overflow:auto; }
.home-shortcuts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.home-shortcuts a { display:flex; align-items:center; gap:10px; border:1px solid var(--stroke); border-radius:9px; padding:14px; font-size:13px; }
.home-preferences { display:grid; gap:8px; }
.profile-tab-panel:has([data-home-preferences]) { min-width:0; }
.home-preferences,.home-pref-row { min-width:0; }
#modalUserProfile :is([data-profile-account-save],[data-home-save])[hidden] { display:none!important; }
.home-pref-row { display:flex; align-items:center; gap:12px; padding:12px; border:1px solid var(--stroke); border-radius:12px; }
.home-pref-row.is-dragging { opacity:.25; background:rgb(16 185 129 / .12); }
.home-pref-ghost { position:fixed; z-index:20000; pointer-events:none; background:var(--surface,#fff); box-shadow:0 15px 40px #0004; opacity:.95; transform:rotate(.5deg); }
.home-drag-handle { border:0; background:transparent; color:var(--muted); padding:4px; flex-shrink:0; cursor:grab; touch-action:none; }
.home-drag-handle svg { width:19px; height:24px; }
.home-mini { position:relative; display:flex; align-items:flex-end; justify-content:center; gap:4px; flex:0 0 82px; height:48px; padding:8px; border:1px solid var(--stroke); border-radius:7px; background:rgb(16 185 129 / .04); overflow:hidden; }
.home-mini i { display:block; width:12px; height:40%; border-radius:3px; background:#10b981; }
.home-mini i:nth-child(2) { height:65%; background:#38bdf8; }.home-mini i:nth-child(3) { height:50%; background:#a78bfa; }.home-mini i:nth-child(4) { height:85%; background:#f59e0b; }
.home-mini--operation,.home-mini--financial { align-items:center; }.home-mini--operation i,.home-mini--financial i { width:14px; height:24px; border:1px solid #10b98155; background:#10b98122; box-shadow:inset 0 5px #10b981; }.home-mini--financial i { box-shadow:inset 0 5px #38bdf8; }
.home-mini--distribution i { display:none; }.home-mini--distribution b { width:30px; height:30px; border-radius:50%; background:conic-gradient(#10b981 0 40%,#38bdf8 40% 72%,#a78bfa 72%); position:relative; }.home-mini--distribution b::after { content:''; position:absolute; inset:7px; border-radius:50%; background:var(--surface,#fff); }
.home-mini--alerts,.home-mini--balances,.home-mini--workload,.home-mini--clients { flex-direction:column; align-items:stretch; gap:4px; }.home-mini--alerts i,.home-mini--balances i,.home-mini--workload i,.home-mini--clients i { height:4px; width:90%; }.home-mini--workload i:nth-child(2),.home-mini--clients i:nth-child(2) { width:70%; }.home-mini--workload i:nth-child(3),.home-mini--clients i:nth-child(3) { width:50%; }
.home-mini--agenda,.home-mini--legacy_calendar,.home-mini--shortcuts { display:grid; grid-template-columns:repeat(4,1fr); gap:4px; }.home-mini--agenda i,.home-mini--legacy_calendar i,.home-mini--shortcuts i { width:100%; height:100%; }.home-mini--agenda,.home-mini--legacy_calendar { background:repeating-linear-gradient(0deg,transparent 0 7px,#10b98122 7px 8px),repeating-linear-gradient(90deg,transparent 0 10px,#10b98122 10px 11px); }.home-mini--agenda i,.home-mini--legacy_calendar i { height:8px; }.home-mini--legacy_calendar { filter:grayscale(1); }
@media(max-width:600px) { .home-pref-row { gap:7px; padding:10px; }.home-mini { flex-basis:54px; height:40px; padding:5px; }.home-mini i { width:8px; }.home-pref-row .icon-btn { width:28px; min-width:28px; }.home-pref-row > label { gap:7px; }.home-pref-row strong { font-size:13px; }.home-pref-row small { font-size:11px; } }
@media(max-width:600px) { .home-pref-row { display:grid; grid-template-columns:18px 38px minmax(0,1fr) 28px; gap:6px; padding:9px; }.home-mini { width:38px; height:38px; grid-row:1/3; grid-column:2; }.home-drag-handle { grid-row:1/3; grid-column:1; padding:0; }.home-pref-row > label { grid-row:1/3; grid-column:3; }.home-pref-row [data-home-move="up"] { grid-row:1; grid-column:4; }.home-pref-row [data-home-move="down"] { grid-row:2; grid-column:4; }.home-pref-row > input[type="hidden"] { display:none!important; }.home-pref-row strong,.home-pref-row small { overflow-wrap:anywhere; } }
.home-pref-row > label { display:flex; align-items:center; gap:12px; flex:1; min-width:0; }
.home-pref-row small { display:block; color:var(--muted); margin-top:4px; }
.home-pref-row .icon-btn { flex-shrink:0; }
html[data-theme] body.has-app-sidebar .home-pref-row[data-home-widget] [data-home-move] { width:30px; height:30px; min-height:30px; padding:0; background:rgb(56 189 248 / .06)!important; background-image:none!important; color:#0891b2!important; border:1px solid rgb(8 145 178 / .3)!important; box-shadow:none!important; }
html[data-theme="dark"] body.has-app-sidebar .home-pref-row[data-home-widget] [data-home-move] { color:#67e8f9!important; }
.home-pref-row [data-home-move]:disabled { opacity:.35; }
.topbar-monitor { position:relative; }
.topbar-monitor > summary { list-style:none; cursor:pointer; }
.topbar-monitor > summary::-webkit-details-marker { display:none; }
.topbar-monitor__menu { position:absolute; top:calc(100% + 10px); right:0; width:270px; z-index:100; padding:8px; background:var(--surface, var(--card, #172332)); border:1px solid var(--stroke); border-radius:12px; box-shadow:0 12px 32px #0003; }
html[data-theme="light"] .topbar-monitor__menu { background:#fff; }
.topbar-monitor__menu a { display:flex; align-items:center; gap:10px; padding:11px; border-radius:7px; }
.topbar-monitor__menu a:hover { background:var(--stroke); }
.topbar-monitor .topbar-monitor__menu { width:320px; max-width:calc(100vw - 24px); padding:9px; background:var(--surface,#fff); }
html[data-theme="dark"] .topbar-monitor .topbar-monitor__menu { background:#111814; border-color:#2b3730; }
.topbar-monitor .monitor-menu-heading { padding:7px 10px 10px; font-size:11px; font-weight:700; letter-spacing:1px; text-transform:uppercase; color:var(--muted); }
.topbar-monitor .topbar-monitor__menu a { gap:11px; padding:11px 9px; text-decoration:none!important; color:var(--text); }
.topbar-monitor__menu a > span:nth-child(2) { flex:1; min-width:0; }.topbar-monitor__menu strong { display:block; font-size:14px; }.topbar-monitor__menu small { display:block; margin-top:3px; color:var(--muted); font-size:11px; }
.monitor-menu-icon { display:grid; place-items:center; width:36px; height:36px; border-radius:9px; background:#10b98118; color:#059669; flex-shrink:0; }.monitor-menu-icon svg { width:19px; height:19px; }.monitor-menu-icon.is-blue { color:#0284c7; background:#38bdf818; }.monitor-menu-icon.is-purple { color:#8b5cf6; background:#a78bfa18; }.topbar-monitor__menu a > svg:last-child { width:14px; height:14px; color:var(--muted); }

/* Dashboard filters share the compact list/kanban toolbar. */
.reports-graphs--modern .reports-filters { padding:12px!important; }
.reports-graphs--modern .reports-filters__title { display:none; }
.reports-graphs--modern .reports-filters > .form-grid { display:flex; flex-wrap:nowrap; align-items:flex-end; gap:10px; }
.reports-graphs--modern .reports-filters .field { flex:1; min-width:90px; }
.reports-graphs--modern .reports-filters .field.span-12 { flex:0 0 auto; }
.reports-graphs--modern .reports-filters .filters-actions { margin:0; display:flex; gap:8px; }
.reports-graphs--modern .reports-filters .reports-options-grid { display:flex; }
.reports-graphs--modern .reports-filters .check-line { max-width:120px; font-size:11px; }
.reports-graphs-content { min-height:0; }
.reports-graphs--modern { display:flex; flex-direction:column; }
.reports-graphs--modern > form { flex-shrink:0; }
.reports-graphs-content > section { margin-bottom:14px; }
.reports-layout { grid-template-columns:280px minmax(0,1fr); align-items:start; }
.reports-layout { min-height:0; }
.reports-layout > .reports-panel { min-height:0; }
.reports-menu { max-height:100%; }
.reports-menu { position:sticky; top:10px; max-height:calc(100dvh - 170px); overflow:auto; }
.reports-menu__items a { border-bottom:1px dashed var(--stroke); display:flex; align-items:center; gap:9px; }
.reports-menu__items a::before { content:'☆'; color:var(--accent,#10b981); font-size:18px; }
.reports-panel .reports-filters .form-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.reports-panel .reports-filters .field { grid-column:auto!important; }
.reports-panel .reports-filters .field.span-12 { grid-column:1/-1!important; }
.reports-panel .reports-filters { background:var(--surface, var(--card)); }
.reports-panel .reports-options-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.report-preset-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.report-preset-actions .input { max-width:220px; }
.report-generate-menu { position:relative; }
.report-generate-menu summary { list-style:none; }
.report-generate-menu > div { position:absolute; right:0; z-index:10; padding:8px; background:var(--surface, var(--card, #172332)); border:1px solid var(--stroke); border-radius:8px; white-space:nowrap; }
@media(max-width:1100px) { .reports-graphs--modern .reports-filters > .form-grid { flex-wrap:wrap; } .reports-graphs--modern .reports-filters .field { flex:1 1 140px; } }
@media screen {
  #financeControlPage .fin-kpi { padding:12px; gap:8px; min-height:0; }
  #financeControlPage .fin-kpi > div { min-width:0; }
  #financeControlPage .fin-kpi__top { font-size:11px; }
  #financeControlPage .fin-kpi__value { font-size:clamp(17px,1.5vw,24px); white-space:nowrap; }
  #financeControlPage .fin-kpi__meta { font-size:10px; }
  #financeControlPage .fin-kpi-action { width:32px; height:32px; min-width:32px; min-height:32px; }
  #financeControlPage .fin-kpi-action i, #financeControlPage .fin-kpi-action svg { width:18px; height:18px; }
  #financeControlPage .fin-kpi__sub { font-size:10px; padding-top:8px; margin-top:8px; }
}
@media screen and (max-width:1100px) {
  #financeControlPage .fin-kpis { grid-template-columns:repeat(5,minmax(170px,1fr)); overflow-x:auto; padding-bottom:6px; }
}
@media print { .reports-layout { display:block!important; } }
@media(max-width:760px) { .reports-layout { grid-template-columns:1fr; grid-template-rows:auto minmax(0,1fr); } .home-overview { grid-template-columns:1fr; } .home-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } .home-agenda { grid-template-columns:1fr; } .reports-panel .reports-filters .form-grid { grid-template-columns:1fr; } .reports-menu { position:static; max-height:120px; } .home-shortcuts { grid-template-columns:1fr; } }
@media print { .reports-graphs--modern,.reports-graphs-content,.reports-layout, .reports-layout > .reports-panel, .reports-menu { height:auto!important; max-height:none!important; overflow:visible!important; } .table-wrap.viewport-grid { height:auto!important; max-height:none!important; overflow:visible!important; } .viewport-grid thead,.viewport-grid tfoot { position:static; } .report-preset-actions { display:none!important; } }
