/* juribooks-odoo-classic-v3.css — Classic Odoo Accounting theme.
   Loaded LAST in <head>, after all 14 existing stylesheets.

   Why this exists: the app carries 13 legacy skin layers plus saved
   appearance preferences (data-ui / data-accent / data-repfont /
   data-plain, read from localStorage by loadAppr()). A stale saved skin
   re-applied itself on every load and fought whatever theme was intended.
   This layer resolves that by redefining the DESIGN TOKENS those layers
   all consume, at :root scope, so the skins keep working but resolve to
   Odoo values instead of competing with them.

   Presentation only. No ledger, billing, VAT/WHT, payroll, trust, budget,
   cash-flow, storage, auth, export or posting logic is touched. */

html[data-jb-theme="odoo-classic"]{
  color-scheme:light;

  --odoo-purple:#714b67; --odoo-purple-dark:#5b3c52;
  --odoo-purple-soft:#f1eaf0; --odoo-purple-pale:#f8f4f7;
  --odoo-teal:#00a09d; --odoo-success:#2e7d5b;
  --odoo-warning:#d58a1f; --odoo-danger:#c64b55;
  --odoo-bg:#f5f6f8; --odoo-header:#eef0f3;
  --odoo-line:#d9dde3; --odoo-line-strong:#bfc5cd;
  --odoo-ink:#23262d; --odoo-ink-soft:#454b55; --odoo-muted:#737b88;

  /* Redefining the tokens every legacy skin already reads. This is the
     mechanism that stops the old themes interfering: they are not
     disabled, they simply resolve to Odoo values. */
  /* juribooks-plain-v2.css sets --accent:#0B4D3A (emerald) at :root and
     is never overridden here otherwise — measured live: the nav active-bar,
     .jb2-badge "NEW" pill and KPI lead accent all rendered green under
     data-jb-theme="odoo-classic" until this line was added. --jb2-accent
     (skin-v2) is a plain alias of --accent, so this one token fixes both. */
  --accent:var(--odoo-purple)!important;
  --on-navy:#fff!important;
  --navy:var(--odoo-purple)!important;
  --navy-700:var(--odoo-purple-dark)!important;
  --navy-600:#64425b!important;
  --navy-300:#ae8ca5!important;
  --fill-navy:var(--odoo-purple)!important;
  --fill-navy-hover:var(--odoo-purple-dark)!important;
  --fill-navy-active:#4f3448!important;
  --ink:var(--odoo-ink)!important;
  --ink-soft:var(--odoo-ink-soft)!important;
  --paper:var(--odoo-bg)!important;
  --surface:#fff!important;
  --surface-2:#f8f9fb!important;
  --surface-3:#eff1f4!important;
  --line:var(--odoo-line)!important;
  --line-2:#cfd4da!important;
  --line-strong:var(--odoo-line-strong)!important;
  --debit:var(--odoo-purple)!important;
  --credit:var(--odoo-danger)!important;
  --balanced:var(--odoo-success)!important;
  --flag:var(--odoo-warning)!important;
  --bg-debit:var(--odoo-purple-soft)!important;
  --bg-credit:#fbecee!important;
  --bg-balanced:#e9f5ef!important;
  --bg-flag:#fff4df!important;
  --mute:var(--odoo-muted)!important;
  --mute-2:#8d949f!important;
  --radius:5px!important; --r-xs:3px!important; --r-sm:5px!important;
  --r-md:6px!important;  --r-lg:7px!important;
  --shadow:0 1px 2px rgba(22,27,35,.045),0 4px 14px rgba(22,27,35,.055)!important;
  --sh-1:0 1px 2px rgba(22,27,35,.04)!important;
  --sh-3:0 18px 55px rgba(30,24,29,.20)!important;
  --ring:0 0 0 1px #fff,0 0 0 3px rgba(113,75,103,.30)!important;
  --color-heading:var(--odoo-ink)!important;
  --color-subheading:var(--odoo-muted)!important;
  --color-body:var(--odoo-ink)!important;
}

/* A stale saved dark preference must not survive into this theme: the
   Odoo accounting look is a light surface. The toggle still works, it
   simply cannot leave the app in a half-dark state on open. */
html[data-jb-theme="odoo-classic"],
html[data-jb-theme="odoo-classic"][data-theme="dark"]{background:var(--odoo-bg)!important}
html[data-jb-theme="odoo-classic"] body,
html[data-jb-theme="odoo-classic"][data-theme="dark"] body,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"]{
  color:var(--odoo-ink)!important;background:var(--odoo-bg)!important;background-image:none!important;
}

