@font-face { font-family: "Noto Sans Arabic"; src: url("fonts/NotoSansArabic-Regular.ttf"); font-weight: 400; }
@font-face { font-family: "Noto Sans Arabic"; src: url("fonts/NotoSansArabic-Bold.ttf"); font-weight: 700; }
@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans-Regular.ttf"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans-Bold.ttf"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Noto Kufi Arabic"; src: url("fonts/NotoKufiArabic-Bold.ttf"); font-weight: 700; }

:root {
  --paper: #F3F5F6;
  --sheet: #FFFFFF;
  --ink: #1C1F23;
  --steel: #5B6670;
  --zinc: #D9DEE2;
  --zinc-2: #EBEEF0;
  --amber: #F6B221;
  --amber-ink: #5C3F00;
  --ok: #2E7D4F;
  --warn: #9A5B00;
  --err: #B3261E;
  --radius: 6px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans Arabic", "Noto Sans", system-ui, sans-serif;
  font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--paper);
  display: grid; grid-template-columns: 228px 1fr; min-height: 100vh;
}
h1, h2, h3 { font-family: "Noto Kufi Arabic", "Noto Sans Arabic", sans-serif; font-weight: 700; line-height: 1.35; margin: 0 0 .6rem; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.12rem; margin-top: 1.6rem; }
h3 { font-size: 1rem; }
a { color: inherit; }
p { margin: 0 0 .7rem; max-width: 72ch; }
.muted { color: var(--steel); }
.small { font-size: .85rem; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; direction: ltr; text-align: left; white-space: nowrap; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* navigation */
.nav { background: var(--ink); color: #E6E9EB; padding: 1.1rem 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.nav .brand { display: block; padding: 0 1.1rem 1rem; text-decoration: none; }
.nav .brand img { width: 120px; background: #fff; border-radius: 4px; padding: 4px 6px; display: block; }
.nav .brand span { display: block; font-family: "Noto Kufi Arabic"; font-size: .9rem; margin-top: .5rem; color: #fff; }
.nav .grp { font-size: .78rem; color: #97A2AB; padding: 1rem 1.1rem .3rem; }
.nav a.item { display: block; padding: .38rem 1.1rem; text-decoration: none; color: #E6E9EB; border-inline-start: 4px solid transparent; }
.nav a.item:hover { background: #2A2F35; }
.nav a.item.on { border-inline-start-color: var(--amber); background: #262B31; color: #fff; }
.nav .who { padding: 1rem 1.1rem 0; font-size: .85rem; color: #B9C1C7; border-top: 1px solid #2E343A; margin-top: 1rem; }
.nav .badge { background: var(--amber); color: var(--amber-ink); border-radius: 10px; padding: 0 .45rem; font-size: .75rem; margin-inline-start: .3rem; }

main { padding: 1.4rem 1.8rem 4rem; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* panels and tables */
.panel { background: var(--sheet); border: 1px solid var(--zinc); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
table { width: 100%; border-collapse: collapse; background: var(--sheet); }
th, td { padding: .42rem .5rem; border-bottom: 1px solid var(--zinc-2); text-align: start; vertical-align: top; }
th { font-size: .82rem; color: var(--steel); font-weight: 700; background: #FAFBFB; border-bottom: 1px solid var(--zinc); }
tr.err td { background: #FDF1F0; }
tr.warn td { background: #FFF8EC; }
.tablewrap { overflow-x: auto; border: 1px solid var(--zinc); border-radius: var(--radius); }
.tablewrap table { border: 0; }

/* forms */
label { display: block; font-size: .85rem; color: var(--steel); margin-bottom: .2rem; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid #C5CCD2; border-radius: 4px;
  padding: .38rem .5rem; width: 100%;
}
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 4.5rem; }
.grid { display: grid; gap: .8rem 1rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.grid .wide { grid-column: 1 / -1; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: .4rem; color: var(--ink); font-size: .95rem; }

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 4px; padding: .42rem .95rem;
  border: 1px solid #AEB7BE; background: #fff; color: var(--ink); text-decoration: none; display: inline-block; line-height: 1.5;
}
button:hover, .btn:hover { background: var(--zinc-2); }
.btn.primary, button.primary { background: var(--amber); border-color: #D99A10; color: #241900; }
.btn.primary:hover, button.primary:hover { background: #E9A713; }
.btn.danger, button.danger { color: var(--err); border-color: #E3B4B0; }
.btn.small, button.small { padding: .15rem .55rem; font-size: .85rem; font-weight: 400; }
form.inline { display: inline; }

/* messages */
.flash { padding: .6rem .9rem; border-radius: var(--radius); margin-bottom: .8rem; border: 1px solid; }
.flash.ok { background: #EEF7F1; border-color: #B9DCC6; color: #1E5434; }
.flash.err { background: #FDF1F0; border-color: #EBC1BD; color: #7D1B15; }
.note { border-inline-start: 4px solid var(--steel); background: #F7F9FA; padding: .55rem .8rem; margin: .5rem 0; }
.note.warn { border-color: var(--warn); background: #FFF8EC; }
.note.err { border-color: var(--err); background: #FDF1F0; }
.note.ok { border-color: var(--ok); background: #EEF7F1; }
.tag { display: inline-block; font-size: .78rem; border: 1px solid var(--zinc); border-radius: 3px; padding: 0 .35rem; color: var(--steel); background: #fff; }
.tag.fire { color: #8A2B00; border-color: #F0C3A8; background: #FFF3EC; }
.tag.st-draft { color: var(--steel); }
.tag.st-pending_approval { color: var(--warn); border-color: #E9CC9C; background: #FFF8EC; }
.tag.st-issued, .tag.st-sent { color: #1E4E79; border-color: #B9CFE3; background: #F0F6FB; }
.tag.st-won { color: var(--ok); border-color: #B9DCC6; background: #EEF7F1; }
.tag.st-lost { color: var(--err); border-color: #EBC1BD; background: #FDF1F0; }
.tag.st-superseded { text-decoration: line-through; }

/* the door plate: quote identity */
.plate {
  display: inline-grid; grid-template-columns: auto auto; gap: .1rem 1.4rem; align-items: baseline;
  background: linear-gradient(180deg, #E9EDF0, #D7DDE2); border: 1px solid #B8C1C8; border-radius: 8px;
  padding: .7rem 1.1rem .8rem; box-shadow: inset 0 1px 0 #fff;
  position: relative;
}
.plate::before, .plate::after {
  content: ""; position: absolute; top: 50%; width: 7px; height: 7px; border-radius: 50%;
  background: #9AA5AD; box-shadow: inset 0 1px 1px #6E7881; transform: translateY(-50%);
}
.plate::before { inset-inline-start: 7px; }
.plate::after { inset-inline-end: 7px; }
.plate .no { font-family: "Noto Kufi Arabic"; font-size: 1.5rem; direction: ltr; letter-spacing: .02em; grid-column: 1 / -1; }
.plate .k { font-size: .8rem; color: var(--steel); }
.plate .v { font-variant-numeric: tabular-nums; font-weight: 700; direction: ltr; text-align: end; }

/* quote layout */
.quote-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.summary { position: sticky; top: 1rem; }
.summary table td { border: 0; padding: .2rem 0; }
.summary .grand td { border-top: 2px solid var(--ink); padding-top: .4rem; font-weight: 700; font-size: 1.05rem; }
.lines td .desc { min-width: 24ch; max-width: 52ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lines td:has(.desc) { min-width: 26ch; }
.row-actions { display: flex; gap: .3rem; flex-wrap: nowrap; }
.lines td .sub { font-size: .8rem; color: var(--steel); }
.price-a { font-weight: 700; }
.alt { font-size: .8rem; color: var(--steel); }

/* configurator */
.cfg { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.tpl-pick label { border: 1px solid var(--zinc); border-radius: var(--radius); padding: .5rem .6rem; color: var(--ink); cursor: pointer; background: #fff; margin: 0; }
.tpl-pick input { margin-inline-end: .35rem; }
.tpl-pick label:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.live { position: sticky; top: 1rem; }
.live .big { font-family: "Noto Kufi Arabic"; font-size: 1.6rem; direction: ltr; text-align: end; }
.methods td { padding: .25rem .3rem; }
.methods tr.on td { font-weight: 700; background: #FFF7E0; }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .6rem; }
.stat { background: var(--sheet); border: 1px solid var(--zinc); border-radius: var(--radius); padding: .6rem .8rem; text-decoration: none; }
.stat .n { font-family: "Noto Kufi Arabic"; font-size: 1.3rem; }
.bar { height: 8px; background: var(--zinc-2); border-radius: 4px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--steel); }

.login { grid-column: 1 / -1; display: grid; place-items: center; min-height: 100vh; }
.login .panel { width: min(380px, 92vw); padding: 1.6rem; }
.login img { width: 170px; display: block; margin-bottom: 1rem; }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; }
  .quote-grid, .cfg { grid-template-columns: 1fr; }
  main { padding: 1rem; }
}
@media print { .nav, .noprint { display: none; } body { display: block; } }
.lines td.small { white-space: nowrap; }

@media (max-width: 1500px) { .quote-grid { grid-template-columns: minmax(0, 1fr); } }
details.inline-menu { position: relative; display: inline-block; }
details.inline-menu > summary { list-style: none; cursor: pointer; }
details.inline-menu > summary::-webkit-details-marker { display: none; }
details.inline-menu[open] > form { left: 0; top: 2.6rem; }
[hidden] { display: none !important; }

/* training tips (trial phase): a small "i" with the explanation on hover */
.tip-i {
  display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; padding: 0; margin: 0 .3rem;
  border: 1px solid var(--steel); border-radius: 50%; background: var(--sheet); color: var(--steel);
  font: 700 .68rem/1 "Noto Sans", Georgia, serif; font-style: italic; cursor: help; vertical-align: middle;
  flex: none; text-decoration: none; text-transform: none; letter-spacing: 0; min-height: 0; box-shadow: none;
}
.tip-i:hover, .tip-i:focus-visible, .tip-i[aria-describedby] { background: var(--amber); border-color: var(--amber-ink); color: var(--amber-ink); }
.nav .tip-i { background: transparent; border-color: #7C8790; color: #B9C1C7; }
.nav .tip-i:hover, .nav .tip-i[aria-describedby] { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.tipbox {
  position: fixed; z-index: 1000; max-width: min(320px, calc(100vw - 16px)); padding: .55rem .7rem;
  background: var(--ink); color: #fff; border-radius: var(--radius); font-size: .85rem; line-height: 1.65;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28); pointer-events: none; direction: rtl; text-align: start;
}
.tips-switch { margin-top: .6rem; }
.tips-switch button { background: none; border: 1px solid #55606A; color: #B9C1C7; border-radius: var(--radius); padding: .2rem .55rem; font: inherit; font-size: .78rem; cursor: pointer; min-height: 0; }
.tips-switch button:hover { border-color: var(--amber); color: #fff; }
@media print { .tip-i, .tipbox { display: none !important; } }

/* side menu: quick search, folded settings, waiting counts */
.navsearch { padding: 0 1.1rem .4rem; }
.navsearch input { background: #2A2F35; border: 1px solid #3B434A; color: #fff; padding: .35rem .55rem; font-size: .85rem; }
.navsearch input::placeholder { color: #97A2AB; }
.navsearch input:focus { border-color: var(--amber); }
.nav details.navmore { margin-top: .4rem; }
.nav details.navmore > summary { cursor: pointer; font-size: .78rem; color: #97A2AB; padding: .5rem 1.1rem .3rem; list-style-position: inside; }
.nav details.navmore > summary:hover { color: #fff; }


/* "what is left before issuing" on a draft quote */
.ready { border: 1px solid var(--zinc); border-radius: var(--radius); padding: .6rem .8rem; margin: 0 0 .8rem; }
.ready.ok { border-color: #B9DCC6; background: #F5FBF7; }
.ready.no { border-color: #EBC1BD; background: #FFFBFA; }
.ready h3 { margin: 0 0 .3rem; font-size: .95rem; }
.ready ul { list-style: none; margin: 0; padding: 0; }
.ready li { padding: .18rem 0; padding-inline-start: 1.4rem; position: relative; font-size: .9rem; }
.ready li::before { position: absolute; inset-inline-start: 0; font-weight: 700; }
.ready li.no::before { content: "✕"; color: var(--err); }
.ready li.wait::before { content: "!"; color: var(--warn); }
.ready li.tip::before { content: "•"; color: var(--steel); }
.ready li.yes::before { content: "✓"; color: var(--ok); }
.ready a { font-weight: 700; }
tr:target td { outline: 2px solid var(--amber); outline-offset: -2px; }
form.move { display: inline-flex; flex-direction: column; gap: 2px; }
form.move button { padding: 0 .35rem; line-height: 1.25; font-size: .7rem; }
.row-actions { align-items: flex-start; }
form.move button:disabled { opacity: .35; cursor: default; }

/* dashboard: my work and linked alerts */
.work h3 { margin-top: .9rem; font-size: .95rem; }
.work > h3:nth-child(2) { margin-top: 0; }
.alert-link a { font-weight: 700; white-space: nowrap; margin-inline-start: .4rem; }

/* tables edited in place */
.savebar { position: sticky; top: 0; z-index: 3; background: var(--paper); padding: .4rem 0; margin-bottom: .4rem; gap: .8rem; align-items: center; }
tr.changed td { background: #FFF7E0; }
tr.changed td:first-child { box-shadow: inset -4px 0 0 var(--amber); }

/* live price: line total */
.live .line-total { font-size: .9rem; margin-top: .2rem; }
.live .line-total .num { font-weight: 700; }

/* go-live checklist */
table.golive td { vertical-align: top; }
table.golive td.state { width: 7.5rem; white-space: nowrap; }
table.golive td.go { width: 9rem; text-align: end; white-space: nowrap; }
table.golive tr.done td { color: var(--steel); }
.tag.gl-ok { border-color: #B9DCC6; background: #DDF0E4; color: #1E5434; }
.tag.gl-err { border-color: #EBC1BD; background: #F8DAD7; color: #8A1F17; }
.tag.gl-warn { border-color: #E9CC9C; background: #FCE9C4; color: #7A4B00; }
