/* WME CRM - one stylesheet, mobile first, no framework. */
:root {
  --navy: #003585; --navy-2: #0a2b66; --blue: #0060c0; --cyan: #008dd4;
  --ink: #1d2433; --muted: #667085; --line: #e3e7ee; --bg: #f3f5f9; --card: #fff;
  --ok: #1e7b34; --ok-bg: #e6f4ea; --warn: #b54708; --warn-bg: #fef0c7; --bad: #b42318; --bad-bg: #fde2e1;
  --cold: #854a0e; --cold-bg: #fef7c3; --info: #0b5394; --info-bg: #dceefb;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
[hidden], .check[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", Arial, sans-serif; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; color: var(--navy); letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; color: var(--navy); }
h3 { font-size: 14px; margin: 14px 0 8px; color: var(--ink); }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.print-only { display: none; }

/* ---------- header ---------- */
.top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.top-in { max-width: 1320px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--cyan); color: #fff; display: grid; place-items: center; font-weight: 800; font-family: Georgia, serif; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: rgba(255, 255, 255, .78); padding: 8px 10px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.on { color: #fff; background: rgba(255, 255, 255, .16); font-weight: 600; }
.btn-log { background: var(--cyan) !important; color: #fff !important; border-color: var(--cyan) !important; font-weight: 700; white-space: nowrap; }
.me { position: relative; }
.me summary { list-style: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .16); display: grid; place-items: center; font-size: 12px; font-weight: 700; overflow: hidden; }
.me summary::-webkit-details-marker { display: none; }
.me .menu { position: absolute; right: 0; top: 42px; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(16, 24, 40, .18); min-width: 200px; padding: 6px; z-index: 30; }
.me .menu a, .me .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.me .menu a:hover, .me .menu button:hover { background: var(--bg); text-decoration: none; }
.me .who { padding: 8px 10px 10px; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.me .who small { display: block; color: var(--muted); font-weight: 400; }

/* ---------- layout ---------- */
.wrap { max-width: 1320px; margin: 0 auto; padding: 18px 16px 80px; }
.narrow { max-width: 760px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
/* grid children may shrink below their content's width, so wide tables scroll inside their card instead of widening the page */
.grid2 > *, .grid3 > * { min-width: 0; }
.grid3 { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 0; }
.grid3 > .card { margin-bottom: 16px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.empty { text-align: center; padding: 28px; color: var(--muted); }
.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; overflow-x: auto; }
.subnav a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a.on { color: var(--navy); border-color: var(--navy); font-weight: 600; }
.subnav a:hover { text-decoration: none; color: var(--navy); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #cfd6e1; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { text-decoration: none; background: #f7f9fc; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.linkbtn.danger, .danger { color: var(--bad); }
.row-actions { display: flex; gap: 14px; align-items: center; font-size: 13px; margin-top: 4px; }
.row-actions form { display: inline; }
form.inline { display: inline; }

/* ---------- forms ---------- */
.vp-fresh { background: var(--info-bg); color: var(--info); border-radius: 8px; padding: 8px 12px; margin: 0 0 12px; font-size: 14px; }
.form label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 14px; color: #344054; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .filters input, .filters select, .table input, .table select, .addrow input {
  display: block; width: 100%; margin-top: 6px; height: 42px; padding: 0 12px; border: 1px solid #cfd6e1; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; font-weight: 400; }
.form textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus, .chip input:focus-visible + span { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 141, 212, .18); }
.form small { display: block; font-weight: 400; margin-top: 5px; }
small.error { color: var(--bad); font-weight: 600; }
.row2, .row3 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }
.check input { width: 18px; height: 18px; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; position: relative; }
legend { font-weight: 600; font-size: 13.5px; color: #344054; margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips legend { width: 100%; }
.chip { position: relative; margin: 0 !important; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span { display: inline-flex; align-items: center; min-height: 38px; padding: 6px 14px; border: 1px solid #cfd6e1; border-radius: 999px; background: #fff; font-weight: 500; font-size: 14px; cursor: pointer; user-select: none; }
.chip:hover span { border-color: var(--cyan); }
.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-won input:checked + span { background: var(--ok); border-color: var(--ok); }
.chip-lost input:checked + span { background: var(--bad); border-color: var(--bad); }
.chip-hold input:checked + span { background: #667085; border-color: #667085; }
.chip.current span { box-shadow: inset 0 0 0 2px var(--cyan); }
.chip.current span::after { content: "now"; font-size: 10px; font-weight: 700; color: var(--cyan); margin-left: 6px; text-transform: uppercase; }
.chip.current input:checked + span::after { color: #fff; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.quick button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink); }
.quick button:hover { border-color: var(--cyan); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
form.filters.inline { display: flex; margin: 0; }
.page-head > form.filters { flex: 1 1 520px; justify-content: flex-end; }
.flt { display: block; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 140px; }
.flt input, .flt select { height: 36px !important; margin-top: 4px !important; }
.flt.grow { flex: 1; min-width: 180px; }
.flt.check { min-width: 0; color: var(--ink); height: 36px; }
.addrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.addrow input { flex: 1; min-width: 120px; margin: 0; height: 34px; }
.w4 { max-width: 80px; }
.w8 { max-width: 150px; }

/* ---------- update form ---------- */
.log-grid { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.logform section { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 16px; }
.logform h2 { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.logform h2 small { font-weight: 400; }
.logform .n { width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 13px; flex: none; }
.context { background: #f0f7fc; border: 1px solid #cfe5f5; border-radius: 8px; padding: 10px 12px; margin: -4px 0 14px; font-size: 14px; }
.context:empty { display: none; }
.context .muted { display: block; margin-top: 4px; }
.more { margin-bottom: 16px; }
.more summary { cursor: pointer; font-weight: 600; color: var(--navy); padding: 6px 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.logform .form-actions { position: sticky; bottom: 0; background: #fff; margin: 0 -16px -16px; padding: 12px 16px; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
.logform .form-actions .btn { min-width: 120px; }
.saved { display: flex; gap: 12px; align-items: center; border-color: #b7e1c3; background: #f3fbf5; }
.saved-tick { width: 36px; height: 36px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.recent-list li:last-child { border-bottom: 0; }
.combo { position: relative; }
.combo-native { position: absolute !important; left: 12px; bottom: 0; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.combo-list { position: absolute; z-index: 15; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 28px rgba(16, 24, 40, .16); max-height: 300px; overflow: auto; font-weight: 400; }
.combo-list li { padding: 9px 10px; border-radius: 6px; cursor: pointer; }
.combo-list li.on, .combo-list li:hover { background: #eaf4fb; }
.combo-list li.none { color: var(--muted); cursor: default; }
input.invalid { border-color: var(--bad) !important; }

/* ---------- badges ---------- */
.st, .stg, .pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; vertical-align: middle; }
.st { text-transform: uppercase; }
.st-overdue, .st-no-next-step { background: var(--bad-bg); color: var(--bad); }
.st-due-today { background: var(--warn-bg); color: var(--warn); }
.st-check-in-due { background: var(--info-bg); color: var(--info); }
.st-going-cold { background: var(--cold-bg); color: var(--cold); }
.st-this-week { background: var(--ok-bg); color: var(--ok); }
.st-on-track { background: #eef6f0; color: var(--ok); }
.st-won { background: #d1fadf; color: #05603a; }
.st-on-hold { background: #f2f4f7; color: #475467; }
.st-lost { background: #f2f4f7; color: #98a2b3; }
.stg { font-weight: 600; background: #eef2f8; color: #344054; }
.stg-s1 { background: #eef4ff; color: #3538cd; } .stg-s2 { background: #e0eaff; color: #2d31a6; }
.stg-s3 { background: #d1e9ff; color: #175cd3; } .stg-s4 { background: #b2ddff; color: #1849a9; }
.stg-s5 { background: #84caff; color: #102a56; } .stg-won { background: #d1fadf; color: #05603a; }
.stg-hold { background: #f2f4f7; color: #475467; } .stg-lost { background: #fee4e2; color: #912018; }
.pill { background: #f2f4f7; color: #475467; font-weight: 600; }
.pill-new { background: #ecfdf3; color: #027a48; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }

/* ---------- flash ---------- */
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: #0b4a1f; border: 1px solid #b7e1c3; }
.flash-error { background: var(--bad-bg); color: #7a1a12; border: 1px solid #f6c3be; }
.flash-info { background: #eaf2fd; color: #0b3a75; border: 1px solid #c4d9f5; font-weight: 400; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; }
.card .table-wrap { border: 0; box-shadow: none; margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 10px; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table .note { max-width: 340px; color: #475467; }
.table .note span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table.compact input, .table.compact select { height: 34px; margin: 0; }
.table tr.total td { background: #f8fafc; border-top: 2px solid var(--line); }
.table tr.inactive td { opacity: .55; }
.table td.c, .table th.c { text-align: center; }
input.w-time { width: 140px; }
.email-settings { margin-top: 14px; }
ul.tight { margin: 0; padding-left: 18px; }
ul.tight li { margin-bottom: 8px; }
.kv dd .warn { font-weight: 600; }
.table .act { text-align: right; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f8fbfe; }
.cellbar { position: relative; }
.cellbar span { position: absolute; left: 4px; top: 7px; bottom: 7px; background: #e0effa; border-radius: 4px; z-index: 0; max-width: calc(100% - 8px); }
.cellbar b { position: relative; z-index: 1; }
.stats td { white-space: nowrap; }
.stats th { white-space: normal; min-width: 0; vertical-align: bottom; line-height: 1.25; }
.stats td, .stats th { padding-left: 7px; padding-right: 7px; }

/* ---------- follow-ups / pipeline ---------- */
.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.counter { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; color: var(--ink); box-shadow: var(--shadow); }
.counter:hover { text-decoration: none; border-color: var(--cyan); }
.counter b { display: block; font-size: 24px; font-family: Georgia, serif; }
.counter span { font-size: 12px; text-transform: capitalize; color: var(--muted); font-weight: 600; }
.c-overdue b, .c-no-next-step b { color: var(--bad); } .c-due-today b { color: var(--warn); }
.c-check-in-due b { color: var(--info); } .c-going-cold b { color: var(--cold); } .c-this-week b { color: var(--ok); }
.group h2 { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.funnel { display: grid; gap: 6px; }
.fbar, .bar { display: grid; grid-template-columns: 150px 1fr 150px; gap: 10px; align-items: center; color: var(--ink); padding: 3px 4px; border-radius: 6px; font-size: 13.5px; }
.fbar:hover { background: #f5f9fd; text-decoration: none; }
.fbar.on { background: #eaf4fb; }
.fl, .bl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft, .bt { height: 14px; background: #f0f3f8; border-radius: 7px; overflow: hidden; }
.fill { display: block; height: 100%; background: var(--blue); border-radius: 7px; min-width: 2px; }
.fill-won { background: var(--ok); } .fill-lost { background: #f04438; } .fill-hold { background: #98a2b3; }
.lost .fill { background: #f04438; }
.fn, .bn { font-size: 13px; color: var(--muted); white-space: nowrap; }
.fn b, .bn b { color: var(--ink); }

/* ---------- deal / customer ---------- */
.kv h3 { margin-top: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.kv dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.kv .big { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.phone { display: inline-flex; gap: 6px; align-items: center; margin-right: 8px; white-space: nowrap; }
.wa { font-size: 10px; font-weight: 800; color: #fff !important; background: #25d366; border-radius: 4px; padding: 1px 4px; }
.wa:hover { text-decoration: none; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px 14px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #98a2b3; }
.timeline li.fwd::before { border-color: var(--ok); background: var(--ok); }
.timeline li.archived { opacity: .7; }
.tl-head { font-size: 14px; }
.tl-note { margin: 4px 0; white-space: pre-wrap; }
.tl-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: #475467; }
.imported { background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; color: #475467; margin-top: 4px; }

/* ---------- dashboard / weekly ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.tile { background: #f8fafc; border: 1px solid var(--line); border-top: 3px solid var(--cyan); border-radius: 8px; padding: 10px 12px; }
.tile span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.tile b { display: block; font-size: 26px; font-family: Georgia, serif; color: var(--navy); line-height: 1.2; margin: 2px 0; }
.tile small { color: var(--muted); font-size: 11.5px; }
.bars { display: grid; gap: 4px; }
.bar { grid-template-columns: 140px 1fr 120px; }
.health .bar:nth-child(1) .fill, .health .bar:nth-child(3) .fill { background: #f04438; }
.health .bar:nth-child(2) .fill { background: #f79009; } .health .bar:nth-child(4) .fill { background: var(--info); }
.health .bar:nth-child(5) .fill { background: #eaaa08; } .health .bar:nth-child(6) .fill, .health .bar:nth-child(7) .fill { background: var(--ok); }
.health .bar:nth-child(8) .fill { background: #12b76a; } .health .bar:nth-child(n+9) .fill { background: #98a2b3; }
.cols { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; align-items: end; height: 150px; padding-top: 6px; }
.col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.cb { width: 70%; background: var(--blue); border-radius: 4px 4px 0 0; min-height: 2px; }
.cv { font-size: 12px; font-weight: 700; }
.cl { font-size: 11px; color: var(--muted); white-space: nowrap; }
.weeknav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 0; }
.highlights { display: grid; grid-template-columns: 1fr; gap: 12px; }
.hl { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; border-left: 4px solid var(--blue); }
.hl h3 { margin: 0 0 6px; display: flex; justify-content: space-between; }
.hl .count { background: var(--bg); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.hl ul { margin: 0; padding: 0; list-style: none; }
.hl li { padding: 6px 0; border-top: 1px solid var(--line); }
.hl li:first-child { border-top: 0; }
.hl li .muted { display: block; }
.hl-won { border-left-color: var(--ok); } .hl-lost { border-left-color: #f04438; } .hl-proposals { border-left-color: #7a5af8; }
.hl-samples { border-left-color: var(--cyan); } .hl-forward { border-left-color: #12b76a; } .hl-new { border-left-color: #f79009; }
.day h3 { margin: 16px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--navy); color: var(--navy); }
.day:first-child h3 { margin-top: 0; }

/* ---------- wins / orders ---------- */
.pill-won { background: var(--ok-bg); color: var(--ok); }
.row-won td { background: #f0faf3; }
.row-won td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.hl h3 { align-items: center; justify-content: flex-start; gap: 8px; }
.hl h3 .count { margin-left: auto; }
.hl-won { background: #f6fcf8; }
.hl-total { color: var(--ok); font-size: 13px; }
.hl .amt { color: var(--ok); white-space: nowrap; }
.tile-won { border-top-color: var(--ok); } .tile-won b { color: var(--ok); }
.table th.th-won { color: var(--ok); }
.cell-won span { background: #d3f0dc; }
.won-box { display: block; background: var(--ok-bg); border: 1px solid #b7e1c3; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.won-title { margin: 0 0 8px; color: #0b4a1f; }
.won-box > .row2 label { margin-bottom: 8px; }
.won-box > small { margin: 6px 0 4px; }
#order-price { font-weight: 700; color: var(--ok); }
.po-title { font-weight: 600; font-size: 13.5px; color: #344054; margin: 12px 0 0; }
.po-line { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; align-items: end; border-top: 1px dashed #b7e1c3; padding-top: 8px; margin-top: 8px; }
.po-line label:first-child, .po-line .error { grid-column: 1 / -1; }
.po-line .po-remove { justify-self: start; margin: 0 0 14px; }
#po-add { margin-top: 10px; background: #fff; }
.req { font-weight: 400; font-size: 12px; color: var(--ok); }

.nr-box { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; background: #f2f4f7; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.nr-box input { margin-top: 3px; }
.st-not-relevant { background: #f2f4f7; color: #667085; }
form.move { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
form.move select { max-width: 210px; padding: 4px 6px; font-size: 13px; }
.health .bar:nth-child(11) .fill { background: #d0d5dd; }

/* ---------- customer form ---------- */
.form .sec { font-size: 15px; color: var(--navy); margin: 18px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.form .sec.first { border-top: 0; padding-top: 0; margin-top: 4px; }
.star { color: var(--bad); font-weight: 700; }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.flash-warn { background: var(--warn-bg); color: #7a2e0e; border: 1px solid #fedf89; font-weight: 400; }
.btn-link { background: none; border: 0; color: var(--blue); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

/* ---------- auth ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, #003585, #0060c0 60%, #008dd4); }
body.auth .wrap { padding: 16px; width: 100%; }
.auth-card { max-width: 380px; margin: 0 auto; background: #fff; border-radius: 14px; padding: 28px 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.brand.big { color: var(--navy); font-size: 22px; margin-bottom: 14px; }
.brand.big .logo { width: 38px; height: 38px; font-size: 20px; }
.help ol, .help ul { padding-left: 20px; }
.help li { margin-bottom: 6px; }

/* ---------- responsive: cards on phones ---------- */
/* ---------- forecast ---------- */
.ok { color: var(--ok); }
.fc-sum th small { display: block; font-weight: 400; }
.fc-sum tr.total td { font-weight: 700; border-top: 2px solid #cfd6e1; }
.fc-sum tr.muted-row td { color: var(--muted); }
.fc-sum tr.actual td { background: #f8fafc; }
.flags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.flag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #f2f4f7; color: #475467; white-space: nowrap; }
.flag-missing, .flag-risk, .flag-overdue { background: var(--bad-bg); color: var(--bad); }
.flag-stale, .flag-comp, .flag-late { background: var(--warn-bg); color: var(--warn); }
.flag-month { background: var(--info-bg); color: var(--info); }
.cat { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.cat-commit { background: var(--ok-bg); color: var(--ok); }
.cat-best { background: var(--info-bg); color: var(--info); }
.cat-pipeline { background: #f2f4f7; color: #475467; }
.cat-omit { background: #f2f4f7; color: #98a2b3; text-decoration: line-through; }
.table tr.cat-row-omit td { opacity: .6; }
.fc-form { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 6px; min-width: 150px; }
.table .fc-form input, .table .fc-form select { height: 32px; margin-top: 0; padding: 0 8px; font-size: 13px; }
.fc-form .btn { height: 32px; }
.fc-table td { vertical-align: top; }
.orders { display: flex; flex-wrap: wrap; gap: 4px; }
.om { display: inline-block; padding: 1px 7px; border-radius: 999px; background: #eef4ff; color: #1d2433; font-size: 12px; white-space: nowrap; }
.om-typed { background: #fff4d6; box-shadow: inset 0 0 0 1px #f0c25a; }
.om-zero { background: #f2f4f7; color: #98a2b3; text-decoration: line-through; }
details.months { margin-top: 6px; }
details.months summary { cursor: pointer; color: var(--blue); font-size: 13px; }
.mgrid { display: grid; grid-template-columns: repeat(3, minmax(64px, 1fr)); gap: 6px; margin: 6px 0 4px; }
.mgrid label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.table .mgrid input { height: 30px; margin-top: 2px; padding: 0 6px; font-size: 13px; }
.stg-line { margin-top: 4px; }
.order-sets { display: grid; gap: 6px; margin-bottom: 6px; min-width: 170px; }
.table .order-sets select { height: 32px; margin-top: 0; padding: 0 8px; font-size: 13px; }
.table select.tier-sel { width: auto; height: 32px; margin-top: 0; padding: 0 6px; font-size: 13px; }
.fill-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; min-width: 260px; }
.table .fill-form input { height: 32px; margin-top: 0; padding: 0 8px; font-size: 13px; }
.table .fill-form input[readonly] { background: #f2f4f7; color: var(--muted); }
.fill-form .btn { height: 32px; }

@media (max-width: 760px) {
  .top { position: static; }
  .top-in { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand span:last-child { display: none; }
  .nav { order: 3; flex-basis: 100%; }
  .btn-log { margin-left: auto; }
  .wrap { padding: 14px 12px 90px; }
  h1 { font-size: 20px; }
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .table.cards td { border: 0; padding: 3px 0 3px 112px; position: relative; min-height: 24px; }
  .table.cards td::before { content: attr(data-label); position: absolute; left: 0; top: 5px; width: 104px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
  .table.cards td:not([data-label]) { padding-left: 0; }
  .table.cards td:not([data-label])::before { content: none; }
  .table.cards td.r { text-align: left; }
  .table.cards td.act { display: block; text-align: left; padding-top: 8px; }
  .table.cards td.act .btn { width: 100%; height: 40px; }
  .table .note { max-width: none; }
  .fbar, .bar { grid-template-columns: 105px 1fr 92px; font-size: 12.5px; }
  .fn, .bn { white-space: normal; line-height: 1.2; overflow-wrap: anywhere; }
  .logform .form-actions { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; width: 100%; border-radius: 0; z-index: 10; box-shadow: 0 -6px 18px rgba(16, 24, 40, .1); }
  .logform .form-actions .btn { flex: 1; }
  .fc-form, .fill-form, .order-sets { min-width: 0; }
  .flag { white-space: normal; }
}
@media (min-width: 761px) {
  .row2 { grid-template-columns: 1fr 1fr; }
  .row3 { grid-template-columns: 1fr 1fr 1fr; }
  .po-line { grid-template-columns: 2fr 1fr 1fr auto; }
  .po-line label:first-child { grid-column: auto; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .grid3 { grid-template-columns: repeat(3, 1fr); }
  .counters { grid-template-columns: repeat(6, 1fr); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .highlights { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1100px) {
  .log-grid { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
  .tiles { grid-template-columns: repeat(6, 1fr); }
  .highlights { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- print / PDF (weekly report, forecast, dashboard) ----------
   A4 landscape with real margins, a title block on page 1, "Page x of y" in the footer, colours kept
   without the "Background graphics" option, headings kept with what follows and rows never split. */
@media print {
  @page {
    size: A4 landscape;
    margin: 15mm 15mm 16mm;
    @bottom-left { font: 7.5pt Arial, sans-serif; color: #667085; vertical-align: top; padding-top: 4mm; }
    @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 7.5pt Arial, sans-serif; color: #667085; vertical-align: top; padding-top: 4mm; }
  }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff; }
  body { font: 9pt/1.35 Arial, "Noto Sans Arabic", sans-serif; color: #1d2433; }
  .top, .no-print, .filters, .head-actions, .row-actions, .btn, .flash, .subnav { display: none !important; }
  .wrap:has(.print-head) .page-head { display: none !important; }   /* reports print their own title block */
  .wrap { max-width: none; margin: 0; padding: 0; }
  .print-only { display: block; }
  span.print-only { display: inline; }
  a { color: inherit; text-decoration: none; }

  /* title block (page 1) */
  .print-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-bottom: 2px solid var(--navy); padding-bottom: 6px; margin: 0 0 14px; }
  .ph-title { font: 700 17pt/1.15 Georgia, serif; color: var(--navy); }
  .ph-sub { font-size: 9pt; color: #475467; margin-top: 3px; }
  .ph-co { text-align: right; font-size: 8pt; color: #667085; white-space: nowrap; }
  .ph-co b { display: block; font-size: 10pt; color: var(--navy); }

  /* sections */
  .card { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 0; margin: 0 0 16px; }
  .table-wrap, .card .table-wrap { overflow: visible !important; border: 0; box-shadow: none; margin: 0; background: none; }
  h1, h2, h3, h4 { break-after: avoid; page-break-after: avoid; }
  h2 { font-size: 11.5pt; margin: 0 0 7px; padding-bottom: 3px; border-bottom: 1px solid #cfd6e1; }
  h3 { font-size: 9.5pt; margin: 10px 0 5px; }
  h2 .small, h3 .small { font-size: 7.5pt; font-weight: 400; }
  p { margin: 0 0 6px; }
  .small { font-size: 7.5pt; }
  .print-break { break-before: page; page-break-before: always; }

  /* tables fit the page: cells wrap, rows never split, the header row repeats on every page */
  .table { width: 100%; font-size: 8.5pt; }
  .table thead { display: table-header-group; }
  .table th { font-size: 6.8pt; padding: 4px 5px; white-space: normal; background: #f1f4f8; border-bottom: 1px solid #cfd6e1; }
  .table td { padding: 4px 5px; border-bottom: 1px solid #e3e7ee; overflow-wrap: break-word; }
  .table tr, .table td { break-inside: avoid; page-break-inside: avoid; }
  .table .note { max-width: none; }
  .table .note span { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .table.compact td, .table.compact th { padding: 3px 5px; }
  .stats { font-size: 8pt; }
  .stats th { font-size: 6.5pt; min-width: 0; }
  .st, .stg, .pill, .cat, .flag { font-size: 6.8pt; padding: 1px 6px; }

  /* blocks that should stay whole on one page */
  .tile, .hl, .grid2 > *, .cols, .bars, .day h3, .print-keep { break-inside: avoid; page-break-inside: avoid; }
  .tiles { grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
  .tile { padding: 6px 8px; border-top-width: 2px; }
  .tile b { font-size: 15pt; }
  .tile span, .tile small { font-size: 7pt; }
  .grid2 { grid-template-columns: 1fr 1fr; gap: 10px 22px; }
  .highlights { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .hl { padding: 6px 8px; }
  .hl li { padding: 4px 0; }
  .bar { grid-template-columns: 130px 1fr 110px; font-size: 8pt; padding: 1px 2px; }
  .bn { font-size: 7.5pt; }
  .bt { height: 10px; }
  .cols { height: 105px; }
  .cl, .cv { font-size: 7pt; }
  .day { break-inside: auto; }
  .day h3 { margin-top: 12px; }

  /* forecast page */
  .fc-top { display: block; }
  /* the forecast on paper: only the deals with an order in these months - unless a manager chose "Print all deals" */
  body:not(.print-all) tr.print-zero, body:not(.print-all) section.print-empty, body:not(.print-all) .print-all-note, body.print-all .print-fc-note { display: none !important; }
  span.print-only.print-note { display: block; margin-top: 4px; font-weight: 600; color: var(--navy); }
  .fc-print { margin-top: 3px; font-size: 7.5pt; color: #475467; }
  .om { font-size: 7pt; padding: 0 5px; }
}
