/* ASM Interiors - Site Control. Dark maroon, white and neutral. */
:root {
  --maroon: #6d1f2f;
  --maroon-dark: #521624;
  --maroon-soft: #f5ecee;
  --gold: #b08d57;
  --ink: #1f1d1d;
  --muted: #6b6466;
  --line: #e4dfe0;
  --bg: #f7f5f4;
  --card: #ffffff;
  --ok: #2f7a4b;
  --ok-soft: #e7f3ec;
  --warn: #9a6a00;
  --warn-soft: #fbf3df;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --info: #2c5d8a;
  --info-soft: #e8f0f8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Nastaliq Urdu", "Noto Sans Arabic", sans-serif; }
a { color: var(--maroon); }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar { background: var(--maroon); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  height: 56px; position: sticky; top: 0; z-index: 50; }
.brand { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand .word { font-family: Georgia, "Times New Roman", serif; letter-spacing: 3px; font-size: 17px; white-space: nowrap; }
.brand .proj { font-size: 11.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand img { height: 34px; width: 34px; }
.nav { display: flex; gap: 2px; margin-left: 12px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #fff; text-decoration: none; padding: 8px 11px; border-radius: 6px; font-size: 14px; white-space: nowrap; opacity: .88; }
.nav a.active, .nav a:hover { background: rgba(255,255,255,.14); opacity: 1; }
.topbar .spacer { flex: 1; }
.userchip { font-size: 13px; text-align: right; line-height: 1.2; white-space: nowrap; }
.userchip small { opacity: .8; display: block; }
.iconbtn { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 6px; padding: 6px 10px; cursor: pointer; }
.menu-toggle { display: none; }
.nav .menu-only { display: none; }

@media (max-width: 900px) {
  .nav { position: fixed; top: 56px; left: 0; right: 0; background: var(--maroon-dark); flex-direction: column; margin: 0; padding: 8px;
    display: none; z-index: 60; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 16px; }
  .menu-toggle { display: inline-block; }
  .nav .menu-only { display: block; }
  .userchip { display: none; }
}

/* ---------- layout ---------- */
main { padding: 16px; max-width: 1400px; margin: 0 auto; }
.page-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.page-title h1 { font-size: 21px; margin: 0; font-weight: 600; }
.page-title .sub { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.card h2 { font-size: 15px; margin: 0 0 10px; font-weight: 600; color: var(--maroon); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .g2, .g3 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.note { background: var(--info-soft); color: #1d3e5c; border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.warnbox { background: var(--warn-soft); color: #5f4400; border-radius: 8px; padding: 9px 12px; font-size: 13px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow);
  text-decoration: none; color: inherit; display: block; }
.kpi .v { font-size: 26px; font-weight: 650; line-height: 1.1; }
.kpi .l { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kpi.bad .v { color: var(--bad); } .kpi.warn .v { color: var(--warn); } .kpi.ok .v { color: var(--ok); } .kpi.m .v { color: var(--maroon); }

/* ---------- buttons / forms ---------- */
.btn { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer;
  font-size: 14px; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; }
.btn:hover { border-color: #c9c1c3; }
.btn.primary { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.btn.primary:hover { background: var(--maroon-dark); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.bad { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 4px 9px; min-height: 30px; font-size: 13px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  border: 1px solid #d6cfd1; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); min-height: 38px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }

/* ---------- badges ---------- */
.badge { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 99px; border: 1px solid transparent; white-space: nowrap; font-weight: 550; }
.st-not_started { background: #f0eeee; color: #555; }
.st-in_progress { background: var(--info-soft); color: var(--info); }
.st-completion_requested { background: var(--warn-soft); color: var(--warn); }
.st-completed { background: var(--ok-soft); color: var(--ok); }
.st-problem { background: var(--bad-soft); color: var(--bad); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-m { background: var(--maroon-soft); color: var(--maroon); }
.b-grey { background: #f0eeee; color: #555; }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); background: #faf8f8; padding: 8px 10px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 8px 10px; border-bottom: 1px solid #f0ecec; vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fcf9f9; }
table.t tr.sum td { background: #f6f2f3; font-weight: 600; color: var(--maroon); }
table.t tr.ms td:first-child::before { content: "\25C6  "; color: var(--gold); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- progress bars ---------- */
.bar { position: relative; height: 10px; background: #efeaea; border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ok); border-radius: 99px; }
.bar > b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--maroon); }
.bars .r { display: grid; grid-template-columns: minmax(120px, 210px) 1fr 92px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; border-bottom: 1px dashed #eee; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 8px; border-radius: 2px; margin-right: 5px; background: var(--c); vertical-align: middle; }

/* ---------- drawer / modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,10,12,.42); z-index: 80; display: flex; justify-content: flex-end; }
.drawer { background: #fff; width: min(640px, 100%); height: 100%; overflow-y: auto; padding: 18px; box-shadow: -4px 0 18px rgba(0,0,0,.15); }
.drawer h2 { margin: 0 0 4px; font-size: 19px; }
.modal-wrap { position: fixed; inset: 0; background: rgba(20,10,12,.5); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: min(520px, 100%); max-height: 92vh; overflow-y: auto; padding: 18px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 13.5px; margin: 10px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.timeline li { border-left: 2px solid var(--line); padding: 4px 0 10px 12px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--maroon); }
.section-h { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 6px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #222; color: #fff; padding: 10px 16px; border-radius: 8px;
  z-index: 100; font-size: 14px; max-width: 92vw; }
.toast.err { background: var(--bad); }

/* ---------- worker screen ---------- */
.worker { max-width: 720px; margin: 0 auto; }
.worker .hello { font-size: 18px; margin: 4px 0 2px; }
.wtabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.wtabs button { flex: 1; min-width: 100px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 15px; cursor: pointer; }
.wtabs button.on { background: var(--maroon); color: #fff; border-color: var(--maroon); }
.task { display: flex; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 14px 14px 16px;
  margin-bottom: 10px; box-shadow: var(--shadow); }
.task .where { font-size: 13px; color: var(--maroon); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.task .what { font-size: 20px; font-weight: 600; margin: 3px 0 6px; line-height: 1.2; }
.task .when { font-size: 14.5px; color: #444; line-height: 1.5; }
.task .info { flex: 1; min-width: 0; }
.tick { width: 68px; height: 68px; border: 3px solid #8b8385; border-radius: 12px; background: #fff; font-size: 38px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex: none; color: #fff; }
.tick.requested { background: var(--warn); border-color: var(--warn); }
.tick.done { background: var(--ok); border-color: var(--ok); }
.tick.problem { background: var(--bad); border-color: var(--bad); }
.tick.started { border-color: var(--info); color: var(--info); }
.task.late { border-left: 6px solid var(--bad); }
.bigchoice { display: grid; gap: 12px; margin-top: 12px; }
.bigchoice button { padding: 18px; font-size: 21px; border-radius: 12px; border: 2px solid var(--line); background: #fff; cursor: pointer; text-align: left; display: flex; gap: 14px; align-items: center; }
.bigchoice button .ic { font-size: 30px; width: 36px; text-align: center; }
.bigchoice .c-ok { border-color: var(--ok); color: var(--ok); }
.bigchoice .c-bad { border-color: var(--bad); color: var(--bad); }
.bigchoice .c-info { border-color: var(--info); color: var(--info); }
.reasons button { font-size: 18px; padding: 15px; }
[dir=rtl] .bigchoice button { text-align: right; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: linear-gradient(160deg, var(--maroon) 0%, var(--maroon-dark) 55%, #2b0b12 100%); }
.login .box { background: #fff; border-radius: 16px; padding: 28px 24px; width: min(400px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.login .word { font-family: Georgia, serif; letter-spacing: 4px; color: var(--maroon); font-size: 22px; text-align: center; }
.login .tag { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login form { display: grid; gap: 12px; }

/* ---------- gantt ---------- */
.gantt-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; max-height: 72vh; }
.gantt-wrap svg { display: block; }
.gantt-wrap text { font-size: 11px; font-family: inherit; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 14px; cursor: pointer; border-bottom: 3px solid transparent; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tabs button.on { border-bottom-color: var(--maroon); color: var(--maroon); font-weight: 600; }

/* ---------- print / reports ---------- */
.report { background: #fff; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); }
.report .rhead { display: flex; justify-content: space-between; border-bottom: 3px solid var(--maroon); padding-bottom: 10px; margin-bottom: 14px; gap: 12px; }
.report .rhead .word { font-family: Georgia, serif; letter-spacing: 3px; color: var(--maroon); font-size: 20px; }
.report h3 { color: var(--maroon); font-size: 15px; margin: 18px 0 6px; }
.report table.t { font-size: 12px; }
.report .rfoot { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 11px; color: var(--muted); }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; }
  .topbar, .no-print, .toast { display: none !important; }
  main { padding: 0; max-width: none; }
  .report { border: none; padding: 0; }
  .tablewrap { overflow: visible; border: none; }
  table.t th { position: static; }
  tr { break-inside: avoid; }
}
