/* Retwa client report. Look approved in salwaweb_design/mockup_v6.html:
   calm beige page, white cards with soft sharp edges, Retwa navy as the only accent.
   Only opacity/transform animate; a blur is never animated. */
@font-face {
  font-family: 'Alyamama'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/alyamama-arabic.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Alyamama'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(fonts/alyamama-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper-0: #ffffff; --paper-100: #f1eadc; --paper-200: #eceae3; --paper-300: #dedbd2;
  --ink-900: #14202e; --ink-700: #34465a; --ink-500: #5d6c7b; --ink-400: #8b97a3;
  --brand: #1a2f5c; --brand-2: #4a5f8a; --brand-3: #8797b8; --brand-4: #b9c4d9; --brand-bg: #e9edf4;
  --bg: var(--paper-100); --surface: var(--paper-0); --line: var(--paper-200); --line-2: var(--paper-300);
  --hover: #f5f1e8; --err: #9b2c2c;
  --r: 12px; --r-lg: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Alyamama', Tahoma, sans-serif; font-size: 15px; line-height: 1.6; color: var(--ink-900); background: var(--bg); font-variant-numeric: tabular-nums; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; }
a { color: inherit; }
svg.i { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); z-index: 0; padding: 26px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side::after { content: ''; position: absolute; top: 0; bottom: 0; inset-inline-end: -2px; width: 4px; background: #fff; filter: blur(1.5px); pointer-events: none; }
.side .logo { padding: 0 10px 22px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.side .logo img { width: 168px; display: block; }
.side a { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 0 12px; border-radius: 10px; color: var(--ink-500); text-decoration: none; transition: color .15s, background .15s; }
.side a:hover { color: var(--ink-900); }
.side a.on { background: var(--brand-bg); color: var(--brand); font-weight: 700; }
.side .sep { height: 1px; background: var(--line); margin: 8px 12px; flex: none; }
.side .foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-500); }
.side .foot b { display: block; color: var(--ink-900); font-size: 14px; }
.side .out { margin-top: 10px; height: 34px; padding: 0; border: 0; background: none; color: var(--ink-500); display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.side .out:hover { color: var(--brand); }
.side .out svg { width: 17px; height: 17px; }

main { position: relative; z-index: 1; padding: 32px clamp(24px, 3vw, 44px) 60px; padding-inline-start: 44px; min-width: 0; }
.page { animation: pagein .22s cubic-bezier(.2,.7,.2,1); }
@keyframes pagein { from { opacity: 0; transform: translateY(4px); } }

.head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.head h1 { font-size: 30px; font-weight: 700; line-height: 1.2; }
.head .sub { color: var(--ink-500); margin-top: 6px; }
.hact { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- buttons and inputs ---------- */
.fbtn, .btn { height: 42px; padding: 0 18px; border: 0; border-radius: var(--r); background: #fff; color: var(--ink-900); font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 9px; cursor: pointer; white-space: nowrap; transition: color .15s, background .15s; }
.fbtn:hover, .btn:hover { color: var(--brand); }
.fbtn svg, .btn svg { width: 18px; height: 18px; }
.btn.pri { background: var(--brand); color: #fff; }
.btn.pri:hover { background: #22396b; color: #fff; }
.btn.ln { border: 1px solid var(--line-2); }
.btn.plain { background: none; color: var(--ink-500); }
.btn.plain:hover { color: var(--ink-900); }
.btn.big { height: 46px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.sb { height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; color: var(--ink-700); font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: color .15s, border-color .15s; }
.sb:hover { color: var(--brand); border-color: var(--brand-4); }
.sb svg { width: 16px; height: 16px; }

.inp { width: 100%; height: 46px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; padding: 0 14px; font: inherit; font-size: 15px; color: var(--ink-900); outline: none; transition: border-color .15s; }
.inp:focus { border-color: var(--brand-4); }
textarea.inp { height: 96px; padding: 11px 14px; resize: vertical; line-height: 1.6; }
input[type=date].inp { direction: rtl; }
input[type=file].inp { padding: 9px 12px; height: auto; cursor: pointer; }
.search { width: 240px; height: 40px; }
.err { color: var(--err); font-size: 14px; min-height: 22px; margin-top: 10px; }

/* ---------- soft white cards ---------- */
.kpi, .chart, .card, .auth .box { position: relative; isolation: isolate; background: none; }
.kpi::before, .chart::before, .card::before, .auth .box::before { content: ''; position: absolute; inset: 2px; z-index: -1; border-radius: 27px; background: #fff; filter: blur(1.5px); transition: bottom .2s; }

/* ---------- number row ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; position: relative; z-index: 2; }
.kpis.n4 { grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 34px 28px 32px; display: flex; flex-direction: column; }
.kpi small { display: block; font-size: 16px; white-space: nowrap; color: var(--ink-700); }
.kpi > b { display: block; font-size: 52px; font-weight: 700; line-height: 1.2; margin-top: auto; padding-top: 8px; color: var(--brand); }
/* clickable cards lift a little on hover (transform only, stays smooth) */
.kpi.go { cursor: pointer; transition: transform .22s cubic-bezier(.2,.7,.2,1); will-change: transform; }
.kpi.go:hover { transform: translateY(-5px); }

/* cases card: hover drops a finished vs ongoing bar under it */
.kpi.cases:hover { z-index: 3; }
.more { position: absolute; inset-inline: 0; top: calc(100% - 6px); padding: 0 24px; opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .2s, transform .2s; }
.kpi.cases:hover::before { bottom: -50px; }
.kpi.cases:hover .more { opacity: 1; transform: none; }
.more .track { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 3px; }
.more .track i { display: block; height: 100%; }
.more .track i.a { background: var(--brand); }
.more .track i.b { background: var(--brand-4); }
.more .row { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--ink-500); }
.more .row strong { color: var(--ink-900); font-size: 15px; margin-inline-end: 4px; }
.hint { position: absolute; bottom: 10px; inset-inline: 0; display: flex; justify-content: center; color: var(--ink-400); transition: opacity .2s; }
.hint svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi.cases:hover .hint { opacity: 0; }

/* ---------- summary charts ---------- */
.charts { display: grid; grid-template-columns: 1.75fr 1fr; gap: 28px; margin-top: 66px; }
.chart { padding: 34px 36px 30px; }
.chart h2, .card h2 { font-size: 20px; font-weight: 700; }
.chart .cap, .card .cap { font-size: 13px; color: var(--ink-500); margin-top: 2px; }
.plot { position: relative; height: 300px; margin-top: 50px; display: grid; grid-template-columns: 36px 1fr; }
.axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 12px; color: var(--ink-400); padding-bottom: 30px; text-align: end; padding-inline-end: 8px; }
.area { position: relative; border-bottom: 1px solid var(--line-2); margin-bottom: 30px; }
.area .grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; }
.area .grid i { border-top: 1px solid var(--line); }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: space-around; gap: 14px; padding: 0 10px; }
.bar { flex: 1; max-width: 72px; position: relative; border-radius: 6px 6px 0 0; transition: height .4s cubic-bezier(.2,.7,.2,1); }
.bar.a { background: var(--brand-3); }
.bar.b { background: var(--brand); }
.bar span { position: absolute; top: -24px; inset-inline: 0; text-align: center; font-weight: 700; font-size: 14px; color: var(--ink-900); }
.bar em { position: absolute; bottom: -28px; inset-inline: -10px; text-align: center; font-style: normal; font-size: 13px; color: var(--ink-700); white-space: nowrap; }

.donut { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; }
.donut .ring { position: relative; width: 330px; height: 330px; flex: none; }
.donut svg { width: 100%; height: 100%; overflow: visible; }
.donut circle { fill: none; stroke-width: 20; }
.donut .mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut .mid b { font-size: 60px; font-weight: 700; color: var(--brand); line-height: 1.1; }
.donut .mid small { color: var(--ink-500); font-size: 16px; }
.donut .empty-ring { stroke: var(--line); }
.lg { height: 290px; display: flex; flex-direction: column; justify-content: space-between; }
.lg .nm { display: flex; align-items: center; gap: 8px; font-size: 16px; color: var(--ink-700); white-space: nowrap; }
.lg .nm span { width: 10px; height: 10px; border-radius: 3px; }
.lg b { display: inline-block; font-size: 28px; font-weight: 700; margin-top: 2px; }
.lg.end { align-items: flex-end; text-align: end; }
.lg > div { cursor: pointer; }

.seg { cursor: pointer; }
.seg .mv { transition: transform .25s ease; }
.seg .arc { pointer-events: none; }
.seg .hit { pointer-events: stroke; stroke-width: 46; }
.seg .haze { stroke-width: 34; }
.seg .haze, .seg text { opacity: 0; transition: opacity .25s ease; pointer-events: none; }
.seg text { font-family: 'Alyamama', Tahoma, sans-serif; font-size: 10px; font-weight: 700; fill: var(--ink-900); }
.seg:hover .mv { transform: translate(var(--tx), var(--ty)); }
.seg:hover .haze { opacity: .3; filter: url(#haze); }
.seg:hover text { opacity: 1; }

/* ---------- lists ---------- */
.card { padding: 30px 34px; }
.sect { margin-top: 40px; }
.card .ch { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 13px; color: var(--ink-500); font-weight: 500; text-align: start; padding: 0 12px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row { cursor: pointer; }
.tbl tr.row td { transition: background .15s; }
.tbl tr.row:hover td { background: #faf7f0; }
.tbl td.t { font-weight: 700; }
.tbl td.m { color: var(--ink-500); white-space: nowrap; }
.tbl td.n { font-weight: 700; color: var(--brand); }
.st { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.st::before { content: ''; width: 9px; height: 9px; border-radius: 3px; background: var(--brand); flex: none; }
.st.s2::before { background: var(--brand-3); }
.st.s3::before { background: var(--brand-4); }
.st.off { color: var(--ink-500); }
.empty, .loading { padding: 44px 0; text-align: center; color: var(--ink-500); }
.loading { color: var(--ink-400); }
.count { color: var(--ink-400); font-size: 14px; }

/* segmented switch (period, active or archive) */
.seg3 { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line-2); border-radius: var(--r); padding: 4px; gap: 4px; background: #fff; }
.seg3 button { height: 38px; padding: 0 14px; border: 0; border-radius: 8px; background: none; font-size: 15px; color: var(--ink-500); cursor: pointer; outline: none; white-space: nowrap; }
.seg3 button.on { background: var(--brand-bg); color: var(--brand); font-weight: 700; }
.hact .seg3 { border: 0; height: 42px; padding: 3px; }
.hact .seg3 button { height: 36px; }

/* ---------- panes over a fog ---------- */
.veil { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; padding: 32px 16px; overflow-y: auto; visibility: hidden; opacity: 0; pointer-events: none; background: rgba(241,234,220,.78); will-change: opacity; transition: opacity .24s cubic-bezier(.2,.7,.2,1), visibility 0s linear .24s; }
.veil.on { visibility: visible; opacity: 1; pointer-events: auto; transition: opacity .24s cubic-bezier(.2,.7,.2,1), visibility 0s; }
.veil.blur { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.pane { position: relative; margin: auto 0; flex: none; width: 460px; max-width: 100%; background: #fff; border-radius: 22px; padding: 30px 32px 26px; opacity: 0; will-change: transform, opacity; transform: translateY(10px) scale(.985); transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .2s ease-out; }
.veil.on .pane { opacity: 1; transform: none; }
.pane.wide { width: 760px; }
.pane h2 { font-size: 22px; font-weight: 700; margin-bottom: 22px; padding-inline-end: 44px; line-height: 1.35; }
.pane h2 + .psub { margin: -16px 0 22px; color: var(--ink-500); font-size: 14px; }
.pane .x { position: absolute; top: 24px; inset-inline-end: 24px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--ink-500); display: grid; place-items: center; cursor: pointer; }
.pane .x:hover { background: var(--hover); color: var(--ink-900); }
.pane .x svg { width: 20px; height: 20px; }
.fld { margin-bottom: 18px; }
.fld > label { display: block; font-size: 14px; color: var(--ink-500); margin-bottom: 7px; }
.fld > label em { font-style: normal; color: var(--ink-400); }
.fg { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.fg .full { grid-column: 1 / -1; }
.acts { display: flex; gap: 10px; margin-top: 26px; align-items: center; }
.acts .grow { flex: 1; }
.note { color: var(--ink-500); font-size: 14px; }
.secret { margin: 6px 0 4px; padding: 14px 16px; border-radius: var(--r); background: var(--hover); font-size: 20px; font-weight: 700; letter-spacing: .5px; direction: ltr; text-align: center; user-select: all; }

/* custom dropdowns, drawn like the rest of the page */
.dd { position: relative; }
.ddb { width: 100%; height: 46px; border: 1px solid var(--line-2); border-radius: var(--r); background: #fff; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; font-size: 15px; font-weight: 700; color: var(--ink-900); cursor: pointer; outline: none; transition: border-color .15s; }
.ddb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ddb svg { width: 16px; height: 16px; color: var(--ink-400); transition: transform .2s; }
.dd.open .ddb { border-color: var(--brand-4); }
.dd.open .ddb svg { transform: rotate(180deg); }
.ddm { position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 5; max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: 0 10px 24px rgba(20,32,46,.06); opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .15s, transform .15s; }
.dd.open .ddm { opacity: 1; transform: none; pointer-events: auto; }
.ddm button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font-size: 15px; color: var(--ink-700); cursor: pointer; text-align: start; }
.ddm button:hover { background: var(--hover); }
.ddm button.on { color: var(--brand); font-weight: 700; }
.ddm button.on::after { content: ''; flex: none; width: 16px; height: 16px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a2f5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") no-repeat center / contain; }
.hact .dd { min-width: 230px; }
.hact .ddb { border: 0; height: 42px; }
/* tools inside a white card need their border back */
.card .hact .seg3 { border: 1px solid var(--line-2); height: 40px; padding: 3px; }
.card .hact .seg3 button { height: 32px; font-size: 14px; }
.card .hact .dd { min-width: 200px; }
.card .hact .ddb { border: 1px solid var(--line-2); height: 40px; font-size: 14px; }
.dd.off .ddb { color: var(--ink-400); cursor: default; }

/* ---------- item detail ---------- */
.dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 24px; }
.dl small { display: block; font-size: 13px; color: var(--ink-500); }
.dl b { font-size: 16px; font-weight: 700; }
.dl b.none { color: var(--ink-400); font-weight: 500; }
.psec { margin-top: 28px; }
.psec h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.psec p.txt { color: var(--ink-700); white-space: pre-wrap; }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li .tx { flex: 1; min-width: 0; }
.li .tx b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .tx small { display: block; color: var(--ink-500); font-size: 13px; }
.li .ops { display: flex; gap: 8px; flex: none; }
.li.arch .tx b { color: var(--ink-500); }
.fi { width: 40px; height: 40px; border-radius: 10px; background: var(--hover); color: var(--brand); display: grid; place-items: center; flex: none; }
.fi svg { width: 20px; height: 20px; }
.li.click { cursor: pointer; }
.li.click:hover .tx b { color: var(--brand); }
.day { width: 52px; flex: none; text-align: center; color: var(--brand); line-height: 1.15; }
.day b { display: block; font-size: 22px; font-weight: 700; }
.day small { font-size: 12px; color: var(--ink-500); }
.addrow { display: grid; grid-template-columns: 180px 1fr auto; gap: 10px; margin-top: 10px; }

/* ---------- file library ---------- */
.lib .card + .card { margin-top: 24px; }
.grp { margin-top: 22px; }
.grp > h3 { font-size: 15px; font-weight: 700; color: var(--ink-700); padding-bottom: 8px; border-bottom: 1px solid var(--line-2); }
.grp .itm { margin-top: 12px; }
.grp .itm > small { display: block; color: var(--ink-500); font-size: 13px; margin-bottom: 2px; }

/* ---------- document viewer ---------- */
.pane.doc { width: min(1040px, 94vw); height: calc(100vh - 64px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.doc .dbar { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.doc .dbar .tx { flex: 1; min-width: 0; }
.doc .dbar .tx b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc .dbar .tx small { color: var(--ink-500); font-size: 13px; }
.doc .zoom { color: var(--ink-500); font-size: 14px; min-width: 48px; text-align: center; }
.doc .x2 { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--ink-500); display: grid; place-items: center; cursor: pointer; }
.doc .x2:hover { background: var(--hover); color: var(--ink-900); }
.doc .pages { flex: 1; overflow: auto; background: #f6f2ea; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.doc .pages canvas, .doc .pages img { display: block; background: #fff; border-radius: 4px; box-shadow: 0 1px 3px rgba(20,32,46,.08); flex: none; }
.doc .pages img { max-width: 100%; height: auto; }

/* ---------- sign in ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .box { width: 420px; max-width: 100%; padding: 44px 40px 36px; }
.auth .logo { display: block; width: 150px; margin: 0 auto 30px; }
.auth h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth .sub { color: var(--ink-500); margin-bottom: 24px; font-size: 14px; }
.auth form .btn { margin-top: 8px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 24px; left: 24px; z-index: 60; max-width: 380px; background: var(--ink-900); color: #fff; padding: 12px 18px; border-radius: var(--r); font-size: 14px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: none; }
.toast.bad { background: var(--err); }
