/* My Arbec — RTL ERP UI */
:root {
  --cobalt: #1E5BC6;
  --cobalt-dark: #1648A0;
  --cobalt-soft: #E8EFFB;
  --navy: #0F2240;
  --navy-2: #172E52;
  --paper: #F4F6F9;
  --surface: #FFFFFF;
  --line: #D8DEE8;
  --line-soft: #E9EDF3;
  --ink: #16202E;
  --ink-2: #4A5668;
  --ink-3: #7A8596;
  --green: #1F8A5B;
  --green-soft: #E3F4EC;
  --red: #C8372D;
  --red-soft: #FBE9E7;
  --amber: #D99A0B;
  --amber-soft: #FDF3DC;
  --radius: 6px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--paper);
  font-variant-numeric: tabular-nums;
}
a { color: var(--cobalt); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.3; }
h1 { font-size: 20px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
.num, td.num, th.num { direction: ltr; text-align: left; white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  background: var(--navy); color: #C9D4E6; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 24px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { max-height: 34px; max-width: 150px; background: #fff; border-radius: 4px; padding: 3px 6px; }
.brand .name { color: #fff; font-weight: 700; font-size: 16px; }
.brand .sub { font-size: 11px; color: #8FA0BC; }
.nav { padding: 8px 8px 24px; }
.nav details { margin: 2px 0; }
.nav summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 5px;
  color: #E3EAF5; font-weight: 500;
}
.nav summary::-webkit-details-marker { display: none; }
.nav summary:hover { background: rgba(255,255,255,.06); }
.nav summary .chev { margin-inline-start: auto; transition: transform .15s; opacity: .6; }
.nav details[open] summary .chev { transform: rotate(-90deg); }
.nav .grp { font-size: 11px; color: #7F91AF; padding: 8px 12px 2px 0; padding-inline-start: 34px; }
.nav a.item { display: block; padding: 6px 10px; padding-inline-start: 34px; color: #B9C6DB; border-radius: 5px; font-size: 13px; }
.nav a.item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.item.active { background: var(--cobalt); color: #fff; }
.nav a.top { display: flex; align-items: center; gap: 10px; padding: 8px 10px; color: #E3EAF5; border-radius: 5px; font-weight: 500; }
.nav a.top:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.top.active { background: var(--cobalt); color: #fff; }
.nav .badge-count { margin-inline-start: auto; background: var(--amber); color: #2b1d00; border-radius: 10px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.topbar select { min-width: 180px; }
.menu-btn { display: none; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--cobalt-soft); color: var(--cobalt); display: grid; place-items: center; font-weight: 700; }
.content { padding: 20px 24px 48px; max-width: 1500px; width: 100%; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head .crumbs { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #B9C3D3; text-decoration: none; }
.btn-primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-dark); border-color: var(--cobalt-dark); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-danger { color: var(--red); border-color: #EBC3BF; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #241800; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-link { border: 0; background: none; color: var(--cobalt); padding: 0; height: auto; }
.inline { display: inline; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search],
input[type=time], input[type=month], input:not([type]), select, textarea {
  width: 100%; height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  font: inherit; color: var(--ink);
}
textarea { height: auto; min-height: 74px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--cobalt); outline: 2px solid rgba(30,91,198,.15); outline-offset: 0; }
input[type=number], .ltr { direction: ltr; text-align: left; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--cobalt); vertical-align: middle; }
label.field { display: block; }
label.field > span { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; font-weight: 500; }
label.field > span .req { color: var(--red); }
.help { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.check { display: flex; align-items: center; gap: 8px; height: 34px; margin-top: 21px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { flex: 1; }
.panel-body { padding: 16px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.grid .c2 { grid-column: span 2; }
.grid .c3 { grid-column: 1 / -1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; background: var(--surface); }
table.t th, table.t td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); text-align: start; vertical-align: middle; }
table.t thead th { background: #F7F9FC; color: var(--ink-2); font-weight: 600; font-size: 12.5px; position: sticky; top: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t tbody tr:hover { background: #F8FAFE; }
table.t tfoot td { font-weight: 700; background: #F7F9FC; border-top: 1px solid var(--line); }
table.t tr.bold td { font-weight: 600; }
table.t td.wrap { white-space: normal; min-width: 240px; }
table.t tr.heading td { background: #F1F4F9; font-weight: 600; }
.row-link { cursor: pointer; }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

.toolbar { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { max-width: 300px; }
.toolbar select { max-width: 200px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 10px 16px; color: var(--ink-3); }

/* ---------- status stamps ---------- */
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 3px; font-size: 12px; font-weight: 600; border: 1.5px solid currentColor;
  letter-spacing: 0; white-space: nowrap; transform: rotate(-1.5deg);
}
.badge-gray { color: #6B7586; }
.badge-amber { color: #A97300; background: var(--amber-soft); }
.badge-blue { color: var(--cobalt); background: var(--cobalt-soft); }
.badge-green { color: var(--green); background: var(--green-soft); }
.badge-red { color: var(--red); background: var(--red-soft); }
.stamp-lg { font-size: 15px; padding: 3px 16px; border-width: 2px; }
.pill { display: inline-block; padding: 0 8px; border-radius: 10px; background: var(--line-soft); font-size: 12px; color: var(--ink-2); }
.yes { color: var(--green); font-weight: 700; }
.no { color: var(--ink-3); }

/* ---------- flash ---------- */
.flashes { margin-bottom: 14px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; font-weight: 500; white-space: pre-line; }
.flash-success { background: var(--green-soft); border-color: #B6E0CB; color: #145C3D; }
.flash-error { background: var(--red-soft); border-color: #F0C2BD; color: #8E2219; }
.flash-warning { background: var(--amber-soft); border-color: #F1D79A; color: #6E4A00; }
.flash-info { background: var(--cobalt-soft); border-color: #C3D4F2; color: #173E85; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; }
.kpi { padding: 14px 18px; border-inline-start: 1px solid var(--line-soft); display: block; color: inherit; }
.kpi:hover { background: #F8FAFE; text-decoration: none; }
.kpi .label { font-size: 12.5px; color: var(--ink-2); }
.kpi .value { font-size: 22px; font-weight: 700; direction: ltr; text-align: right; margin: 2px 0; }
.kpi .sub { font-size: 11.5px; color: var(--ink-3); }

/* ---------- detail ---------- */
.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
.dl > div { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.dl dt { font-size: 12px; color: var(--ink-3); }
.dl dd { margin: 2px 0 0; font-weight: 500; word-break: break-word; }
.dl .c3 { grid-column: 1 / -1; }
.doc-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.totals-box { display: grid; grid-template-columns: auto auto; gap: 4px 24px; justify-content: end; padding: 14px 16px; }
.totals-box .k { color: var(--ink-2); }
.totals-box .v { direction: ltr; text-align: left; font-weight: 600; }
.totals-box .grand { font-size: 16px; color: var(--ink); }
.timeline { list-style: none; margin: 0; padding: 0 16px 12px; }
.timeline li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--cobalt); border-bottom-color: var(--cobalt); font-weight: 600; }
.progress { height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; min-width: 80px; }
.progress > span { display: block; height: 100%; background: var(--cobalt); }

/* ---------- lines editor ---------- */
table.lines { width: 100%; border-collapse: collapse; }
table.lines th { background: #F7F9FC; font-size: 12px; color: var(--ink-2); font-weight: 600; padding: 6px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.lines td { padding: 4px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.lines input, table.lines select { height: 32px; padding: 4px 6px; min-width: 70px; }
table.lines td.ro { background: #F9FAFC; direction: ltr; text-align: left; padding: 9px 8px; color: var(--ink-2); white-space: nowrap; }
table.lines .del { color: var(--red); background: none; border: 0; cursor: pointer; font-size: 18px; line-height: 1; padding: 6px; }
.lines-wrap { overflow-x: auto; }
.lookup { position: relative; min-width: 200px; }
.lookup .menu {
  position: absolute; inset-inline: 0; top: 100%; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(15,34,64,.14); max-height: 260px; overflow-y: auto; display: none;
}
.lookup .menu div { padding: 7px 10px; cursor: pointer; font-size: 13px; }
.lookup .menu div:hover, .lookup .menu div.on { background: var(--cobalt-soft); }
.lookup .menu .none { color: var(--ink-3); cursor: default; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .art {
  background: var(--navy); color: #DCE5F3; padding: 48px; display: flex; flex-direction: column; justify-content: flex-end;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px),
                    linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 20px 20px, 20px 20px, 100px 100px, 100px 100px;
}
.auth .art h2 { font-size: 30px; color: #fff; margin-bottom: 8px; max-width: 420px; }
.auth .art p { max-width: 420px; color: #A9B8D0; }
.auth .form { display: grid; place-items: center; padding: 32px; background: #fff; }
.auth form { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.auth .logo-word { font-size: 26px; font-weight: 700; color: var(--cobalt); }
.auth .logo-img { height: 72px; width: auto; display: block; margin-bottom: 8px; }

/* ---------- tender grid ---------- */
.grid-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table.sheet { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
table.sheet th { position: sticky; top: 0; background: #EEF2F8; z-index: 3; font-weight: 600; font-size: 12px; color: var(--ink-2); padding: 6px 8px; border-bottom: 1px solid var(--line); border-inline-start: 1px solid var(--line-soft); white-space: nowrap; }
table.sheet th.grp-cost { background: #E6F0E9; }
table.sheet th.grp-price { background: #E5EDFB; }
table.sheet td { border-bottom: 1px solid var(--line-soft); border-inline-start: 1px solid var(--line-soft); padding: 0; height: 30px; }
table.sheet td .cell { padding: 5px 8px; min-height: 30px; outline: none; white-space: pre-wrap; }
table.sheet td.n .cell { direction: ltr; text-align: left; white-space: nowrap; }
table.sheet td.desc { min-width: 320px; max-width: 520px; }
table.sheet td.ro .cell { color: var(--ink-2); background: #FAFBFD; }
table.sheet td.calc .cell { font-weight: 600; }
table.sheet td [contenteditable=true]:focus { background: #FFFBEA; box-shadow: inset 0 0 0 2px var(--amber); }
table.sheet tr.heading td { background: #F1F4F9; font-weight: 700; }
table.sheet tr.flash-remote td { animation: remote 1.6s ease-out; }
table.sheet tr.saving td.desc .cell { opacity: .7; }
table.sheet td.rowno { position: sticky; inset-inline-start: 0; background: #F7F9FC; z-index: 2; color: var(--ink-3); font-size: 11px; text-align: center; min-width: 44px; }
table.sheet td.who { font-size: 11px; color: var(--ink-3); white-space: nowrap; padding: 0 6px; }
@keyframes remote { from { background: #DCEAFE; } to { background: transparent; } }
.presence { font-size: 12px; color: var(--ink-3); }
.sumbar { display: flex; gap: 24px; flex-wrap: wrap; align-items: baseline; padding: 10px 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.sumbar .v { font-size: 18px; font-weight: 700; direction: ltr; display: inline-block; }
.stages { display: flex; gap: 0; margin: 0 0 12px; padding: 0; list-style: none; flex-wrap: wrap; }
.stages li { padding: 6px 14px; background: #fff; border: 1px solid var(--line); margin-inline-end: -1px; font-size: 12.5px; color: var(--ink-3); }
.stages li.done { color: var(--green); }
.stages li.now { background: var(--cobalt); border-color: var(--cobalt); color: #fff; font-weight: 600; }
.stages li.lost { background: var(--red-soft); color: var(--red); }

dialog { border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(520px, 92vw); }
dialog::backdrop { background: rgba(15,34,64,.4); }
dialog form { padding: 18px; display: grid; gap: 12px; }

/* ---------- self service (mobile first) ---------- */
.me { max-width: 560px; margin: 0 auto; }
.clock { background: var(--navy); color: #fff; border-radius: 12px; padding: 20px; text-align: center; }
.clock .time { font-size: 38px; font-weight: 700; direction: ltr; }
.clock .btn { height: 46px; font-size: 16px; width: 100%; margin-top: 12px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.tile .v { font-size: 20px; font-weight: 700; }
.tile .l { font-size: 12px; color: var(--ink-3); }

/* ---------- print ---------- */
.print-page { background: #fff; max-width: 210mm; margin: 0 auto; padding: 14mm; min-height: 297mm; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid var(--cobalt); padding-bottom: 10px; margin-bottom: 14px; }
.print-head img { max-height: 54px; }
.print-title { font-size: 20px; font-weight: 700; color: var(--cobalt); }
.sign-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 48px; text-align: center; }
.sign-row div { border-top: 1px solid var(--ink-3); padding-top: 6px; color: var(--ink-2); }
.print-only { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only { display: flex !important; }
  .side, .topbar, .menu-btn { display: none !important; }
  .shell { display: block !important; }
  .table-wrap { max-height: none !important; overflow: visible !important; }
  body { background: #fff; }
  .print-page { padding: 0; min-height: 0; }
  table.t th { background: #EEF2F8 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; z-index: 60; transform: translateX(100%); transition: transform .2s; }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(15,34,64,.4); z-index: 55; }
  .menu-btn { display: inline-flex; }
  .content { padding: 14px 12px 40px; }
  .topbar { padding: 8px 12px; }
  .topbar select { min-width: 0; max-width: 150px; }
  .grid, .grid-2, .dl { grid-template-columns: 1fr; }
  .grid .c2, .grid .c3 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth .art { display: none; }
  .user-chip .uname { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
table.sheet td.ro-auto .cell { color: var(--ink-3); }
/* mixed Arabic / English text: let each cell pick its own direction */
table.t td, table.lines td, table.sheet td .cell, .dl dd, h1 { unicode-bidi: plaintext; text-align: start; }
table.t td.num, .dl dd.num, table.sheet td.n .cell { unicode-bidi: normal; text-align: left; }
.sumbar input, .sumbar select { width: auto; }

/* ---------- pricing workbook (Excel-like grid) ---------- */
body.focus-mode .shell { grid-template-columns: minmax(0, 1fr); }
body.focus-mode .side { display: none; }
body.focus-mode .content { max-width: none; }
.content:has(.wb) { max-width: none; padding-top: 12px; }
.wb-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 22px; margin-bottom: 8px; }
.wb-head .titles { min-width: 260px; flex: 1 1 340px; }
.wb-head h1 { font-size: 18px; }
.wb-head .stages { margin: 0; }
.wb-totals { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.wb-totals b { font-size: 19px; direction: ltr; display: inline-block; margin-inline-start: 6px; }
.wb-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.people { display: flex; align-items: center; gap: 4px; }
.person { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; }
.sync { font-size: 12px; color: var(--ink-3); padding: 2px 8px; border-radius: 10px; background: #EEF2F8; }
.sync.ok { color: var(--green); background: var(--green-soft); }
.sync.busy { color: #8a6100; background: var(--amber-soft); }
.sync.err { color: var(--red); background: var(--red-soft); }

.wb { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.sg-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); background: #F7F9FC; direction: ltr; }
.sg-toolbar button, .sg-toolbar select { height: 28px; min-width: 28px; padding: 0 7px; border: 1px solid transparent; background: transparent; border-radius: 4px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; width: auto; }
.sg-toolbar button:hover, .sg-toolbar select:hover { background: #fff; border-color: var(--line); }
.sg-toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.sg-toolbar .clr { position: relative; display: inline-grid; place-items: center; width: 30px; height: 28px; cursor: pointer; border-radius: 4px; font-weight: 700; }
.sg-toolbar .clr:hover { background: #fff; }
.sg-toolbar .clr span { width: 16px; height: 16px; border: 1px solid #999; display: block; }
.sg-toolbar .clr.txt { color: #c00000; text-decoration: underline; }
.sg-toolbar .clr input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.sg-formula { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); direction: ltr; }
.sg-formula .sg-name { width: 110px; border: 0; border-inline-end: 1px solid var(--line); padding: 4px 8px; font: 13px/1.4 ui-monospace, Consolas, monospace; text-align: center; border-radius: 0; }
.sg-formula .fx { padding: 4px 10px; color: var(--ink-3); font-style: italic; border-inline-end: 1px solid var(--line-soft); }
.sg-formula .sg-bar { flex: 1; border: 0; padding: 4px 8px; font-size: 13px; border-radius: 0; unicode-bidi: plaintext; text-align: start; }
.sg-formula input:focus { outline: none; background: #FFFBEA; }
.sg-scroll { position: relative; overflow: auto; height: 520px; background: #fff; font-family: Calibri, "Segoe UI", "IBM Plex Sans Arabic", Tahoma, sans-serif; font-size: 13px; outline: none; }
.sg-inner { position: relative; }
.sg-top { position: sticky; top: 0; z-index: 5; display: flex; }
.sg-corner { position: sticky; inset-inline-start: 0; z-index: 6; background: #fff; flex: none; }
.sg-tophead { position: relative; flex: none; background: #fff; box-shadow: 0 2px 0 #C9D1DC; }
.sg-body { display: flex; }
.sg-left { position: sticky; inset-inline-start: 0; z-index: 4; background: #fff; flex: none; }
.sg-main { position: relative; flex: none; }
.sg-cells { position: absolute; inset: 0; }
.sg-all { position: absolute; top: 0; inset-inline-start: 0; background: #EEF1F5; border-inline-end: 1px solid #C9D1DC; border-bottom: 1px solid #C9D1DC; cursor: pointer; }
.sh, .rh { position: absolute; background: #EEF1F5; color: #4A5668; font-size: 11.5px; display: flex; align-items: center; justify-content: center; user-select: none; cursor: default; box-sizing: border-box; }
.sh { top: 0; height: 22px; border-inline-end: 1px solid #C9D1DC; border-bottom: 1px solid #C9D1DC; }
.rh { inset-inline-start: 0; width: 48px; border-inline-end: 1px solid #C9D1DC; border-bottom: 1px solid #DCE2EA; }
.sh.on, .rh.on { background: #D5E1F5; color: var(--cobalt-dark); font-weight: 600; }
.sh .rz { position: absolute; inset-inline-end: -3px; top: 0; width: 7px; height: 100%; cursor: col-resize; z-index: 2; }
.sc { position: absolute; box-sizing: border-box; border-inline-end: 1px solid #E3E7EE; border-bottom: 1px solid #E3E7EE; padding: 0 4px; display: flex; align-items: flex-end; overflow: hidden; white-space: nowrap; line-height: 1.25; color: #111; background-clip: padding-box; text-align: start; }
.sc > span { overflow: hidden; text-overflow: clip; unicode-bidi: plaintext; text-align: inherit; width: 100%; }
.sc.n { justify-content: flex-end; text-align: right; }
.sc.n > span { direction: ltr; unicode-bidi: normal; }
.sc.bo { justify-content: center; text-align: center; }
.sc.er { color: var(--red); justify-content: center; text-align: center; }
.sc.wr { white-space: pre-wrap; word-break: break-word; align-items: flex-start; }
.sc.wr > span { overflow: hidden; }
.sc.bd { border: 1px solid #444; }
.sc.mg { background-color: #fff; z-index: 1; }
.sc.spl { overflow: visible; z-index: 1; }
.sc.spl > .sp { white-space: nowrap; flex: none; overflow: hidden; unicode-bidi: plaintext; text-align: inherit; }
.sc.in-sel { box-shadow: inset 0 0 0 9999px rgba(30, 91, 198, .10); }
.sc.act { outline: 2px solid var(--cobalt); outline-offset: -2px; z-index: 3; }
.sc.remote { animation: sg-flash 2.4s ease-out; }
@keyframes sg-flash { 0% { box-shadow: inset 0 0 0 9999px rgba(217, 154, 11, .45); } 100% { box-shadow: inset 0 0 0 9999px rgba(217, 154, 11, 0); } }
.pres { position: absolute; box-sizing: border-box; border: 2px solid; pointer-events: none; z-index: 4; }
.pres b { position: absolute; top: -15px; inset-inline-start: -2px; font-size: 10px; line-height: 13px; color: #fff; padding: 0 4px; border-radius: 3px 3px 3px 0; white-space: nowrap; font-weight: 600; }
.sg-editor { position: absolute; z-index: 8; box-sizing: border-box; border: 2px solid var(--cobalt); padding: 1px 3px; font: inherit; font-size: 13px; line-height: 1.25; resize: none; overflow: hidden; background: #fff; box-shadow: 0 4px 14px rgba(15, 34, 64, .18); white-space: pre-wrap; unicode-bidi: plaintext; text-align: start; border-radius: 0; }
.sg-kb { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; resize: none; border: 0; padding: 0; }
.sg-tabs { display: flex; gap: 2px; padding: 4px 6px 0; border-top: 1px solid var(--line); background: #F2F4F8; overflow-x: auto; direction: ltr; }
.sg-tabs .tab { border: 1px solid var(--line); border-bottom: 0; background: #E8ECF2; padding: 5px 14px; font: inherit; font-size: 12.5px; border-radius: 6px 6px 0 0; cursor: pointer; white-space: nowrap; color: var(--ink-2); }
.sg-tabs .tab.on { background: #fff; color: var(--cobalt-dark); font-weight: 600; box-shadow: inset 0 2px 0 var(--cobalt); }
.sg-tabs .tab.add { font-weight: 700; padding: 5px 10px; }
.sg-status { display: flex; justify-content: space-between; gap: 12px; padding: 3px 10px; font-size: 12px; border-top: 1px solid var(--line-soft); background: #fff; direction: rtl; }
.sg-status .st-sel { direction: rtl; font-weight: 600; color: var(--ink-2); white-space: pre; }
.sg-status .st-help { font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sg-menu { display: none; position: fixed; z-index: 50; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 30px rgba(15, 34, 64, .18); padding: 4px; min-width: 220px; }
.sg-menu button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 6px 10px; font: inherit; font-size: 13px; border-radius: 4px; cursor: pointer; }
.sg-menu button:hover { background: var(--cobalt-soft); }
.sg-menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 3px 0; }
.sg-toast { position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 6px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 30; max-width: 80%; }
.sg-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.sg-toast.warn { background: #8a5a00; }
.sg-toast.err { background: var(--red); }
@media (max-width: 760px) {
  .sg-status .st-help { display: none; }
  .wb-totals b { font-size: 16px; }
}
/* sheet: Excel features */
.sc.bd2 { border: 2px solid #000; }
.sc.bdb { border-bottom: 1px solid #333; }
.sc.nt::after { content: ""; position: absolute; top: 0; inset-inline-end: 0; width: 7px; height: 7px; background: #D9480F; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.sg-scroll[dir=rtl] .sc.nt::after { clip-path: polygon(0 0, 100% 0, 0 100%); }
.fbtn { position: absolute; width: 16px; height: 16px; font: 400 10px/15px sans-serif; text-align: center; background: #fff; border: 1px solid #9AA5B5; border-radius: 3px; cursor: pointer; color: #334155; z-index: 5; box-sizing: border-box; }
.fbtn.on { background: var(--cobalt); color: #fff; border-color: var(--cobalt); }
.sg-selbox { position: absolute; box-sizing: border-box; border: 2px solid var(--cobalt); pointer-events: none; z-index: 3; }
.sg-fill { position: absolute; width: 9px; height: 9px; background: var(--cobalt); border: 1.5px solid #fff; cursor: crosshair; z-index: 7; box-sizing: border-box; }
.sg-fillbox { position: absolute; box-sizing: border-box; border: 2px dashed #5B6B80; pointer-events: none; z-index: 4; }
.sg-clipbox { position: absolute; box-sizing: border-box; border: 2px dashed var(--cobalt); pointer-events: none; z-index: 4; animation: sg-ants 1s linear infinite; }
@keyframes sg-ants { 50% { border-color: #9DB7E8; } }
.sg-refbox { position: absolute; box-sizing: border-box; border: 2px solid; pointer-events: none; z-index: 4; }
.rh .rzr { position: absolute; left: 0; right: 0; bottom: -3px; height: 7px; cursor: row-resize; z-index: 2; }
.sh.hid-b { border-inline-start: 3px double #7F8A9B; }
.rh.hid-b { border-top: 3px double #7F8A9B; }
.wb.painting .sg-scroll, .wb.painting .sc { cursor: copy; }
.wb.painting [data-fmt=painter] { background: var(--cobalt-soft); border-color: var(--cobalt); }
.sg-find { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 5px 8px; border-bottom: 1px solid var(--line); background: #FFFBEA; font-size: 13px; }
.sg-find[hidden] { display: none; }
.sg-find .f-q, .sg-find .f-r { width: 190px; height: 28px; padding: 2px 8px; }
.sg-find:not(.rep) .f-r, .sg-find:not(.rep) .f-rep { display: none; }
.sg-find label { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.sg-find button { height: 28px; min-width: 28px; padding: 0 8px; border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer; font: inherit; width: auto; }
.sg-ac { position: fixed; z-index: 60; display: none; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 30px rgba(15, 34, 64, .18); min-width: 170px; max-height: 260px; overflow: auto; font: 12.5px/1.5 ui-monospace, Consolas, monospace; direction: ltr; padding: 3px; }
.sg-ac div { padding: 2px 8px; border-radius: 4px; cursor: pointer; }
.sg-ac div.on, .sg-ac div:hover { background: var(--cobalt-soft); color: var(--cobalt-dark); }
.sg-ac small { display: block; color: var(--ink-3); padding: 3px 8px 1px; border-top: 1px solid var(--line-soft); margin-top: 2px; direction: rtl; font-family: inherit; }
.sg-fpop { position: fixed; z-index: 55; display: none; width: 260px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(15, 34, 64, .2); padding: 8px; font-size: 13px; }
.sg-fpop .fp-acts { display: flex; gap: 4px; margin-bottom: 6px; }
.sg-fpop .fp-acts button, .sg-fpop .fp-foot button { flex: 1; height: 28px; border: 1px solid var(--line); background: #fff; border-radius: 4px; cursor: pointer; font: inherit; font-size: 12.5px; }
.sg-fpop .fp-foot button.btn-primary { background: var(--cobalt); color: #fff; border-color: var(--cobalt); }
.sg-fpop .fp-q { width: 100%; height: 28px; padding: 2px 8px; margin-bottom: 4px; box-sizing: border-box; }
.sg-fpop .fp-list { max-height: 240px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 4px; padding: 3px; margin: 4px 0 8px; }
.sg-fpop .fp-list label, .sg-fpop .fp-all { display: flex; gap: 6px; align-items: center; padding: 2px 4px; white-space: nowrap; overflow: hidden; }
.sg-fpop .fp-list label span { overflow: hidden; text-overflow: ellipsis; }
.sg-fpop .fp-list small { color: var(--ink-3); margin-inline-start: auto; }
.sg-fpop .fp-foot { display: flex; gap: 6px; }
.sg-menu { max-height: 90vh; overflow: visible; }
.sg-menu button { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 5px 10px; }
.sg-menu .k { color: var(--ink-3); font-size: 11px; direction: ltr; }
.sg-menu .sub { position: relative; }
.sg-menu .kids { display: none; position: absolute; top: -5px; inset-inline-start: 100%; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 30px rgba(15, 34, 64, .18); padding: 4px; min-width: 230px; }
.sg-menu .sub:hover > .kids, .sg-menu .sub:focus-within > .kids { display: block; }
.sg-menu.flip .kids { inset-inline-start: auto; inset-inline-end: 100%; }
/* mapping screen */
.map-costs { border-top: 1px solid var(--line-soft); padding: 8px 12px; }
.map-costs summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--cobalt-dark); }
.map-costs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 12px; margin: 10px 0 6px; }
.map-costs-grid label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.map-costs-grid label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; text-align: start; unicode-bidi: plaintext; }
.map-sheet { border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 12px; }
.map-sheet > header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.map-sheet .cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 12px; padding: 12px 14px; }
.map-sheet .cols label span { display: block; font-size: 12px; color: var(--ink-3); }
.map-sheet.off .cols { display: none; }

/* BOQ section headings: keep long specification text inside the item columns, clamp to 3 lines */
table.t tr.heading .heading-text { white-space: normal; max-width: 640px; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }


/* ---------- English (left-to-right) pages: mirror the physical alignments above ---------- */
[dir="ltr"] .num, [dir="ltr"] td.num, [dir="ltr"] th.num, [dir="ltr"] input[type=number], [dir="ltr"] .ltr,
[dir="ltr"] .totals-box .v, [dir="ltr"] table.lines td.ro, [dir="ltr"] table.sheet td.n .cell,
[dir="ltr"] table.t td.num, [dir="ltr"] .dl dd.num { text-align: right; }
[dir="ltr"] .kpi .value { text-align: left; }
[dir="ltr"] .nav summary .chev { transform: scaleX(-1); }
[dir="ltr"] .nav details[open] summary .chev { transform: scaleX(-1) rotate(-90deg); }
.steps-list { margin: 0 0 10px; padding-inline-start: 22px; line-height: 2; }

/* ---------- sections: sidebar, section page, tab bar, reports center ---------- */
.hidden { display: none !important; }
.nav a.item.sec { display: flex; align-items: center; gap: 8px; padding-inline-start: 26px; }
.nav a.item.sec .ico { width: 15px; height: 15px; opacity: .75; }
.sec-tabs { display: flex; gap: 4px; align-items: center; overflow-x: auto; margin: -4px 0 16px; padding: 4px;
  background: var(--paper, #fff); border: 1px solid var(--line); border-radius: 10px; scrollbar-width: thin; }
.sec-tabs a { white-space: nowrap; padding: 6px 12px; border-radius: 7px; color: var(--ink-2); font-size: 13.5px; }
.sec-tabs a:hover { background: #EEF2F8; text-decoration: none; color: var(--ink); }
.sec-tabs a.on { background: var(--cobalt); color: #fff; }
.sec-tabs .sec-home { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink);
  border-inline-end: 1px solid var(--line); border-radius: 7px 0 0 7px; margin-inline-end: 4px; }
.sec-tabs .sec-home .ico { width: 16px; height: 16px; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sec-card { position: relative; background: var(--paper, #fff); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s; }
.sec-card:hover { border-color: var(--cobalt); box-shadow: 0 2px 10px rgba(30, 91, 198, .08); }
.sec-main { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ico title" "ico num" "ico sub";
  column-gap: 12px; padding: 16px; color: var(--ink); min-height: 96px; }
.sec-main:hover { text-decoration: none; }
.sec-ico { grid-area: ico; width: 40px; height: 40px; border-radius: 10px; background: #EEF2F8; color: var(--cobalt);
  display: grid; place-items: center; }
.sec-card.report .sec-ico { background: #EAF6EF; color: #1F8A4C; }
.sec-card.tool .sec-ico { background: #F4F1EA; color: #8A6A1F; }
.sec-title { grid-area: title; font-weight: 600; font-size: 14.5px; }
.sec-num { grid-area: num; font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.sec-sub { grid-area: sub; color: var(--ink-2); font-size: 12.5px; }
.sec-new { position: absolute; inset-block-start: 12px; inset-inline-end: 12px; }
.rep-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; align-items: start; }
.rep-group .panel-head h2 { display: flex; align-items: center; gap: 8px; }
.rep-list { display: grid; }
.rep-item { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line);
  color: var(--ink); align-items: start; }
.rep-item:hover { background: #F6F8FC; text-decoration: none; }
.rep-ico { width: 32px; height: 32px; border-radius: 8px; background: #EAF6EF; color: #1F8A4C; display: grid; place-items: center; }
.rep-title { display: block; font-weight: 600; }
.rep-desc { display: block; color: var(--ink-2); font-size: 12.5px; margin-top: 2px; }
@media (max-width: 860px) { .rep-groups { grid-template-columns: 1fr; } .sec-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .sec-grid { grid-template-columns: 1fr; } }
.rep-groups .panel { margin: 0; }

/* =====================================================================
   Theme of the previous Arbec system (same colours, sidebar, top bar,
   module header, tabs) so the team keeps the layout it is used to.
   ===================================================================== */
:root {
  --cobalt: #3478F6; --cobalt-dark: #2563D9; --cobalt-soft: #EAF2FF;
  --navy: #17243B; --navy-2: #111C2F;
  --paper: #F5F7FB; --surface: #FFFFFF; --line: #E8EDF3; --line-soft: #EEF2F7;
  --ink: #16233B; --ink-2: #566074; --ink-3: #7E899D;
  --green: #15A876; --green-soft: #E7F8F2; --red: #ED5B61; --red-soft: #FFEFF0; --amber: #ED9E3F; --amber-soft: #FFF3DF;
  --violet: #7857DF;
  --radius: 9px;
  --font: "Segoe UI", Tahoma, "IBM Plex Sans Arabic", Arial, sans-serif;
}
body { background: var(--paper); }
.shell { grid-template-columns: 255px 1fr; }
.side {
  background: linear-gradient(180deg, #17243B 0%, #111C2F 100%); background-size: auto; color: #fff;
  display: flex; flex-direction: column; padding: 22px 16px 16px; overflow: hidden;
}
.side .brand { flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; height: 82px; padding: 0 12px;
  margin-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.side .brand img { width: 164px; max-width: 164px; height: auto; max-height: 46px; object-fit: contain; object-position: right center;
  background: #fff; border-radius: 8px; padding: 5px 8px; filter: drop-shadow(0 3px 12px rgba(0,0,0,.27)); }
[dir="ltr"] .side .brand img { object-position: left center; }
.side .brand small { color: #AAB5C7; font-size: 11px; }
.side .nav { display: grid; gap: 5px; padding: 0 0 0 4px; overflow-y: auto; min-height: 0; scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.27) transparent; }
.side .nav a { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 10px; color: #B9C2D1;
  font-size: 14.5px; transition: background .2s, color .2s; }
.side .nav a .ico { width: 19px; height: 19px; }
.side .nav a:hover, .side .nav a.active { background: var(--cobalt); color: #fff; text-decoration: none; }
.side-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 16px 7px 2px; color: #fff;
  border-top: 1px solid rgba(255,255,255,.07); }
.side-foot:hover { text-decoration: none; }
.side-foot .who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.side-foot b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot small { color: #AAB5C7; font-size: 11px; }
.side-foot > .ico { color: #AAB5C7; }
.avatar { width: 36px; height: 36px; border-radius: 10px; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, #4988FF, #735BE6); display: grid; place-items: center; flex: none; }

.topbar { height: 88px; padding: 0 32px; gap: 16px; justify-content: space-between; border-bottom: 1px solid var(--line); }
.page-heading { display: flex; flex-direction: column; }
.page-heading span { color: var(--ink-3); font-size: 11.5px; }
.page-heading h1 { margin: 4px 0; font-size: 20px; font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.top-actions select { min-width: 170px; }
.tb-btn { position: relative; width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 10px; background: #fff;
  display: grid; place-items: center; color: var(--ink); }
.tb-btn .ico { width: 19px; height: 19px; }
.tb-btn.bell i { position: absolute; top: -4px; inset-inline-start: -4px; background: var(--red); color: #fff; border-radius: 9px;
  min-width: 18px; height: 18px; padding: 0 4px; font: 10px/18px Arial, sans-serif; font-style: normal; text-align: center; }
.top-user { position: relative; }
.top-user summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; color: var(--ink); }
.top-user summary::-webkit-details-marker { display: none; }
.top-user .who { display: flex; flex-direction: column; }
.top-user .who b { font-size: 12.5px; }
.top-user .who small { color: var(--ink-3); font-size: 11px; }
.top-user summary > .ico { transform: rotate(90deg); color: var(--ink-3); }
.user-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 230px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(22,35,59,.12); padding: 6px; z-index: 40; }
.user-menu a, .user-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px;
  color: var(--ink); font: inherit; background: none; border: 0; cursor: pointer; text-align: start; }
.user-menu a:hover, .user-menu button:hover { background: var(--paper); text-decoration: none; }
.user-menu form { margin: 0; }

.content { max-width: 1600px; margin: 0 auto; padding: 28px 32px 50px; }
.module-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.module-head small { color: var(--ink-3); }
.module-head h2 { margin: 4px 0 0; font-size: 23px; font-weight: 700; }
.module-actions { display: flex; gap: 10px; }
.mod-pills { display: flex; gap: 6px; padding: 6px; margin-bottom: 16px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; overflow-x: auto; }
.mod-pills a { white-space: nowrap; padding: 10px 15px; border-radius: 8px; color: var(--ink-3); }
.mod-pills a:hover { color: var(--ink); text-decoration: none; background: var(--paper); }
.mod-pills a.on { color: var(--cobalt); background: var(--cobalt-soft); font-weight: 600; }
.workflow-strip { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; padding: 13px 18px;
  background: var(--navy); border-radius: 12px; color: #fff; font-size: 12.5px; white-space: nowrap; overflow-x: auto; }
.workflow-strip a { color: #fff; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09); border-radius: 7px; padding: 7px 11px; }
.workflow-strip a:hover, .workflow-strip a.on { background: var(--cobalt); border-color: var(--cobalt); text-decoration: none; }
.workflow-strip i { color: #72A1FF; font-style: normal; }
[dir="ltr"] .workflow-strip i { transform: scaleX(-1); display: inline-block; }
.doc-tabs { display: flex; gap: 5px; margin-bottom: 16px; border-bottom: 1px solid #DFE5ED; overflow-x: auto; }
.doc-tabs a { white-space: nowrap; padding: 12px 15px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.doc-tabs a:hover { color: var(--ink); text-decoration: none; }
.doc-tabs a.on { color: var(--cobalt); border-bottom-color: var(--cobalt); font-weight: 600; }
.doc-tabs em { font-style: normal; font-size: 11px; background: #EEF2F7; color: var(--ink-3); border-radius: 10px; padding: 1px 7px;
  margin-inline-start: 7px; }
.doc-tabs a.on em { background: var(--cobalt-soft); color: var(--cobalt); }
.mod-group { margin-bottom: 22px; }
.mod-group-head { display: flex; align-items: baseline; gap: 10px; margin: 6px 2px 10px; }
.mod-group-head h3 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; }
.mod-group-head small { color: var(--ink-3); }

.page-head { align-items: center; }
.page-head h1 { font-size: 18px; }
.panel { border-color: var(--line); border-radius: 13px; }
.panel-head { border-bottom-color: var(--line); padding: 14px 18px; }
.btn { height: 38px; border-radius: 9px; border-color: #E1E7EF; color: #536078; }
.btn-sm { height: 30px; border-radius: 7px; }
.btn-primary { background: var(--cobalt); border-color: var(--cobalt); color: #fff; box-shadow: 0 5px 15px rgba(52,120,246,.16); }
.btn-primary:hover { background: var(--cobalt-dark); border-color: var(--cobalt-dark); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search],
input[type=time], input[type=month], input:not([type]), select { height: 38px; border-radius: 9px; border-color: var(--line); }
textarea { border-radius: 9px; border-color: var(--line); }
table.t thead th { background: #F9FAFC; color: #8791A2; font-size: 12px; font-weight: 600; padding: 12px 16px; border-bottom-color: var(--line); }
table.t td { color: #566074; padding: 12px 16px; border-bottom-color: var(--line); }
table.t td a { color: var(--cobalt); }
.kpis { gap: 12px; background: none; border: 0; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 18px 20px; border-inline-start: 1px solid var(--line); }
.kpi .label { color: var(--ink-3); font-size: 12px; }
.kpi .value { font-size: 22px; }
.sec-card { border-radius: 13px; border-color: var(--line); }
.sec-ico { background: var(--cobalt-soft); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; height: 100vh; z-index: 60; }
  .topbar { height: 64px; padding: 0 12px; }
  .top-user .who { display: none; }
  .top-actions select { min-width: 0; max-width: 130px; }
  .content { padding: 16px 12px 40px; }
  .module-head h2 { font-size: 19px; }
}
.menu-btn { width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
  align-items: center; justify-content: center; cursor: pointer; }
.sec-card .sec-title { padding-inline-end: 78px; }
.module-head ~ .page-head .crumbs, .doc-tabs ~ .page-head .crumbs { display: none; }

/* ---------- inner screens in the old-site style (lists, document sheet, record view, module overview) ---------- */
.screen-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 12px; }
.screen-head small, .record-title small, .doc-sheet-head small, .items-title small, .info-head small {
  display: block; color: var(--ink-3); font-size: 11px; margin-bottom: 3px; }
.screen-head h2, .record-title h2, .doc-sheet-head h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.screen-head h2 span, .record-title h2 span, .doc-sheet-head h2 span { color: var(--cobalt); background: #EAF2FF; border-radius: 20px;
  padding: 4px 10px; font-size: 12px; font-weight: 600; direction: ltr; }
.record-title h2 em { font-style: normal; font-size: 15px; font-weight: 500; color: #566074; }
.screen-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; }
.search span { color: var(--ink-3); }
.search input[type=search] { border: 0; height: 38px; width: 220px; padding: 0; background: transparent; box-shadow: none; outline: 0; }
.summary-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.summary-chips > * { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 13px; font-size: 12px; color: var(--ink-3); }
.summary-chips b { color: var(--ink); margin-inline-end: 4px; }
.summary-chips a:hover { text-decoration: none; border-color: var(--cobalt); }
.summary-chips a.on { border-color: var(--cobalt); background: #EAF2FF; color: var(--cobalt); }
.summary-chips .st-pending b, .summary-chips .st-draft b { color: #B46C12; }
.summary-chips .st-posted b { color: #078B61; }
.summary-chips .st-cancelled b, .summary-chips .st-rejected b { color: var(--red); }
.table-panel { padding: 0; overflow: hidden; }
.doc-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.doc-toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-toolbar select { height: 36px; max-width: 210px; }
table.list-t tbody tr:hover { background: #FAFCFF; }
table.list-t .cell-title { font-weight: 600; color: var(--ink); }
table.list-t .cell-title:hover { color: var(--cobalt); }
.cell-subtitle { display: block; color: #8A94A5; font-size: 10.5px; margin-top: 3px; white-space: nowrap; }
.row-act-h { width: 1%; }
.row-acts { white-space: nowrap; }
.row-acts a { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 29px; border: 1px solid #DFE6EF;
  border-radius: 7px; color: #536078 !important; background: #fff; margin-inline-end: 4px; font-size: 13px; }
.row-acts a:hover { border-color: var(--cobalt); color: var(--cobalt) !important; text-decoration: none; }
.row-acts .ico { width: 14px; height: 14px; }
.table-panel .pager { border-top: 1px solid var(--line); }
.badge { border-radius: 20px; padding: 4px 10px; font-size: 11px; font-weight: 600; }
.badge-green { color: #078B61; background: #E8F8F2; }
.badge-amber { color: #B46C12; background: #FFF3DF; }

/* document sheet (new / edit) — the old document modal laid out as a page */
.doc-sheet { background: #F7F9FC; border: 1px solid #E2E7EE; border-radius: 16px; overflow: hidden; max-width: 1180px; margin: 0 auto;
  box-shadow: 0 10px 30px rgba(23, 36, 59, .06); }
.doc-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; padding: 20px 24px;
  border-bottom: 1px solid var(--line); }
.doc-close { width: 34px; height: 34px; border-radius: 9px; background: #F0F3F7; color: var(--ink-3); display: grid; place-items: center;
  font-size: 20px; line-height: 1; }
.doc-close:hover { background: #E4E9F0; color: var(--ink); text-decoration: none; }
.doc-form-grid { padding: 18px 24px; gap: 12px 14px; }
.doc-form-grid .field > span:first-child { color: #526078; font-size: 11px; font-weight: 600; }
.doc-form-grid input, .doc-form-grid select, .doc-form-grid textarea { background: #fff; border-color: #DFE5ED; border-radius: 7px; }
.doc-form-grid input:focus, .doc-form-grid select:focus, .doc-form-grid textarea:focus { border-color: var(--cobalt); }
.items-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 24px 10px; }
.items-title h3 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.items-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.btn-add { color: var(--cobalt); border-color: #CFE0FD; background: #F3F8FF; }
.items-table { background: #fff; border: 1px solid #E2E7EE; border-radius: 10px; margin: 0 24px; overflow: auto; }
.items-table table.lines th { background: #F9FAFC; color: #8791A2; padding: 10px 9px; }
.items-table table.lines td { padding: 7px 6px; border-bottom-color: #EEF1F5; }
.items-table table.lines input, .items-table table.lines select { border-color: #DFE5ED; border-radius: 7px; }
.doc-lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 380px); gap: 16px; padding: 16px 24px 20px; }
.totals-card { background: #fff; border: 1px solid #E2E7EE; border-radius: 10px; padding: 0; display: grid;
  grid-template-columns: 1fr 150px; gap: 0; justify-content: stretch; overflow: hidden; }
.totals-card:empty { display: none; }
.totals-card .k, .totals-card .v { padding: 9px 14px; border-bottom: 1px solid #EEF1F5; }
.totals-card .k { color: #566074; font-size: 13px; }
.totals-card .grand { background: #EAF2FF; color: var(--cobalt) !important; font-weight: 700; font-size: 15px; border-bottom: 0; }
.doc-note { padding: 0 24px 16px; }
.doc-sheet-foot { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 8px; background: #fff;
  border-top: 1px solid var(--line); padding: 14px 24px; z-index: 5; }
.doc-sheet-foot .btn { border-radius: 8px; padding-inline: 18px; }
.btn-outline { color: var(--cobalt); border-color: var(--cobalt); background: #fff; }

/* record view */
.record-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 4px 0 14px;
  background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 16px 20px; }
.record-title { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.record-title .back { width: 34px; height: 34px; border-radius: 9px; background: #F0F3F7; color: var(--ink-3); display: grid;
  place-items: center; font-size: 17px; flex: none; }
.record-title .back:hover { background: #E4E9F0; text-decoration: none; }
.record-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.info-head { padding: 14px 18px 4px; }
.info-head h3 { margin: 0; font-size: 15px; }
.info-panel .dl > div { padding: 11px 18px; border-bottom-color: #EEF1F5; }
.info-panel .dl dt { font-size: 11px; color: #8791A2; font-weight: 600; }
.info-panel .dl dd { color: var(--ink); }
.items-panel .items-title { padding: 14px 18px 10px; }
.items-panel .doc-lower { padding: 14px 18px 18px; }

/* module overview */
.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 13px;
  padding: 18px; color: var(--ink); }
.stat:hover { text-decoration: none; border-color: var(--cobalt); }
.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.stat-icon .ico { width: 20px; height: 20px; }
.stat-icon.c1 { background: #EAF2FF; color: #3478F6; }
.stat-icon.c2 { background: #E8F8F2; color: #078B61; }
.stat-icon.c3 { background: #F1EDFF; color: #6D4AE0; }
.stat-icon.c4 { background: #FFF3DF; color: #B46C12; }
.stat-txt { display: flex; flex-direction: column; min-width: 0; }
.stat-txt small { color: var(--ink-3); font-size: 11.5px; }
.stat-txt b { font-size: 22px; line-height: 1.3; }
.stat-txt em { font-style: normal; color: #8791A2; font-size: 10.5px; }
.recent-panel { margin-bottom: 20px; }
.recent-panel .items-title { padding: 14px 18px 10px; }

@media (max-width: 860px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .doc-lower { grid-template-columns: 1fr; }
  .doc-lower > div:first-child:empty { display: none; }
  .search input[type=search] { width: 150px; }
  .doc-form-grid, .items-title, .doc-sheet-head, .doc-sheet-foot { padding-inline: 14px; }
  .items-table { margin: 0 14px; }
  .doc-lower { padding-inline: 14px; }
}
@media print { .doc-sheet-foot, .record-head .actions, .row-acts, .row-act-h, .doc-toolbar, .screen-actions { display: none !important; } }
.doc-toolbar .filters select { width: auto; min-width: 150px; }
table.list-t td { white-space: nowrap; }
.btn-success, .btn-success:hover { background: #078B61; border-color: #078B61; color: #fff; }
.btn-danger { color: #D33C3C; border-color: #F3C9C9; background: #fff; }
.btn-amber { background: #FFF3DF; border-color: #F2D7A6; color: #B46C12; }
.row-acts a { vertical-align: middle; }

/* ---------- search everywhere, export menu, import ---------- */
.search button:not(.btn), .top-search button { border: 0; background: none; padding: 0 2px; color: var(--ink-3); cursor: pointer; display: grid;
  place-items: center; height: 36px; }
.search button:not(.btn):hover, .top-search button:hover { color: var(--cobalt); }
.search .ico, .top-search .ico { width: 16px; height: 16px; }
.top-search { display: flex; align-items: center; gap: 6px; background: #F5F7FB; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 10px; margin-inline-start: auto; margin-inline-end: 14px; width: min(340px, 34vw); }
.top-search input[type=search] { border: 0; background: transparent; height: 40px; flex: 1; min-width: 0; padding: 0; box-shadow: none; outline: 0; }
.top-search:focus-within { border-color: var(--cobalt); background: #fff; }
.search-lg { flex: 1; max-width: 720px; }
.search-lg input[type=search] { flex: 1; width: auto; }
.search-lg select { border: 0; border-inline-start: 1px solid var(--line); border-radius: 0; height: 38px; max-width: 170px; }
.search-lg .btn { height: 32px; margin-inline-start: 4px; }
.search-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.search-groups .items-title { padding: 14px 18px 10px; }
.module-actions { display: flex; gap: 10px; align-items: center; }
.toolbar-btns { display: flex; gap: 8px; align-items: center; }
.menu-pop { position: relative; }
.menu-pop > summary { list-style: none; cursor: pointer; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.menu-pop .caret { font-size: 11px; color: var(--ink-3); }
.menu-pop .menu-list { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 40; min-width: 190px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(23, 36, 59, .14); padding: 6px; display: grid; }
.menu-pop .menu-list a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--ink); font-size: 13px; }
.menu-pop .menu-list a:hover { background: #F3F7FF; text-decoration: none; }
.fx { font-size: 9.5px; font-weight: 700; border-radius: 5px; padding: 3px 5px; min-width: 32px; text-align: center; color: #fff; }
.fx.x { background: #1D7A46; } .fx.p { background: #D33C3C; } .fx.w { background: #2B5DB8; } .fx.c { background: #6B7586; }
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; }
.import-box { padding: 18px; display: grid; gap: 14px; align-content: start; }
.drop { display: grid; justify-items: center; gap: 6px; text-align: center; border: 2px dashed #CFE0FD; background: #F7FAFF;
  border-radius: 12px; padding: 30px 16px; cursor: pointer; position: relative; }
.drop:hover, .drop:focus-within { border-color: var(--cobalt); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-ico { width: 46px; height: 46px; border-radius: 12px; background: #EAF2FF; color: var(--cobalt); display: grid; place-items: center; }
.drop small { color: var(--ink-3); }
.drop-name { font-style: normal; color: var(--cobalt); font-weight: 600; }
.check-line { display: flex; gap: 8px; align-items: center; font-size: 13px; color: #536078; }
.import-help { padding-bottom: 14px; }
.import-help p { padding: 0 18px; margin: 6px 0; }
.import-help .items-title { padding: 14px 18px 4px; }
.col-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 18px; }
.col-chips span { background: #F5F7FB; border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; font-size: 12px; color: #536078; }
.col-chips span.req { border-color: #CFE0FD; color: var(--cobalt); font-weight: 600; }
.items-btns label.btn { cursor: pointer; }
@media (max-width: 860px) {
  .top-search { display: none; }
  .search-groups, .import-grid { grid-template-columns: 1fr; }
  .module-actions .search input[type=search] { width: 130px; }
}
@media print { .top-search, .export-menu, .module-actions { display: none !important; } }

/* ---------- print templates ---------- */
.tpl-chips { white-space: normal !important; }
.tpl-chip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px 2px 8px;
  margin: 2px; background: #fff; font-size: 12px; }
.tpl-chip.on { border-color: #CFE0FD; background: #F3F8FF; }
.tpl-chip a { color: var(--ink) !important; font-weight: 600; }
.tpl-chip button { border: 0; background: none; cursor: pointer; color: var(--ink-3); width: 22px; height: 22px; border-radius: 5px; }
.tpl-chip button:hover { background: #EEF2F7; color: var(--cobalt); }
.tpl-chip button.danger:hover { color: var(--red); }
.designer { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.designer-form { padding: 6px 0 0; max-height: calc(100vh - 150px); overflow: auto; position: sticky; top: 12px; }
.designer-form details { border-bottom: 1px solid var(--line); padding: 4px 16px 12px; display: grid; gap: 8px; }
.designer-form details[open] { padding-bottom: 14px; }
.designer-form summary { cursor: pointer; font-weight: 700; padding: 10px 0 6px; color: var(--ink); }
.designer-form .field > span { font-size: 12px; color: #526078; font-weight: 600; }
.designer-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.designer-form input[type=color] { height: 38px; padding: 2px; width: 100%; }
.pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 13px; }
.pick-grid label { display: flex; gap: 6px; align-items: center; color: #536078; }
.col-order { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.col-order li { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid #EEF1F5;
  background: #fff; font-size: 13px; }
.col-order li:last-child { border-bottom: 0; }
.col-order li label { display: flex; gap: 6px; align-items: center; }
.col-order button { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 26px; height: 24px; cursor: pointer; color: #536078; }
.col-order button:hover { border-color: var(--cobalt); color: var(--cobalt); }
.designer-foot { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 16px; display: flex;
  justify-content: flex-end; gap: 8px; }
.designer-preview { background: #E9EDF3; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; }
.pv-head { display: flex; gap: 10px; align-items: baseline; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.pv-head small { color: var(--ink-3); }
.designer-preview iframe { width: 100%; height: calc(100vh - 190px); min-height: 640px; border: 0; display: block; background: #E9EDF3; }
@media (max-width: 1100px) { .designer { grid-template-columns: 1fr; } .designer-form { position: static; max-height: none; } }
.btn-icon { width: 38px; padding: 0; justify-content: center; }

/* ---------- live search ---------- */
#list-results.loading { opacity: .55; transition: opacity .15s; }
form.has-suggest { position: relative; }
.suggest-pop { position: absolute; top: calc(100% + 6px); inset-inline: 0; min-width: 340px; max-height: 70vh; overflow: auto; z-index: 70;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(23, 36, 59, .18); padding: 6px; }
.module-actions .suggest-pop { inset-inline: auto 0; width: 420px; }
.sx-group + .sx-group { border-top: 1px solid #EEF1F5; margin-top: 4px; padding-top: 4px; }
.sx-head { display: flex; align-items: baseline; gap: 8px; padding: 6px 8px 2px; font-size: 12.5px; }
.sx-head small { color: var(--ink-3); }
.sx-head a { margin-inline-start: auto; font-size: 11.5px; }
.sx-item { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink) !important; font-size: 13px; }
.sx-item:hover, .sx-item.on { background: #F3F7FF; text-decoration: none; }
.sx-item span { color: #566074; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-item em { margin-inline-start: auto; font-style: normal; font-size: 11px; color: var(--ink-3); }
.sx-all { display: block; text-align: center; padding: 8px; margin-top: 4px; border-top: 1px solid #EEF1F5; font-weight: 600; font-size: 12.5px; }
.sx-empty { padding: 12px; color: var(--ink-3); text-align: center; font-size: 13px; }
.row-acts form.inline { display: inline; }
.row-acts button { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 29px; border: 1px solid #DFE6EF;
  border-radius: 7px; color: #536078; background: #fff; margin-inline-end: 4px; font: inherit; font-size: 13px; cursor: pointer; vertical-align: middle; }
.row-acts button:hover { border-color: var(--cobalt); color: var(--cobalt); }
.row-acts button.ok { color: #078B61; border-color: #BFE8D6; }
.row-acts button.ok:hover { background: #E8F8F2; }
.row-acts button.del:hover { color: var(--red); border-color: #F3C9C9; background: #FFF5F5; }
.row-acts button.conv { padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--cobalt); border-color: #CFE0FD; background: #F3F8FF; }
.conv-links { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.conv-links a { font-size: 10.5px; background: #EEF4FF; color: var(--cobalt) !important; border-radius: 10px; padding: 1px 7px; }

/* ---------- purchase request (old-system layout) ---------- */
.approval-banner { margin: 0 24px 14px; display: grid; gap: 3px; background: #F3F8FF; border: 1px solid #CFE0FD; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; }
.approval-banner b { color: var(--ink); }
.approval-banner span { color: #3A4A66; }
.approval-banner small { color: var(--ink-3); font-size: 11px; }
.approval-banner.ok { background: #EEFAF5; border-color: #BFE8D6; }
.approval-banner.ok span { color: #078B61; font-weight: 600; }
.approval-banner.wait { background: #FFF8EC; border-color: #F2D7A6; }
.record-head + .approval-banner { margin: 0 0 14px; }
.items-table th.wide { min-width: 300px; }
td.product-cell { min-width: 300px; }
td.product-cell .line-desc { margin-top: 5px; font-size: 12.5px; color: #566074; background: #FBFCFE; }
.request-lower { grid-template-columns: 1fr 1fr; background: #F8FAFC; border-top: 1px solid #E6EBF2; padding: 20px 24px 24px; }
.request-lower textarea { min-height: 150px; border-radius: 10px; }
.request-lower .notes-box > span { font-size: 12px; font-weight: 700; color: #33415B; }
.upload-box { border-color: #B9C9DC; background: #fff; min-height: 150px; }
.upload-box:hover { border-color: #16A085; background: #F5FFFC; }
.upload-box .drop-ico { background: #E8FAF5; color: #0F9B75; border-radius: 50%; }
.upload-box b { color: #0F8F70; }
.upload-box a { position: relative; z-index: 2; font-size: 11px; text-decoration: underline; }
@media (max-width: 860px) { .request-lower { grid-template-columns: 1fr; padding: 16px; } .approval-banner { margin-inline: 14px; } }
table.list-t td.wrap-cell { white-space: normal; min-width: 170px; max-width: 320px; }
table.list-t td.row-acts { white-space: normal; min-width: 132px; max-width: 220px; }
table.list-t td.row-acts > * { margin-bottom: 3px; }
table.list-t td.wrap-cell { max-width: 260px; }
table.list-t td.row-acts { min-width: 178px; }
.row-acts button.conv { white-space: nowrap; height: 27px; }

/* ---------- product identity: My Arbec on top, the company under it ---------- */
.side .brand { height: auto; padding: 0 6px 16px; gap: 12px; align-items: stretch; }
.side .brand .product-logo { display: block; }
.side .brand .product-logo img { width: 100%; max-width: 190px; max-height: 50px; background: #fff; border-radius: 10px; padding: 7px 10px;
  object-fit: contain; object-position: center; }
.side .company-chip { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px; padding: 7px 9px; min-width: 0; }
.side .company-chip img { width: 46px; max-width: 46px; height: 30px; max-height: 30px; padding: 2px 4px; border-radius: 6px; background: #fff;
  object-fit: contain; filter: none; flex: none; }
.side .company-chip span { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side .company-chip b { color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .company-chip small { color: #8FA0BC; font-size: 10.5px; }
.eta-ready { border-color: #F2D7A6; background: #FFF8EC; margin-bottom: 14px; }
.eta-ready ul { margin: 6px 0; padding-inline-start: 20px; }
.eta-ready.ok { border-color: #BFE8D6; background: #EEFAF5; }

/* ---------- project portal ---------- */
.pp-head h2 .pp-status { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 20px; background: var(--cobalt-soft); color: var(--cobalt); vertical-align: middle; }
.pp-head h2 .pp-status.stopped { background: var(--amber-soft); color: #9a6200; }
.pp-head h2 .pp-status.completed { background: var(--green-soft); color: var(--green); }
.pp-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.pp-kpis .kpi { text-decoration: none; }
.pp-kpis a.kpi:hover { border-color: var(--cobalt); }
.pp-kpis .kpi.neg .value { color: var(--red); }
.pp-bars { display: grid; gap: 3px; margin: 6px 0 2px; }
.pp-bars .progress.time span { background: var(--ink-3); opacity: .45; }
.pp-tabs .pill { margin-inline-start: 6px; }
.pill.warn { background: var(--amber-soft); color: #9a6200; }
.pp-alert { display: block; padding: 9px 12px; border-radius: 8px; margin-bottom: 8px; background: var(--cobalt-soft); color: var(--ink); border-inline-start: 3px solid var(--cobalt); }
.pp-alert.warn { background: var(--amber-soft); border-color: var(--amber); }
.pp-alert.bad { background: var(--red-soft); border-color: var(--red); }
.pp-alert:hover { text-decoration: none; filter: brightness(.98); }
.pp-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.pp-fin th { font-weight: 500; color: var(--ink-2); background: none; }
.pp-scroll { max-height: 68vh; }
.pp-table thead th { position: sticky; top: 0; z-index: 1; }
.pp-prog thead tr:nth-child(2) th { top: 37px; }
.pp-prog th.grp { text-align: center; border-bottom: 1px solid var(--line); }
.pp-in { width: 92px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 6px; text-align: left; direction: ltr; font: inherit; background: #fff; }
.pp-prog td .pp-in { width: 96px; min-width: 96px; padding: 5px 6px; }
.pp-prog td .pp-in.pct { width: 64px; min-width: 64px; }
.pp-kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.pp-in:focus { outline: 2px solid var(--cobalt-soft); border-color: var(--cobalt); }
.pp-save { padding: 4px 10px !important; border-radius: 6px; background: var(--cobalt) !important; color: #fff !important; border: 0; cursor: pointer; font: inherit; font-size: 12px; }
.pp-save:disabled { background: var(--line) !important; color: var(--ink-3) !important; cursor: default; }
.pp-st { font-size: 11.5px; padding: 1px 8px; border-radius: 10px; white-space: nowrap; }
.pp-st.pending { background: var(--amber-soft); color: #9a6200; }
.pp-st.approved { background: var(--green-soft); color: var(--green); }
.pp-st.rejected { background: var(--red-soft); color: var(--red); }
.pp-summary { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); }
.pp-summary b { color: var(--ink); }
.pp-date { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.pp-date input { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 12px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; border-inline-start: 1px solid var(--line); }
.seg button:first-child { border-inline-start: 0; }
.seg button.on { background: var(--cobalt-soft); color: var(--cobalt); font-weight: 600; }
.link-btn { border: 0; background: none; color: var(--cobalt); cursor: pointer; font: inherit; padding: 0 4px; }
.link-btn:hover { text-decoration: underline; }
td.neg, .num.neg { color: var(--red); font-weight: 600; }
.pp-rel { margin-bottom: 16px; }
.pp-drawer { position: fixed; inset-block: 0; inset-inline-end: 0; width: min(520px, 100vw); background: #fff; z-index: 60; box-shadow: -12px 0 40px rgba(15, 34, 64, .18); overflow-y: auto; padding: 18px 20px 28px; }
.pp-close { position: absolute; inset-inline-end: 14px; top: 12px; border: 0; background: var(--paper); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 15px; }
.pp-line h3 { margin: 4px 36px 8px 0; font-size: 15px; line-height: 1.5; }
.pp-line h4 { margin: 18px 0 6px; font-size: 13.5px; }
.pp-links { list-style: none; padding: 0; margin: 0; }
.pp-links li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.pp-line-acts { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pp-toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translate(50%, 20px); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; opacity: 0; transition: .2s; z-index: 80; pointer-events: none; }
[dir="ltr"] .pp-toast { transform: translate(-50%, 20px); }
.pp-toast.on { opacity: 1; transform: translate(50%, 0); }
[dir="ltr"] .pp-toast.on { transform: translate(-50%, 0); }
.pp-toast.bad { background: var(--red); }
@media (max-width: 760px) { .pp-in { width: 70px; } .pp-drawer { padding: 14px; } }
/* sheet full screen: the sheet takes the whole window */
body.focus-mode .topbar, body.focus-mode .flash, body.focus-mode .wb-head .titles, body.focus-mode .wb-head .stages,
body.focus-mode .wb-actions > :not([data-focus]), body.focus-mode .wb-head .people { display: none !important; }
body.focus-mode .content { padding: 6px 10px 0 !important; max-width: none !important; position: relative; }
body.focus-mode .wb-head { position: absolute; top: 6px; inset-inline-end: 12px; margin: 0; z-index: 20; }
body.focus-mode .wb-head .wb-totals b { font-size: 15px; }
body.focus-mode .wb-actions { margin-bottom: 6px; min-height: 30px; }
body.focus-mode .sg-toolbar { flex-wrap: nowrap; overflow-x: auto; }

body.focus-mode .sg-toolbar > * { flex: none; white-space: nowrap; }
.sc > span, .sc > .sp { position: relative; z-index: 1; }
.sc .cfbar { position: absolute; inset-inline-start: 0; top: 2px; bottom: 2px; opacity: .5; z-index: 0; border-radius: 0 2px 2px 0; }
.dvbtn { position: absolute; width: 16px; height: 17px; font: 400 10px/16px sans-serif; text-align: center; background: #fff; border: 1px solid #9AA5B5; cursor: pointer; color: #334155; z-index: 7; box-sizing: border-box; }
.wb.show-f .sc.fx { font-family: ui-monospace, Consolas, monospace; font-size: .9em; color: #1F4E8C; justify-content: flex-start; text-align: left; }
.sg-formula .fx { cursor: pointer; }
.sg-formula .fx:hover { color: var(--cobalt); }
.sg-dlg { position: fixed; inset: 0; z-index: 70; display: none; align-items: flex-start; justify-content: center; background: rgba(15, 34, 64, .25); padding-top: 10vh; }
.sg-dlg-box { background: #fff; border-radius: 10px; box-shadow: 0 20px 50px rgba(15, 34, 64, .3); padding: 16px 18px; max-width: calc(100vw - 32px); max-height: 75vh; overflow: auto; font-size: 13px; }
.sg-dlg-box h3 { margin: 0 0 10px; font-size: 16px; }
.sg-dlg-box h4 { margin: 14px 0 6px; font-size: 13px; }
.sg-dlg-box label { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }
.sg-dlg-box input, .sg-dlg-box select, .sg-dlg-box textarea { width: 100%; box-sizing: border-box; }
.sg-dlg-box .cf-vals { display: flex; gap: 8px; } .sg-dlg-box .cf-vals label { flex: 1; }
.sg-dlg-box .dlg-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sg-dlg-box .dlg-list { list-style: none; padding: 0; margin: 0; }
.sg-dlg-box .dlg-list li { padding: 5px 6px; border-bottom: 1px solid var(--line-soft); display: flex; gap: 6px; align-items: center; }
.sg-dlg-box .dlg-list li button { margin-inline-start: auto; border: 0; background: none; cursor: pointer; color: var(--red); }
.sg-dlg-box .fn-list li { cursor: pointer; display: block; direction: ltr; text-align: left; }
.sg-dlg-box .fn-list li:hover { background: var(--cobalt-soft); }
.sg-dlg-box .fn-list li .muted { direction: rtl; unicode-bidi: plaintext; }
.sg-dlg-box .sw { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 3px; font-weight: 700; }
.sg-dvpop { position: fixed; z-index: 65; display: none; background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 10px 30px rgba(15, 34, 64, .2); max-height: 260px; overflow: auto; min-width: 140px; padding: 3px; font-size: 13px; }
.sg-dvpop div { padding: 4px 10px; cursor: pointer; border-radius: 4px; white-space: nowrap; }
.sg-dvpop div:hover, .sg-dvpop div.on { background: var(--cobalt-soft); }
.sc.lk { background-image: repeating-linear-gradient(135deg, rgba(120, 130, 150, .07) 0 4px, transparent 4px 8px); }
.grp { position: absolute; inset-inline-start: 1px; width: 14px; height: 14px; font: 700 11px/12px sans-serif; text-align: center; border: 1px solid #7F8A9B; background: #fff; color: #334155; cursor: pointer; z-index: 3; border-radius: 2px; }
.grp.col { inset-inline-start: auto; }
.rh.ing { box-shadow: inset 3px 0 0 #9DB7E8; }
.sh.ing { box-shadow: inset 0 3px 0 #9DB7E8; }
.sg-charts { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.sg-chart { position: absolute; pointer-events: auto; background: #fff; border: 1px solid #B9C3D1; border-radius: 6px; box-shadow: 0 6px 18px rgba(15, 34, 64, .15); overflow: hidden; }
.sg-chart .ch-head { display: flex; gap: 6px; align-items: center; height: 28px; padding: 0 8px; background: #F4F6F9; border-bottom: 1px solid var(--line-soft); cursor: move; font-size: 12px; }
.sg-chart .ch-head b { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sg-chart .ch-head select { height: 22px; font-size: 11px; width: auto; padding: 0 4px; }
.sg-chart .ch-head button { border: 0; background: none; cursor: pointer; font-size: 12px; padding: 0 3px; }
.sg-chart svg { display: block; font: 10px sans-serif; direction: ltr; }
.sg-chart svg text { fill: #4A5668; }
.sg-chart svg .gl { stroke: #E3E7EE; }
.sg-chart .ch-rs { position: absolute; inset-inline-end: 0; bottom: 0; width: 12px; height: 12px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, #9AA5B5 50%); }
.sg-img { position: absolute; pointer-events: auto; cursor: move; outline: 1px dashed transparent; }
.sg-img:hover { outline-color: #9AA5B5; }
.sg-img img { width: 100%; height: 100%; display: block; object-fit: fill; user-select: none; }
.sg-img button { position: absolute; top: 2px; inset-inline-end: 2px; display: none; border: 0; background: rgba(255,255,255,.9); border-radius: 3px; cursor: pointer; color: var(--red); }
.sg-img:hover button { display: block; }

.sc.spl > .sp { pointer-events: none; }
td input.warn { border-color: #d08a00; background: #fff8e6; }
