/* ==========================================================================
   SNAM Quality — Design System
   ========================================================================== */
:root{
  --maroon:#6E1220;
  --maroon-800:#5A0D19;
  --maroon-900:#45080F;
  --maroon-50:#FBF3F4;
  --gold:#C4BA96;
  --gold-600:#A9986A;
  --gold-soft:#EFE7D2;

  --paper:#FFFFFF;
  --sand:#F7F4EE;
  --ink:#211C19;
  --ink-2:#4A423B;
  --muted:#827870;
  --line:#E7DFD2;
  --line-soft:#F0EAE0;

  --ok:#2F7D5B;
  --ok-bg:#EAF5EF;
  --warn:#B0761A;
  --warn-bg:#FCF3E2;
  --bad:#A8231D;
  --bad-bg:#FBEBEA;
  --info:#2B5F86;
  --info-bg:#EAF2F8;

  --r-sm:10px; --r:14px; --r-lg:20px;
  --shadow-1:0 1px 2px rgba(46,32,20,.05);
  --shadow-2:0 10px 30px -12px rgba(46,32,20,.18);
  --shadow-3:0 30px 70px -25px rgba(46,32,20,.35);
  --sidebar-w:276px;
  --ease:cubic-bezier(.22,.61,.36,1);
}

*,*::before,*::after{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{
  font-family:"IBM Plex Sans Arabic","Segoe UI",Tahoma,system-ui,sans-serif;
  background:var(--sand);
  color:var(--ink);
  font-size:15px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,p{margin:0}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
svg{display:block}
table{border-collapse:collapse;width:100%}
::selection{background:var(--gold-soft)}

/* Scrollbar */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#DCD2C2;border-radius:8px;border:3px solid var(--sand)}
::-webkit-scrollbar-track{background:transparent}

/* ==========================================================================
   Layout
   ========================================================================== */
.app{display:flex;min-height:100vh}

.sidebar{
  width:var(--sidebar-w);flex:0 0 var(--sidebar-w);
  background:
    radial-gradient(120% 80% at 100% 0%, #7C1A29 0%, transparent 55%),
    linear-gradient(180deg,#5C1019 0%,#45080F 100%);
  color:#F6EDE9;
  display:flex;flex-direction:column;
  position:sticky;top:0;height:100vh;
  padding:22px 18px 18px;
  z-index:40;
}
.brand{display:flex;flex-direction:column;gap:14px;padding:6px 4px 20px;border-bottom:1px solid rgba(196,186,150,.18)}
.brand-mark img,.brand-mark svg{display:block}
.brand-logo{width:172px;height:auto;filter:drop-shadow(0 6px 14px rgba(0,0,0,.25))}
.brand-text{display:flex;flex-direction:column;gap:2px}
.brand-text strong{font-size:15.5px;font-weight:600;letter-spacing:.2px;color:#FBF6EA}
.brand-text span{font-size:11.5px;color:#CBBFA8}
.brand-text em{
  font-style:normal;font-size:11px;font-weight:600;color:var(--gold);
  letter-spacing:.5px;margin-top:6px;display:inline-flex;align-items:center;gap:6px;
}
.brand-text em::before{content:"";width:14px;height:1px;background:var(--gold);opacity:.7}

.nav{display:flex;flex-direction:column;gap:3px;margin-top:18px;overflow-y:auto;flex:1}
.nav-label{font-size:10.5px;letter-spacing:1px;color:#A08F79;padding:14px 12px 6px;text-transform:uppercase}
.nav-item{
  display:flex;align-items:center;gap:11px;
  padding:10px 12px;border-radius:10px;
  color:#DCCFBE;font-size:13.5px;font-weight:500;
  border:1px solid transparent;transition:.18s var(--ease);
  position:relative;
}
.nav-item svg{width:19px;height:19px;opacity:.85;flex:0 0 19px}
.nav-item:hover{background:rgba(255,255,255,.055);color:#fff}
.nav-item.active{
  background:linear-gradient(90deg,rgba(196,186,150,.20),rgba(196,186,150,.06));
  border-color:rgba(196,186,150,.28);color:#FFF9EC;
}
.nav-item.active::before{
  content:"";position:absolute;inset-inline-start:-1px;top:9px;bottom:9px;width:3px;
  border-radius:3px;background:var(--gold);
}
.nav-item .count{
  margin-inline-start:auto;background:rgba(0,0,0,.28);color:#EADFC9;
  font-size:11px;padding:1px 7px;border-radius:20px;
}
.nav-item.active .count{background:var(--gold);color:#4A1018;font-weight:700}

.sidebar-foot{padding-top:14px;border-top:1px solid rgba(196,186,150,.15);display:flex;flex-direction:column;gap:10px}
.compliance-mini{display:grid;grid-template-columns:1fr auto;gap:2px 8px;align-items:center;font-size:11.5px;color:#C9BCA6}
.compliance-mini strong{font-size:19px;color:#FFF6E6;font-weight:600;letter-spacing:-.3px}
.mini-bar{grid-column:1/-1;height:5px;border-radius:6px;background:rgba(255,255,255,.12);overflow:hidden}
.mini-bar i{display:block;height:100%;border-radius:6px;background:linear-gradient(90deg,var(--gold-600),var(--gold));transition:width .8s var(--ease)}

.main{flex:1;min-width:0;display:flex;flex-direction:column}

/* Topbar */
.topbar{
  height:76px;display:flex;align-items:center;gap:18px;
  padding:0 30px;background:rgba(255,255,255,.86);
  border-bottom:1px solid var(--line);
  position:sticky;top:0;z-index:30;backdrop-filter:blur(10px);
}
.page-id h1{font-size:21px;font-weight:600;letter-spacing:-.3px;line-height:1.3}
.page-id p{font-size:12.5px;color:var(--muted);margin-top:1px}
.topbar-tools{margin-inline-start:auto;display:flex;align-items:center;gap:10px}

.search{position:relative;display:flex;align-items:center;gap:8px;background:#F6F2EA;border:1px solid var(--line);border-radius:10px;padding:8px 12px;width:300px;transition:.18s}
.search:focus-within{border-color:var(--gold-600);background:#fff;box-shadow:0 0 0 4px rgba(196,186,150,.18)}
.search svg{color:var(--muted);flex:0 0 18px}
.search input{border:0;background:transparent;outline:none;width:100%;font-size:13px}
.search input::placeholder{color:#A79C90}
.search kbd{font-family:inherit;font-size:10.5px;color:#9C9186;border:1px solid var(--line);border-radius:5px;padding:1px 5px;background:#fff}

.icon-btn{
  position:relative;width:38px;height:38px;border-radius:10px;border:1px solid var(--line);
  background:#fff;color:var(--ink-2);display:grid;place-items:center;transition:.18s;
}
.icon-btn:hover{background:#FAF6EF;border-color:#D9CDB9;color:var(--maroon)}
.icon-btn .dot{position:absolute;top:8px;inset-inline-end:9px;width:6px;height:6px;border-radius:50%;background:var(--bad);box-shadow:0 0 0 2px #fff}
.icon-btn .dot[hidden]{display:none}

.user{display:flex;align-items:center;gap:9px;padding-inline-start:12px;border-inline-start:1px solid var(--line)}
.avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(150deg,var(--maroon),#8C1B2C);color:#F4E6C8;font-weight:600;font-size:14px;border:1.5px solid var(--gold)}
.user-text{display:flex;flex-direction:column;line-height:1.25}
.user-text strong{font-size:12.5px;font-weight:600}
.user-text span{font-size:11px;color:var(--muted)}

.view{flex:1;padding:26px 30px 10px;outline:none}
.foot{display:flex;gap:8px;align-items:center;justify-content:center;padding:16px 0 22px;color:#9C9186;font-size:11.5px}
.foot-sep{opacity:.5}

/* ==========================================================================
   Typography & helpers
   ========================================================================== */
.muted{color:var(--muted)}
.small{font-size:12px}
.tiny{font-size:11px}
.nowrap{white-space:nowrap}
.num{font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
.section-title{font-size:16px;font-weight:600;letter-spacing:-.2px}
.section-sub{font-size:12px;color:var(--muted);margin-top:2px}
.row{display:flex;align-items:center;gap:10px}
.spacer{flex:1}
.hide{display:none!important}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  border:1px solid transparent;border-radius:10px;padding:9px 16px;
  font-size:13px;font-weight:500;transition:.18s var(--ease);white-space:nowrap;
}
.btn svg{width:16px;height:16px}
.btn:active{transform:translateY(1px)}
.btn-primary{background:linear-gradient(180deg,#7C1A29,#5C1019);color:#FBF3E4;box-shadow:0 1px 0 rgba(255,255,255,.12) inset,0 6px 16px -8px rgba(110,18,32,.8)}
.btn-primary:hover{background:linear-gradient(180deg,#8A1F30,#66121D)}
.btn-gold{background:linear-gradient(180deg,#D3C9A6,#BFB287);color:#451018;font-weight:600;border-color:#B3A57A}
.btn-gold:hover{filter:brightness(1.03)}
.btn-outline{background:#fff;border-color:var(--line);color:var(--ink-2)}
.btn-outline:hover{border-color:#CFC2AC;background:#FCF9F3;color:var(--maroon)}
.btn-ghost{background:transparent;color:#CBBFA8;border-color:rgba(255,255,255,.18);font-size:12px}
.btn-ghost:hover{background:rgba(255,255,255,.07);color:#fff}
.btn-sm{padding:6px 11px;font-size:12px;border-radius:8px}
.btn-danger{background:#fff;color:var(--bad);border-color:#EBC9C6}
.btn-danger:hover{background:var(--bad-bg)}
.btn[disabled]{opacity:.55;cursor:not-allowed}

/* ==========================================================================
   Cards
   ========================================================================== */
.card{background:var(--paper);border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--shadow-1)}
.card-head{display:flex;align-items:flex-start;gap:12px;padding:18px 20px 14px}
.card-head .spacer{flex:1}
.card-body{padding:0 20px 18px}
.card-body.pad{padding:18px 20px}

/* KPI */
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:18px}
.kpi{
  background:#fff;border:1px solid var(--line);border-radius:var(--r);
  padding:17px 18px 15px;position:relative;overflow:hidden;box-shadow:var(--shadow-1);
}
.kpi::after{content:"";position:absolute;inset-inline-start:0;top:0;bottom:0;width:3px;background:var(--gold)}
.kpi.k-ok::after{background:var(--ok)}
.kpi.k-warn::after{background:var(--warn)}
.kpi.k-bad::after{background:var(--bad)}
.kpi-top{display:flex;align-items:center;gap:8px}
.kpi-icon{width:32px;height:32px;border-radius:9px;display:grid;place-items:center;background:var(--maroon-50);color:var(--maroon)}
.kpi-icon svg{width:17px;height:17px}
.kpi-label{font-size:12.5px;color:var(--muted);font-weight:500}
.kpi-value{font-size:31px;font-weight:600;letter-spacing:-1px;line-height:1.15;margin-top:10px;display:flex;align-items:baseline;gap:4px}
.kpi-value small{font-size:15px;font-weight:500;color:var(--muted);letter-spacing:0}
.kpi-foot{display:flex;align-items:center;gap:6px;margin-top:4px;font-size:11.5px;color:var(--muted)}
.trend{display:inline-flex;align-items:center;gap:3px;font-weight:600;font-size:11.5px}
.trend.up{color:var(--ok)}
.trend.down{color:var(--bad)}
.trend svg{width:12px;height:12px}

/* Charts */
.chart-wrap{padding:4px 6px 0}
.chart{width:100%;height:auto;overflow:visible}
.chart text{font-family:inherit;fill:#9C9186;font-size:10.5px}
.chart .grid-line{stroke:#EFE9DE;stroke-width:1}
.chart .axis{stroke:#E2D9C9;stroke-width:1}
.chart .value{fill:var(--maroon);font-weight:600;font-size:11px}

.legend{display:flex;flex-wrap:wrap;gap:10px 16px;padding:6px 4px 0}
.legend-item{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--ink-2)}
.legend-item i{width:8px;height:8px;border-radius:2px;display:block}
.legend-item b{font-weight:600;margin-inline-start:2px}

/* Bars list */
.bar-list{display:flex;flex-direction:column;gap:13px}
.bar-item{display:grid;grid-template-columns:1fr auto;gap:4px 10px;align-items:center}
.bar-item .label{font-size:12.5px}
.bar-item .val{font-size:12.5px;font-weight:600}
.bar-track{grid-column:1/-1;height:7px;border-radius:6px;background:#F2ECE1;overflow:hidden}
.bar-track i{display:block;height:100%;border-radius:6px;background:linear-gradient(90deg,#8C1B2C,#6E1220);transition:width .7s var(--ease)}
.bar-track i.good{background:linear-gradient(90deg,#4E9B76,#2F7D5B)}
.bar-track i.warn{background:linear-gradient(90deg,#D9A24A,#B0761A)}
.bar-track i.low{background:linear-gradient(90deg,#C9553F,#A8231D)}

/* ==========================================================================
   Table
   ========================================================================== */
.table-wrap{overflow:auto;border-radius:0 0 var(--r) var(--r)}
table.tbl{font-size:13px}
.tbl thead th{
  text-align:start;font-weight:500;font-size:11.5px;color:var(--muted);
  padding:10px 20px;background:#FBF8F2;border-bottom:1px solid var(--line);white-space:nowrap;
}
.tbl tbody td{padding:12px 20px;border-bottom:1px solid var(--line-soft);vertical-align:middle}
.tbl tbody tr:last-child td{border-bottom:0}
.tbl tbody tr{transition:background .15s}
.tbl tbody tr:hover{background:#FDFAF4}
.tbl tbody tr.clickable{cursor:pointer}
.tbl .strong{font-weight:500}
.tbl .sub{font-size:11.5px;color:var(--muted);margin-top:1px}

/* Score pill */
.score{display:inline-flex;align-items:center;gap:6px;font-weight:600;font-size:12.5px;font-variant-numeric:tabular-nums}
.score .dot{width:7px;height:7px;border-radius:50%}
.score.good{color:var(--ok)} .score.good .dot{background:var(--ok)}
.score.warn{color:var(--warn)} .score.warn .dot{background:var(--warn)}
.score.bad{color:var(--bad)} .score.bad .dot{background:var(--bad)}

/* Chips */
.chip{
  display:inline-flex;align-items:center;gap:5px;border-radius:20px;
  padding:3px 10px;font-size:11.5px;font-weight:500;white-space:nowrap;
  border:1px solid transparent;
}
.chip .d{width:6px;height:6px;border-radius:50%;background:currentColor;opacity:.85}
.chip-ok{background:var(--ok-bg);color:var(--ok);border-color:#CFE6D8}
.chip-warn{background:var(--warn-bg);color:var(--warn);border-color:#F0DCB8}
.chip-bad{background:var(--bad-bg);color:var(--bad);border-color:#F0CFCC}
.chip-info{background:var(--info-bg);color:var(--info);border-color:#CFE0EC}
.chip-muted{background:#F4F0E8;color:#7A7065;border-color:#E7DFD2}
.chip-gold{background:#F7F1DF;color:#8A7434;border-color:#E8DDBE}

/* Toolbar */
.toolbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.toolbar .field{min-width:170px}
.toolbar .spacer{flex:1}
.seg{display:inline-flex;background:#F4EFE6;border:1px solid var(--line);border-radius:9px;padding:3px;gap:2px}
.seg button{border:0;background:transparent;padding:5px 12px;border-radius:7px;font-size:12px;color:var(--muted)}
.seg button.active{background:#fff;color:var(--maroon);font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.06)}

/* Tabs */
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:16px;overflow:auto}
.tab{border:0;background:transparent;padding:10px 14px;font-size:13px;color:var(--muted);border-bottom:2px solid transparent;white-space:nowrap}
.tab:hover{color:var(--ink)}
.tab.active{color:var(--maroon);border-bottom-color:var(--maroon);font-weight:600}
.tab .n{background:#F2ECE0;border-radius:20px;padding:1px 7px;font-size:11px;margin-inline-start:5px;color:#6C6258}

/* ==========================================================================
   Forms
   ========================================================================== */
.field{display:flex;flex-direction:column;gap:6px}
.field > label,.f-label{font-size:12px;font-weight:500;color:var(--ink-2)}
.field .hint{font-size:11px;color:var(--muted)}
.input,.select,.textarea{
  width:100%;border:1px solid var(--line);background:#fff;border-radius:9px;
  padding:9px 12px;font-size:13px;outline:none;transition:.16s;color:var(--ink);
}
.input:focus,.select:focus,.textarea:focus{border-color:var(--gold-600);box-shadow:0 0 0 4px rgba(196,186,150,.16)}
.input::placeholder,.textarea::placeholder{color:#AEA396}
.textarea{min-height:88px;resize:vertical;line-height:1.7}
.select{appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23827870' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");background-repeat:no-repeat;background-position:left 10px center;padding-inline-start:28px}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.form-grid .full{grid-column:1/-1}
.form-actions{display:flex;justify-content:flex-end;gap:10px;padding-top:16px}

/* ==========================================================================
   Settings
   ========================================================================== */
.settings-grid{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:18px;align-items:start}
.settings-block{display:flex;flex-direction:column;gap:16px}
.settings-section{padding:22px}
.settings-section h3{font-size:14.5px;font-weight:600;display:flex;align-items:center;gap:8px}
.settings-section h3 svg{width:17px;height:17px;color:var(--gold-600)}
.settings-section .desc{font-size:12px;color:var(--muted);margin:4px 0 18px}
.logo-box{
  border:1px dashed #D8CCB7;border-radius:12px;background:
    repeating-conic-gradient(#FAF7F0 0% 25%, #F3EEE3 0% 50%) 50% / 16px 16px;
  display:grid;place-items:center;padding:22px 16px;gap:10px;text-align:center;
}
.logo-box img{max-width:230px;max-height:90px;object-fit:contain}
.logo-box .on-dark{background:linear-gradient(160deg,#6E1220,#45080F);padding:14px 22px;border-radius:10px}
.upload-row{display:flex;gap:8px;justify-content:center;flex-wrap:wrap;margin-top:6px}
.save-bar{
  position:sticky;bottom:14px;display:flex;align-items:center;gap:10px;
  background:rgba(255,255,255,.94);border:1px solid var(--line);border-radius:12px;
  padding:10px 14px;box-shadow:var(--shadow-2);backdrop-filter:blur(8px);margin-top:18px;
}
.save-bar .dot-unsaved{width:7px;height:7px;border-radius:50%;background:var(--warn)}

/* ==========================================================================
   Modal / Drawer / Toast
   ========================================================================== */
.overlay{position:fixed;inset:0;background:rgba(35,20,14,.42);backdrop-filter:blur(2px);z-index:80;animation:fade .2s var(--ease)}
@keyframes fade{from{opacity:0}to{opacity:1}}

.modal-host{position:fixed;inset:0;z-index:90;display:grid;place-items:center;padding:24px;pointer-events:none}
.modal{
  background:#fff;border-radius:18px;box-shadow:var(--shadow-3);
  width:min(980px,100%);max-height:92vh;display:flex;flex-direction:column;
  pointer-events:auto;animation:pop .22s var(--ease);overflow:hidden;
}
.modal.sm{width:min(520px,100%)}
@keyframes pop{from{opacity:0;transform:translateY(10px) scale(.985)}to{opacity:1;transform:none}}
.modal-head{display:flex;align-items:flex-start;gap:12px;padding:20px 24px 16px;border-bottom:1px solid var(--line)}
.modal-head h2{font-size:17px;font-weight:600}
.modal-head p{font-size:12px;color:var(--muted);margin-top:2px}
.modal-body{padding:20px 24px;overflow:auto;flex:1}
.modal-foot{display:flex;gap:10px;align-items:center;padding:14px 24px;border-top:1px solid var(--line);background:#FCFAF5}
.modal-foot .spacer{flex:1}
.close-x{margin-inline-start:auto;border:0;background:#F4EFE6;width:32px;height:32px;border-radius:8px;display:grid;place-items:center;color:var(--muted)}
.close-x:hover{background:#EDE5D7;color:var(--ink)}

.drawer{
  position:fixed;top:0;bottom:0;inset-inline-start:0;width:min(480px,94vw);
  background:#fff;z-index:95;box-shadow:var(--shadow-3);
  display:flex;flex-direction:column;animation:slideIn .25s var(--ease);
}
@keyframes slideIn{from{transform:translateX(-24px);opacity:.6}to{transform:none;opacity:1}}
.drawer-head{padding:20px 22px;border-bottom:1px solid var(--line);display:flex;align-items:flex-start;gap:10px}
.drawer-body{padding:20px 22px;overflow:auto;flex:1}
.drawer-foot{padding:14px 22px;border-top:1px solid var(--line);display:flex;gap:8px;background:#FCFAF5}

.toasts{position:fixed;bottom:22px;inset-inline-start:22px;z-index:120;display:flex;flex-direction:column;gap:8px}
.toast{
  display:flex;align-items:center;gap:10px;background:#221A16;color:#F7EFE2;
  padding:11px 16px;border-radius:10px;font-size:13px;box-shadow:var(--shadow-3);
  animation:toastIn .25s var(--ease);max-width:360px;
}
.toast .ic{width:18px;height:18px;color:var(--gold)}
.toast.ok .ic{color:#78C79A}
.toast.err .ic{color:#F09A93}
@keyframes toastIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

/* ==========================================================================
   Audit wizard
   ========================================================================== */
.wizard{display:grid;grid-template-columns:1fr 260px;gap:22px}
.wiz-main{min-width:0}
.wiz-side{position:sticky;top:0;align-self:start}
.wiz-step{margin-bottom:20px;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.wiz-step-head{display:flex;align-items:center;gap:10px;padding:12px 16px;background:#FBF8F2;border-bottom:1px solid var(--line);cursor:pointer}
.wiz-step-head .idx{width:24px;height:24px;border-radius:7px;background:var(--maroon);color:#F7E9CE;font-size:11.5px;display:grid;place-items:center;font-weight:600}
.wiz-step-head h4{font-size:13.5px;font-weight:600;flex:1}
.wiz-step-head .w{font-size:11px;color:var(--muted)}
.wiz-step-head .chev{color:var(--muted);transition:.2s}
.wiz-step.collapsed .chev{transform:rotate(-90deg)}
.wiz-step.collapsed .wiz-items{display:none}
.wiz-items{padding:4px 0}
.wiz-item{display:grid;grid-template-columns:1fr 220px;gap:14px;align-items:center;padding:10px 16px;border-bottom:1px solid var(--line-soft)}
.wiz-item:last-child{border-bottom:0}
.wiz-item .t{font-size:12.5px;line-height:1.55}
.wiz-item .t small{display:block;color:var(--muted);font-size:11px}
.rate{display:inline-flex;background:#F5F0E6;border-radius:8px;padding:2px;gap:2px;justify-self:end}
.rate label{position:relative;cursor:pointer}
.rate input{position:absolute;opacity:0;pointer-events:none}
.rate span{display:block;padding:4px 10px;border-radius:6px;font-size:11.5px;color:var(--muted);transition:.15s}
.rate input:checked + span{background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.08);font-weight:600}
.rate input[value="100"]:checked + span{color:var(--ok)}
.rate input[value="50"]:checked + span{color:var(--warn)}
.rate input[value="0"]:checked + span{color:var(--bad)}
.rate .na{font-size:11.5px;color:#A0968A;padding:4px 8px;align-self:center}

.score-panel{border:1px solid var(--line);border-radius:12px;padding:16px;background:linear-gradient(180deg,#FCFAF5,#fff);text-align:center}
.score-ring{position:relative;width:132px;height:132px;margin:8px auto 6px}
.score-ring svg{transform:rotate(-90deg)}
.score-ring .val{position:absolute;inset:0;display:grid;place-items:center;font-size:30px;font-weight:600;letter-spacing:-1px}
.score-ring .val small{font-size:12px;font-weight:500;color:var(--muted)}
.score-panel .lbl{font-size:12px;color:var(--muted)}
.score-panel .est{display:flex;justify-content:space-between;font-size:11.5px;color:var(--muted);padding:8px 2px;border-top:1px dashed var(--line);margin-top:8px}
.wiz-meta{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-bottom:16px}

/* ==========================================================================
   Misc components
   ========================================================================== */
.avatar-sm{width:28px;height:28px;border-radius:50%;background:#F3ECDD;color:#7A6335;display:grid;place-items:center;font-size:11px;font-weight:600;flex:0 0 28px;border:1px solid #E7DCC5}
.branch-cell{display:flex;align-items:center;gap:10px}
.branch-cell .code{font-size:10.5px;color:var(--muted)}

.empty{text-align:center;padding:44px 20px;color:var(--muted)}
.empty svg{width:38px;height:38px;margin:0 auto 10px;opacity:.5}
.empty h4{font-size:14px;color:var(--ink-2);margin-bottom:3px}

.pagination{display:flex;align-items:center;gap:8px;padding:12px 20px;border-top:1px solid var(--line-soft);font-size:12px;color:var(--muted)}
.pagination .spacer{flex:1}
.page-btn{border:1px solid var(--line);background:#fff;border-radius:7px;width:28px;height:28px;display:grid;place-items:center;font-size:12px}
.page-btn.active{background:var(--maroon);color:#fff;border-color:var(--maroon)}
.page-btn:disabled{opacity:.4}

.stat-line{display:flex;align-items:center;justify-content:space-between;padding:9px 0;border-bottom:1px dashed var(--line-soft);font-size:12.5px}
.stat-line:last-child{border-bottom:0}
.stat-line b{font-weight:600}

.note{display:flex;gap:9px;padding:11px 13px;background:#FBF6E9;border:1px solid #EADFC4;border-radius:10px;font-size:12px;color:#6F5A2C}
.note svg{width:16px;height:16px;flex:0 0 16px;margin-top:2px}

.only-mobile{display:none}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width:1180px){
  .kpis{grid-template-columns:repeat(2,1fr)}
  .settings-grid{grid-template-columns:1fr}
  .search{width:220px}
}
@media (max-width:980px){
  .sidebar{position:fixed;inset-inline-start:0;transform:translateX(100%);transition:.25s var(--ease)}
  .sidebar.open{transform:none;box-shadow:var(--shadow-3)}
  .only-mobile{display:grid}
  .view{padding:20px}
  .topbar{padding:0 18px}
  .wizard{grid-template-columns:1fr}
  .wiz-side{position:static}
  .settings-grid{grid-template-columns:1fr}
}
@media (max-width:720px){
  .kpis{grid-template-columns:1fr 1fr;gap:12px}
  .kpi-value{font-size:25px}
  .search{display:none}
  .user-text{display:none}
  .form-grid{grid-template-columns:1fr}
  .topbar{height:66px}
  .modal-host{padding:10px}
  .wiz-item{grid-template-columns:1fr}
  .rate{justify-self:start}
}
@media print{
  .sidebar,.topbar,.foot,.toolbar,.no-print{display:none!important}
  .view{padding:0}
  body{background:#fff}
  .card{break-inside:avoid;box-shadow:none}
}

/* ==========================================================================
   SNAM 2.0 — new components
   ========================================================================== */
.page-actions{display:flex;gap:10px;justify-content:flex-end;margin-bottom:16px;flex-wrap:wrap}
.grid-2-1{display:grid;grid-template-columns:1.55fr 1fr;gap:16px;margin-bottom:16px}
.coverage-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.coverage-cell{border:1px solid var(--line);border-radius:11px;padding:12px 14px;background:#FCFAF5}

/* Region tree */
.region-card{overflow:hidden}
.region-head{display:flex;align-items:center;gap:12px;padding:16px 20px;background:linear-gradient(180deg,#FCFAF5,#fff);border-bottom:1px solid var(--line-soft)}
.region-badge{width:38px;height:38px;border-radius:11px;display:grid;place-items:center;color:#F7EEDC;flex:0 0 38px}
.region-body{padding:4px 20px 16px}
.city-block{padding:14px 0;border-bottom:1px dashed var(--line-soft)}
.city-block:last-child{border-bottom:0;padding-bottom:0}
.city-head{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.city-name{font-size:13.5px;font-weight:600;color:var(--ink)}
.city-add{color:var(--maroon);border-color:var(--line)}
.branch-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px}
.branch-tile{border:1px solid var(--line);border-radius:12px;padding:12px 13px;background:#fff;cursor:pointer;transition:.16s}
.branch-tile:hover{border-color:#D6C8B1;box-shadow:0 6px 18px -12px rgba(46,32,20,.35);transform:translateY(-1px)}
.branch-ico{width:32px;height:32px;border-radius:9px;background:var(--maroon-50);color:var(--maroon);display:grid;place-items:center;flex:0 0 32px}
.branch-meta{display:flex;justify-content:space-between;margin-top:9px;padding-top:8px;border-top:1px dashed var(--line-soft);font-size:11px;color:var(--muted)}
.city-empty{font-size:12px;color:var(--muted);background:#FBF8F2;border:1px dashed var(--line);border-radius:10px;padding:12px 14px}
.link-btn{border:0;background:none;color:var(--maroon);font-weight:600;font-size:12px;padding:0;text-decoration:underline}

/* Switch */
.switch{display:inline-flex;align-items:center;gap:7px;border:0;background:none;padding:0;font-size:11.5px;color:var(--muted)}
.switch i{width:32px;height:18px;border-radius:20px;background:#E3DACB;position:relative;transition:.18s;flex:0 0 32px}
.switch i::after{content:"";position:absolute;top:2px;inset-inline-start:2px;width:14px;height:14px;border-radius:50%;background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.2);transition:.18s}
.switch.on{color:var(--ok);font-weight:600}
.switch.on i{background:var(--ok)}
.switch.on i::after{inset-inline-start:16px}
.row-off{opacity:.55}
.icon-btn.sm{width:30px;height:30px;border-radius:8px}

/* Wizard */
.modal.full{width:min(1120px,100%);height:min(92vh,900px)}
.wiz-progress{padding:14px 24px 0;background:#fff}
.wiz-steps{display:flex;gap:2px;overflow-x:auto;padding-bottom:10px;scrollbar-width:none}
.wiz-steps::-webkit-scrollbar{display:none}
.wiz-dot{display:flex;flex-direction:column;align-items:center;gap:5px;min-width:74px;flex:1;cursor:pointer;opacity:.55;transition:.18s}
.wiz-dot i{width:26px;height:26px;border-radius:50%;background:#F0E9DC;color:#8A7E6E;font-style:normal;font-size:11.5px;display:grid;place-items:center;font-weight:600;border:1px solid transparent}
.wiz-dot span{font-size:10.5px;color:var(--muted);white-space:nowrap;max-width:90px;overflow:hidden;text-overflow:ellipsis}
.wiz-dot.active{opacity:1}
.wiz-dot.active i{background:var(--maroon);color:#F7E9CE;box-shadow:0 0 0 4px rgba(110,18,32,.1)}
.wiz-dot.active span{color:var(--maroon);font-weight:600}
.wiz-dot.done i{background:#EAF5EF;color:var(--ok);border-color:#CFE6D8}
.wiz-bar{height:3px;background:#F0E9DC;border-radius:4px;overflow:hidden}
.wiz-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--maroon),#A8231D);transition:width .3s var(--ease)}
.wiz-sec-head{display:flex;align-items:center;gap:12px;margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid var(--line)}
.wiz-sec-head h3{font-size:16px;font-weight:600}
.wiz-items{border:1px solid var(--line);border-radius:12px;overflow:hidden}
.wiz-item{display:grid;grid-template-columns:30px 1fr 260px;gap:12px;align-items:start;padding:12px 14px;border-bottom:1px solid var(--line-soft);background:#fff}
.wiz-item:last-child{border-bottom:0}
.wiz-item:hover{background:#FDFBF7}
.wi-index{width:24px;height:24px;border-radius:7px;background:#F5EFE4;color:#8A7E6E;display:grid;place-items:center;font-size:11px;font-weight:600;margin-top:1px}
.wi-text{font-size:12.5px;line-height:1.6}
.wi-note{display:block;width:100%;border:1px solid #E7DCC6;background:#FFFEFB;border-radius:10px;font-size:12.5px;padding:9px 11px;margin-top:8px;outline:none;color:var(--ink);min-height:40px;transition:.15s}
.wi-note::placeholder{color:#A99C86}
.wi-note:focus{border-color:#C9A45E;background:#fff;box-shadow:0 0 0 3px rgba(201,164,94,.14)}
.wi-actions{display:flex;align-items:center;gap:6px;justify-content:flex-end;flex-wrap:wrap}
.rate{display:inline-flex;background:#F5F0E6;border-radius:8px;padding:2px;gap:2px}
.rate label{position:relative;cursor:pointer}
.rate input{position:absolute;opacity:0;pointer-events:none}
.rate span{display:block;min-width:26px;text-align:center;padding:4px 6px;border-radius:6px;font-size:11.5px;color:var(--muted);transition:.15s}
.rate input:checked + span{background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.09);font-weight:700;color:var(--maroon)}
.rate input[value="0"]:checked + span{color:var(--bad)}
.rate input[value="4"]:checked + span{color:var(--ok)}
.photo-btn{width:34px;height:34px;border-radius:8px;border:1px dashed #D6C9B4;display:grid;place-items:center;color:#9C9186;cursor:pointer;overflow:hidden;background:#FCFAF5;flex:0 0 34px}
.photo-btn.has{border-style:solid;border-color:var(--line)}
.photo-btn img{width:100%;height:100%;object-fit:cover}
.photo-del{width:22px;height:22px;border-radius:6px;border:1px solid #EBC9C6;background:#fff;color:var(--bad);display:grid;place-items:center;padding:0}
.final-grid{display:grid;grid-template-columns:1fr 300px;gap:22px;align-items:start}
.score-ring{position:relative}

/* Reports */
.report-sheet{padding:34px 40px;max-width:1000px;margin:0 auto}
.report-head{display:flex;align-items:flex-start;gap:20px;border-bottom:2px solid var(--maroon);padding-bottom:18px}
.report-logo{width:140px;height:auto;background:linear-gradient(150deg,#6E1220,#45080F);padding:10px 14px;border-radius:10px}
.report-head h2{font-size:21px;font-weight:600;margin-top:2px}
.report-meta{display:grid;grid-template-columns:1.2fr 300px;gap:20px;margin-top:20px}
.report-score{border:1px solid var(--line);border-radius:12px;padding:14px 16px;background:#FCFAF5}
.big-score{font-size:36px;font-weight:600;letter-spacing:-1px;line-height:1.2}
.big-score span{font-size:14px;font-weight:500;color:var(--muted);margin-inline-start:4px;letter-spacing:0}
.rep-h{font-size:14px;font-weight:600;margin:24px 0 10px;display:flex;align-items:center;gap:7px}
.chart-box{border:1px solid var(--line);border-radius:10px;padding:6px}
.two-col{display:grid;grid-template-columns:1fr 1fr;gap:24px}
.mini-row{display:flex;gap:8px;padding:7px 0;border-bottom:1px dashed var(--line-soft);font-size:12px;align-items:flex-start}
.point-list{margin:0;padding:0 0 0 0;list-style:none;font-size:12px}
.point-list li{position:relative;padding:6px 22px 6px 0;border-bottom:1px dashed var(--line-soft);color:var(--ink-2);display:flex;gap:8px;justify-content:space-between}
.point-list li::before{content:"";position:absolute;inset-inline-start:0;top:12px;width:7px;height:7px;border-radius:50%}
.point-list.good li::before{background:var(--ok)}
.point-list.bad li::before{background:var(--bad)}
.point-list li b{color:var(--bad);font-size:11px;white-space:nowrap}
.photo-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px}
.photo-grid figure{margin:0;border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#FCFAF5}
.photo-grid img{width:100%;height:130px;object-fit:cover;display:block}
.photo-grid figcaption{font-size:10.5px;color:var(--muted);padding:6px 8px;line-height:1.4}
.signatures{display:flex;justify-content:space-between;gap:30px;margin-top:34px;padding-top:14px;border-top:1px solid var(--line);font-size:11.5px;color:var(--muted)}
.signatures div{flex:1}
.signatures span{display:inline-block;margin-top:22px;border-top:1px dashed #CFC2AC;padding-top:4px;min-width:160px;color:var(--ink-2);font-weight:500}
.report-foot{display:flex;justify-content:space-between;margin-top:26px;padding-top:12px;border-top:1px solid var(--line);font-size:11px;color:var(--muted)}
table.bordered{border:1px solid var(--line);border-radius:10px;overflow:hidden}
table.bordered thead th{background:#FBF8F2}
table.bordered tbody td{padding:9px 14px}

/* Drawers */
.drawer-score{display:flex;align-items:center;gap:16px;background:#FCFAF5;border:1px solid var(--line);border-radius:12px;padding:14px}
.ring-val{position:absolute;inset:0;display:grid;place-items:center;font-weight:600;font-size:19px}

/* Company card */
.company-card{background:linear-gradient(160deg,#6E1220,#45080F);border-radius:12px;padding:18px;color:#F7EFE0;margin-top:14px}
.company-card img{width:130px;height:auto;margin-bottom:12px}
.cc-tag{font-size:11.5px;opacity:.8}
.cc-service{font-size:15px;font-weight:600;color:#E6D6AE;margin-top:2px}
.cc-line{height:1px;background:rgba(196,186,150,.25);margin:12px 0}
.cc-info{font-size:11.5px;opacity:.85;margin-bottom:2px}

/* Tabbar (mobile) */
.tabbar{display:none}

/* ==========================================================================
   Responsive 2.0
   ========================================================================== */
@media (max-width:1180px){
  .grid-2-1{grid-template-columns:1fr}
  .coverage-grid{grid-template-columns:repeat(2,1fr)}
  .report-meta{grid-template-columns:1fr}
}
@media (max-width:980px){
  .sidebar{position:fixed;inset-inline-start:0;transform:translateX(105%);transition:.25s var(--ease);height:100dvh}
  .sidebar.open{transform:none;box-shadow:var(--shadow-3)}
  .only-mobile{display:grid}
  .view{padding:18px 16px 90px}
  .topbar{padding:0 16px;height:64px}
  .wiz-item{grid-template-columns:26px 1fr;gap:8px 10px}
  .wi-actions{grid-column:1/-1;justify-content:flex-start;padding-inline-start:36px}
  .final-grid{grid-template-columns:1fr}
  .report-sheet{padding:22px 18px}
  .report-head{flex-wrap:wrap}
  .report-logo{width:120px}
  .two-col{grid-template-columns:1fr}
  .tabbar{display:flex;position:fixed;bottom:0;inset-inline:0;background:rgba(255,255,255,.96);border-top:1px solid var(--line);z-index:70;padding:6px 4px calc(6px + env(safe-area-inset-bottom));backdrop-filter:blur(12px)}
  .tabbar-item{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;font-size:10px;color:#8A8076;padding:5px 2px;border-radius:8px}
  .tabbar-item.active{color:var(--maroon);font-weight:600}
  .tabbar-item.active svg{stroke-width:2.1}
  .modal-host{padding:0;align-items:flex-end}
  .modal{width:100%;border-radius:18px 18px 0 0;max-height:94dvh}
  .modal.full{height:94dvh;max-height:94dvh}
  .drawer{width:100%;inset-inline:0;border-radius:18px 18px 0 0;top:6dvh}
  .foot{display:none}
}
@media (max-width:720px){
  .kpis{grid-template-columns:1fr 1fr;gap:10px}
  .kpi{padding:13px 14px}
  .kpi-value{font-size:24px}
  .search{display:none}
  .user-text{display:none}
  .topbar{gap:8px}
  .page-id h1{font-size:17px}
  .page-id p{display:none}
  .form-grid{grid-template-columns:1fr}
  .coverage-grid{grid-template-columns:1fr 1fr;gap:8px}
  .region-body{padding:4px 14px 14px}
  .region-head{padding:13px 14px;flex-wrap:wrap}
  .branch-grid{grid-template-columns:1fr}
  .report-sheet{padding:18px 14px}
  .wiz-item{padding:10px}
  .wiz-progress{padding:10px 14px 0}
  .wiz-dot{min-width:56px}
  .wiz-dot span{font-size:9px;max-width:60px}
  .modal-head,.modal-body,.modal-foot{padding-inline:16px}
  .signatures{flex-direction:column;gap:14px}
  .report-foot{flex-direction:column;gap:4px}
}
@media print{
  .sidebar,.topbar,.foot,.toolbar,.no-print,.tabbar,.toasts{display:none!important}
  .view{padding:0}
  body{background:#fff;font-size:12px}
  .card{box-shadow:none;border:0}
  .report-sheet{padding:0;max-width:none}
  .chart-box{break-inside:avoid}
  .report-head img{background:#fff!important;filter:none}
  @page{size:A4;margin:14mm}
}

/* ==========================================================================
   LUXURY THEME — سنام الفخم
   ========================================================================== */
:root{
  --maroon:#5B0F1B;
  --maroon-800:#47080F;
  --maroon-900:#320409;
  --maroon-50:#FAF2F1;
  --gold:#C9A45E;
  --gold-600:#A67F3C;
  --gold-soft:#F3E9D2;
  --paper:#FFFDF9;
  --sand:#F6F1E7;
  --ink:#1E1713;
  --ink-2:#4A3E34;
  --muted:#847767;
  --line:#E9DDC7;
  --line-soft:#F2E9DA;
  --sidebar-w:292px;
  --shadow-1:0 1px 2px rgba(74,44,20,.04);
  --shadow-2:0 18px 40px -30px rgba(74,44,20,.45);
  --shadow-3:0 40px 90px -40px rgba(40,20,8,.55);
}

html{background:#F6F1E7}
body{
  font-family:"Almarai","IBM Plex Sans Arabic",system-ui,sans-serif;
  background:
    radial-gradient(90% 55% at 100% 0%, rgba(201,164,94,.10) 0%, rgba(201,164,94,0) 60%),
    radial-gradient(70% 45% at 0% 100%, rgba(91,15,27,.05) 0%, rgba(91,15,27,0) 60%),
    #F6F1E7;
  color:var(--ink);
  letter-spacing:0;
}
h1,h2,h3,h4,.section-title,.brand-text strong,.report-head h2{
  font-family:"Amiri","Almarai",serif;
  letter-spacing:0;
}

/* Sidebar */
.sidebar{
  width:var(--sidebar-w);flex:0 0 var(--sidebar-w);
  background:
    radial-gradient(100% 60% at 100% 0%, rgba(201,164,94,.14) 0%, rgba(201,164,94,0) 55%),
    linear-gradient(180deg,#4E0C15 0%,#3A070D 55%,#2C0408 100%);
  padding:26px 20px 20px;
  border-inline-end:1px solid rgba(201,164,94,.18);
  box-shadow:inset 1px 0 0 rgba(255,255,255,.03);
}
.brand{padding:2px 2px 22px;border-bottom:1px solid rgba(201,164,94,.22);gap:16px}
.brand-logo{width:186px;filter:drop-shadow(0 10px 22px rgba(0,0,0,.35))}
.brand-text span{font-size:11px;color:#C9B896;letter-spacing:.3px}
.brand-text em{color:var(--gold);font-size:10.5px;letter-spacing:2px;font-weight:700}
.brand-text em::before{background:linear-gradient(90deg,transparent,var(--gold));width:22px}
.nav{margin-top:20px;gap:2px}
.nav-label{font-size:9.5px;letter-spacing:2px;color:#9A8257;padding:16px 14px 7px;font-weight:700}
.nav-item{padding:10px 13px;border-radius:10px;color:#D9C9B0;font-size:13px;letter-spacing:.1px}
.nav-item svg{opacity:.75;color:#C9A45E}
.nav-item:hover{background:rgba(201,164,94,.07);color:#FFF7E8}
.nav-item.active{
  background:linear-gradient(90deg,rgba(201,164,94,.16),rgba(201,164,94,.03));
  border-color:rgba(201,164,94,.34);color:#FFF8EA;box-shadow:0 8px 18px -16px rgba(0,0,0,.9);
}
.nav-item.active::before{background:linear-gradient(180deg,#E4C88C,#B08A45);width:2.5px}
.nav-item .count{background:rgba(201,164,94,.16);color:#E9D3A7}
.nav-item.active .count{background:var(--gold);color:#3A070D}
.sidebar-foot{border-top-color:rgba(201,164,94,.18);gap:12px}
.compliance-mini{color:#BFAE90;font-size:11px;letter-spacing:.4px}
.compliance-mini strong{font-family:"Amiri",serif;font-size:23px;color:#FFF6E3;font-weight:700}
.mini-bar{height:4px;background:rgba(255,255,255,.09)}
.mini-bar i{background:linear-gradient(90deg,#B08A45,#E8CE96)}
.btn-ghost{color:#BDA983;border-color:rgba(201,164,94,.25);letter-spacing:.2px}
.btn-ghost:hover{background:rgba(201,164,94,.1);color:#FFF6E3;border-color:rgba(201,164,94,.45)}

/* Topbar */
.topbar{
  height:82px;padding:0 34px;
  background:rgba(252,248,240,.88);
  border-bottom:1px solid #E8DCC6;
  box-shadow:0 1px 0 rgba(255,255,255,.6) inset;
}
.page-id h1{font-size:27px;font-weight:700;color:#33121A;line-height:1.2}
.page-id p{font-size:11.5px;color:#8B7B67;letter-spacing:.4px;margin-top:2px}
.search{width:320px;background:#FBF6EC;border-color:#E9DDC7;border-radius:11px;padding:9px 13px}
.search input{font-size:12.5px}
.search kbd{background:#fff;color:#A08C6A;border-color:#E9DDC7}
.icon-btn{background:#FFFDF8;border-color:#E9DDC7;color:#6F5A44}
.icon-btn:hover{background:#FBF5E8;border-color:#D8BE8A;color:var(--maroon)}
.avatar{background:linear-gradient(150deg,#5B0F1B,#8A2A3A);color:#F3DFB6;border:1px solid #C9A45E;box-shadow:0 0 0 3px rgba(201,164,94,.12)}
.user-text strong{font-size:12px;letter-spacing:.2px}
.user-text span{font-size:10.5px;color:#9A8A74}
.user{border-inline-start-color:#E9DDC7}

/* View rhythm */
.view{padding:30px 34px 10px}
.foot{color:#A3947E;letter-spacing:.3px}

/* Cards */
.card{
  background:linear-gradient(180deg,#FFFEFA 0%,#FFFCF4 100%);
  border:1px solid #EADFC9;border-radius:18px;
  box-shadow:0 22px 45px -38px rgba(74,44,20,.55),0 1px 0 rgba(255,255,255,.8) inset;
}
.card-head{padding:20px 22px 14px}
.section-title{font-size:19px;font-weight:700;color:#2F141A}
.section-sub{font-size:11px;color:#907F68;letter-spacing:.3px;margin-top:3px}

/* KPI */
.kpi{
  background:linear-gradient(160deg,#FFFEFB 0%,#FBF5E9 100%);
  border:1px solid #EADFC9;border-radius:16px;padding:18px 20px 16px;
  box-shadow:0 24px 46px -40px rgba(74,44,20,.7);
}
.kpi::after{width:2px;background:linear-gradient(180deg,#D8B979,#A67F3C)}
.kpi-top{gap:9px}
.kpi-icon{
  width:34px;height:34px;border-radius:50%;
  background:linear-gradient(150deg,#F7EEDC,#F1E3C8);color:#8A6A2F;
  border:1px solid rgba(201,164,94,.35);
}
.kpi-label{font-size:10.5px;letter-spacing:.9px;color:#8B7B67;font-weight:500}
.kpi-value{font-family:"Amiri",serif;font-size:38px;font-weight:700;letter-spacing:-.5px;margin-top:10px;color:#2B1016}
.kpi-value small{font-size:14px;color:#9A8A74}
.kpi-foot{font-size:10.5px;color:#8F7F69;letter-spacing:.2px}
.trend{font-size:10.5px;letter-spacing:.2px}

/* Buttons */
.btn{border-radius:10px;letter-spacing:.2px;font-weight:600}
.btn-primary{
  background:linear-gradient(180deg,#611323 0%,#420810 100%);
  border:1px solid #7A5A2C;
  box-shadow:0 1px 0 rgba(255,255,255,.14) inset,0 12px 24px -18px rgba(60,10,20,.9);
  color:#FBEFD8;
}
.btn-primary:hover{background:linear-gradient(180deg,#6E1728 0%,#4A0A12 100%)}
.btn-outline{background:#FFFDF8;border-color:#E5D8C0;color:#4A3A2C}
.btn-outline:hover{border-color:#C9A45E;background:#FBF4E4;color:#5B0F1B}
.btn-gold{background:linear-gradient(180deg,#DFC48C,#C4A05A);color:#3A1016;border-color:#B08C45}
.btn-danger{background:#FFF9F7;border-color:#EBC9C6;color:#A8231D}

/* Tables */
.tbl thead th{
  background:transparent;color:#9A8A72;font-size:10px;letter-spacing:1.2px;font-weight:700;
  border-bottom:1px solid #E7DAC2;padding:11px 20px;
}
.tbl tbody td{border-bottom:1px solid #F3EADA;padding:13px 20px}
.tbl tbody tr:hover{background:#FCF6E9}
.tbl .strong{color:#2C1A1A;font-weight:600}

/* Chips */
.chip{border-radius:30px;letter-spacing:.2px;font-weight:600;font-size:10.5px;padding:4px 11px}
.chip-gold{background:#F8F0DD;color:#8A6A2F;border-color:#E9D9B6}
.chip-muted{background:#F6F1E6;color:#84735C;border-color:#E9DDC7}
.chip-ok{background:#EDF6F0;color:#2C6E4F;border-color:#D5E8DC}
.chip-warn{background:#FCF4E3;color:#A1711C;border-color:#EFDCB4}
.chip-bad{background:#FBEDEB;color:#9E211C;border-color:#EFCFCA}

/* Section accents */
.coverage-cell{background:linear-gradient(180deg,#FFFDF8,#FBF6EA);border-color:#EDE1CB;border-radius:12px}
.region-head{background:linear-gradient(180deg,#FFFDF8,#FBF6EA)}
.region-badge{border-radius:12px;box-shadow:0 8px 18px -14px rgba(0,0,0,.6)}
.branch-tile{background:#FFFDF8;border-color:#EDE1CB;border-radius:13px}
.branch-tile:hover{border-color:#D9BE8B;box-shadow:0 18px 34px -28px rgba(74,44,20,.65)}
.branch-ico{background:#F8F0DD;color:#8A6A2F}
.city-name{font-family:"Amiri",serif;font-size:16px;font-weight:700;color:#3A1A1E}

/* Wizard */
.modal{border-radius:20px;border:1px solid #E7D9C0;background:#FFFDF8}
.modal-head{background:linear-gradient(180deg,#FFFDF8,#FBF6EA);border-bottom-color:#EADFC9}
.modal-head h2{font-family:"Amiri",serif;font-size:21px}
.modal-foot{background:#FBF6EA;border-top-color:#EADFC9}
.wiz-dot i{background:#F4EBD9;color:#8C7857}
.wiz-dot.active i{background:linear-gradient(150deg,#611323,#420810);color:#F0D9AE;box-shadow:0 0 0 4px rgba(201,164,94,.15)}
.wiz-bar i{background:linear-gradient(90deg,#A67F3C,#D8B979)}
.wiz-items{border-color:#EADFC9;border-radius:14px}
.wiz-item{background:#FFFEFB}
.wiz-item:hover{background:#FDF8ED}
.wi-index{background:#F7EEDC;color:#8A6A2F}
.rate{background:#F5EDDD}
.rate input:checked + span{color:#5B0F1B}
.photo-btn{background:#FFFDF8;border-color:#DCC9A6;color:#A08C6A}

/* Report */
.report-sheet{border-top:3px solid #C9A45E;background:#FFFEFA}
.report-head{border-bottom:1.5px solid #5B0F1B}
.report-head h2{font-size:26px;color:#33121A}
.report-score{background:linear-gradient(180deg,#FFFDF8,#FBF5E7);border-color:#EADFC9}
.big-score{font-family:"Amiri",serif;font-size:44px}
.rep-h{font-family:"Amiri",serif;font-size:17px;font-weight:700;color:#33121A}
.point-list li{color:#4A3A2C}
.signatures span{border-top-color:#D9C6A2}

/* Tabbar */
.tabbar{background:rgba(255,253,248,.97);border-top-color:#E9DDC7}
.tabbar-item{color:#8C7B64}
.tabbar-item.active{color:#5B0F1B}
.tabbar-item.active::before{content:"";position:absolute;top:0;width:22px;height:2px;border-radius:2px;background:#C9A45E}
.tabbar-item{position:relative}

/* Scrollbar */
::-webkit-scrollbar-thumb{background:#DDCFB6;border-color:#F6F1E7}

/* Small refinements */
.chip .d{opacity:1}
.score{font-family:"Almarai",sans-serif;letter-spacing:.2px}
.bar-track{background:#F3EAD9}
.link-btn{color:#8A6A2F}
.note{background:linear-gradient(180deg,#FBF4E3,#FAF0DA);border-color:#EAD9B7;color:#6E552A}
.note svg{color:#A67F3C}
.empty svg{color:#C9A45E}

/* Layout hardening (large datasets & mobile) */
.card,.kpi,.grid-2-1>*,.kpis>*,.region-card,.city-block,.branch-tile{min-width:0}
.table-wrap{max-width:100%}
.brand-text{min-width:0}
.brand-text span{font-size:10.5px;line-height:1.5;display:block}
.brand-logo{max-width:100%}
@media (max-width:720px){
  .page-id h1{font-size:20px}
  .topbar{height:64px;padding:0 12px;gap:8px}
  .topbar-tools{gap:6px}
  .view{padding:16px 12px 92px}
  .kpi-value{font-size:30px}
}

/* Ring/value alignment */
.score-ring .val{display:flex;align-items:baseline;justify-content:center;gap:3px}
.score-ring .val small{font-size:12px;font-weight:500;color:var(--muted)}
.kpi-value small{align-self:baseline;margin-inline-start:2px}
.brand-text span{line-height:1.5}

.branch-grid{align-items:stretch}
.branch-tile{display:flex;flex-direction:column;justify-content:space-between;min-height:104px}
.branch-tile .strong{line-height:1.45}

/* Approval & seal */
.approval-bar{display:flex;align-items:center;gap:10px;margin:0 0 14px;padding:10px 14px;background:#FBF6EA;border:1px solid #EADFC9;border-radius:12px;flex-wrap:wrap}
.report-sheet{position:relative}
.report-stamp{position:absolute;top:16px;left:20px;right:auto;width:126px;transform:rotate(-7deg);opacity:.96;pointer-events:none;z-index:2}
.seal{width:100%;height:auto}
.report-qr{display:flex;align-items:center;gap:10px;margin-top:22px;padding-top:12px;border-top:1px dashed #E3D6BC}
.report-qr svg{width:74px;height:74px;background:#fff;padding:3px;border:1px solid #EADFC9;border-radius:6px}
.report-qr span{font-size:10.5px;color:var(--muted)}
.demo-banner{background:#FBF3E2;border-bottom:1px solid #EAD9B7;color:#8A6A2F;font-size:11.5px;padding:6px 34px;text-align:center}
@media (max-width:720px){
  .report-stamp{width:92px;top:8px;left:8px;right:auto}
  .report-qr{gap:8px}
}
@media print{
  .approval-bar{display:none!important}
  .report-stamp{width:120px}
  .report-qr svg{width:70px;height:70px}
}

/* Sidebar drawer behaviour */
.side-backdrop{position:fixed;inset:0;background:rgba(32,16,10,.48);z-index:38;backdrop-filter:blur(1px)}
body.side-open{overflow:hidden}
@media (min-width:981px){.side-backdrop{display:none!important}}
@media (max-width:980px){
  .sidebar{overflow-y:auto;padding-bottom:calc(24px + env(safe-area-inset-bottom))}
  .sidebar .nav{overflow:visible}
  .tabbar-item{border:0;background:transparent}
}

/* Full report */
.rep-title{font-family:"Amiri",serif;font-size:20px;font-weight:700;color:#33121A;margin:26px 0 12px;padding-bottom:6px;border-bottom:1px solid #EADFC9}
.rep-section{margin-bottom:16px}
.rep-sec-head{display:flex;align-items:center;gap:10px;margin:0 0 6px}
.rep-sec-head h3{font-size:14px;font-weight:600;color:#3A1A1E}
.rep-sec-head .chip{margin-inline-start:auto}
table.compact thead th{padding:6px 10px;font-size:9.5px;letter-spacing:.6px}
table.compact tbody td{padding:6px 10px;font-size:11px;line-height:1.5;border-bottom:1px solid #F4ECDC}
table.compact tr.row-weak{background:#FDF6EC}
.report-end{display:flex;align-items:flex-end;justify-content:space-between;gap:20px;margin-top:26px;padding-top:14px;border-top:1px solid #EADFC9}
.stamp-block{text-align:center;width:150px}
.stamp-block .seal{width:150px}
.stamp-block.pending .seal{opacity:.45;filter:grayscale(.55)}
.stamp-cap{font-size:10px;color:var(--muted);margin-top:4px}
.photo-grid.appendix{grid-template-columns:repeat(auto-fill,minmax(200px,1fr))}
@media print{
  .rep-section{break-inside:avoid}
  table.compact tr{break-inside:avoid}
  .report-end{break-inside:avoid}
  .stamp-block{width:130px}
}

/* Dictation */
.wi-note-row{display:flex;align-items:center;gap:8px;margin-top:2px}
.wi-note-row .wi-note{margin-top:0;flex:1}
.mic-btn{width:28px;height:28px;border-radius:8px;border:1px solid #E5D8C0;background:#FFFDF8;color:#8A6A2F;display:grid;place-items:center;flex:0 0 28px;transition:.18s}
.mic-btn:hover{border-color:#C9A45E;background:#FBF4E4}
.mic-btn.rec{background:#A8231D;border-color:#A8231D;color:#fff;animation:pulse 1.2s infinite}
@keyframes pulse{0%{box-shadow:0 0 0 0 rgba(168,35,29,.35)}70%{box-shadow:0 0 0 8px rgba(168,35,29,0)}100%{box-shadow:0 0 0 0 rgba(168,35,29,0)}}
.ta-wrap{position:relative}
.mic-btn.floating{position:absolute;bottom:8px;inset-inline-end:8px;z-index:2}
.ta-wrap .textarea{padding-inline-end:44px}

/* Nav section separation */
.nav-label{margin-top:8px;padding-top:16px;border-top:1px solid rgba(201,164,94,.14)}
.nav-label:first-child{margin-top:0;padding-top:2px;border-top:0}

/* Rectangular seal */
.report-stamp-row{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-top:26px;padding-top:16px;border-top:1px dashed #E3D6BC;break-inside:avoid}
.stamp-card{width:296px;background:#F2F9F4;border:2px solid #8FC3A8;border-radius:6px;padding:12px 14px 10px;text-align:center;transform:rotate(-4deg);color:#2F6E52;position:relative}
.stamp-card::after{content:"";position:absolute;inset:4px;border:1px dashed #A9D3BC;border-radius:3px;pointer-events:none}
.stamp-top{font-size:10px;font-weight:700;letter-spacing:2px;opacity:.95}
.stamp-logo{width:92px;height:auto;margin:3px auto 2px;display:block}
.stamp-company{font-size:8px;opacity:.9;line-height:1.5}
.stamp-no{font-size:8px;letter-spacing:.4px;margin-top:2px;opacity:.9}
.stamp-sep{height:1px;background:#A9D3BC;width:78%;margin:6px auto}
.stamp-mgr-title{font-size:7.5px;opacity:.85}
.stamp-mgr{font-size:10px;font-weight:700}
.stamp-sup{font-size:7.5px;opacity:.85;margin-top:4px}
.stamp-card.pending{opacity:.5;filter:grayscale(.5)}
.stamp-qr{display:flex;flex-direction:column;align-items:center;gap:6px}
.stamp-qr svg{width:94px;height:94px;background:#fff;padding:4px;border:1px solid #EADFC9;border-radius:6px}
.stamp-qr span{font-size:9px;color:var(--muted);text-align:center;max-width:120px}
@media (max-width:720px){
  .report-stamp-row{flex-direction:column;align-items:flex-start;gap:14px}
  .stamp-card{width:100%;max-width:300px;transform:rotate(-2deg)}
}
@media print{
  .report-stamp-row{break-inside:avoid}
  .stamp-card{width:260px}
}

/* Remove gold/green frames from reports */
.report-sheet{border:0!important;box-shadow:none!important;border-top:0!important;background:#fff}
.stamp-card{border:0!important;background:#F3FAF6;box-shadow:none}
.stamp-card::after{display:none}
table.bordered{border-color:#ECE4D6}
table.bordered thead th{background:#FBF8F2}
.report-head{border-bottom-color:#E7DCC7}

/* ==========================================================================
   PRINT / PDF — monochrome, no coloured frames or fills
   ========================================================================== */
@media print{
  *{ -webkit-print-color-adjust: economy !important; print-color-adjust: economy !important; }
  html,body{background:#fff !important;color:#000 !important}
  .sidebar,.topbar,.foot,.toolbar,.no-print,.tabbar,.toasts,.approval-bar,.overlay,.modal-host,.drawer{display:none !important}
  .view{padding:0 !important}
  .card,.report-sheet,.settings-section{
    background:#fff !important;border:0 !important;box-shadow:none !important;border-radius:0 !important;
  }
  .report-sheet{padding:0 !important;max-width:none !important;border-top:0 !important}
  .report-head{border-bottom:1px solid #000 !important;padding-bottom:10px !important}
  .report-logo{filter:grayscale(1) contrast(1.1) !important;background:#fff !important;padding:0 !important}
  .rep-title,.rep-h,.report-head h2,.section-title{color:#000 !important}
  .rep-title,.rep-h{border-bottom:1px solid #999 !important}
  .chip{
    background:#fff !important;color:#000 !important;border:1px solid #999 !important;box-shadow:none !important;
  }
  .chip .d,.chip i{background:#000 !important}
  .score,.score .dot,.trend,.kpi-value,.big-score{color:#000 !important}
  .score .dot{background:#000 !important}
  .tbl thead th,table.bordered thead th{background:#fff !important;color:#000 !important;border-color:#999 !important}
  .tbl tbody td,.tbl tbody tr,.tbl,table.bordered,table.compact tbody td{
    border-color:#bbb !important;background:#fff !important;color:#000 !important;
  }
  .tbl tbody tr.row-weak,.tbl tbody tr:hover{background:#fff !important}
  .bar-track{background:#eee !important;border:1px solid #ccc}
  .bar-track i{background:#000 !important;filter:grayscale(1)}
  .chart,.stamp-card,.stamp-qr svg{filter:grayscale(1) !important}
  .chart text{fill:#000 !important}
  .chart .grid-line{stroke:#ddd !important}
  .chart path[fill^="url"]{opacity:.12 !important}
  .report-stamp-row{border-top:1px dashed #666 !important;break-inside:avoid}
  .stamp-card{background:#fff !important;border:1px dashed #444 !important;color:#000 !important}
  .report-qr svg,.stamp-qr svg{background:#fff !important;border:1px solid #999 !important}
  .note{background:#fff !important;border:1px solid #999 !important;color:#000 !important}
  .photo-grid figure{border:1px solid #bbb !important}
  .photo-grid img{filter:grayscale(1) !important}
  .signatures span{border-top:1px solid #444 !important;color:#000 !important}
  .kpi,.kpi-icon,.region-badge,.branch-ico,.avatar{background:#fff !important;color:#000 !important;border:1px solid #bbb !important;box-shadow:none !important}
  .kpi::after{background:#000 !important}
  a{color:#000 !important;text-decoration:none}
  .two-col,.rep-section,table.compact tr{break-inside:avoid}
  @page{size:A4;margin:12mm}
}

@media print{
  .report-score,.score-panel,.kpi,.coverage-cell,.region-card,.branch-tile,.card-body,.report-meta{
    background:#fff !important;border-color:#bbb !important;box-shadow:none !important;
  }
  .big-score,.kpi-value,.report-score div,.report-score span{color:#000 !important}
  .report-score{border:1px solid #999 !important}
  .report-score .stat-line{border-color:#ccc !important}
  .report-score .chip{background:#fff !important;color:#000 !important;border-color:#666 !important}
  .report-head h2,.report-head p,.report-head div{color:#000 !important}
  .signatures,.signatures div{color:#000 !important}
}

/* Hard print isolation (Safari iOS fixes) */
@media print{
  html,body{background:#fff !important;background-image:none !important}
  body{-webkit-print-color-adjust:exact !important}
  .app{display:block !important}
  .sidebar,.topbar,.tabbar,.drawer,.modal-host,.overlay,.toasts,.foot,.page-actions{
    display:none !important;visibility:hidden !important;position:static !important;
    width:0 !important;height:0 !important;overflow:hidden !important;
  }
  #brandLogo,.brand-logo{display:none !important}
  .main{width:100% !important;min-width:0 !important}
  .view{padding:0 !important;margin:0 !important}
  .card,.report-sheet{background:#fff !important;background-image:none !important}
}

/* ==========================================================================
   PRINT THEME v2 — light colours, compact, landscape
   ========================================================================== */
@media print{
  @page{size:A4 landscape;margin:9mm}

  html,body{background:#fff !important;background-image:none !important;color:#1E1713 !important}
  *{ -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important }

  .sidebar,.topbar,.tabbar,.drawer,.modal-host,.overlay,.toasts,.foot,.page-actions,.approval-bar,.toolbar,.no-print{display:none !important}
  .view{padding:0 !important}
  .main{width:100% !important}

  .card,.report-sheet{
    background:#fff !important;background-image:none !important;
    border:0 !important;box-shadow:none !important;border-radius:0 !important;padding:0 !important;
  }

  /* header */
  .report-head{border-bottom:1px solid #C9A45E !important;padding-bottom:6px !important;gap:12px !important}
  .report-logo{width:96px !important;background:#5B0F1B !important;padding:4px 6px !important;border-radius:4px !important;filter:none !important}
  .report-head h2{font-size:17px !important;color:#5B0F1B !important;margin:0 !important}
  .report-head p,.report-head div{color:#6B5B4A !important;font-size:9px !important}
  .report-meta{gap:12px !important;margin-top:8px !important}
  .report-score{background:#FBF6EA !important;border:1px solid #E7D9C0 !important;padding:8px 10px !important}
  .big-score{font-size:26px !important;color:#5B0F1B !important}
  .report-score .chip{background:#fff !important;border:1px solid #D9C6A2 !important;color:#5B2B12 !important}
  .report-meta table td{padding:2px 0 !important;font-size:10px !important}

  /* titles */
  .rep-title{
    font-size:13px !important;margin:10px 0 5px !important;padding:3px 8px !important;
    color:#5B0F1B !important;background:#F8F1E3 !important;border:0 !important;border-radius:4px;
  }
  .rep-h{font-size:11px !important;margin:8px 0 4px !important;color:#5B0F1B !important;border-bottom:1px solid #EADFC9 !important;padding-bottom:2px !important}

  /* sections flow without blank gaps */
  .rep-section{break-inside:auto !important;margin-bottom:6px !important}
  .rep-sec-head{
    gap:6px !important;margin:0 0 2px !important;padding:3px 8px !important;
    background:#FBF6EA !important;border:1px solid #EADFC9 !important;border-radius:4px;
    break-after:avoid !important;
  }
  .rep-sec-head h3{font-size:11px !important;margin:0 !important}
  .rep-sec-head .chip{font-size:8px !important;padding:1px 6px !important}

  /* tables */
  table.tbl{width:100% !important}
  table.compact thead th,table.bordered thead th{
    background:#F7F1E3 !important;color:#5B3B24 !important;border-color:#E7D9C0 !important;
    font-size:7.5px !important;padding:2px 5px !important;
  }
  table.compact tbody td,table.bordered tbody td{
    padding:2px 5px !important;font-size:8.5px !important;line-height:1.35 !important;
    border-color:#F0E7D7 !important;color:#241A14 !important;background:#fff !important;
  }
  table.compact tr.row-weak{background:#FDF6EC !important}
  tr{break-inside:avoid !important}
  thead{display:table-header-group}

  /* soft chips */
  .chip{
    background:#F7F1E3 !important;color:#5B3B24 !important;border:1px solid #E5D8C0 !important;
    font-size:7.5px !important;padding:1px 5px !important;border-radius:10px !important;
  }
  .chip-ok{background:#EDF6F0 !important;color:#2C6E4F !important;border-color:#CFE6D8 !important}
  .chip-warn{background:#FCF4E3 !important;color:#8A5A12 !important;border-color:#EFDCB4 !important}
  .chip-bad{background:#FBEDEB !important;color:#8E1B17 !important;border-color:#EFCFCA !important}
  .chip-gold{background:#F8F0DD !important;color:#6E5420 !important;border-color:#E9D9B6 !important}

  /* charts & bars keep light colour */
  .chart{filter:none !important}
  .chart text{fill:#7A6A57 !important}
  .chart .grid-line{stroke:#F0E9DE !important}
  .bar-track{background:#F3EAD9 !important;border:0 !important;height:5px !important}
  .bar-track i{background:#8C1B2C !important}
  .bar-list{gap:5px !important}
  .bar-item .label,.bar-item .val{font-size:8.5px !important}

  /* layout helpers */
  .two-col{gap:10px !important;margin-top:6px !important}
  .point-list li{font-size:8.5px !important;padding:2px 12px 2px 0 !important}
  .mini-row{font-size:8.5px !important;padding:2px 0 !important}
  .note{background:#FBF6E9 !important;border:1px solid #EADFC4 !important;color:#5B4620 !important;padding:6px 8px !important;font-size:9px !important}

  /* photos */
  .photo-grid{grid-template-columns:repeat(6,1fr) !important;gap:5px !important}
  .photo-grid img{height:70px !important;filter:none !important}
  .photo-grid figcaption{font-size:7px !important;padding:2px 4px !important}

  /* signatures */
  .signatures{margin-top:10px !important;padding-top:6px !important;font-size:8px !important}
  .signatures span{font-size:8px !important;margin-top:14px !important;min-width:120px !important;border-top:1px solid #C9B896 !important}
  .report-foot{display:none !important}
  .stamp-card,.stamp-qr,.report-stamp-row{display:none !important}
}

/* Monthly chart appendix */
.report-appendix{margin-top:18px;padding-top:10px;border-top:1px solid #EADFC9}
@media print{
  .report-appendix{break-before:page !important;margin-top:0 !important;padding-top:0 !important;border-top:0 !important}
  .report-appendix .chart-box{border:1px solid #EADFC9 !important;border-radius:6px !important}
  .report-appendix .chart{height:70mm !important}
}

@media print{
  .two-col{break-inside:auto !important;page-break-inside:auto !important}
  .bar-track i{background:#B08A45 !important}
  .bar-track{height:4px !important}
  .photo-grid{grid-template-columns:repeat(8,1fr) !important}
}

/* Report v3 layout */
.rep-branch{font-size:16px;font-weight:600;color:#33121A;margin-bottom:4px}
.meta-tbl td{padding:4px 8px 4px 0;font-size:12px;border-bottom:1px solid #F3EADA}
.meta-tbl .muted{width:20%}
.rep-cols{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin-top:6px}
@media (max-width:720px){.rep-cols{grid-template-columns:1fr}}
@media print{
  .rep-cols{grid-template-columns:1fr 1fr !important;gap:8px !important;break-inside:auto !important}
  .meta-tbl td{padding:1px 5px 1px 0 !important;font-size:8px !important;border-bottom:1px solid #F3EADA !important}
  .rep-branch{font-size:12px !important;color:#33121A !important}
}

@media print{
  .bar-list{gap:3px !important}
  .bar-item{gap:1px 6px !important}
  .bar-item .label,.bar-item .val{font-size:8px !important}
  .rep-cols .rep-h{margin:4px 0 2px !important;font-size:9.5px !important}
  .mini-row{font-size:7.5px !important;padding:1px 0 !important}
  .mini-row .chip{font-size:6.5px !important;padding:0 4px !important}
  .meta-tbl td{padding:0 5px 0 0 !important}
  .report-meta{margin-top:4px !important}
  .report-score{padding:5px 8px !important}
  .big-score{font-size:22px !important}
}

@media print{
  .report-appendix .chart{height:60mm !important;width:80% !important;margin:0 auto !important}
  .report-appendix{padding-top:6px !important}
}

/* Wide-table fixes for print + axes table */
.axes-total td{background:#FBF6EA !important;border-top:2px solid #D9C6A2 !important}
.axes-tbl td{font-size:12px}
@media print{
  html,body{width:100% !important;max-width:100% !important;overflow:hidden !important}
  .main,.view,.report-sheet,#annualReport{
    width:100% !important;max-width:100% !important;min-width:0 !important;
    margin:0 !important;overflow:hidden !important;
  }
  .report-sheet table,.tbl{width:100% !important;table-layout:fixed !important;word-wrap:break-word !important}
  .tbl th,.tbl td{padding:2px 4px !important;font-size:8px !important;white-space:normal !important}
  .axes-tbl td,.axes-tbl th{font-size:8.5px !important}
  .axes-total td{background:#FBF6EA !important}
  .report-appendix{break-before:auto !important;margin-top:10px !important}
  .report-appendix .chart{height:45mm !important;width:70% !important}
  .rep-cols{gap:8px !important}
  .report-head{flex-wrap:nowrap !important}
  .report-head h2{white-space:normal !important}
}

@media print{
  .mini-row{padding:1px 0 !important}
  .report-appendix{margin-top:14px !important}
}

/* Compact score gauge */
.report-score{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;
  padding:12px 14px;background:#FBF6EA;border:1px solid #E7D9C0;border-radius:12px;
  min-width:190px;max-width:220px;
}
.score-title{font-size:12.5px;font-weight:600;color:#5B0F1B;text-align:center;line-height:1.4}
.score-ring-sm{position:relative;width:118px;height:118px}
.score-ring-sm svg{width:118px;height:118px;display:block}
.score-ring-sm .val{
  position:absolute;inset:0;display:flex;align-items:baseline;justify-content:center;gap:2px;
  font-size:26px;font-weight:700;color:#5B0F1B;font-family:"Amiri",serif;
}
.score-ring-sm .val small{font-size:11px;font-weight:500;color:#8A7A64}
@media print{
  .report-score{min-width:150px;max-width:170px;padding:6px 8px !important;background:#FBF6EA !important;border:1px solid #E7D9C0 !important}
  .score-title{font-size:8.5px !important}
  .score-ring-sm,.score-ring-sm svg{width:88px !important;height:88px !important}
  .score-ring-sm .val{font-size:18px !important}
  .score-ring-sm .val small{font-size:7px !important}
}

.score-ring-sm .val{white-space:nowrap;line-height:1}
.report-meta{grid-template-columns:minmax(0,1fr) 190px}
@media print{
  .report-meta{grid-template-columns:minmax(0,1fr) 150px !important;gap:8px !important}
  .report-score{min-width:0 !important;width:100% !important;max-width:none !important}
  .score-ring-sm,.score-ring-sm svg{width:80px !important;height:80px !important}
  .score-ring-sm .val{font-size:17px !important}
  .score-ring-sm .val small{font-size:8px !important}
  .score-title{font-size:8px !important}
}

/* Score next to branch data (right side in RTL) */
.report-meta{grid-template-columns:190px minmax(0,1fr)}
.report-score{order:-1}
.score-ring-sm .val{font-size:22px}
.score-ring-sm .val small{font-size:10px;margin-inline-start:1px}
@media print{
  .report-meta{grid-template-columns:130px minmax(0,1fr) !important}
  .report-score{order:-1 !important}
  .score-ring-sm,.score-ring-sm svg{width:74px !important;height:74px !important}
  .score-ring-sm .val{font-size:15px !important}
}

@media print{
  .report-appendix{break-inside:avoid !important;page-break-inside:avoid !important}
  .report-appendix .rep-h{break-after:avoid !important}
}

/* Item details + signatures in monthly report */
.rep-section{margin-bottom:10px}
.rep-sec-head{display:flex;align-items:center;gap:8px;margin:10px 0 4px}
.rep-sec-head h3{font-size:13px;font-weight:600;color:#3A1A1E;margin:0}
.rep-sec-head .chip{margin-inline-start:auto}
.rep-signs{display:grid;grid-template-columns:repeat(3,1fr);gap:24px;margin-top:26px;padding-top:16px;border-top:1px solid #EADFC9;text-align:center}
.rep-signs span{display:block;font-size:10.5px;color:#8A7A64;margin-bottom:26px}
.rep-signs b{display:block;font-size:12.5px;color:#33121A;border-top:1px solid #C9B896;padding-top:5px}
@media print{
  .rep-signs{gap:14px !important;margin-top:14px !important;padding-top:8px !important}
  .rep-signs span{font-size:8px !important;margin-bottom:14px !important}
  .rep-signs b{font-size:9px !important;padding-top:3px !important}
  .rep-section{margin-bottom:5px !important}
  .rep-sec-head{margin:4px 0 2px !important}
  .rep-sec-head h3{font-size:9.5px !important}
}

/* Mobile report fit */
@media (max-width:980px){
  .report-sheet{width:100% !important;max-width:100% !important;overflow:hidden !important;padding:16px 12px !important}
  .report-head{flex-wrap:wrap !important;gap:10px !important}
  .report-logo{width:100px !important}
  .report-head h2{font-size:18px !important;line-height:1.4}
  .report-meta{grid-template-columns:1fr !important;gap:10px !important}
  .report-score{order:0 !important;max-width:none !important;width:100% !important;flex-direction:row !important;justify-content:center !important;gap:14px !important;padding:8px !important}
  .score-title{font-size:12px !important}
  .score-ring-sm,.score-ring-sm svg{width:96px !important;height:96px !important}
  .report-sheet table,.tbl{width:100% !important;table-layout:fixed !important}
  .report-sheet th,.report-sheet td{font-size:10px !important;padding:6px 4px !important;word-break:break-word !important;white-space:normal !important}
  .meta-tbl td{font-size:10px !important;padding:4px 2px !important}
  .rep-signs{grid-template-columns:1fr !important;gap:14px !important}
  .rep-sec-head h3{font-size:12px !important}
  .report-sheet .two-col{grid-template-columns:1fr !important}
  .photo-grid{grid-template-columns:repeat(2,1fr) !important}
}


/* Print: keep stamp + all signatures together on the last page */
@media print{
  .report-stamp-row{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:space-between!important;gap:16px!important;margin-top:12px!important;padding-top:8px!important;break-inside:avoid!important;page-break-inside:avoid!important;break-before:avoid!important;page-break-before:avoid!important}
  .stamp-card{display:block!important;width:200px!important;transform:none!important;padding:7px 9px!important}
  .stamp-qr{display:flex!important}
  .stamp-qr svg{width:62px!important;height:62px!important}
  .stamp-logo{width:62px!important;margin:2px auto 1px!important}
  .stamp-top{font-size:8px!important;letter-spacing:1.2px!important}
  .stamp-company,.stamp-no{font-size:6.5px!important}
  .stamp-mgr-title,.stamp-sup{font-size:6.5px!important}
  .stamp-mgr{font-size:8px!important}
  .stamp-sep{margin:4px auto!important}
  .rep-signs{display:grid!important;grid-template-columns:repeat(3,1fr)!important;gap:10px!important;margin-top:10px!important;padding-top:6px!important;break-inside:avoid!important;page-break-inside:avoid!important;break-before:avoid!important;page-break-before:avoid!important}
  .rep-signs>div{break-inside:avoid!important;page-break-inside:avoid!important}
  .rep-signs span{font-size:7.5px!important;margin-bottom:12px!important}
  .rep-signs b{font-size:8.5px!important;padding-top:3px!important}
}

/* Photo appendix with report header */
.photo-appendix{margin-top:22px;padding-top:12px;border-top:1px solid #EADFC9}
.pa-head{text-align:center;margin-bottom:12px}
.pa-brand{font-size:9.5px;letter-spacing:1px;color:#8A6A2F;font-weight:600}
.pa-head h3{font-size:15px;color:#33121A;margin:4px 0 3px;font-family:'Amiri',serif}
.pa-meta{font-size:10px;color:#7A6A55}
@media print{
  .photo-appendix.has-photos{break-before:page!important;page-break-before:always!important;margin-top:0!important;padding-top:0!important;border-top:0!important}
  .pa-head{margin-bottom:8px!important;padding-bottom:6px!important;border-bottom:1px solid #E3D6BC!important}
  .pa-brand{font-size:8px!important}
  .pa-head h3{font-size:13px!important;margin:2px 0!important}
  .pa-meta{font-size:8px!important}
}

/* Save bar must sit above the mobile tab bar */
@media (max-width:980px){
  .save-bar{position:fixed!important;bottom:calc(72px + env(safe-area-inset-bottom))!important;left:12px!important;right:12px!important;z-index:76;margin:0!important;box-shadow:0 8px 24px rgba(35,20,14,.18)}
  .main{padding-bottom:96px!important}
}

/* ---- بند إضافة صور أخرى (بدون درجة) ---- */
.wiz-item.photo-extra{align-items:flex-start;background:#FCFAF5}
.wiz-item.photo-extra .wi-text{width:100%}
.extra-photos{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;margin-top:4px}
.xp-card{position:relative;background:#fff;border:1px solid var(--line);border-radius:10px;padding:6px;margin:0}
.xp-card img{width:100%;height:110px;object-fit:cover;border-radius:6px;display:block}
.xp-card .wi-note{width:100%;margin-top:6px}
.xp-no{position:absolute;top:11px;inset-inline-start:11px;background:rgba(33,28,25,.62);color:#fff;font-size:10px;line-height:1;padding:3px 6px;border-radius:20px}
.xp-add{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:150px;border:1.5px dashed #D8C9AC;border-radius:10px;color:#8A7434;cursor:pointer;font-size:12px;background:#fff}
.xp-add:active{background:var(--gold-soft)}
.xp-card .photo-del{top:10px;inset-inline-end:10px}

/* ---- صور البنود (حتى 5 صور) ---- */
.item-photos{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.item-photos .ip{position:relative;display:block;width:54px;height:54px;border-radius:8px;overflow:hidden;border:1px solid var(--line)}
.item-photos .ip img{width:100%;height:100%;object-fit:cover;display:block}
.item-photos .ip-x{position:absolute;top:2px;inset-inline-end:2px;width:16px;height:16px;border-radius:50%;border:0;background:rgba(33,28,25,.7);color:#fff;display:flex;align-items:center;justify-content:center;padding:0;cursor:pointer}
.photo-count{position:absolute;bottom:2px;inset-inline-end:2px;background:rgba(33,28,25,.7);color:#fff;font-size:9px;padding:1px 4px;border-radius:8px}

@media print{
  body.print-written #photoReport{display:none!important}
  body.print-photos #auditReport{display:none!important}
  body.print-photos .toolbar,body.print-photos .approval-bar{display:none!important}
  body.print-photos .report-sheet{box-shadow:none;border:0}
}

/* ---- توزيع التوقيعات والباركود والختم أسفل التقريرين ---- */
.report-sheet .signatures{display:grid;grid-template-columns:repeat(3,1fr);gap:28px;text-align:center;align-items:start}
.report-sheet .signatures > div{flex:none}
.report-sheet .signatures span{display:block;margin:26px auto 0;max-width:220px;text-align:center;min-width:0}
.report-sheet .report-stamp-row{align-items:flex-end}
@media print{
  .report-sheet .signatures{display:grid!important;grid-template-columns:repeat(3,1fr)}
  .report-sheet .signatures span{border-top:1px solid #444;color:#000}
}

/* ---- تكبير الصورة ---- */
.lightbox{position:fixed;inset:0;z-index:9999;background:rgba(15,10,8,.92);display:flex;align-items:center;justify-content:center;padding:18px;cursor:zoom-out}
.lightbox figure{margin:0;display:flex;flex-direction:column;align-items:center;gap:10px;max-width:100%;max-height:100%}
.lightbox img{max-width:94vw;max-height:82vh;object-fit:contain;border-radius:10px;box-shadow:0 20px 50px rgba(0,0,0,.5)}
.lightbox figcaption{color:#F3E9D2;font-size:12.5px;text-align:center}

/* ---- التوقيع الإلكتروني ---- */
.sig-box{border:1px dashed var(--line);border-radius:10px;padding:12px;text-align:center;background:#fff}
.sig-box img{max-width:260px;max-height:120px;object-fit:contain;display:block;margin:0 auto}
.sig-img{display:block;max-width:150px;max-height:54px;object-fit:contain;margin:4px auto 0}

/* ---- الصفحة الرئيسية العامة ---- */
.landing-hero{background:linear-gradient(135deg,#6E1220,#45080F);color:#F7EEDC;border-radius:16px;padding:28px 26px;margin-bottom:16px}
.landing-brand{display:flex;align-items:center;gap:16px}
.landing-brand img{height:64px;width:auto;background:#fff;border-radius:12px;padding:6px}
.landing-brand h1{font-size:24px;margin:0;color:#fff}
.landing-brand p{margin:2px 0 6px;font-size:13px;color:#E9D9B8}
.landing-lead{margin:14px 0 16px;font-size:14px;line-height:1.8;color:#F3E6CC;max-width:760px}
.landing-kpis{margin-bottom:16px}
.landing-rank{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px dashed var(--line-soft)}
.landing-rank:last-child{border-bottom:0}
.rank-no{width:28px;height:28px;border-radius:50%;background:var(--gold-soft);color:#8A7434;display:grid;place-items:center;font-weight:700;font-size:12px;flex:0 0 28px}
.feature-card{border:1px solid var(--line);border-radius:12px;overflow:hidden;margin-bottom:12px;background:#FCFAF5}
.feature-card img{width:100%;height:150px;object-fit:cover;display:block}
.feature-card h4{margin:10px 12px 4px;font-size:13.5px}
.feature-card p{margin:0 12px 12px}
.landing-foot{margin-top:18px;padding:16px;text-align:center;font-size:12px;color:var(--muted);border-top:1px solid var(--line)}
.landing-foot a{color:var(--maroon);font-weight:600;text-decoration:none}

/* وضع الصفحة العامة (بدون تسجيل دخول) */
body.public-landing .sidebar,body.public-landing .topbar,body.public-landing .tabbar,body.public-landing .side-backdrop{display:none!important}
body.public-landing .app{display:block}
body.public-landing .main{width:100%}
body.public-landing .view{max-width:1080px;margin:0 auto;padding:22px 16px 40px}

/* ---- سجل التحديثات ---- */
.changelog-row{border:1px solid var(--line);border-radius:12px;padding:12px 14px;margin-bottom:10px;background:#FCFAF5}
.changelog-row.current{border-color:#8FC3A8;background:#F2F9F4}
.changelog-head{display:flex;align-items:center;gap:8px;margin-bottom:6px}
.changelog-list{margin:0;padding-inline-start:18px;font-size:12.5px;color:var(--ink-2);line-height:1.8}

/* ---- الإعلانات والعرض الكامل ---- */
body.public-landing .view{max-width:none}
.landing-section-title{font-size:18px;font-weight:700;color:var(--maroon);margin:18px 2px 10px}
.ads-card{padding:0;overflow:hidden;margin-bottom:6px}
.ads-carousel{position:relative}
.ad-slide{display:none;grid-template-columns:minmax(0,420px) 1fr;gap:0;align-items:stretch}
.ad-slide.active{display:grid}
.ad-slide img{width:100%;height:100%;max-height:320px;object-fit:cover;display:block}
.ad-body{padding:20px 22px;display:flex;flex-direction:column;justify-content:center;gap:8px}
.ad-body h3{margin:0;font-size:17px;color:var(--maroon)}
.ad-body p{margin:0;font-size:13px;line-height:1.9;color:var(--ink-2);white-space:pre-wrap}
.ads-dots{display:flex;gap:6px;justify-content:center;padding:10px}
.ads-dots i{width:7px;height:7px;border-radius:50%;background:#D9C9A8;display:block}
.ads-dots i.on{background:var(--maroon)}
#featCarousel .feat-slide{display:none}
#featCarousel .feat-slide.active{display:block}
@media (max-width:760px){
  .ad-slide.active{display:block}
  .ad-slide img{max-height:200px}
}

/* ---- إدارة الإعلانات ---- */
.ad-manage{display:flex;gap:14px;padding:14px;align-items:flex-start}
.ad-manage-img{width:180px;height:110px;border-radius:10px;overflow:hidden;background:#F3EDE1;display:grid;place-items:center;flex:0 0 180px}
.ad-manage-img img{width:100%;height:100%;object-fit:cover}
.ad-manage-body{flex:1;min-width:0}
@media (max-width:720px){.ad-manage{flex-wrap:wrap}.ad-manage-img{flex:1 1 100%;width:100%}}

a.ad-slide{text-decoration:none;color:inherit}
a.ad-slide:hover .ad-body h3{text-decoration:underline}
.ad-cta{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:700;color:var(--maroon);margin-top:4px}

/* ---- إطار الإعلان ---- */
.ads-card{
  position:relative;padding:10px;border-radius:20px;
  background:linear-gradient(135deg,#C9A45E 0%,#F3E9D2 35%,#C9A45E 65%,#F3E9D2 100%);
  box-shadow:0 14px 34px rgba(91,15,27,.14);
  margin-bottom:18px;
}
.ads-card::before{content:"";position:absolute;inset:4px;border-radius:16px;background:#fff;z-index:0}
.ads-carousel,.ads-dots{position:relative;z-index:1}
.ads-carousel{border-radius:14px;overflow:hidden}
.ad-badge{position:absolute;top:-10px;inset-inline-start:18px;z-index:2;background:var(--maroon);color:#F7EEDC;font-size:10.5px;font-weight:700;letter-spacing:1px;padding:3px 10px;border-radius:20px;box-shadow:0 4px 10px rgba(91,15,27,.25)}
.ad-slide{border-radius:14px;overflow:hidden}
.ad-body{padding:18px 20px}
.ad-body h3{font-size:18px}
.ad-body p{max-height:220px;overflow:auto}

/* تصحيح شارة الإعلان */
.ads-card{overflow:visible}
.ad-badge{top:8px;inset-inline-start:12px}

/* ---- مؤشرات الفروع ---- */
.branch-metrics{margin-bottom:16px}
.metric-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px}
.metric-card{display:flex;flex-direction:column;gap:2px;align-items:flex-start;text-align:start;border:1px solid var(--line);border-radius:12px;padding:12px 14px;background:#FCFAF5;cursor:pointer;font-family:inherit;transition:.15s}
.metric-card:hover{border-color:var(--gold-600);transform:translateY(-1px)}
.metric-card b{font-size:24px;line-height:1.1;color:var(--maroon)}
.metric-card .m-lbl{font-size:12px;color:var(--muted)}
.metric-card.ok b{color:var(--ok)}
.metric-card.good b{color:var(--ok)}
.metric-card.bad b{color:#A8231D}
.metric-card.muted b{color:var(--muted)}
.metric-alert{display:flex;align-items:center;gap:8px;margin-top:12px;padding:10px 12px;border:1px solid #E8C9A0;background:#FDF3E6;border-radius:10px;font-size:12.5px;color:#7a4a12;cursor:pointer}

/* شارة نظام الجودة أسفل يسار البانر */
.landing-hero{position:relative;padding-bottom:34px}
.landing-service{position:absolute;left:18px;bottom:12px;font-size:11px;letter-spacing:.5px;color:#E9D9B8;background:rgba(255,255,255,.10);border:1px solid rgba(233,217,184,.45);border-radius:20px;padding:2px 10px;direction:rtl}
