/* ACE Code Audit. Palette and type from ACE_DESIGN v2. Author: Ahmed Fathy. */
@font-face { font-family: 'Almarai'; font-weight: 300; src: url('../fonts/Almarai-Light.ttf') format('truetype'); }
@font-face { font-family: 'Almarai'; font-weight: 400; src: url('../fonts/Almarai-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Almarai'; font-weight: 700; src: url('../fonts/Almarai-Bold.ttf') format('truetype'); }
@font-face { font-family: 'Almarai'; font-weight: 800; src: url('../fonts/Almarai-ExtraBold.ttf') format('truetype'); }
:root {
  --navy: #052976; --navy2: #041F5C; --ink: #0B1F3A; --blue: #2633FF; --blue2: #1E29CC; --cyan: #4CC4FF;
  --paper: #FAFAF7; --mist: #EEF1F7; --card: #FFFFFF; --line: #D9DEE8; --mut: #5B6475; --field: #8A93A6;
  --ok: #0F7B4B; --okbg: #E5F4EC; --nc: #B42318; --ncbg: #FDECEA; --na: #5B6475; --nabg: #EEF1F7;
  --r: 6px; --rc: 8px; --font: 'Almarai', Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.7; }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
a { color: var(--blue); }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.top .in { max-width: 1280px; margin: 0 auto; padding: 10px clamp(16px, 3vw, 32px); display: flex; align-items: center; gap: 18px; }
.top img { height: 36px; }
.top .name { font-weight: 800; font-size: 17px; }
.top .name small { display: block; font-weight: 400; font-size: 12px; color: var(--cyan); line-height: 1.2; }
.top nav { margin-inline-start: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.top nav button { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: var(--r); padding: 6px 12px; cursor: pointer; }
.top nav button.on, .top nav button:hover { background: rgba(255,255,255,.12); border-color: var(--cyan); }

main { max-width: 1280px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 32px) 80px; }
h1 { font-size: 26px; font-weight: 800; color: var(--navy); margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 18px; font-weight: 800; color: var(--navy); margin: 0 0 10px; }
.sub { color: var(--mut); margin: 0 0 20px; }
.eyebrow { color: var(--blue); font-weight: 700; font-size: 12px; }

/* buttons */
.btn { background: var(--blue); color: #fff; border: 0; border-radius: var(--r); padding: 9px 16px; font-weight: 800; cursor: pointer; }
.btn:hover { background: var(--blue2); }
.btn.line { background: transparent; color: var(--blue); border: 1px solid var(--blue); font-weight: 700; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.red { background: var(--nc); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--rc); padding: 18px 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.pcard { border-top: 3px solid var(--navy); cursor: pointer; }
.pcard:hover { border-color: var(--blue); }
.pcard h3 { margin: 0 0 4px; font-size: 17px; color: var(--navy); }
.meta { color: var(--mut); font-size: 13px; }

/* forms */
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.form label { display: block; font-size: 13px; font-weight: 700; color: var(--mut); }
.form input, .form select, .form textarea, .fld { width: 100%; border: 1px solid var(--field); border-radius: var(--r); padding: 8px 10px; background: #fff; }
textarea.fld { min-height: 60px; }
.fld:focus, .form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--rc); padding: 12px 14px; }
.stat b { display: block; font-size: 28px; font-weight: 300; color: var(--navy); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--mut); font-weight: 700; }
.stat.nc b { color: var(--nc); } .stat.ok b { color: var(--ok); }
.bar { height: 6px; background: var(--mist); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }

/* inspection layout */
.ins { display: grid; grid-template-columns: 270px 1fr; gap: 20px; align-items: start; }
.side { position: sticky; top: 72px; background: var(--card); border: 1px solid var(--line); border-radius: var(--rc); padding: 8px; max-height: calc(100vh - 90px); overflow: auto; }
.side button { display: block; width: 100%; text-align: start; background: transparent; border: 0; border-radius: var(--r); padding: 8px 10px; cursor: pointer; }
.side button.on { background: var(--mist); }
.side button b { display: block; font-size: 13.5px; color: var(--navy); }
.side button small { color: var(--mut); font-size: 12px; }
.side .bar { margin-top: 4px; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tools input[type=search] { flex: 1; min-width: 200px; }
.sechead { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 12px; }

.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--rc); margin-bottom: 10px; }
.item.C { border-inline-start: 4px solid var(--ok); } .item.NC { border-inline-start: 4px solid var(--nc); } .item.NA { border-inline-start: 4px solid var(--field); }
.item .hd { display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; padding: 12px 14px; align-items: start; }
.item .id { font-weight: 800; color: var(--navy); font-size: 13px; }
.item .ref { display: block; font-size: 11.5px; color: var(--mut); font-weight: 700; }
.item .tx { font-size: 14.5px; }
.item .tx .alt { display: block; color: var(--mut); font-size: 12.5px; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 11px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--mut); border-inline-start: 1px solid var(--line); }
.seg button:first-child { border-inline-start: 0; }
.seg button.C.on { background: var(--ok); color: #fff; } .seg button.NC.on { background: var(--nc); color: #fff; } .seg button.NA.on { background: var(--field); color: #fff; }
.item .bd { border-top: 1px dashed var(--line); padding: 12px 14px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.item .bd .full { grid-column: 1 / -1; }
.badge { display: inline-block; border-radius: 4px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.badge.C { background: var(--okbg); color: var(--ok); } .badge.NC { background: var(--ncbg); color: var(--nc); } .badge.NA { background: var(--nabg); color: var(--na); } .badge.U { background: #fff; color: var(--mut); border: 1px solid var(--line); }
.badge.open { background: var(--ncbg); color: var(--nc); } .badge.closed { background: var(--okbg); color: var(--ok); }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 96px; height: 72px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.photos figure button { position: absolute; top: 2px; inset-inline-end: 2px; border: 0; background: rgba(11,31,58,.75); color: #fff; border-radius: 3px; cursor: pointer; font-size: 11px; padding: 0 5px; }
.mres { font-weight: 700; font-size: 13px; }
.mres.ok { color: var(--ok); } .mres.bad { color: var(--nc); }

/* tables */
table.t { width: 100%; border-collapse: collapse; background: var(--card); font-size: 13.5px; }
table.t th { background: var(--mist); color: var(--navy); font-weight: 700; text-align: start; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tw { border: 1px solid var(--line); border-radius: var(--rc); overflow: auto; }

/* workflow */
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--rc); padding: 14px 16px; border-top: 3px solid var(--line); }
.step.done { border-top-color: var(--ok); } .step.cur { border-top-color: var(--blue); }
.step h3 { margin: 0 0 6px; font-size: 15px; color: var(--navy); }
.note { background: var(--mist); border-radius: var(--rc); padding: 10px 14px; font-size: 13px; color: var(--mut); }
.empty { text-align: center; padding: 48px 16px; color: var(--mut); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(11,31,58,.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal .box { background: #fff; border-radius: var(--rc); max-width: 760px; width: 100%; max-height: 90vh; overflow: auto; padding: 22px 24px; box-shadow: 0 10px 26px rgba(5,41,118,.25); }

/* report */
.rep { background: #fff; max-width: 210mm; margin: 0 auto; padding: 14mm 14mm 18mm; border: 1px solid var(--line); }
.rep .rh { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--navy); padding-bottom: 10px; margin-bottom: 14px; }
.rep .rh img { height: 46px; }
.rep h1 { font-size: 22px; }
.rep h2 { font-size: 15px; margin: 18px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.rep table.t { font-size: 11.5px; }
.rep table.t td, .rep table.t th { padding: 5px 7px; }
.rep .kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 18px; font-size: 12.5px; }
.rep .kv div { border-bottom: 1px solid var(--mist); padding: 3px 0; }
.rep .kv b { color: var(--mut); font-weight: 700; margin-inline-end: 6px; }
.rep .stats { margin: 10px 0; grid-template-columns: repeat(5, 1fr); }
.rep .stat b { font-size: 22px; }
.rep .sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.rep .sign div { border: 1px solid var(--line); border-radius: 6px; padding: 10px; min-height: 96px; font-size: 12px; }
.rep .foot { margin-top: 18px; font-size: 10.5px; color: var(--mut); border-top: 1px solid var(--line); padding-top: 8px; }
.rep .ph img { width: 120px; height: 90px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; margin: 2px; }
.noprint { }

@media (max-width: 860px) {
  .ins { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; display: flex; overflow-x: auto; gap: 4px; }
  .side button { min-width: 150px; }
  .item .hd { grid-template-columns: 1fr; }
  .top .name small { display: none; }
}
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  .top, .noprint { display: none !important; }
  main { padding: 0; max-width: none; }
  .rep { border: 0; max-width: none; }
  .rep table.t tr { page-break-inside: avoid; }
  .rep h2 { page-break-after: avoid; }
}
