/* ===================== UI v2 — premium layer ===================== */
:root{--sidebar:272px;--sidebar-mini:84px;--bottom-h:72px;--top-h:68px}

/* ---------- Form controls ---------- */
select.inp,.filters select.inp,.toolbar select.inp{appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f877d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:left 10px center;background-size:16px;padding-left:34px}
input[type=date].inp,input[type=month].inp,input[type=time].inp{direction:ltr;text-align:right;font-variant-numeric:tabular-nums}
input[type=date]::-webkit-calendar-picker-indicator,input[type=month]::-webkit-calendar-picker-indicator{opacity:.55;cursor:pointer}
.inp:hover{border-color:#c9c0b5}
.inp:focus{border-color:var(--primary)!important}

/* ---------- Sidebar ---------- */
.sidebar{background:linear-gradient(180deg,#221c17 0%,#1a1612 100%);border-left:1px solid #2c251f;width:var(--sidebar);transition:width .22s ease,transform .25s}
.brand{padding:18px 16px 14px;gap:12px;position:relative}
.brand-logo{width:44px;height:44px;border-radius:14px;background:none;box-shadow:0 6px 18px rgba(217,119,42,.35);overflow:hidden;flex:none}
.brand-logo img{width:100%;height:100%;display:block;object-fit:cover}
.brand-txt{min-width:0;flex:1}
.brand-name{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand-sub{display:flex;align-items:center;gap:6px}
.brand-sub::before{content:'';width:6px;height:6px;border-radius:50%;background:#4ade80;box-shadow:0 0 0 3px rgba(74,222,128,.18)}
.collapse-btn{width:30px;height:30px;border-radius:9px;border:1px solid #352d26;background:#2a231d;color:#a89d92;display:grid;place-items:center;cursor:pointer;flex:none;transition:.15s}
.collapse-btn:hover{color:#fff;background:#352d26}
.collapse-btn svg{width:16px;height:16px;transition:transform .2s}
.side-quick{margin:4px 14px 6px;display:flex;align-items:center;justify-content:center;gap:8px;height:42px;border-radius:12px;background:linear-gradient(135deg,#e08a3c,#b4580e);color:#fff;font-weight:700;box-shadow:0 8px 20px -6px rgba(224,138,60,.55);transition:.15s}
.side-quick:hover{filter:brightness(1.06);transform:translateY(-1px)}
.nav{padding:4px 12px 16px}
.nav-group{display:flex;align-items:center;gap:8px;padding:16px 10px 6px;font-weight:600;font-size:11px;letter-spacing:.4px;color:#7d7368}
.nav-group::after{content:'';flex:1;height:1px;background:#2c251f}
.nav a{padding:8px 10px;gap:12px;border-radius:12px;color:#c9bfb4;position:relative}
.nav a .ni{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:#2a231d;color:#b8ab9e;transition:.15s;flex:none}
.nav a .ni svg{width:18px;height:18px}
.nav a:hover{background:#2a231d}
.nav a:hover .ni{background:#352c24;color:#fff}
.nav a.active{background:linear-gradient(270deg,rgba(224,138,60,.20),rgba(224,138,60,.04));color:#fff;box-shadow:none}
.nav a.active .ni{background:linear-gradient(135deg,#e08a3c,#b4580e);color:#fff;box-shadow:0 6px 14px -4px rgba(224,138,60,.6)}
.nav a.active::before{content:'';position:absolute;right:-12px;top:10px;bottom:10px;width:4px;border-radius:4px 0 0 4px;background:#e08a3c}
.nav a .lbl{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.side-foot{margin:0 12px 12px;border:1px solid #2f2822;border-radius:14px;background:#241e19;padding:10px}
.avatar{background:linear-gradient(135deg,#5b4636,#3a2d23);font-size:13px}
/* mini sidebar */
.app.mini{--sidebar:var(--sidebar-mini)}
.app.mini .brand-txt,.app.mini .nav a .lbl,.app.mini .nav-group,.app.mini .side-foot .who,.app.mini .side-foot button[data-pass],.app.mini .side-quick span{display:none}
.app.mini .brand{flex-direction:column;padding:16px 10px}
.app.mini .collapse-btn svg{transform:rotate(180deg)}
.app.mini .nav a{justify-content:center;padding:6px}
.app.mini .nav-group{padding:8px 0;justify-content:center}.app.mini .nav-group::after{display:block;max-width:30px}
.app.mini .side-quick{margin:4px 18px 8px;height:44px}
.app.mini .side-foot{flex-direction:column;padding:8px 4px;margin:0 10px 12px}
.app.mini .nav a.active::before{right:-12px}

/* ---------- Topbar ---------- */
.topbar{height:var(--top-h);padding:0 28px;gap:14px;background:rgba(246,244,241,.82);backdrop-filter:saturate(1.4) blur(14px)}
.top-title{display:none}
.search-global input{height:42px;border-radius:13px;width:320px;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.03)}
.search-global .kbd-hint{position:absolute;left:10px;top:11px}
.icon-btn{width:42px;height:42px;border-radius:13px}
.top-actions .btn.primary{height:42px;border-radius:13px}
.user-chip{display:flex;align-items:center;gap:10px;padding:4px 4px 4px 12px;border:1px solid var(--border);background:#fff;border-radius:14px;height:42px}
.user-chip .avatar{width:32px;height:32px;font-size:12px;background:linear-gradient(135deg,#e08a3c,#b4580e)}
.user-chip b{font-size:13px;white-space:nowrap}

/* ---------- Page header (hero) ---------- */
.page-head{position:relative;align-items:center;gap:18px;margin:14px 0 22px;padding:20px 22px;background:#fff;border:1px solid var(--border);border-radius:20px;box-shadow:var(--shadow);overflow:hidden}
.page-head::before{content:'';position:absolute;inset:0;background:radial-gradient(600px 160px at 0% 0%,rgba(224,138,60,.10),transparent 70%),radial-gradient(400px 140px at 100% 100%,rgba(42,120,214,.05),transparent 70%);pointer-events:none}
.page-head::after{content:'';position:absolute;left:-40px;top:-40px;width:180px;height:180px;border-radius:50%;border:28px solid rgba(224,138,60,.06);pointer-events:none}
.page-head > *{position:relative;z-index:1}
.ph-ico{width:52px;height:52px;border-radius:16px;display:grid;place-items:center;flex:none;background:linear-gradient(135deg,#fdf0e3,#f9dcc0);color:var(--primary);box-shadow:inset 0 0 0 1px rgba(180,88,14,.12)}
.ph-ico svg{width:24px;height:24px;stroke-width:1.7}
.ph-main{min-width:0;flex:1}
.ph-crumb{font-size:12px;color:var(--text-3);display:flex;align-items:center;gap:6px;margin-bottom:3px}
.ph-crumb svg{width:12px;height:12px;transform:rotate(180deg)}
.page-head h1{font-size:21px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.page-head p{margin-top:3px}
.page-head .actions{gap:8px}
.page-head .actions .btn{height:40px}

/* ---------- Tabs (pill style) ---------- */
.tabs{border-bottom:0;background:#fff;border:1px solid var(--border);border-radius:14px;padding:5px;gap:4px;width:fit-content;max-width:100%;margin-bottom:18px;box-shadow:var(--shadow)}
.tabs a{border:0;margin:0;border-radius:10px;padding:8px 14px;font-size:13px}
.tabs a svg{width:16px;height:16px}
.tabs a.on{background:var(--primary-50);color:var(--primary);box-shadow:inset 0 0 0 1px rgba(180,88,14,.15)}
.tabs a:not(.on):hover{background:var(--surface-2)}

/* ---------- Filters / toolbar ---------- */
.toolbar{padding:14px 16px;gap:10px;background:linear-gradient(180deg,#fff,#fcfbf9);border-radius:var(--radius) var(--radius) 0 0}
.toolbar .search input{height:40px;width:280px;border-radius:12px;background:#fff;border-color:var(--border)}
.filters{gap:8px}
.filters .inp,.toolbar .filters .inp{height:40px;border-radius:12px;background-color:#fff;border-color:var(--border);min-width:150px;font-weight:500;color:var(--text)}
.filters .inp:hover{background-color:var(--surface-2)}
.filters > .muted{font-size:12px}
.date-chip{display:inline-flex;align-items:center;gap:2px;height:40px;border:1px solid var(--border);border-radius:12px;background:#fff;padding:0 4px 0 6px}
.date-chip > svg{width:16px;height:16px;color:var(--primary);margin:0 6px}
.date-chip input{border:0!important;box-shadow:none!important;height:36px!important;min-width:0!important;width:132px!important;padding:0 6px!important;background:transparent!important}
.date-chip .sep{color:var(--text-3);font-size:12px}
.date-chip:focus-within{border-color:var(--primary);box-shadow:0 0 0 3px var(--primary-100)}
.seg{background:#f1ede8;border-radius:12px;padding:4px}
.seg button{border-radius:9px;padding:6px 12px}
.filter-card{background:#fff;border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow);padding:12px 14px;margin-bottom:16px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.filter-card .fc-label{display:flex;align-items:center;gap:8px;font-weight:700;font-size:13px;color:var(--text-2);padding-inline-end:6px;border-inline-end:1px solid var(--border);margin-inline-end:2px}
.filter-card .fc-label svg{width:17px;height:17px;color:var(--primary)}
.toolbar .btn.ghost{border:1px solid var(--border);background:#fff}
.tb-btns{display:flex;gap:6px;flex:none}
.toolbar .search input{width:240px}
@media (max-width:1280px){.tb-btns .btn span{display:none}.tb-btns .btn{padding:0 9px}}

/* ---------- Cards & KPIs refinement ---------- */
.card{border-radius:18px}
.kpi{padding:18px 18px 16px;transition:.15s}
.kpi:hover{box-shadow:0 8px 24px -12px rgba(31,26,22,.18)}
.kpi .k-ico{width:38px;height:38px;border-radius:12px}
.kpi .k-val{font-size:25px}
.quick a{border-radius:16px;padding:16px 14px}
.quick a .k-ico{width:42px;height:42px;border-radius:13px}
table.t th{background:#faf8f5}

/* ---------- Mobile bottom nav ---------- */
.bottom-nav{display:none}
.sheet-ov{position:fixed;inset:0;background:rgba(24,20,17,.45);backdrop-filter:blur(3px);z-index:120;animation:fade .15s}
.sheet{position:fixed;left:0;right:0;bottom:0;z-index:121;background:#fff;border-radius:24px 24px 0 0;padding:10px 18px calc(22px + env(safe-area-inset-bottom));max-height:86vh;overflow:auto;animation:sheetUp .24s cubic-bezier(.2,.9,.3,1)}
.sheet .grab{width:44px;height:5px;border-radius:5px;background:#e2dcd4;margin:2px auto 14px}
.sheet h4{margin:14px 2px 10px;font-size:12.5px;color:var(--text-3);font-weight:600}
.sheet-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.sheet-grid a{display:flex;flex-direction:column;align-items:center;gap:7px;padding:12px 4px;border-radius:16px;color:var(--text);font-size:11.5px;font-weight:600;text-align:center;line-height:1.35;background:var(--surface-2);border:1px solid #f0ebe5}
.sheet-grid a .k-ico{width:44px;height:44px;border-radius:14px;display:grid;place-items:center}
.sheet-grid a:active{transform:scale(.97)}
.sheet-user{display:flex;align-items:center;gap:12px;padding:12px;border-radius:16px;background:var(--surface-2);border:1px solid #f0ebe5}
.sheet-user .avatar{background:linear-gradient(135deg,#e08a3c,#b4580e)}
@keyframes sheetUp{from{transform:translateY(100%)}}

/* ---------- Mobile cards for tables ---------- */
.mcards{display:flex;flex-direction:column;gap:10px;padding:12px}
.mcard{background:#fff;border:1px solid var(--border);border-radius:16px;padding:14px;box-shadow:0 1px 2px rgba(0,0,0,.02)}
.mcard.click:active{background:var(--surface-2)}
.mcard-top{display:flex;align-items:flex-start;gap:10px;margin-bottom:10px}
.mcard-top .t1{flex:1;min-width:0;font-weight:600}
.mcard-top .t2{font-weight:700;white-space:nowrap}
.mcard-sub{font-size:12px;color:var(--text-3);margin-top:2px}
.mcard-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px 14px;border-top:1px dashed var(--border);padding-top:10px}
.mcard-grid > div{min-width:0}
.mcard-grid label{display:block;font-size:11px;color:var(--text-3);margin-bottom:1px}
.mcard-grid span.v{font-size:13px;font-weight:500;word-break:break-word}
.mcard-act{display:flex;gap:6px;justify-content:flex-end;margin-top:10px;border-top:1px solid #f3efea;padding-top:8px}
.mcard-act .btn{border:1px solid var(--border)}

/* ---------- Login refresh ---------- */
.login-art .brand-logo{width:52px;height:52px}
.login-form .brand-logo{width:60px;height:60px;border-radius:18px;margin-bottom:18px}

/* ---------- Responsive ---------- */
@media (max-width:860px){
  :root{--top-h:60px}
  .sidebar,.backdrop{display:none!important}
  .main{margin-right:0}
  .topbar{padding:0 14px;padding-top:env(safe-area-inset-top);height:calc(var(--top-h) + env(safe-area-inset-top));background:rgba(255,255,255,.9);border-bottom:1px solid var(--border)}
  .icon-btn.menu-btn{display:none!important}
  .top-title{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
  .top-title img{width:34px;height:34px;border-radius:11px;flex:none}
  .top-title b{font-size:15.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .top-actions{margin-inline-start:0}
  .top-actions .btn.primary,.user-chip{display:none}
  .search-global{display:block}
  .search-global input{width:42px;padding:0;color:transparent;cursor:pointer;background:#fff}
  .search-global input::placeholder{color:transparent}
  .search-global svg{right:12px}
  .search-global.open{position:fixed;top:calc(8px + env(safe-area-inset-top));right:12px;left:12px;z-index:60}
  .search-global.open input{width:100%;padding:0 38px 0 12px;color:var(--text);box-shadow:var(--shadow-lg)}
  .search-global.open .search-results{top:48px}
  .icon-btn{width:40px;height:40px}
  .content{padding:10px 12px calc(var(--bottom-h) + 26px + env(safe-area-inset-bottom))}
  .page-head{padding:16px;border-radius:18px;margin:6px 0 14px;gap:12px}
  .ph-ico{width:44px;height:44px;border-radius:14px}
  .page-head h1{font-size:18px}
  .page-head p{font-size:12px}
  .page-head .actions{width:100%;margin:0;flex-wrap:nowrap;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
  .page-head .actions::-webkit-scrollbar{display:none}
  .page-head .actions .btn{flex:none;height:38px}
  .tabs{width:100%;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .toolbar{padding:12px}
  .toolbar .search{order:1;flex:1}.tb-btns{order:2}.toolbar .grow{display:none}.toolbar .tb-extra{order:3}
  .toolbar .filters,.tb-extra{width:100%;overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}
  .toolbar .filters .inp{flex:none;min-width:130px}
  .filter-card{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding:10px}
  .filter-card > *{flex:none}
  .filter-card .fc-label{display:none}
  .date-chip input{width:118px!important}
  .quick{grid-template-columns:repeat(3,1fr);gap:10px}
  .quick a{align-items:center;text-align:center;padding:14px 8px;font-size:12px}
  .grid.g4{grid-template-columns:1fr 1fr;gap:10px}
  .kpi{padding:14px}
  .kpi .k-val{font-size:18px}
  .kpi .k-label{font-size:12px}
  .kpi .k-ico{width:32px;height:32px}
  .toasts{left:12px;right:12px;bottom:calc(var(--bottom-h) + 18px + env(safe-area-inset-bottom))}
  .modal-foot{padding-bottom:calc(14px + env(safe-area-inset-bottom))}

  .bottom-nav{display:grid;grid-template-columns:repeat(5,1fr);align-items:end;position:fixed;left:10px;right:10px;bottom:calc(10px + env(safe-area-inset-bottom));height:var(--bottom-h);z-index:90;
    background:rgba(255,255,255,.92);backdrop-filter:saturate(1.5) blur(18px);border:1px solid rgba(231,226,220,.9);border-radius:24px;box-shadow:0 12px 36px -10px rgba(31,26,22,.28);padding:0 6px}
  .bottom-nav a,.bottom-nav button{background:none;border:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;height:100%;color:#9a9086;font-size:10.5px;font-weight:600;cursor:pointer;position:relative;-webkit-tap-highlight-color:transparent}
  .bottom-nav .bi{width:42px;height:30px;border-radius:12px;display:grid;place-items:center;transition:.18s}
  .bottom-nav .bi svg{width:22px;height:22px}
  .bottom-nav a.on{color:var(--primary)}
  .bottom-nav a.on .bi{background:var(--primary-50)}
  .bottom-nav a.on .bi svg{stroke-width:2.1}
  .bottom-nav .fab{justify-content:flex-start}
  .bottom-nav .fab .bi{width:58px;height:58px;border-radius:20px;margin-top:-26px;background:linear-gradient(135deg,#ec9a4c,#b4580e);color:#fff;box-shadow:0 10px 22px -6px rgba(180,88,14,.6),0 0 0 6px #f6f4f1}
  .bottom-nav .fab .bi svg{width:26px;height:26px;stroke-width:2.3}
  .bottom-nav .fab span.l{margin-top:2px}
  .bottom-nav .bdot{position:absolute;top:8px;left:calc(50% - 18px);min-width:16px;height:16px;border-radius:8px;background:var(--danger);color:#fff;font-size:9.5px;display:grid;place-items:center;padding:0 4px;border:2px solid #fff}
}
@media (max-width:380px){.sheet-grid{grid-template-columns:repeat(3,1fr)}}
@media print{.bottom-nav,.page-head::before,.page-head::after{display:none!important}.page-head{border:0;box-shadow:none;padding:0}}

/* ===================== v3 — typography, header band, app mode, sections ===================== */
:root{--font:'Readex Pro','IBM Plex Sans Arabic',system-ui,sans-serif;--font-num:'Readex Pro',system-ui,sans-serif}
body{font-family:var(--font);font-size:14px;letter-spacing:0;font-feature-settings:"ss01","tnum"}
h1,h2,h3,h4,.brand-name,.kpi .k-val,.page-head h1{font-family:var(--font);letter-spacing:-.2px}
.kpi .k-val,.num{font-feature-settings:"tnum"}
.btn{font-weight:500}
.btn.primary,.btn.success{font-weight:600}
.nav a{font-weight:400}
.nav a.active{font-weight:500}
table.t th{font-weight:500;font-size:12px;color:#7a7168}
.f label{font-weight:500}
b,.bold{font-weight:600}

/* page enter animation */
#view > *{animation:viewIn .28s cubic-bezier(.2,.8,.3,1) both}
#view > *:nth-child(2){animation-delay:.03s}#view > *:nth-child(3){animation-delay:.06s}#view > *:nth-child(4){animation-delay:.09s}#view > *:nth-child(n+5){animation-delay:.12s}
@keyframes viewIn{from{opacity:0;transform:translateY(8px)}}

/* ---------- Header band ---------- */
.page-head{margin:0 -28px 24px;padding:22px 28px 20px;border:0;border-bottom:1px solid var(--border);border-radius:0;background:#fff;box-shadow:none;align-items:center;overflow:visible}
.page-head::before{background:
  radial-gradient(circle at 1px 1px,rgba(180,88,14,.13) 1px,transparent 1.2px) 0 0/16px 16px;
  -webkit-mask-image:linear-gradient(to left,transparent 55%,#000 100%);mask-image:linear-gradient(to left,transparent 55%,#000 100%);opacity:.9}
.page-head::after{display:none}
.ph-ico{width:54px;height:54px;border-radius:17px;background:linear-gradient(145deg,#f0a259,#c4650f);color:#fff;box-shadow:0 10px 22px -10px rgba(180,88,14,.7),inset 0 1px 0 rgba(255,255,255,.35)}
.ph-ico svg{width:25px;height:25px;stroke-width:1.8}
.ph-crumb{gap:6px;margin-bottom:4px;font-size:12px}
.ph-crumb span{color:var(--text-3)}
.ph-crumb span:last-child{color:var(--primary);font-weight:500}
.page-head h1{font-size:23px;font-weight:700;line-height:1.3}
.page-head p{font-size:13px;color:var(--text-3);max-width:720px}
.page-head .actions .btn{height:42px;border-radius:12px;padding:0 16px}
.page-head .actions .btn:not(.primary):not(.success):not(.danger){background:#fff;box-shadow:0 1px 2px rgba(31,26,22,.05)}
.topbar{border-bottom:1px solid transparent}
.topbar + .content,.content{padding-top:0}
.topbar.scrolled{background:rgba(255,255,255,.9)}

/* ---------- Section cards ---------- */
.card-head{padding:16px 20px 14px;border-bottom:1px solid #f1ece6;gap:12px}
.card-head h3{font-size:15px;font-weight:600}
.card-head .ch-ico{width:34px;height:34px;border-radius:10px;display:grid;place-items:center;background:var(--primary-50);color:var(--primary);flex:none}
.card-head .ch-ico svg{width:17px;height:17px}
.card-head .ch-txt{min-width:0}
.card-head .ch-txt .sub{display:block;font-size:12px;margin-top:1px}
.card-body{padding:18px 20px 20px}
.card > .table-wrap,.card > div > .table-wrap{border-radius:0 0 18px 18px}
.section-title{font-size:14px;font-weight:600;color:var(--text);margin:26px 0 12px;gap:10px}
.section-title::before{content:'';width:4px;height:18px;border-radius:4px;background:linear-gradient(180deg,#f0a259,#c4650f)}
.section-title::after{background:linear-gradient(to left,var(--border),transparent)}
.stack{display:flex;flex-direction:column;gap:16px}
.layout-aside{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:18px;align-items:start}
.aside-sticky{position:sticky;top:calc(var(--top-h) + 16px);display:flex;flex-direction:column;gap:16px}
.sum-card{background:linear-gradient(160deg,#2a211b,#1d1814);color:#efe7df;border:0}
.sum-card .card-head{border-color:rgba(255,255,255,.08)}
.sum-card .card-head h3{color:#fff}
.sum-card .stat-row{border-color:rgba(255,255,255,.1)}
.sum-card .stat-row span{color:#b9ada1}
.sum-card .big{font-size:30px;font-weight:700;color:#fff;letter-spacing:-.5px}
.sum-card .muted{color:#9c9085}
.pill-status{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;font-size:12px;font-weight:600}
.profile-card{display:flex;align-items:center;gap:16px}
.profile-card .avatar{width:56px;height:56px;font-size:20px;border-radius:18px;background:linear-gradient(145deg,#f0a259,#c4650f)}
.info-grid{border-radius:16px}
.info-grid > div{padding:14px 16px}
.info-grid label{font-size:11.5px}

/* ---------- KPI polish ---------- */
.kpi{border-radius:18px;padding:18px 20px}
.kpi .k-label{color:var(--text-2);font-weight:500}
.kpi .k-val{font-size:26px;font-weight:600;margin-top:4px}
.kpi .k-val small{font-weight:400}

/* ---------- Lines editor as cards on mobile ---------- */
@media (max-width:860px){
  .lines{border:0;overflow:visible}
  .lines table{min-width:0;display:block}
  .lines thead{display:none}
  .lines tbody{display:flex;flex-direction:column;gap:10px}
  .lines tr{display:grid;grid-template-columns:1fr 1fr;gap:8px 10px;background:#fff;border:1px solid var(--border);border-radius:16px;padding:12px 12px 12px;position:relative;box-shadow:0 1px 2px rgba(0,0,0,.02)}
  .lines td{display:flex;flex-direction:column;gap:4px;padding:0;border:0!important;min-width:0}
  .lines td::before{content:attr(data-l);font-size:11px;color:var(--text-3);font-weight:500}
  .lines td.idx{display:none}
  .lines td.wide{grid-column:span 2}
  .lines td:last-child{position:absolute;top:8px;left:8px}
  .lines td:last-child::before{display:none}
  .lines td[data-calc]{text-align:right!important;padding:0!important;font-size:15px;color:var(--primary)}
  .lines .inp.sm{height:42px;font-size:15px;border-radius:11px}
  .add-line{border:1.5px dashed #e3c6a8;border-radius:14px;justify-content:center;background:var(--primary-50);margin-top:10px;padding:12px}
  .add-line .muted{display:none}
  .layout-aside{grid-template-columns:1fr}
  .aside-sticky{position:static}
}

/* ---------- App mode v3 ---------- */
@media (max-width:860px){
  body{background:#f4f1ed}
  .topbar{background:rgba(255,255,255,.94);border-bottom:1px solid #efe9e2}
  .top-title b{font-size:16px;font-weight:600}
  .page-head{margin:0 -12px 16px;padding:16px 14px 14px;flex-wrap:wrap;gap:10px 12px}
  .page-head::before{-webkit-mask-image:linear-gradient(to left,transparent 30%,#000 100%);mask-image:linear-gradient(to left,transparent 30%,#000 100%)}
  .ph-ico{width:44px;height:44px;border-radius:14px}
  .ph-ico svg{width:21px;height:21px}
  .ph-crumb{display:none}
  .page-head h1{font-size:19px}
  .page-head p{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
  .page-head .actions{order:3}
  .page-head .actions .btn{height:38px;border-radius:11px;padding:0 13px;font-size:13px}
  .content{padding:0 12px calc(var(--bottom-h) + 30px + env(safe-area-inset-bottom))}
  .card{border-radius:18px}
  .card-head{padding:14px 14px 12px}
  .card-body{padding:14px}
  .bottom-nav{left:0;right:0;bottom:0;height:calc(var(--bottom-h) + env(safe-area-inset-bottom));padding:0 6px env(safe-area-inset-bottom);border-radius:22px 22px 0 0;border:0;border-top:1px solid #ece6df;
    background:rgba(255,255,255,.96);box-shadow:0 -10px 30px -18px rgba(31,26,22,.25)}
  .bottom-nav a,.bottom-nav button{font-size:10.5px;font-weight:500;color:#a1978c;gap:3px}
  .bottom-nav a.on{color:var(--primary);font-weight:600}
  .bottom-nav a.on::before{content:'';position:absolute;top:0;width:28px;height:3px;border-radius:0 0 4px 4px;background:var(--primary)}
  .bottom-nav a.on .bi{background:transparent}
  .bottom-nav .bi{height:28px}
  .bottom-nav .fab .bi{width:56px;height:56px;border-radius:50%;margin-top:-30px;box-shadow:0 12px 24px -8px rgba(180,88,14,.65),0 0 0 7px #fff}
  .bottom-nav .fab span.l{color:var(--primary);font-weight:600}
  .bottom-nav .bdot{top:6px}
  .mcard{border-radius:18px;padding:14px 14px 12px}
  .mcard-top .t1{font-size:14.5px}
  .mcard-top .t2{font-size:15px;color:var(--text)}
  .sheet{border-radius:26px 26px 0 0}
  .sheet-grid a{background:#fff;border-color:#efe9e2;box-shadow:0 1px 2px rgba(0,0,0,.03)}
  .kpi .k-val{font-size:19px}
  .quick a{border-radius:18px}
}
@media print{.page-head{margin:0 0 12px;border:0;padding:0}.page-head::before,.ph-ico,.ph-crumb{display:none}}

.sum-card .inp{color:var(--text);background:#fff;border-color:transparent}
.sum-card .stat-row{align-items:center}
.lines table{min-width:640px}
table.t td.num.small,td .num.small{white-space:nowrap}
#doc table.t td:nth-child(3){white-space:nowrap}

.layout-aside > *{min-width:0}
#doc{min-width:0;overflow:hidden}
.doc-body{padding:28px!important}
.doc-table{border:1px solid var(--border);border-radius:12px}
@media (max-width:860px){.doc-body{padding:16px!important}#doc .info-grid{grid-template-columns:1fr!important}#doc h2{font-size:17px}.doc-body > div:first-child{flex-wrap:wrap}}

@media (max-width:860px){.lines table{min-width:0!important}.lines{overflow:visible!important}}

/* ===================== Field app, maps, roles, accounting ===================== */
.field-hero{margin-bottom:14px}
.fh-top{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px}
.fh-top .big small{font-size:16px;color:#b9ada1;font-weight:400}
.ring{--p:0;width:76px;height:76px;border-radius:50%;background:conic-gradient(#f0a259 calc(var(--p)*1%),rgba(255,255,255,.1) 0);display:grid;place-items:center;flex:none}
.ring span{width:60px;height:60px;border-radius:50%;background:#231c17;display:grid;place-items:center;font-weight:700;color:#fff;font-size:15px}
.fh-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}
.fh-stats > div{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.07);border-radius:14px;padding:10px 12px;min-width:0}
.fh-stats label{display:block;font-size:11px;color:#b9ada1}.fh-stats b{display:block;font-size:17px;color:#fff;margin:2px 0}.fh-stats span{font-size:11px;color:#9c9085}
.fh-target{display:flex;align-items:center;gap:8px;margin-top:12px;font-size:12.5px;color:#e9ddd1;background:rgba(240,162,89,.12);border-radius:12px;padding:8px 12px}
.fh-target svg{width:16px;height:16px;color:#f0a259}
.field-bar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:12px}
.field-bar .seg button{display:inline-flex;align-items:center;gap:6px}.field-bar .seg svg{width:15px;height:15px}
.fcards{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:12px}
.fcard{background:#fff;border:1px solid var(--border);border-radius:18px;padding:14px;box-shadow:var(--shadow);transition:.15s}
.fcard.done{background:linear-gradient(180deg,#f3fbf7,#fff);border-color:#cdeadc}
.fc-top{display:flex;gap:12px;align-items:flex-start}
.fc-n{width:34px;height:34px;border-radius:11px;background:var(--primary-50);color:var(--primary);display:grid;place-items:center;font-weight:700;flex:none;font-size:14px}
.fcard.done .fc-n{background:var(--success);color:#fff}.fc-n svg{width:17px;height:17px}
.fc-main{flex:1;min-width:0}.fc-main b{font-size:15px}
.fc-side{display:flex;flex-direction:column;gap:4px;align-items:flex-end}
.fc-info{display:flex;gap:14px;flex-wrap:wrap;font-size:12px;color:var(--text-3);margin:10px 0;padding:8px 0;border-top:1px dashed var(--border);border-bottom:1px dashed var(--border)}
.fc-info b{color:var(--text)}.fc-info a{color:var(--text-2);display:inline-flex;gap:4px;align-items:center}.fc-info svg{width:13px;height:13px}
.fc-act{display:grid;grid-template-columns:repeat(4,1fr) 40px;gap:6px}
.fc-act .btn{height:40px;padding:0 6px;justify-content:center;font-size:12.5px;gap:5px}
.fc-act .btn svg{width:16px;height:16px}
.btn.warn{background:var(--warning-50);border-color:#f3dca8;color:var(--warning)}
.map-card{overflow:hidden;padding:0}.map-card #fmap{height:62vh;min-height:380px}.map-card.big #bmap{height:68vh;min-height:420px}
.leaflet-container{font-family:var(--font);background:#e9e5df}
.leaflet-popup-content-wrapper{border-radius:14px;box-shadow:var(--shadow-lg)}.leaflet-popup-content{margin:12px 14px;direction:rtl;text-align:right}
.map-pop b{font-size:14px}.mp-act{display:flex;gap:6px;margin-top:8px}
.pin{width:34px;height:42px;position:relative}
.pin::before{content:'';position:absolute;inset:0 0 8px 0;border-radius:50% 50% 50% 0;transform:rotate(-45deg);background:var(--c,#d9772a);box-shadow:0 4px 10px rgba(0,0,0,.25);border:2px solid #fff;width:28px;height:28px;margin:2px}
.pin span{position:absolute;top:7px;left:0;right:0;text-align:center;color:#fff;font-weight:700;font-size:12px}
.pin.s-done{--c:#0f8a5f}.pin.s-todo{--c:#d9772a}.pin.s-risk{--c:#c8323a}
.pin2{width:22px;height:22px;border-radius:50%;background:var(--c);border:3px solid #fff;box-shadow:0 2px 6px rgba(0,0,0,.3);color:#fff;font-size:11px;display:grid;place-items:center;font-weight:700}
.truck-pin{width:36px;height:36px;border-radius:12px;background:var(--c);color:#fff;display:grid;place-items:center;border:3px solid #fff;box-shadow:0 4px 12px rgba(0,0,0,.3)}
.truck-pin svg{width:18px;height:18px}
.me-dot{width:22px;height:22px;border-radius:50%;background:#2a78d6;border:4px solid #fff;box-shadow:0 0 0 8px rgba(42,120,214,.2),0 2px 6px rgba(0,0,0,.3)}
.arrive-info{display:flex;flex-direction:column;gap:6px;margin-bottom:12px}
.arrive-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.big-act{display:flex;flex-direction:column;gap:4px;align-items:flex-start;padding:16px;border-radius:18px;border:1px solid var(--border);background:#fff;color:var(--text)}
.big-act svg{width:26px;height:26px;color:var(--primary);margin-bottom:4px}.big-act b{font-size:15px}.big-act span{font-size:12px;color:var(--text-3)}
.big-act.primary{background:linear-gradient(145deg,#f0a259,#c4650f);border:0;color:#fff}.big-act.primary svg,.big-act.primary span{color:#fff}
.role-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:10px}
.role-card{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:14px;border-radius:16px;border:1.5px solid var(--border);background:#fff;cursor:pointer;text-align:right;font-family:inherit;transition:.15s}
.role-card .k-ico{width:38px;height:38px;border-radius:12px;display:grid;place-items:center}
.role-card b{font-size:14px}.role-card span:last-child{font-size:11.5px;color:var(--text-3);line-height:1.5}
.role-card:hover{border-color:#e8c8a6}
.role-card.on{border-color:var(--primary);background:var(--primary-50);box-shadow:0 0 0 3px var(--primary-100)}
.je{overflow:hidden}.je-head{display:flex;gap:12px;align-items:center;padding:10px 14px;background:var(--surface-2);border-bottom:1px solid var(--border);font-size:13px;flex-wrap:wrap}
.je table.t td{padding:8px 14px}
tr.sub-row td{background:#fcfbf9;font-size:13px}
@media (max-width:860px){
  .fh-stats{grid-template-columns:1fr 1fr}.fh-stats b{font-size:15px}
  .fcards{grid-template-columns:1fr}
  .fc-act{grid-template-columns:repeat(4,1fr) 38px}
  .fc-act .btn{flex-direction:column;height:54px;font-size:11px;gap:2px}
  .map-card #fmap{height:58vh}
  .field-bar{overflow-x:auto;flex-wrap:nowrap;scrollbar-width:none}.field-bar > *{flex:none}
}

/* ---------- Brand lockups ---------- */
.brand-lockup{display:flex;align-items:center;flex:1;min-width:0;height:52px}
.brand-lockup .bl-full{height:50px;width:auto;max-width:100%;object-fit:contain;object-position:right center}
.brand-lockup .bl-mark{display:none;height:46px;width:46px;object-fit:contain}
.app.mini .brand-lockup{justify-content:center;flex:none}
.app.mini .brand-lockup .bl-full{display:none}.app.mini .brand-lockup .bl-mark{display:block}
.top-title img{object-fit:contain;border-radius:0!important}
.login-lockup{height:76px;width:auto;align-self:flex-start}
.login-lockup-light{height:64px;width:auto;display:block;margin-bottom:26px}
.doc-logo{height:62px;width:auto;display:block;margin-bottom:6px}
@media (max-width:860px){.login-lockup-light{height:58px;margin:0 auto 24px}.login-form h1,.login-form > form > p{text-align:center}}