/* ---------- Sidebar ---------- */
html[data-jb-theme="odoo-classic"] .rail,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .rail{
  color:var(--odoo-ink)!important;background:#fff!important;background-image:none!important;
  border-right:1px solid var(--odoo-line)!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .jb-brandmark-txt b{color:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] .jb-brandmark-txt span{color:var(--odoo-muted)!important}
html[data-jb-theme="odoo-classic"] .jb-brandmark:hover{background:var(--odoo-purple-pale)!important}
html[data-jb-theme="odoo-classic"] .navtoggle,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .navtoggle{
  color:var(--odoo-muted)!important;background:#fff!important;border:1px solid var(--odoo-line)!important;
}
html[data-jb-theme="odoo-classic"] .navtoggle:hover{color:var(--odoo-purple)!important;background:var(--odoo-purple-pale)!important}
html[data-jb-theme="odoo-classic"] .nav,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] #nav{background:#fff!important;border:0!important}
/* .navgrp-label is the ORIGINAL markup name; the live DOM is rebuilt at
   runtime by juribooks-nav-v2.js into .jb2-glab (see juribooks-app-
   architecture memory / THEME-CASCADE-AUDIT.md). Both are targeted so
   this survives either rendering path. MEASURED BUG on .jb2-glab: its
   own injected rule sets `font:700 10.5px/1.2 inherit`, which is invalid
   CSS (a partial `inherit` inside the `font` shorthand) and is silently
   dropped by the parser — confirmed via the live CSSOM, the parsed rule
   contains no font-size/weight/family at all. The element falls back to
   the browser's default <button> metrics (13.3333px) and its colour,
   rgba(255,255,255,.46/.5), was written for the LEGACY DARK rail. Under
   Odoo Classic the rail is white, so this was white-on-white — measured
   ~1.4:1, effectively invisible group headings. */
