/* ==========================================================================
   OPFE app layout (v2). Loaded after brand.css while the OPFE design is on; everything is scoped to body.v2, which only
   the workspace app sets (src/layouts/app.php), so public pages, documents and the portal are untouched.
   "Undo the new design" in Platform settings removes it together with the brand.

   The idea, from the design canvas (design/screens and the OPFE App v2 canvas):
   - a rail of places, each an icon with its name under it, strung on one vertical line (the logo's stem);
   - the pages of the open place as tabs at the top of the sheet: two clicks to anything, never a long tree;
   - one wide box in the top bar to do or find anything;
   - bigger, calmer type: headlines light with the key words heavy, labels in mono capitals;
   - lists with taller rows, quiet heads and a tinted hover; empty pages that show the shape of what will be there.
   ========================================================================== */

/* ---------- the rail (desktop) ---------- */
@media (min-width:861px){
  .v2{--sidebar:96px;--topbar-h:64px;--row-h:52px}
  .v2 .sidebar{background:var(--bg);align-items:center;padding:14px 0 10px}
  .v2 .side-top{display:flex;flex-direction:column;align-items:center;gap:10px;padding:0 0 10px}
  .v2 .v2-mark{display:block;border-radius:14px;transition:transform var(--dur-1) var(--ease)}
  .v2 .v2-mark .opfe-icon{display:block;width:48px;height:48px}
  .v2 .v2-mark:active{transform:scale(.95)}
  .v2 .ws-switch,.v2 .ws-switch.dropdown{margin:0}
  .v2 .ws-btn{justify-content:center;width:auto;padding:4px;border-radius:10px}
  .v2 .ws-btn .grow,.v2 .ws-btn>.icon{display:none}
  .v2 .ws-switch .dropdown-menu{inset-inline:0 auto}
  .v2 .side-nav{position:relative;width:100%;padding:4px 0 8px;overflow:visible;display:flex;flex-direction:column;align-items:center;gap:2px}
  /* the stem the places hang on */
  .v2 .side-nav::before{content:"";position:absolute;top:18px;bottom:24px;left:50%;width:2px;margin-left:-1px;border-radius:2px;background:var(--line)}
  .v2 .nav-group{width:100%;display:flex;justify-content:center}
  .v2 .nav-item{position:relative;z-index:1;flex-direction:column;justify-content:center;gap:7px;width:80px;min-height:58px;margin:0;padding:6px 0 5px;border-radius:12px;background:none!important;box-shadow:none!important;color:var(--muted);font-size:11px;font-weight:600;line-height:1.2;text-align:center}
  [dir=rtl] .v2 .nav-item{font-size:12px}
  .v2 .nav-item>span:first-of-type{flex:none;max-width:84px;padding:0 4px;border-radius:4px;background:var(--bg)}
  .v2 .nav-item>.icon{box-sizing:content-box;width:20px;height:20px;padding:6px 10px;border-radius:10px;background:var(--bg);color:var(--n-500);transition:background var(--dur-1),color var(--dur-1),box-shadow var(--dur-2) var(--ease)}
  .v2 .nav-item.active{color:var(--brand)}
  .v2 .nav-item.active>.icon{background:var(--brand);color:var(--brand-ink);box-shadow:0 0 0 4px var(--bg),0 0 0 5px var(--brand)}
  .v2 .nav-mark{display:none}
  .v2 .nav-item .count{position:absolute;top:2px;inset-inline-end:14px;margin:0;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:var(--ink);color:#fff;font-size:10px;line-height:17px;box-shadow:0 0 0 2px var(--bg)}
  .v2 .nav-item .count.hide{display:none}
  .v2 .side-foot{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;padding:8px 0 0}
  .v2 .side-foot .nav-group{width:100%}
  .v2 .nav-kepi .kepi-dot{display:flex;align-items:center;justify-content:center;width:40px;height:32px;border-radius:10px;background:var(--accent-200);transition:box-shadow var(--dur-2) var(--ease)}
  .v2 .nav-kepi .kepi-dot .kepi{width:30px}
  .v2 .nav-kepi.active{color:var(--accent-700)}
  .v2 .nav-kepi.active .kepi-dot{box-shadow:0 0 0 4px var(--bg),0 0 0 5px var(--accent-700)}
  .v2 .shell-tag{display:none}
  @media (hover:hover) and (pointer:fine){
    .v2 .nav-item:hover{color:var(--ink)}
    .v2 .nav-item:not(.active):hover>.icon{background:var(--press);color:var(--ink)}
    .v2 .nav-kepi:hover .kepi-dot{box-shadow:0 0 0 4px var(--bg),0 0 0 5px var(--accent-400)}
  }
  /* the tooltips beside the rail repeat the label: not needed when the label is under the icon */
  .v2 .sidebar [data-tip]::after{display:none}

  /* ---------- the top bar: where you are, one box to do anything, then you ---------- */
  .v2 .main{padding-inline-end:10px}
  .v2 .topbar{flex-wrap:wrap;gap:10px 14px;min-height:var(--topbar-h);padding:10px 8px 10px 4px}
  .v2 .crumbs{flex:1 1 0}
  .v2 .crumbs li{font-size:var(--fs-md)}
  .v2 .topbar .search{flex:0 1 560px;min-height:44px;border-radius:12px;border-color:var(--control-line);padding:0 10px 0 14px;font-size:var(--fs-base)}
  .v2 .topbar .search .kbd{font-family:var(--font-mono);font-size:11px}
  .v2 .topbar-right{flex:1 1 0}
  .v2 .topbar .new-btn{min-height:40px;padding:0 16px;background:var(--brand);border-color:var(--brand);color:var(--brand-ink);font-weight:600;box-shadow:var(--shadow-primary)}
  .v2 .topbar .ask-ai{display:none}
  /* the pages of the open place: tabs on top of the sheet */
  .v2 .hub-row{display:flex;align-items:center;gap:6px;flex:1 0 100%;order:9;min-width:0;margin:2px 0 -2px}
  .v2 .hub-in{gap:4px}
  .v2 .hub-tab{min-height:38px;padding:6px 14px;border-radius:10px;font-weight:600;color:var(--muted)}
  .v2 .hub-tab.active{color:var(--brand-700)}
  .v2 .hub-ind{background:var(--brand-50);box-shadow:none}
  @media (hover:hover) and (pointer:fine){.v2 .hub-tab:not(.active):hover{background:color-mix(in srgb,var(--ink) 6%,transparent)}}
  .v2 .hub-gear{flex:none}

  /* ---------- the sheet ---------- */
  .v2 .content{border-radius:var(--radius-lg);margin-bottom:10px;min-height:calc(100dvh - var(--topbar-h) - 64px);padding:28px clamp(24px,3vw,44px) 64px;box-shadow:0 1px 2px rgba(28,9,16,.07),0 0 0 1px var(--line)}
}

/* ---------- type: big and light, key words heavy; labels in mono capitals ---------- */
.v2{--fs-2xl:32px;--fs-3xl:40px}
.v2 .page-head{margin-bottom:28px;align-items:flex-end}
.v2 .page-head h1{font-size:var(--fs-2xl);line-height:1.18;letter-spacing:-.025em;font-weight:600}
[dir=rtl] .v2 .page-head h1{letter-spacing:0;line-height:1.4}
.v2 .page-head p{font-size:var(--fs-base)}
.v2 .card-head h2,.v2 .card-head h3{font-size:var(--fs-lg)}
.v2 .stat{border-radius:12px;padding:16px 20px;gap:6px}
.v2 .stat-label{font:500 11px/16px var(--font-mono);letter-spacing:.08em;text-transform:uppercase}
[dir=rtl] .v2 .stat-label{font:600 13px/1.4 var(--font);letter-spacing:0;text-transform:none}
.v2 .stat-value{font-size:28px;font-weight:700;letter-spacing:-.03em;line-height:1.15}
.v2 .figure{font-weight:700;letter-spacing:-.03em}

/* ---------- controls ---------- */
.v2 .btn{min-height:40px;padding:6px 16px;border-radius:8px;border-color:var(--control-line);font-weight:600}
.v2 .btn-sm{min-height:32px;padding:4px 12px}
.v2 .btn-lg{min-height:48px;padding:8px 20px}
.v2 .btn-icon{padding:0;min-width:40px}
.v2 .btn-ghost{border-color:transparent;box-shadow:none}
.v2 .btn-primary{border-color:var(--brand)}
.v2 .btn-soft{border-color:transparent}
.v2 .card{border-radius:12px}

/* ---------- lists: taller rows, quiet heads, a tinted hover ---------- */
.v2 .table{font-size:var(--fs-md)}
.v2 .table th{background:transparent;padding:11px 16px;font:500 11px/16px var(--font-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
[dir=rtl] .v2 .table th{font:600 13px/1.4 var(--font);letter-spacing:0;text-transform:none}
.v2 .table td{border-bottom-color:var(--n-100)}
.v2 .table a.row-link{font-weight:600}
@media (hover:hover) and (pointer:fine){.v2 .table tbody tr:hover>td{background:#fff6f4}}
.v2 .table tbody tr.is-selected>td,.v2 .table tbody tr[aria-selected=true]>td{background:var(--brand-50)}

/* ---------- empty pages: the faint shape of what will be here, a big light sentence, the ways to start ---------- */
.v2 .empty.v2-empty{position:relative;overflow:hidden;padding:0;text-align:center;border-radius:16px}
.v2 .v2-ghost{display:grid;gap:10px;padding:22px 22px 0;opacity:.6;-webkit-mask-image:linear-gradient(to bottom,#000 10%,transparent 92%);mask-image:linear-gradient(to bottom,#000 10%,transparent 92%)}
.v2 .v2-ghost i{display:flex;align-items:center;gap:12px;height:44px;padding:0 14px;border-radius:10px;background:var(--surface);border:1px solid var(--line)}
.v2 .v2-ghost i::before{content:"";flex:none;width:26px;height:26px;border-radius:50%;background:var(--n-150)}
.v2 .v2-ghost i::after{content:"";height:8px;border-radius:4px;background:var(--n-150);width:var(--w,40%)}
.v2 .v2-ghost i:nth-child(1){--w:38%}.v2 .v2-ghost i:nth-child(2){--w:52%}.v2 .v2-ghost i:nth-child(3){--w:30%}
.v2 .v2-empty-body{position:relative;margin-top:-56px;padding:0 24px 36px;display:flex;flex-direction:column;align-items:center;gap:6px}
.v2 .v2-empty-body .empty-icon{display:inline-flex;align-items:center;justify-content:center;width:52px;height:52px;margin:0 0 6px;border-radius:14px;background:var(--brand-50);color:var(--brand)}
.v2 .v2-empty-body h3{font-family:var(--font-display);font-size:26px;line-height:1.25;font-weight:300;letter-spacing:-.025em;max-width:30ch}
[dir=rtl] .v2 .v2-empty-body h3{letter-spacing:0;line-height:1.5}
.v2 .v2-empty-body p{max-width:56ch;margin:0 auto}
.v2 .v2-empty-body .empty-cta{justify-content:center;margin-top:12px}
.card .v2-empty{border-radius:0}

/* ---------- Home: the day on one line ---------- */
.v2 .home-head h1{font-size:clamp(30px,3.4vw,44px);line-height:1.12;font-weight:300;letter-spacing:-.035em}
.v2 .home-head h1 b{font-weight:800}
[dir=rtl] .v2 .home-head h1{letter-spacing:0;line-height:1.45}
.v2 .home-head .kepi-note{margin-top:14px}
.dayline{margin:0 0 24px;padding:20px 24px 18px;background:var(--surface);border:1px solid var(--line);border-radius:14px}
.dayline-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:22px}
.dayline-head .lbl,.lbl{font:500 11px/16px var(--font-mono);letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
[dir=rtl] .lbl,[dir=rtl] .dayline-head .lbl{font:600 13px/1.4 var(--font);letter-spacing:0;text-transform:none}
.dayline-key{display:flex;gap:16px;font-size:var(--fs-sm);color:var(--muted)}
.dayline-key span{display:inline-flex;align-items:center;gap:6px}
.dayline-track{position:relative}
.dayline-track::before{content:"";position:absolute;inset-inline:calc(100% / var(--n) / 2);top:7px;height:3px;border-radius:3px;background:linear-gradient(to right,var(--brand) 0 var(--done),var(--line) var(--done) 100%)}
[dir=rtl] .dayline-track::before{background:linear-gradient(to left,var(--brand) 0 var(--done),var(--line) var(--done) 100%)}
.dayline-st{display:grid;grid-template-columns:repeat(var(--n),minmax(0,1fr));gap:10px;position:relative;margin:0;padding:0;list-style:none}
.dayline-st li{display:flex;flex-direction:column;align-items:center;gap:5px;text-align:center;min-width:0}
.dayline-st a{display:contents;color:inherit;text-decoration:none!important}
.dl-node{width:17px;height:17px;border-radius:50%;background:var(--surface);border:3px solid var(--brand);box-sizing:border-box}
.dl-node.done{background:var(--brand)}
.dl-node.next{box-shadow:0 0 0 5px var(--brand-50)}
.dl-node.warn{border-color:var(--red)}
.dayline-st small{font:500 11px/14px var(--font-mono);color:var(--muted)}
.dayline-st b{font-size:var(--fs-sm);font-weight:600;line-height:1.3;max-width:100%;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.dayline-st em{font-style:normal;font-size:12px;color:var(--muted);max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@media (hover:hover) and (pointer:fine){.dayline-st a:hover b{color:var(--brand)}}
.dayline-calm{display:flex;align-items:center;gap:12px;color:var(--muted)}
.dayline-calm::before{content:"";flex:1;height:3px;border-radius:3px;background:var(--line)}
.dayline-calm::after{content:"";flex:1;height:3px;border-radius:3px;background:var(--line)}
@media (max-width:860px){
  .dayline{padding:16px}
  .dayline-track::before{inset-inline:auto;inset-inline-start:7px;top:8px;bottom:8px;width:3px;height:auto;background:linear-gradient(to bottom,var(--brand) 0 var(--done),var(--line) var(--done) 100%)}
  .dayline-st{grid-template-columns:minmax(0,1fr);gap:14px}
  .dayline-st li{display:grid;grid-template-columns:17px minmax(0,1fr) auto;column-gap:12px;align-items:center;text-align:start}
  .dayline-st li small{grid-column:3;grid-row:1}
  .dayline-st li b{grid-column:2;grid-row:1}
  .dayline-st li em{grid-column:2;grid-row:2}
  .dayline-st li .dl-node{grid-column:1;grid-row:1 / span 2;position:relative}
}
.home-figs{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:14px;margin:0 0 28px}
.home-fig{display:flex;flex-direction:column;gap:6px;padding:16px 20px;border-radius:12px;background:var(--surface);border:1px solid var(--line);color:inherit;text-decoration:none!important;transition:transform var(--dur-1) var(--ease),box-shadow var(--dur-2) var(--ease)}
.home-fig b{font:700 28px/1.15 var(--font-display);letter-spacing:-.03em;font-variant-numeric:tabular-nums}
[dir=rtl] .home-fig b{letter-spacing:0}
.home-fig small{font-size:var(--fs-sm);color:var(--muted)}
.home-fig.is-red{background:var(--red-bg);border-color:#f6c8ad}
.home-fig.is-red .lbl,.home-fig.is-red small{color:var(--red)}
.home-fig.is-red b{color:var(--red-ink)}
@media (hover:hover) and (pointer:fine){a.home-fig:hover{transform:translateY(-2px);box-shadow:var(--shadow-md)}}
@media (prefers-reduced-motion:reduce){.home-fig,.v2 .v2-mark{transition:none}}

/* ---------- the in-app error page ---------- */
.v2-err .err-kepi{width:110px;margin:0 auto 8px}
.v2-err .err-code{font-weight:800;letter-spacing:-.04em}

/* v3 critique: spaced mono capitals on every card read as a generic dashboard. Labels are sentence case Inter now;
   mono stays for numbers, document numbers and axis ticks. */
.v2 .lbl,.v2 .dayline-head .lbl{font:600 13px/1.35 var(--font);letter-spacing:0;text-transform:none;color:var(--muted)}
.v2 .stat-label{font:600 13px/1.35 var(--font);letter-spacing:0;text-transform:none}
.v2 .table th{font:600 12.5px/1.3 var(--font);letter-spacing:0;text-transform:none}
