/* Camada compartilhada do workspace. Nao altera paginas publicas ou calculos. */
:root,
html[data-theme=light] {
  --ws-canvas: #f5f6f8;
  --ws-surface: #ffffff;
  --ws-subtle: #f0f3f4;
  --ws-hover: #f6f8f7;
  --ws-ink: #202b29;
  --ws-muted: #63716d;
  --ws-line: #e1e7e4;
  --ws-money: #157347;
  --ws-money-bg: #eaf6ef;
  --ws-danger: #b73c4b;
  --ws-danger-bg: #fff0f1;
  --ws-accent: #c35c2b;
  --ws-shadow: 0 1px 2px #172c2010, 0 4px 14px #172c2004;
}
html[data-theme=dark] {
  --ws-canvas: #121616;
  --ws-surface: #1b2120;
  --ws-subtle: #242c29;
  --ws-hover: #242e29;
  --ws-ink: #e8eeeb;
  --ws-muted: #a3b1a9;
  --ws-line: #34403a;
  --ws-money: #7adea4;
  --ws-money-bg: #203c2c;
  --ws-danger: #f2a2ad;
  --ws-danger-bg: #3b282c;
  --ws-accent: #f1a16f;
  --ws-shadow: 0 1px 2px #0002, 0 6px 18px #0001;
}
html { scroll-padding-top: 90px; }
html:has(.shell), body:has(.shell), html[data-theme] .shell {
  background: var(--ws-canvas);
  color: var(--ws-ink);
}
:root .shell {
  --surface: var(--ws-surface);
  --canvas: var(--ws-canvas);
  --ink: var(--ws-ink);
  --muted: var(--ws-muted);
  --line: var(--ws-line);
  --green: var(--ws-money);
}
.workspace-skip { position: fixed; left: 18px; top: -90px; z-index: 1100; padding: 12px 18px; border-radius: 6px; background: var(--ws-surface); color: var(--ws-ink); }
.workspace-skip:focus { top: 12px; }
:root .shell :is(a,button,input,select,textarea,summary):focus-visible { outline: 2px solid var(--ws-money); outline-offset: 3px; }
:root .shell .content:focus { outline: none; }
:root .shell .main { margin-left: 248px; }
:root .shell .content { max-width: 1640px; padding: 26px 28px 36px; animation: none; }
:root .shell .sidebar { width: 248px; padding: 22px 14px; background: #151c19; border-right: 1px solid #303b34; box-shadow: none; scrollbar-width: thin; scrollbar-color: #47574b transparent; }
:root .shell .brand { padding: 0 8px 20px; gap: 10px; font-size: 1.5rem; color: #f4f7f4; }
:root .shell .brand img { width: 38px; height: 38px; flex-basis: 38px; filter: none; }
:root .shell .brand small { font-size: .66rem; color: #a4b5aa; font-weight: 400; }
:root .shell .sidebar-group { margin: 22px 12px 7px; font-size: .65rem; color: #8fa296; text-transform: uppercase; }
:root .shell .sidebar .nav-link { min-height: 42px; padding: 10px 12px; border: 1px solid transparent; border-radius: 6px; font-size: .82rem; color: #bcc9c1; gap: 12px; transition: background-color .15s, color .15s; }
:root .shell .sidebar .nav-link i { width: 20px; flex: 0 0 20px; font-size: .9rem; color: #8ea598; }
:root .shell .sidebar .nav-link:hover { transform: none; background: #222d26; color: #fff; }
:root .shell .sidebar .nav-link.active { background: #283b2d; border-color: #3a5541; color: #f1fff5; box-shadow: inset 2px 0 #ef9a63; }
:root .shell .sidebar .nav-link.active i { color: #9fe2b5; }
:root .shell .sidebar-analysis { margin: 6px 0 0; padding: 0; border: 0; }
:root .shell .sidebar-analysis summary { display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: #bcc9c1; list-style: none; font-size: .82rem; }
:root .shell .sidebar-analysis summary::-webkit-details-marker { display: none; }
:root .shell .sidebar-analysis summary>i:first-child { width: 20px; margin: 0; text-align: center; color: #8ea598; }
:root .shell .sidebar-analysis .sidebar-chevron { margin: 0 0 0 auto; font-size: .6rem; transition: transform .15s; }
:root .shell .sidebar-analysis[open] .sidebar-chevron { transform: rotate(180deg); }
:root .shell .sidebar-analysis .nav-link { padding-left: 24px; font-size: .77rem; }
:root .shell .bi-collapse { background: transparent; border-color: #3a4a3f; box-shadow: none; color: #a8beb0; margin-top: 20px; }
:root .shell .topbar { min-height: 76px; height: auto; padding: 16px 28px; background: var(--ws-surface); border-color: var(--ws-line); box-shadow: none; backdrop-filter: none; }
:root .shell .topbar-title { min-width: 0; }
:root .shell .topbar-title>div { min-width: 0; }
:root .shell .page-title { color: var(--ws-ink); font-size: 1.18rem; line-height: 1.3; overflow-wrap: anywhere; }
:root .shell .page-context { color: var(--ws-muted); font-size: .69rem; }
:root .shell .user-menu { gap: 10px; flex-shrink: 0; }
:root .shell .desktop-user { color: var(--ws-muted); font-size: .82rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root .shell .user-avatar { background: var(--ws-money-bg); border-color: var(--ws-line); color: var(--ws-money); box-shadow: none; }
:root .shell :is(.icon-button,.back-button,.sidebar-toggle) { background: var(--ws-surface); color: var(--ws-muted); border: 1px solid var(--ws-line); border-radius: 6px; box-shadow: none; }
:root .shell :is(.icon-button,.back-button,.sidebar-toggle):hover { background: var(--ws-subtle); color: var(--ws-ink); }
:root .shell .analytics { background: transparent; color: var(--ws-ink); padding: 0; }
:root .shell .bi-heading { margin: 24px 0 28px; }
:root .shell .bi-heading h2 { font-size: 1.28rem; margin: 0 0 7px; font-weight: 700; color: var(--ws-ink); }
:root .shell :is(.bi-heading p,.bi-section header p,.bi-muted,.page-context,footer,.footer-tool,.footer-install) { color: var(--ws-muted); }
:root .shell .bi-muted { color: var(--ws-muted) !important; }
:root .shell .bi-main-tabs { display: flex; width: fit-content; max-width: 100%; gap: 3px; padding: 4px; background: var(--ws-subtle); border: 1px solid var(--ws-line); border-radius: 7px; margin: 0 0 20px; }
:root .shell .bi-main-tabs a { min-height: 36px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 4px; padding: 7px 13px; color: var(--ws-muted); font-size: .78rem; }
:root .shell .bi-main-tabs a[aria-current] { background: var(--ws-surface); color: var(--ws-ink); box-shadow: 0 1px 3px #00000010; }
:root .shell .bi-main-tabs a i { color: var(--ws-money); font-size: .78rem; }
.overview-group { margin-bottom: 28px; }
.overview-group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.overview-group-heading h2 { margin: 0; font-size: .92rem; font-weight: 650; color: var(--ws-ink); }
.overview-group-heading p { margin: 0; font-size: .7rem; color: var(--ws-muted); }
:root .shell .bi-overview-grid { gap: 14px; }
:root .shell :is(.bi-metric,.metric) { border: 1px solid var(--ws-line); background: var(--ws-surface); border-radius: 8px; box-shadow: var(--ws-shadow); color: var(--ws-ink); transition: transform .16s, border-color .16s, box-shadow .16s; }
:root .shell .analytics .bi-metric:not([data-overview=capital_if_all_received]) { background: var(--ws-surface); }
:root .shell .analytics .bi-overview-card[data-overview=cash] { background: var(--ws-money-bg); }
:root .shell .bi-overview-card { display: flex; flex-direction: column; min-height: 168px !important; padding: 18px !important; animation: none; }
:root .shell .bi-overview-card::after,:root .shell a.metric::after { display: none; }
:root .shell .bi-overview-card>span { display: flex; align-items: center; gap: 9px; min-height: 36px; padding-right: 9px; font-size: .73rem; color: var(--ws-muted); font-weight: 550 !important; }
:root .shell .bi-overview-card>span i,:root .shell .bi-metric:has(.fc-money)>span i,:root .shell .metric .metric-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; margin: 0; background: var(--ws-subtle) !important; border: 0 !important; border-radius: 6px; box-shadow: none !important; color: var(--ws-muted) !important; font-size: .8rem; }
:root .shell .bi-metric strong,:root .shell .metric .value { color: var(--ws-ink); font-size: 1.45rem !important; font-weight: 700; margin: 16px 0 10px !important; line-height: 1.25; font-variant-numeric: tabular-nums; }
:root .shell .bi-metric small { color: var(--ws-muted); font-size: .69rem; line-height: 1.5; }
:root .shell .bi-overview-card small { margin-top: auto; }
:root .shell .bi-metric>i { font-size: .6rem; color: var(--ws-muted); top: 17px; right: 13px; opacity: .5; }
:root .shell .fc-money,:root .shell .fc-name .fc-money { color: var(--ws-money) !important; text-shadow: none; }
:root .shell .fc-name { color: var(--ws-ink) !important; }
:root .shell .bi-tone-red .fc-money,:root .shell .bi-overview-card[data-overview=profit_current].bi-tone-red .fc-money { color: var(--ws-danger) !important; }
:root .shell .bi-overview-card[data-overview=cash] { border-color: color-mix(in srgb,var(--ws-money) 38%,var(--ws-line)); background: var(--ws-money-bg); }
:root .shell .bi-overview-card[data-overview=cash]>span i { color: var(--ws-money) !important; background: var(--ws-surface) !important; }
:root .shell .bi-overview-card[data-overview=overdue_total]>span i { color: var(--ws-danger) !important; background: var(--ws-danger-bg) !important; }
:root .shell .bi-overview-card[data-overview=capital_if_all_received],html[data-theme] .shell .analytics .bi-overview-card[data-overview=capital_if_all_received] { background: var(--ws-surface); border: 1px solid var(--ws-line); box-shadow: var(--ws-shadow); }
:root .shell .bi-overview-card[data-overview=capital_if_all_received]>span,:root .shell .bi-overview-card[data-overview=capital_if_all_received] small { color: var(--ws-muted); }
:root .shell .bi-overview-card[data-overview=capital_if_all_received] strong { color: var(--ws-ink); }
:root .shell .bi-overview-card[data-overview=capital_if_all_received] .fc-money { color: var(--ws-money) !important; }
:root .shell .bi-priorities { margin: 8px 0 0; padding: 22px 0 0; border-color: var(--ws-line); }
:root .shell .bi-priorities h3 { color: var(--ws-ink); font-size: .92rem; }
:root .shell .bi-priorities nav { gap: 18px; }
:root .shell .bi-priorities nav a { padding: 10px 0; color: var(--ws-muted); }
:root .shell .bi-priorities nav a>i { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; background: var(--ws-subtle); border-radius: 6px; margin-top: 0; color: var(--ws-money); font-size: .9rem; }
:root .shell .bi-priorities nav strong { color: var(--ws-ink); font-size: .94rem; }
:root .shell .bi-priority-alert { color: var(--ws-muted); }
:root .shell .panel { background: var(--ws-surface); border-color: var(--ws-line); box-shadow: var(--ws-shadow); padding: 22px; }
:root .shell :is(.panel-title,.bi-section h3,.section-toolbar h2) { color: var(--ws-ink); }
:root .shell .bi-filter { background: transparent; border-color: var(--ws-line); gap: 14px; padding-block: 18px; }
:root .shell .bi-tabs { gap: 24px; border-color: var(--ws-line); }
:root .shell .bi-tabs a { color: var(--ws-muted); }
:root .shell .bi-tabs a[aria-current] { color: var(--ws-money); border-color: var(--ws-money); }
:root .shell .bi-section,:root .shell .bi-details,:root .shell .management-section { border-color: var(--ws-line); }
:root .shell .bi-details summary { color: var(--ws-ink); }
:root .shell .btn { min-height: 42px; border-radius: 6px; font-size: .81rem; font-weight: 600; box-shadow: none !important; transition: background-color .15s, transform .15s; }
:root .shell :is(.btn-primary,.btn-success,.btn-warning),:root .shell .analytics .btn-primary,:root .shell a.btn[href="#/loans/new"] { background: #197548 !important; border-color: #197548 !important; color: #fff !important; }
:root .shell :is(.btn-primary,.btn-success,.btn-warning):hover,:root .shell .analytics .btn-primary:hover,:root .shell a.btn[href="#/loans/new"]:hover { background: #12613b !important; border-color: #12613b !important; }
:root .shell .btn-outline-secondary { background: var(--ws-surface); border-color: var(--ws-line); color: var(--ws-muted); }
:root .shell .btn-outline-secondary:hover { background: var(--ws-subtle); color: var(--ws-ink); border-color: var(--ws-muted); }
:root .shell :is(.btn-outline-primary,.btn-outline-success) { --bs-btn-color: var(--ws-money); --bs-btn-border-color: var(--ws-line); --bs-btn-hover-bg: var(--ws-money-bg); --bs-btn-hover-color: var(--ws-money); --bs-btn-hover-border-color: var(--ws-money); }
:root .shell .action-group { gap: 6px; }
:root .shell .action-group .btn { min-width: 38px; min-height: 38px; padding: 8px 10px; }
:root .shell .form-label { font-size: .79rem; font-weight: 550; color: var(--ws-ink); }
:root .shell :is(.form-control,.form-select),html[data-theme] .shell .form-control:is([name=amount],[name=principal_amount],[name=interest_rate],[name=late_fee_daily_rate],#cashValue,#cashCorrectAmount,#pAmount,#pPrincipal,#pLateDiscount,[name=name],[name=client_name],[name=payer_name]) { min-height: 44px; background-color: var(--ws-surface); color: var(--ws-ink); caret-color: var(--ws-money); border: 1px solid var(--ws-line); border-radius: 6px; box-shadow: none; font-size: .87rem; }
:root .shell :is(.form-control,.form-select):focus,html[data-theme] .shell .form-control:is([name=amount],[name=principal_amount],[name=interest_rate],[name=late_fee_daily_rate],#cashValue,#cashCorrectAmount,#pAmount,#pPrincipal,#pLateDiscount,[name=name],[name=client_name],[name=payer_name]):focus { background-color: var(--ws-surface); color: var(--ws-ink); border-color: var(--ws-money); box-shadow: 0 0 0 3px color-mix(in srgb,var(--ws-money) 13%,transparent); }
:root .shell .form-control::placeholder { color: var(--ws-muted); }
:root .shell .form-control:disabled,:root .shell .form-select:disabled { background-color: var(--ws-subtle); opacity: .8; }
:root .shell :is(.text-secondary,.text-muted) { color: var(--ws-muted) !important; }
:root .shell .table,:root .shell .analytics .table { --bs-table-bg: transparent; --bs-table-color: var(--ws-ink); --bs-table-hover-bg: var(--ws-hover); color: var(--ws-ink); font-size: .83rem; }
:root .shell .table th,:root .shell .analytics .table th { background: var(--ws-subtle); color: var(--ws-muted) !important; text-transform: none; font-size: .72rem !important; font-weight: 600 !important; padding-block: 12px; }
:root .shell .table td,:root .shell .analytics .table td { color: var(--ws-ink); border-color: var(--ws-line); padding-block: 14px; }
:root .shell .table tbody tr:hover { background: var(--ws-hover); }
:root .shell .bi-table-wrap { background: var(--ws-surface); border-color: var(--ws-line); }
:root .shell .badge-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 0; border-radius: 5px; font-weight: 600; font-size: .69rem; }
:root .shell .badge-status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
:root .shell footer { max-width: 740px; font-size: .65rem; line-height: 1.7; }
:root .shell .footer-install { min-height: 36px; padding: 8px 10px; border-radius: 6px; }
:root .shell .footer-install:hover { color: var(--ws-money); background: var(--ws-money-bg); }
:root .shell .empty { color: var(--ws-muted) !important; padding: 38px 16px !important; }
/* SweetAlert fica fora de .shell; compartilha os tokens sem afetar paginas publicas. */
body:has(.shell) .swal2-popup { background: var(--ws-surface) !important; color: var(--ws-ink); border: 1px solid var(--ws-line); border-radius: 8px !important; box-shadow: 0 18px 64px #0003 !important; }
body:has(.shell) .swal2-title { color: var(--ws-ink) !important; font-size: 1.2rem !important; }
body:has(.shell) .swal2-html-container { color: var(--ws-muted) !important; }
body:has(.shell) .swal2-popup :is(.form-control,.form-select,.swal2-input,.swal2-textarea) { color: var(--ws-ink); background-color: var(--ws-surface); border-color: var(--ws-line); box-shadow: none; border-radius: 6px; }
body:has(.shell) .swal2-popup :is(.form-control,.form-select):focus { border-color: var(--ws-money); box-shadow: 0 0 0 3px color-mix(in srgb,var(--ws-money) 13%,transparent); }
body:has(.shell) .swal2-popup .form-label { color: var(--ws-ink); font-size: .79rem; }
body:has(.shell) .swal2-popup .swal2-confirm { background: #197548 !important; border-color: #197548 !important; box-shadow: none; min-height: 44px; }
body:has(.shell) .swal2-popup .swal2-cancel { min-height: 44px; background: var(--ws-subtle); color: var(--ws-ink); border: 1px solid var(--ws-line); }
@media (hover:hover) and (pointer:fine) {
  :root .shell a.bi-metric:hover,:root .shell a.metric:hover { transform: translateY(-2px); border-color: var(--ws-money); box-shadow: 0 5px 16px #152d2010; }
  :root .shell .btn:hover { transform: translateY(-1px); }
}
@media (min-width:768px) {
  :root body.bi-sidebar-collapsed .shell .sidebar { width: 76px; padding-inline: 10px; }
  :root body.bi-sidebar-collapsed .shell .main { margin-left: 76px; }
  :root body.bi-sidebar-collapsed .shell .brand { padding-inline: 8px; }
  :root body.bi-sidebar-collapsed .shell .sidebar-analysis summary { justify-content: center; padding-inline: 8px; }
  :root body.bi-sidebar-collapsed .shell .sidebar-chevron { display: none; }
  :root body.bi-sidebar-collapsed .shell .bi-collapse i { transform: rotate(180deg); }
}
@media (max-width:1199px) and (min-width:992px) {
  :root .shell .bi-overview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width:767px) {
  :root .shell .main { margin-left: 0; }
  :root .shell .sidebar { width: min(290px,86vw); padding: max(20px,env(safe-area-inset-top)) 14px calc(90px + env(safe-area-inset-bottom)); }
  :root .shell .topbar { min-height: 64px; padding: 11px 14px; gap: 10px; }
  :root .shell .page-title { font-size: 1rem; }
  :root .shell .topbar-title { gap: 8px; flex: 1; }
  :root .shell .user-menu { gap: 6px; }
  :root .shell :is(.icon-button,.back-button,.sidebar-toggle) { width: 40px; height: 40px; min-width: 40px; flex: 0 0 40px; }
  :root .shell .content { padding: 20px 16px 28px; }
  :root .shell .bi-heading { margin: 20px 0 26px; gap: 16px; }
  :root .shell .bi-heading h2 { font-size: 1.16rem; }
  :root .shell .bi-actions { display: flex; gap: 7px; }
  :root .shell .bi-actions .btn { min-height: 44px; font-size: .76rem; padding-inline: 11px; }
  :root .shell .bi-actions .btn-primary { margin-left: auto; }
  :root .shell .bi-actions .form-select { width: 77px; min-height: 44px; padding-left: 9px; font-size: .77rem; }
  :root .shell .bi-main-tabs { width: 100%; }
  :root .shell .bi-main-tabs a { flex: 1; justify-content: center; padding-inline: 8px; font-size: .76rem; }
  .overview-group { margin-bottom: 26px; }
  .overview-group-heading { display: block; margin-bottom: 12px; }
  .overview-group-heading p { margin-top: 4px; }
  :root .shell .bi-overview-grid { grid-template-columns: minmax(0,1fr); gap: 10px; }
  :root .shell .bi-overview-card { min-height: 142px !important; padding: 16px !important; }
  :root .shell .bi-overview-card>span { min-height: 30px; padding-right: 16px; font-size: .76rem; }
  :root .shell .bi-overview-card strong { margin: 12px 0 8px !important; font-size: 1.5rem !important; }
  :root .shell .bi-priorities nav { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; }
  :root .shell .bi-priorities nav a { gap: 8px; font-size: .7rem; }
  :root .shell .bi-priorities nav strong { font-size: .83rem; }
  :root .shell .bi-priorities nav a>i { width: 28px; height: 28px; flex-basis: 28px; font-size: .8rem; }
  :root .shell .panel { padding: 16px; }
  :root .shell .action-group .btn { min-width: 42px; min-height: 42px; }
  :root .shell .mobile-nav { background: var(--ws-surface); border-top: 1px solid var(--ws-line); box-shadow: 0 -3px 16px #00000007; height: calc(70px + env(safe-area-inset-bottom)); padding: 6px 7px env(safe-area-inset-bottom); }
  :root .shell .mobile-nav a,:root .shell .mobile-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; isolation: isolate; gap: 3px; padding: 2px; color: var(--ws-muted); font-size: .61rem; min-height: 56px; }
  :root .shell .mobile-nav i { display: grid; place-items: center; width: 44px; height: 28px; margin: 0; border-radius: 7px; font-size: 1.05rem; }
  :root .shell .mobile-nav .active { color: var(--ws-money); font-weight: 650; }
  :root .shell .mobile-nav .active i { background: var(--ws-money-bg); color: var(--ws-money); box-shadow: none; }
}
@media (max-width:359px) {
  :root .shell .content { padding-inline: 12px; }
  :root .shell .bi-actions { flex-wrap: wrap; }
  :root .shell .bi-actions .btn-primary { margin-left: 0; }
  :root .shell .bi-priorities nav { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion:reduce) {
  :root .shell *, :root .shell *::before, :root .shell *::after { animation: none !important; transition: none !important; }
  :root .shell a.bi-metric:hover,:root .shell a.metric:hover,:root .shell .btn:hover { transform: none; }
}
@media print {
  :root .shell { --ws-canvas: #fff; --ws-surface: #fff; --ws-ink: #172c20; --ws-muted: #4e6054; --ws-money: #157347; }
  :root .shell :is(.sidebar,.topbar,.mobile-nav,.workspace-skip) { display: none; }
  :root .shell .main { margin: 0; }
}