html[data-jb-theme="odoo-classic"] .navgrp-label,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .navgrp-label,
html[data-jb-theme="odoo-classic"] .jb2-glab,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .jb2-glab{
  background:transparent!important;
  font-size:11px!important;font-weight:600!important;letter-spacing:.04em!important;
}
/* Colour needs to out-specify juribooks-skin-v2.css's
   `body[data-ui="clean"] .rail #nav .jb2-glab{color:rgba(255,255,255,.5)
   !important}` (specificity 1-3-1, written for the dark legacy rail).
   Matching that exact chain plus the theme attribute wins outright. */
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .rail #nav .jb2-glab,
html[data-jb-theme="odoo-classic"] .rail #nav .jb2-glab{
  /* #777e89 measured 4.09:1 here — under the 4.5:1 AA floor for text this
     small. #5d646f is already verified 6.0:1 on this same white rail
     (used for the brandmark subtitle above); reused rather than guessing
     a new value. */
  color:#5d646f!important;
}
html[data-jb-theme="odoo-classic"] .navgrp-label:hover,
html[data-jb-theme="odoo-classic"] .navgrp.open .navgrp-label,
html[data-jb-theme="odoo-classic"] .navgrp.hasactive .navgrp-label,
html[data-jb-theme="odoo-classic"] .jb2-glab:hover,
html[data-jb-theme="odoo-classic"] .jb2-grp.open .jb2-glab,
html[data-jb-theme="odoo-classic"] .jb2-grp.hasactive .jb2-glab,
html[data-jb-theme="odoo-classic"] .rail #nav .jb2-glab:hover,
html[data-jb-theme="odoo-classic"] .rail #nav .jb2-grp.open .jb2-glab,
html[data-jb-theme="odoo-classic"] .rail #nav .jb2-grp.hasactive .jb2-glab{
  /* Matches (or exceeds) the specificity of the base-colour fix above
     (1-3-1) so the open/hover highlight is not itself shadowed by it. */
  color:var(--odoo-purple)!important;background:var(--odoo-purple-pale)!important;
}
html[data-jb-theme="odoo-classic"] .nav button[data-view],
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] #nav button[data-view]{
  color:#555c67!important;background:transparent!important;
  border-radius:5px!important;font-size:13px!important;font-weight:500!important;
}
html[data-jb-theme="odoo-classic"] .nav button[data-view]:hover,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] #nav button[data-view]:hover{
  color:var(--odoo-purple)!important;background:#f7f3f6!important;
}
/* Active state carries colour + fill + a left marker, never weight alone. */
html[data-jb-theme="odoo-classic"] .nav button[data-view].on,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] #nav button[data-view].on{
  position:relative;color:#fff!important;background:var(--odoo-purple)!important;
  font-weight:600!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .nav button[data-view].on::before{
  content:"";position:absolute;left:0;top:7px;bottom:7px;width:3px;
  border-radius:0 3px 3px 0;background:#fff;opacity:.88;transform:none;height:auto;
}
html[data-jb-theme="odoo-classic"] .nav button[data-view].on svg{color:#fff!important;opacity:1}

/* ---------- Topbar ---------- */
html[data-jb-theme="odoo-classic"] .topbar,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .topbar{
  color:var(--odoo-ink)!important;background:#fff!important;
  border-bottom:1px solid var(--odoo-line)!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .topbar h1{color:var(--odoo-ink)!important;font-weight:600!important;letter-spacing:-.018em}
html[data-jb-theme="odoo-classic"] .topbar .sub{color:var(--odoo-muted)!important}
html[data-jb-theme="odoo-classic"] .stat-chip{border-color:var(--odoo-line)!important;background:#fff!important}
html[data-jb-theme="odoo-classic"] .stat-chip .v{color:var(--odoo-ink)!important}

/* ---------- Canvas ---------- */
html[data-jb-theme="odoo-classic"] .main,
html[data-jb-theme="odoo-classic"] .view,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .view{background:var(--odoo-bg)!important;color:var(--odoo-ink)!important}
html[data-jb-theme="odoo-classic"] .stmt-entity{color:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] .stmt-title{color:var(--odoo-ink)!important;font-weight:600!important;letter-spacing:-.022em}
html[data-jb-theme="odoo-classic"] .stmt-sub{color:var(--odoo-muted)!important}
html[data-jb-theme="odoo-classic"] .rep-rule{border-color:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] .eyebrow{color:var(--odoo-purple)!important}

/* ---------- Flat cards and KPI tiles ---------- */
html[data-jb-theme="odoo-classic"] .view :is(.card,.chart-card,.kpi,.dkpi,.mx),
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] :is(.card,.dkpi,.mx){
  border:1px solid var(--odoo-line)!important;border-radius:6px!important;
  background:#fff!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .view :is(.card,.chart-card,.kpi,.dkpi,.mx):hover{
  border-color:#c3b4c0!important;box-shadow:var(--shadow)!important;
}
html[data-jb-theme="odoo-classic"] :is(.kpi,.dkpi,.mx){position:relative;overflow:hidden}
html[data-jb-theme="odoo-classic"] :is(.kpi,.dkpi,.mx)::before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--odoo-purple);
}
html[data-jb-theme="odoo-classic"] :is(.kpi,.mx).ok::before{background:var(--odoo-success)}
html[data-jb-theme="odoo-classic"] :is(.kpi,.mx).cr::before{background:var(--odoo-danger)}
html[data-jb-theme="odoo-classic"] :is(.kpi,.mx).am::before{background:var(--odoo-warning)}
html[data-jb-theme="odoo-classic"] :is(.kpi,.dkpi,.mx) .l{color:var(--odoo-muted)!important}
html[data-jb-theme="odoo-classic"] :is(.kpi,.dkpi,.mx) .v{color:var(--odoo-ink)!important}

/* Dashboard header becomes a restrained command panel, not a gradient banner. */
html[data-jb-theme="odoo-classic"] .home-head,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .home-head,
html[data-jb-theme="odoo-classic"] .exec-dashboard .exec-header{
  color:var(--odoo-ink)!important;background:#fff!important;background-image:none!important;
  border:1px solid var(--odoo-line)!important;border-top:3px solid var(--odoo-purple)!important;
  border-radius:6px!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .home-head :is(.stmt-title,.stmt-sub){color:inherit!important}
html[data-jb-theme="odoo-classic"] .home-head .stmt-entity{color:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] .home-head .stmt-sub{color:var(--odoo-muted)!important}

/* ---------- Accounting tables ---------- */
html[data-jb-theme="odoo-classic"] .view :is(.stmt,.tb-tbl,.coa-tbl,.jtbl,.ppe-tbl,.vat-tbl,.drill-tbl,.far-tbl,.recent-tbl){
  background:#fff!important;border-collapse:collapse!important;
}
html[data-jb-theme="odoo-classic"] .view :is(.stmt,.tb-tbl,.coa-tbl,.jtbl,.ppe-tbl,.vat-tbl,.drill-tbl,.far-tbl,.recent-tbl) thead th{
  color:#4e535c!important;background:var(--odoo-header)!important;background-image:none!important;
  border-color:var(--odoo-line)!important;border-bottom:1px solid var(--odoo-line-strong)!important;
  text-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .view :is(.tb-tbl,.coa-tbl,.jtbl,.ppe-tbl,.vat-tbl,.drill-tbl,.far-tbl,.recent-tbl) tbody td{
  color:var(--odoo-ink)!important;background:#fff!important;border-color:#e5e8ec!important;
}
html[data-jb-theme="odoo-classic"] .view :is(.tb-tbl,.coa-tbl,.drill-tbl,.far-tbl,.recent-tbl) tbody tr:nth-child(even) td{background:#fafbfc!important}
html[data-jb-theme="odoo-classic"] .view :is(.tb-tbl,.coa-tbl,.drill-tbl,.far-tbl,.recent-tbl) tbody tr:hover td{background:var(--odoo-purple-pale)!important}
html[data-jb-theme="odoo-classic"] .view :is(.stmt,.tb-tbl) tr.sec td{color:var(--odoo-purple)!important;background:#f4eef3!important}
html[data-jb-theme="odoo-classic"] .view :is(.stmt,.tb-tbl) tr.sub td{background:#fafbfc!important;border-top:1.5px solid #9f8a99!important}
html[data-jb-theme="odoo-classic"] .view :is(.stmt,.tb-tbl) tr.tot td{
  background:#f4eef3!important;border-top:2px solid var(--odoo-purple)!important;
  border-bottom:3px double var(--odoo-purple)!important;
}

/* ---------- Journal worksheet ---------- */
html[data-jb-theme="odoo-classic"] .sw-title,
html[data-jb-theme="odoo-classic"] .jbar{color:#fff!important;background:var(--odoo-purple)!important;background-image:none!important}
html[data-jb-theme="odoo-classic"] .jtbl thead th{color:#4e535c!important;background:var(--odoo-header)!important}
html[data-jb-theme="odoo-classic"] .jcell:focus{outline:2px solid var(--odoo-purple);background:#f5eff4}
html[data-jb-theme="odoo-classic"] .sw-status{background:var(--surface-2)!important;border-color:var(--odoo-line)!important}

/* ---------- Controls ---------- */
html[data-jb-theme="odoo-classic"] :is(.inp,.pf input,.pf select,.pf textarea,input,select,textarea){
  border-color:var(--odoo-line-strong)!important;background:#fff!important;color:var(--odoo-ink)!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] :is(.inp,input,select,textarea):focus{
  border-color:var(--odoo-purple)!important;box-shadow:0 0 0 2px rgba(113,75,103,.13)!important;outline:none;
}
html[data-jb-theme="odoo-classic"] .btn,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .btn{
  color:var(--odoo-ink-soft)!important;background:#fff!important;
  border:1px solid var(--odoo-line-strong)!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .btn:hover{color:var(--odoo-purple)!important;background:var(--odoo-purple-pale)!important;border-color:#bda9b8!important}
html[data-jb-theme="odoo-classic"] .btn.primary,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .btn.primary{
  color:#fff!important;background:var(--odoo-purple)!important;border-color:var(--odoo-purple)!important;
}
html[data-jb-theme="odoo-classic"] .btn.primary:hover{background:var(--odoo-purple-dark)!important;border-color:var(--odoo-purple-dark)!important;transform:none;filter:none}
html[data-jb-theme="odoo-classic"] .btn.danger{color:var(--odoo-danger)!important;background:transparent!important;border-color:transparent!important}
html[data-jb-theme="odoo-classic"] .btn.danger:hover{background:#fbecee!important;border-color:#e8b8bc!important}
html[data-jb-theme="odoo-classic"] .pill:not(.flag){color:var(--odoo-purple)!important;background:var(--odoo-purple-soft)!important}

/* ---------- Tabs ---------- */
html[data-jb-theme="odoo-classic"] .rtabs{border:0!important;border-bottom:1px solid var(--odoo-line)!important;border-radius:0!important;background:transparent!important}
html[data-jb-theme="odoo-classic"] .rtab,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .rtab{
  color:var(--odoo-muted)!important;background:transparent!important;
  border:0!important;border-bottom:2px solid transparent!important;border-radius:0!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] .rtab:hover{color:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] .rtab.on,
html[data-jb-theme="odoo-classic"] body[data-ui="clean"] .rtab.on{
  color:var(--odoo-purple)!important;background:transparent!important;
  border-bottom-color:var(--odoo-purple)!important;box-shadow:none!important;
}
html[data-jb-theme="odoo-classic"] :is(.rlist-item,.set-list-item).on{color:#fff!important;background:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] :is(.rlist-item,.set-list-item):hover{color:var(--odoo-purple)!important;background:var(--odoo-purple-pale)!important}

/* ---------- Overlays ---------- */
html[data-jb-theme="odoo-classic"] :is(.palette,.modal,#drillBox,#bcScrim>.card){
  border:1px solid var(--odoo-line-strong)!important;background:#fff!important;box-shadow:var(--sh-3)!important;
}
html[data-jb-theme="odoo-classic"] .toast{color:#fff!important;background:#33313a!important}
html[data-jb-theme="odoo-classic"] .balrow{color:var(--odoo-success)!important;background:#edf8f3!important;border:1px solid #bbdfcf!important}
html[data-jb-theme="odoo-classic"] .balrow.bad{color:var(--odoo-danger)!important;background:#fceff0!important;border-color:#efc2c5!important}

/* ---------- Semantic module accents ---------- */
html[data-jb-theme="odoo-classic"] #view-trust :is(.kpi,.dkpi,.mx)::before{background:var(--odoo-success)}
html[data-jb-theme="odoo-classic"] :is(#view-vat,#view-wht,#view-statutory) :is(.kpi,.dkpi,.mx)::before{background:var(--odoo-warning)}

/* ---------- Focus and selection ---------- */
html[data-jb-theme="odoo-classic"] :is(button,input,select,textarea,a,[tabindex]):focus-visible{
  outline:2px solid transparent!important;box-shadow:0 0 0 1px #fff,0 0 0 3px rgba(113,75,103,.38)!important;
}
html[data-jb-theme="odoo-classic"] ::selection{color:#fff;background:var(--odoo-purple)}

/* ---------- Print stays neutral and ink-efficient ---------- */
@media print{
  html[data-jb-theme="odoo-classic"] :is(html,body,.view){background:#fff!important}
  html[data-jb-theme="odoo-classic"] :is(.stmt,.tb-tbl,.coa-tbl,.ppe-tbl,.vat-tbl,.drill-tbl,.far-tbl) thead th{
    color:#111!important;background:#eee!important;border-color:#aaa!important;
  }
  html[data-jb-theme="odoo-classic"] .sw-title,html[data-jb-theme="odoo-classic"] .jbar{color:#111!important;background:#fff!important}
  html[data-jb-theme="odoo-classic"] :is(.kpi,.dkpi,.mx)::before{display:none}
}

@media(prefers-reduced-motion:reduce){
  html[data-jb-theme="odoo-classic"] *,
  html[data-jb-theme="odoo-classic"] *::before,
  html[data-jb-theme="odoo-classic"] *::after{animation-duration:.001ms!important;transition-duration:.001ms!important}
}

/* ---------- Rail text contrast correction ----------
   The legacy rail was navy, so its brand text was near-white cream
   (#f7f3e9) and its subtitle was the legacy green. Turning the rail white
   for the Odoo look left that text at roughly 1.05:1 against its own
   background - effectively invisible. Measured on the live page, not
   assumed. These rules restore legible colour; !important is required
   because the legacy brand rules are themselves !important and sit in a
   later-specificity selector. Removal plan: drop when the brand colours
   are moved onto tokens in juribooks-brand-v2.css. */
html[data-jb-theme="odoo-classic"] .rail .jb-brandmark-txt b,
html[data-jb-theme="odoo-classic"] .jb-brandmark-txt b{
  color:var(--odoo-purple)!important;
}
html[data-jb-theme="odoo-classic"] .rail .jb-brandmark-txt span,
html[data-jb-theme="odoo-classic"] .jb-brandmark-txt span{
  /* --odoo-muted measured 4.27:1 here, marginally under AA for text this
     small. Darkened to #5d646f = 6.0:1. */
  color:#5d646f!important;
}
html[data-jb-theme="odoo-classic"] .rail :is(.brand,.brand *){color:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] .rail-foot,
html[data-jb-theme="odoo-classic"] .rail-foot *{color:var(--odoo-muted)!important;border-color:var(--odoo-line)!important}

/* Chart bars and beams inherit the legacy palette from inline fills;
   these map the common cases onto the theme so a report does not show
   two different accent colours at once. */
html[data-jb-theme="odoo-classic"] .bar-in,
html[data-jb-theme="odoo-classic"] .beam-in{background:var(--odoo-purple)!important}
html[data-jb-theme="odoo-classic"] .bar-out,
html[data-jb-theme="odoo-classic"] .beam-out{background:#c9b3c3!important}
