/* ============================================================================
 * INFINITY CMMS — Main Stylesheet
 * Light, professional enterprise UI with blue/teal accents
 * Based on the Maintenance Connection format, rebranded as Infinity CMMS
 * ============================================================================ */

:root {
  --bg:        #f0f2f7;
  --bg2:       #e8eaf1;
  --surface:   #ffffff;
  --surface2:  #f7f8fb;
  --border:    #e1e5f0;
  --border2:   #cdd3e6;
  --blue:      #2563eb;
  --blue-d:    #1d4ed8;
  --blue-l:    #dbeafe;
  --blue-xl:   #eff6ff;
  --teal:      #0d9488;
  --teal-l:    #ccfbf1;
  --teal-xl:   #f0fdfa;
  --green:     #16a34a;
  --green-l:   #dcfce7;
  --amber:     #d97706;
  --amber-l:   #fef3c7;
  --red:       #dc2626;
  --red-l:     #fee2e2;
  --purple:    #7c3aed;
  --purple-l:  #ede9fe;
  --slate:     #475569;
  --slate-l:   #f1f5f9;
  --text:      #0f172a;
  --text2:     #334155;
  --text3:     #64748b;
  --text4:     #94a3b8;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.06);
  --shadow-sm: 0 1px 4px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.05);
  --shadow:    0 4px 14px rgba(15,23,42,.10), 0 1px 4px rgba(15,23,42,.06);
  --shadow-lg: 0 16px 48px rgba(15,23,42,.14), 0 4px 14px rgba(15,23,42,.08);
  --radius:    9px;
  --sidebar-w: 234px;
  --hdr-h:     56px;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
}

/* ══ TOPBAR ══ */
.hdr {
  height: var(--hdr-h);
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 200;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 15px;
  color: var(--text); white-space: nowrap;
  text-decoration: none; letter-spacing: -.01em;
}
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(145deg, #2563eb, #0d9488);
  border-radius: 9px;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(37,99,235,.3), inset 0 1px 0 rgba(255,255,255,.2);
}
.logo-icon svg { width: 19px; height: 19px; }
.logo em { color: var(--blue); font-style: normal; font-weight: 700; }
.hdr-div { width: 1px; height: 22px; background: var(--border); }
.bc { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text3); }
.bc span { cursor: pointer; transition: color .12s; }
.bc span:hover { color: var(--blue); }
.bc .cur { color: var(--text2); font-weight: 600; }
.bc .sep { color: var(--border2); pointer-events: none; }
.hdr-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hdr-btn {
  height: 32px; padding: 0 12px; border-radius: 7px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 12.5px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  font-weight: 600; font-family: inherit; transition: all .13s;
}
.hdr-btn:hover { background: var(--bg); border-color: var(--border2); }
.hdr-btn.primary {
  background: var(--blue); border-color: var(--blue); color: #fff;
  box-shadow: 0 1px 4px rgba(37,99,235,.28);
}
.hdr-btn.primary:hover { background: var(--blue-d); }
.av {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 800; color: #fff; cursor: pointer;
}

/* ══ BODY LAYOUT ══ */
.wrap { display: flex; flex: 1; overflow: hidden; }

/* ══ SIDEBAR ══ */
.sb {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1.5px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; flex-shrink: 0;
  padding: 6px 8px 20px;
}
.sb::-webkit-scrollbar { width: 3px; }
.sb::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.sb-label {
  font-size: 10px; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--text4); padding: 14px 8px 5px;
}
.sb-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; cursor: pointer;
  color: var(--text3); font-size: 12.5px; font-weight: 600;
  transition: all .12s; border-radius: 7px; margin: 1px 0;
}
.sb-item:hover { background: var(--bg); color: var(--text2); }
.sb-item.active { background: var(--blue-xl); color: var(--blue); }
.sb-item.active-teal { background: var(--teal-xl); color: var(--teal); }
.sb-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }
.sb-item.active svg, .sb-item.active-teal svg { opacity: 1; }
.sb-pip {
  margin-left: auto; font-size: 10.5px; font-weight: 700;
  border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.pip-red    { background: var(--red);    color: #fff; }
.pip-amber  { background: var(--amber);  color: #fff; }
.pip-teal   { background: var(--teal);   color: #fff; }
.pip-blue   { background: var(--blue);   color: #fff; }
.pip-purple { background: var(--purple); color: #fff; }
.pip-slate  { background: var(--slate);  color: #fff; }

/* ══ PAGE ══ */
.page { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page-section { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.page-section.active { display: flex; }

/* ══ STATS STRIP ══ */
.stats { display: flex; gap: 10px; padding: 14px 18px 0; flex-shrink: 0; }
.stat {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 13px 16px; flex: 1;
  box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 3px;
  transition: box-shadow .15s, transform .15s;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-lbl {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text3);
}
.stat-n { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 11px; color: var(--text4); }
.stat.c-blue  .stat-n { color: var(--blue); }
.stat.c-green .stat-n { color: var(--green); }
.stat.c-amber .stat-n { color: var(--amber); }
.stat.c-red   .stat-n { color: var(--red); }
.stat.c-teal  .stat-n { color: var(--teal); }

/* ══ TOOLBAR ══ */
.tbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 18px 8px; flex-shrink: 0; flex-wrap: wrap;
}
.tbar-title {
  font-size: 18px; font-weight: 800; color: var(--text);
  letter-spacing: -.02em; margin-right: 4px;
}
.btn {
  height: 33px; padding: 0 13px; border-radius: 7px;
  border: none; font-size: 12.5px; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
  font-weight: 700; transition: all .13s; white-space: nowrap;
}
.btn-blue  { background: var(--blue); color: #fff; box-shadow: 0 1px 4px rgba(37,99,235,.25); }
.btn-blue:hover  { background: var(--blue-d); }
.btn-teal  { background: var(--teal); color: #fff; box-shadow: 0 1px 4px rgba(13,148,136,.25); }
.btn-teal:hover  { background: #0f766e; }
.btn-amber { background: var(--amber); color: #fff; box-shadow: 0 1px 4px rgba(217,119,6,.25); }
.btn-amber:hover { background: #b45309; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #15803d; }
.btn-ghost { background: var(--surface); color: var(--text2); border: 1.5px solid var(--border); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { background: var(--bg); border-color: var(--border2); }
.btn-danger { background: #fff0f0; color: var(--red); border: 1.5px solid #fca5a5; }
.btn-danger:hover { background: var(--red-l); }
.btn svg { width: 13px; height: 13px; }
.ml { margin-left: auto; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box input {
  width: 230px; height: 33px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 7px;
  color: var(--text); font-size: 13px; font-family: inherit;
  padding: 0 10px 0 33px; outline: none; transition: all .14s;
  box-shadow: var(--shadow-xs);
}
.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.search-box input::placeholder { color: var(--text4); }
.si { position: absolute; left: 10px; color: var(--text4); pointer-events: none; line-height: 0; }

/* ══ TAB STRIP ══ */
.tab-strip { display: flex; gap: 4px; }
.tab {
  height: 33px; padding: 0 13px; border-radius: 7px;
  border: none; background: transparent;
  color: var(--text3); font-size: 12.5px; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: all .13s;
}
.tab:hover { background: var(--bg); color: var(--text2); }
.tab.on { background: var(--blue); color: #fff; box-shadow: 0 1px 4px rgba(37,99,235,.25); }

/* ══ FILTER ROW ══ */
.frow { display: flex; align-items: center; gap: 7px; padding: 0 18px 10px; flex-wrap: wrap; flex-shrink: 0; }
.fl { font-size: 11.5px; color: var(--text3); font-weight: 700; }
.chip {
  height: 27px; padding: 0 11px; border-radius: 20px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text3); font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .12s; font-family: inherit;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip.on-teal { background: var(--teal); border-color: var(--teal); color: #fff; }
.fsel {
  height: 27px; padding: 0 9px; border-radius: 7px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text3); font-size: 12px; font-weight: 600;
  font-family: inherit; outline: none; cursor: pointer;
}
.fsel:focus { border-color: var(--blue); }
.rc { margin-left: auto; font-size: 12px; color: var(--text3); }
.rc b { color: var(--text2); }

/* ══ TABLE ══ */
.tbl-area { flex: 1; overflow: hidden; display: flex; }
.tbl-wrap { flex: 1; overflow: auto; padding: 0 18px 18px; }
.tbl-wrap::-webkit-scrollbar { width: 5px; height: 5px; }
.tbl-wrap::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead th {
  background: var(--surface2);
  border-top: 1.5px solid var(--border);
  border-bottom: 1.5px solid var(--border);
  padding: 9px 11px; font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text3); white-space: nowrap;
  cursor: pointer; user-select: none;
  position: sticky; top: 0; z-index: 5; transition: color .12s;
  text-align: left;
}
thead th:first-child { border-left: 1.5px solid var(--border); border-radius: var(--radius) 0 0 0; padding-left: 15px; }
thead th:last-child { border-right: 1.5px solid var(--border); border-radius: 0 var(--radius) 0 0; }
thead th:hover { color: var(--text); }
thead th.sorted { color: var(--blue); }
.sa { margin-left: 3px; font-size: 9px; }
tbody tr { background: var(--surface); transition: background .1s; cursor: pointer; }
tbody tr:hover td { background: var(--blue-xl); }
tbody tr.sel td { background: var(--blue-l); }
td { padding: 9px 11px; border-bottom: 1.5px solid var(--border); vertical-align: middle; }
td:first-child { border-left: 1.5px solid var(--border); padding-left: 15px; }
td:last-child { border-right: 1.5px solid var(--border); }
tbody tr:last-child td:first-child { border-radius: 0 0 0 var(--radius); }
tbody tr:last-child td:last-child { border-radius: 0 0 var(--radius) 0; }
input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--blue); cursor: pointer; }

/* chips / badges */
.sku {
  font-family: 'DM Mono', monospace; font-size: 11.5px;
  color: var(--blue); font-weight: 500;
  background: var(--blue-l); padding: 2px 7px; border-radius: 5px; white-space: nowrap;
}
.sku.teal { color: var(--teal); background: var(--teal-l); }
.sku.purple { color: var(--purple); background: var(--purple-l); }
.iname { font-weight: 700; color: var(--text); font-size: 13px; }
.idesc { font-size: 11.5px; color: var(--text3); margin-top: 1px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.bd { width: 6px; height: 6px; border-radius: 50%; }
.b-ok    { background: var(--green-l); color: var(--green); }   .b-ok    .bd { background: var(--green); }
.b-low   { background: var(--amber-l); color: var(--amber); }   .b-low   .bd { background: var(--amber); }
.b-out   { background: var(--red-l);   color: var(--red); }     .b-out   .bd { background: var(--red); }
.b-ord   { background: var(--purple-l);color: var(--purple); }  .b-ord   .bd { background: var(--purple); }
.b-teal  { background: var(--teal-l);  color: var(--teal); }    .b-teal  .bd { background: var(--teal); }
.b-blue  { background: var(--blue-l);  color: var(--blue); }    .b-blue  .bd { background: var(--blue); }
.b-grey  { background: var(--bg2);     color: var(--text3); }   .b-grey  .bd { background: var(--text3); }
.rooms-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.room-tag {
  font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 5px;
  background: var(--teal-l); color: var(--teal);
  border: 1px solid rgba(13,148,136,.2); white-space: nowrap;
}

/* qty bar */
.qc { display: flex; align-items: center; gap: 8px; }
.qbar { width: 48px; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.qfill { height: 100%; border-radius: 3px; transition: width .3s; }
.qok .qfill { background: var(--green); }
.qlow .qfill { background: var(--amber); }
.qout .qfill { background: var(--red); }
.qn { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px; min-width: 22px; }

/* action btns */
.ab {
  width: 27px; height: 27px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text3); cursor: pointer;
  display: inline-grid; place-items: center;
  transition: all .12s; font-family: inherit;
}
.ab:hover { background: var(--bg2); color: var(--text); }
.ab.v:hover { background: var(--blue-l); border-color: #bfdbfe; color: var(--blue); }
.ab.e:hover { background: var(--green-l); border-color: #bbf7d0; color: var(--green); }
.ab.t:hover { background: var(--teal-l); border-color: #99f6e4; color: var(--teal); }
.ab.d:hover { background: var(--red-l); border-color: #fca5a5; color: var(--red); }
.ab svg { width: 13px; height: 13px; }

/* ══ STOCK ROOM CARDS ══ */
.sr-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; padding: 14px 18px; overflow-y: auto; flex: 1;
}
.sr-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-xs);
  overflow: hidden; cursor: pointer; transition: all .18s;
  display: flex; flex-direction: column;
}
.sr-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border2); }
.sr-hdr { padding: 14px 16px 10px; display: flex; align-items: flex-start; gap: 10px; border-bottom: 1.5px solid var(--border); }
.sr-icon { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.sr-icon svg { width: 20px; height: 20px; }
.sr-icon.wa { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: var(--blue); }
.sr-icon.wb { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: var(--green); }
.sr-icon.fs { background: linear-gradient(135deg, #fef3c7, #fde68a); color: var(--amber); }
.sr-icon.ws { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: var(--purple); }
.sr-icon.cr { background: linear-gradient(135deg, #ccfbf1, #99f6e4); color: var(--teal); }
.sr-title { font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.sr-code { font-family: 'DM Mono', monospace; font-size: 10.5px; color: var(--text3); margin-top: 2px; }
.sr-loc { font-size: 11.5px; color: var(--text3); margin-top: 3px; }
.sr-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.sr-meter-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sr-meter-label { font-size: 11.5px; color: var(--text3); font-weight: 600; }
.sr-meter-val { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sr-meter-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; max-width: 120px; }
.sr-meter-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.sr-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 4px; }
.sr-stat-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 9px;
  display: flex; flex-direction: column; gap: 1px;
}
.sr-stat-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text4); }
.sr-stat-n { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.sr-footer { padding: 10px 16px; border-top: 1.5px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.sr-footer .btn { height: 28px; font-size: 12px; padding: 0 10px; }
.sr-items-preview { display: flex; flex-wrap: wrap; gap: 4px; }
.sr-item-chip { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px; background: var(--blue-l); color: var(--blue); }

/* ══ DETAIL PANEL ══ */
.dpanel {
  width: 0; overflow: hidden; flex-shrink: 0;
  border-left: 1.5px solid var(--border); background: var(--surface);
  transition: width .22s cubic-bezier(.4,0,.2,1);
}
.dpanel.open { width: 320px; }
.dp-inner { width: 320px; height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.dp-inner::-webkit-scrollbar { width: 3px; }
.dp-inner::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.dp-hdr { padding: 15px 15px 12px; border-bottom: 1.5px solid var(--border); background: var(--surface2); flex-shrink: 0; }
.dp-hdr-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.dp-title { font-size: 14px; font-weight: 800; color: var(--text); }
.dp-sku { font-family: 'DM Mono', monospace; font-size: 10.5px; color: var(--blue); margin-top: 3px; }
.dp-close {
  width: 26px; height: 26px; border-radius: 6px;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text3); cursor: pointer;
  display: grid; place-items: center; font-size: 14px;
  transition: all .12s; flex-shrink: 0;
}
.dp-close:hover { background: var(--bg); color: var(--text); }
.dp-body { padding: 13px 15px; display: flex; flex-direction: column; gap: 14px; flex: 1; }
.dp-sec { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: var(--text4); border-bottom: 1.5px solid var(--border); padding-bottom: 5px; margin-bottom: 7px; }
.dp-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 2px 0; }
.dk { font-size: 12.5px; color: var(--text3); }
.dv { font-size: 12.5px; font-weight: 700; color: var(--text); text-align: right; max-width: 180px; word-break: break-word; }
.hist { background: var(--surface2); border: 1.5px solid var(--border); border-radius: 7px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.ht { display: flex; align-items: center; justify-content: space-between; }
.hn { font-size: 11.5px; font-weight: 800; }
.hn.r { color: var(--green); } .hn.i { color: var(--amber); } .hn.t { color: var(--teal); } .hn.a { color: var(--blue); }
.hm { font-size: 11px; color: var(--text3); }
.dp-actions { padding: 0 15px 15px; display: flex; gap: 7px; flex-shrink: 0; }
.dp-actions .btn { flex: 1; justify-content: center; height: 31px; font-size: 12px; }

/* ══ ROOM / ASSET / WO / PM DETAIL VIEW ══ */
.room-detail { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.room-detail.active { display: flex; }
.rd-hdr { padding: 14px 18px; border-bottom: 1.5px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: 12px; flex-shrink: 0; box-shadow: var(--shadow-xs); }
.rd-back { height: 30px; padding: 0 10px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text2); font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 5px; font-family: inherit; transition: all .12s; }
.rd-back:hover { background: var(--bg); }
.rd-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.rd-info { flex: 1; }
.rd-name { font-size: 16px; font-weight: 800; color: var(--text); }
.rd-meta { font-size: 12px; color: var(--text3); margin-top: 1px; display: flex; align-items: center; gap: 8px; }
.ad-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.ad-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ad-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.ad-card h4 { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text4); border-bottom: 1.5px solid var(--border); padding-bottom: 6px; margin-bottom: 10px; }
.ad-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 4px 0; gap: 8px; }
.ad-k { font-size: 12.5px; color: var(--text3); }
.ad-v { font-size: 13px; font-weight: 700; color: var(--text); text-align: right; }
.kpi-row { display: flex; gap: 10px; }
.kpi-row .stat { flex: 1; }

/* ══ MODALS ══ */
.ov {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.3); backdrop-filter: blur(5px);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.ov.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 620px; max-width: 95vw; max-height: 90vh;
  overflow: hidden; display: flex; flex-direction: column;
  animation: mIn .18s ease;
}
.modal.narrow { width: 480px; }
.modal.wide { width: 760px; }
.modal.x-wide { width: 920px; }
@keyframes mIn { from { transform: translateY(10px) scale(.97); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.mh { padding: 18px 20px 14px; border-bottom: 1.5px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.m-ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.m-ico.blue  { background: var(--blue-l);  color: var(--blue); }
.m-ico.teal  { background: var(--teal-l);  color: var(--teal); }
.m-ico.amber { background: var(--amber-l); color: var(--amber); }
.m-ico.green { background: var(--green-l); color: var(--green); }
.m-ico.red   { background: var(--red-l);   color: var(--red); }
.m-ico svg { width: 19px; height: 19px; }
.mt { font-size: 15px; font-weight: 800; color: var(--text); }
.ms { font-size: 12.5px; color: var(--text3); margin-top: 1px; }
.mx { margin-left: auto; width: 30px; height: 30px; border-radius: 7px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text3); cursor: pointer; font-size: 16px; display: grid; place-items: center; transition: all .12s; font-family: inherit; }
.mx:hover { background: var(--bg); color: var(--text); }
.mb { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.mb::-webkit-scrollbar { width: 4px; }
.mb::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.mf { padding: 13px 20px; border-top: 1.5px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; background: var(--surface2); }

/* ══ FORM ══ */
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg.span2 { grid-column: 1/-1; }
.fg label { font-size: 11px; font-weight: 800; color: var(--text2); text-transform: uppercase; letter-spacing: .05em; }
.fg label .req { color: var(--red); margin-left: 2px; }
.fi {
  height: 36px; background: var(--surface);
  border: 1.5px solid var(--border); border-radius: 7px;
  color: var(--text); font-size: 13px; font-family: inherit;
  padding: 0 11px; outline: none; transition: all .14s; width: 100%;
}
.fi:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.09); }
.fi::placeholder { color: var(--text4); }
.fi.err { border-color: var(--red); }
select.fi {
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px;
}
textarea.fi { height: 70px; padding: 9px 11px; resize: vertical; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fgrid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.fsec { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text4); border-bottom: 1.5px solid var(--border); padding-bottom: 5px; margin-top: 6px; }
.err-msg { font-size: 11px; color: var(--red); display: none; }
.err-msg.show { display: block; }
.sp { background: var(--surface2); border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 12px; display: flex; align-items: center; gap: 10px; }
.sp-l { font-size: 12px; color: var(--text3); flex: 1; }
.sp-v { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ══ MULTI-ROOM BOOKING ══ */
.room-booking-list { display: flex; flex-direction: column; gap: 8px; }
.rb-item {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 11px 13px;
  display: flex; align-items: center; gap: 10px;
}
.rb-item.active { border-color: var(--teal); background: var(--teal-xl); }
.rb-check { accent-color: var(--teal); width: 15px; height: 15px; cursor: pointer; }
.rb-info { flex: 1; }
.rb-name { font-size: 13px; font-weight: 700; color: var(--text); }
.rb-meta { font-size: 11.5px; color: var(--text3); margin-top: 1px; }
.rb-qty-wrap { display: flex; align-items: center; gap: 6px; }
.rb-qty-label { font-size: 12px; color: var(--text3); font-weight: 600; }
.rb-qty-input { width: 70px; height: 28px; padding: 0 8px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12.5px; font-family: inherit; text-align: right; }
.rb-bin-input { width: 100px; height: 28px; padding: 0 8px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 12px; font-family: 'DM Mono', monospace; }

/* ══ TOAST ══ */
#toast-host { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; }
.toast {
  padding: 12px 16px; border-radius: 9px;
  background: var(--surface); border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 13px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 10px;
  min-width: 240px; animation: tIn .25s ease;
}
.toast.t-ok    { border-left: 4px solid var(--green); }
.toast.t-err   { border-left: 4px solid var(--red); }
.toast.t-info  { border-left: 4px solid var(--blue); }
.toast.t-warn  { border-left: 4px solid var(--amber); }
@keyframes tIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ══ CONTEXT MENU ══ */
.ctx-menu {
  position: fixed; display: none;
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 9px; box-shadow: var(--shadow-lg);
  padding: 4px; min-width: 200px; z-index: 1500;
  font-size: 12.5px;
}
.ctx-menu.open { display: block; }
.ctx-item {
  padding: 8px 12px; border-radius: 6px;
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; color: var(--text2); font-weight: 600;
}
.ctx-item:hover { background: var(--bg); color: var(--text); }
.ctx-item svg { width: 13px; height: 13px; }
.ctx-item.danger { color: var(--red); }
.ctx-item.danger:hover { background: var(--red-l); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ══ SUPPLIER / RC / LABOUR GRIDS ══ */
.sup-grid, .rc-grid, .lb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; padding: 14px 18px; overflow-y: auto; flex: 1;
}
.sup-card, .rc-card, .lb-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  cursor: pointer; transition: all .18s; box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 10px;
}
.sup-card:hover, .rc-card:hover, .lb-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.sup-hdr, .rc-hdr, .lb-hdr { display: flex; align-items: flex-start; gap: 10px; }
.lb-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #0d9488);
  color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0; position: relative;
}
.lb-dot { position: absolute; bottom: -1px; right: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--surface); }
.lb-dot.av { background: var(--green); }
.lb-dot.busy { background: var(--amber); }
.lb-dot.off { background: var(--text4); }

/* ══ LOCATION TREE ══ */
.loc-tree { padding: 18px; overflow-y: auto; flex: 1; }
.loc-node {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 8px;
}
.loc-node-hdr { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; cursor: pointer; }
.loc-node-name { font-weight: 800; font-size: 13.5px; color: var(--text); }
.loc-node-type { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--blue-l); color: var(--blue); font-weight: 700; }
.loc-children { padding-left: 20px; border-left: 2px solid var(--border); margin-top: 6px; }
.loc-asset-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 6px; background: var(--surface2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; margin: 3px 4px 0 0; cursor: pointer; }
.loc-asset-chip:hover { background: var(--blue-l); color: var(--blue); }

/* ══ CALENDAR ══ */
.cal-wrap { padding: 18px; overflow-y: auto; flex: 1; }
.cal-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-month { font-size: 17px; font-weight: 800; color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text4); padding: 6px; text-align: center; }
.cal-day {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 7px; min-height: 80px; padding: 6px;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12px; cursor: pointer;
}
.cal-day.other { opacity: .4; }
.cal-day.today { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.cal-day-num { font-size: 12px; font-weight: 700; color: var(--text2); }
.cal-pm-chip { font-size: 10.5px; padding: 2px 5px; border-radius: 4px; font-weight: 700; cursor: pointer; }
.cal-pm-chip.pm-ok { background: var(--blue-l); color: var(--blue); }
.cal-pm-chip.pm-soon { background: var(--amber-l); color: var(--amber); }
.cal-pm-chip.pm-over { background: var(--red-l); color: var(--red); }

/* ══ PM DETAIL TASKS / ATTACHMENTS ══ */
.task-list { display: flex; flex-direction: column; gap: 6px; }
.task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; background: var(--surface2);
  border: 1.5px solid var(--border); border-radius: 7px;
}
.task-row.done { opacity: .55; text-decoration: line-through; }
.task-row.crit { border-left: 3px solid var(--red); }
.task-chk { accent-color: var(--blue); width: 16px; height: 16px; cursor: pointer; }
.task-desc { flex: 1; font-size: 13px; font-weight: 600; }
.task-meta { font-size: 11px; color: var(--text3); display: flex; gap: 8px; }
.attach-list { display: flex; flex-direction: column; gap: 6px; }
.attach-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface2); border: 1.5px solid var(--border); border-radius: 7px; }
.attach-icon { width: 30px; height: 30px; border-radius: 6px; background: var(--blue-l); color: var(--blue); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.dropzone { border: 2px dashed var(--border2); border-radius: 9px; padding: 22px; text-align: center; color: var(--text3); cursor: pointer; transition: all .14s; }
.dropzone:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-xl); }

/* ══ DASHBOARD ══ */
.dash-wrap { padding: 18px; overflow-y: auto; flex: 1; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.dash-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.dash-card h3 { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .07em; }

/* ══ APPROVAL STEPPER ══ */
.appr-stepper { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.appr-step { display: flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--bg2); color: var(--text4); }
.appr-step.done { background: var(--green-l); color: var(--green); }
.appr-step.cur { background: var(--blue); color: #fff; }
.appr-step.rej { background: var(--red-l); color: var(--red); }
.appr-arrow { color: var(--text4); font-size: 11px; }

/* ══ WO LINE TABLE ══ */
.wo-line-table { width: 100%; border-collapse: collapse; }
.wo-line-table th { padding: 6px 9px; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--text4); border-bottom: 1.5px solid var(--border); text-align: left; }
.wo-line-table td { padding: 7px 9px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.wo-line-table input, .wo-line-table select {
  height: 30px; padding: 0 8px; font-size: 12px; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; width: 100%;
}

/* ══ SCHEDULING ══ */
.sched-wrap { display: flex; flex: 1; overflow: hidden; }
.sched-side {
  width: 280px; flex-shrink: 0; border-right: 1.5px solid var(--border);
  background: var(--surface); overflow-y: auto;
  padding: 12px;
}
.sched-side-hdr, .sched-cap-hdr { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text4); margin-bottom: 8px; padding: 0 4px; }
.sched-main { flex: 1; overflow: auto; padding: 12px 18px 18px; }
.sched-bk-card {
  background: var(--surface2); border: 1.5px solid var(--border);
  border-left: 3px solid var(--blue); border-radius: 7px;
  padding: 8px 10px; margin-bottom: 6px; cursor: grab; font-size: 12px;
}
.sched-bk-card.crit { border-left-color: var(--red); }
.sched-bk-card.high { border-left-color: var(--amber); }
.sched-bk-num { font-family: 'DM Mono', monospace; font-size: 10.5px; color: var(--text3); font-weight: 700; }
.sched-bk-title { font-weight: 700; color: var(--text); margin-top: 2px; }
.sched-bk-meta { font-size: 11px; color: var(--text3); margin-top: 3px; }

.cap-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.cap-table th, .cap-table td { padding: 7px 9px; border-bottom: 1.5px solid var(--border); text-align: left; font-size: 12px; }
.cap-table th { background: var(--surface2); font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: var(--text4); position: sticky; top: 0; }
.cap-cell { background: var(--surface); border-radius: 4px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .12s; font-weight: 700; font-size: 11px; }
.cap-cell.free { background: var(--green-l); color: var(--green); }
.cap-cell.med { background: var(--amber-l); color: var(--amber); }
.cap-cell.full { background: var(--red-l); color: var(--red); }
.cap-cell:hover { transform: scale(1.05); box-shadow: var(--shadow-sm); }
.cap-name { font-weight: 700; color: var(--text); }
.cap-name-sub { font-size: 10.5px; color: var(--text3); margin-top: 1px; }

/* ══ ASSET TYPE ICONS ══ */
.atype-ico { display: inline-flex; align-items: center; gap: 6px; }
.atype-mech { color: var(--slate); }
.atype-elec { color: var(--amber); }
.atype-inst { color: var(--purple); }
.atype-util { color: var(--teal); }

/* ══ ALERT BANNERS ══ */
.alert-banner { padding: 12px 16px; border-radius: 9px; display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 13px; }
.alert-green { background: var(--green-l); color: var(--green); }
.alert-amber { background: var(--amber-l); color: var(--amber); }
.alert-red   { background: var(--red-l);   color: var(--red); }
.alert-blue  { background: var(--blue-l);  color: var(--blue); }

/* ══ PROGRESS RING / BAR ══ */
.prog-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width .3s; }

/* ══ MISC ══ */
.empty-state { padding: 40px; text-align: center; color: var(--text3); font-size: 13px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.help { font-size: 11px; color: var(--text4); margin-top: 4px; }
.h-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ══ RESPONSIVE ══ */
@media (max-width: 1100px) {
  .stats { flex-wrap: wrap; }
  .stat { min-width: 150px; }
  .ad-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
 * DASHBOARD
 * ══════════════════════════════════════════════════════════ */
.dash-wrap { display: flex; flex-direction: column; gap: 16px; }

.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.dash-kpi {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.dash-kpi:hover { transform: translateY(-1px); border-color: var(--blue); box-shadow: 0 4px 14px rgba(0,0,0,.05); }
.dash-kpi-icn {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: var(--blue-l);
  font-size: 22px;
}
.dash-kpi.c-blue  .dash-kpi-icn { background: var(--blue-l);  color: var(--blue);  }
.dash-kpi.c-teal  .dash-kpi-icn { background: var(--teal-l);  color: var(--teal);  }
.dash-kpi.c-amber .dash-kpi-icn { background: var(--amber-l); color: var(--amber); }
.dash-kpi.c-red   .dash-kpi-icn { background: var(--red-l);   color: var(--red);   }
.dash-kpi.c-green .dash-kpi-icn { background: var(--green-l); color: var(--green); }
.dash-kpi-body { flex: 1; min-width: 0; }
.dash-kpi-lbl  { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.dash-kpi-n    { font-size: 24px; font-weight: 800; color: var(--text); margin: 2px 0; line-height: 1.1; }
.dash-kpi-sub  { font-size: 11px; color: var(--text3); }

.dash-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-cols > div { display: flex; flex-direction: column; gap: 14px; }

.dash-card h4 {
  font-size: 12px; font-weight: 800; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}
.dash-list { display: flex; flex-direction: column; gap: 4px; }
.dash-row {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s;
}
.dash-row:hover { background: var(--bg); }

@media (max-width: 1100px) {
  .dash-kpi-row { grid-template-columns: repeat(3, 1fr); }
  .dash-cols    { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .dash-kpi-row { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════
 * SCHEDULING — capacity matrix, backlog cards, drag-drop
 * ══════════════════════════════════════════════════════════ */
.sched-wrap {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  margin-top: 10px;
}
.sched-side {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  max-height: 75vh;
  overflow-y: auto;
}
.sched-side-hdr {
  font-size: 12px; font-weight: 800; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}
.sched-main {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 12px;
  overflow-x: auto;
}
.sched-cap-hdr {
  font-size: 12px; font-weight: 800; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--border);
}

.sched-card {
  border: 1.5px solid var(--border);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  background: var(--surface);
  cursor: grab;
  transition: transform .12s, box-shadow .12s;
}
.sched-card:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.05); }
.sched-card:active { cursor: grabbing; }
.sched-card.pri-critical { border-left-color: var(--red); }
.sched-card.pri-high     { border-left-color: var(--amber); }
.sched-card.pri-medium   { border-left-color: var(--blue); }
.sched-card.pri-low      { border-left-color: var(--text4); }
.sched-card-hdr   { display: flex; align-items: center; gap: 6px; justify-content: space-between; margin-bottom: 4px; }
.sched-card-title { font-size: 12.5px; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.sched-card-meta  { font-size: 10.5px; color: var(--text3); display: flex; flex-wrap: wrap; gap: 8px; }

.sched-cap-tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.sched-cap-tbl th, .sched-cap-tbl td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
  background: var(--surface);
}
.sched-cap-tbl thead th { background: var(--bg); font-weight: 700; }
.sched-cap-tbl .sch-tech-col {
  text-align: left;
  padding: 6px 10px;
  width: 170px; min-width: 170px;
  position: sticky; left: 0;
  background: var(--surface);
  z-index: 2;
}
.sched-cap-tbl thead .sch-tech-col { background: var(--bg); }
.sch-cell {
  height: 50px;
  cursor: pointer;
  transition: filter .12s, outline .12s;
  position: relative;
}
.sch-cell:hover { filter: brightness(0.97); outline: 2px solid var(--blue); outline-offset: -2px; }
.sch-cell.drag-over { outline: 2px dashed var(--blue); outline-offset: -2px; background: var(--blue-l); }
.sch-cell.free    { background: #ffffff; }
.sch-cell.partial { background: #ecfdf5; }
.sch-cell.med     { background: #fef3c7; }
.sch-cell.full    { background: #fee2e2; }
.sch-cell.sch-weekend { background: #f3f4f6; }
.sch-cell.sch-today   { box-shadow: inset 0 0 0 2px var(--blue); }
.sch-cell-h    { font-size: 11px; font-weight: 800; color: var(--text2); }
.sch-cell-chips { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; margin-top: 2px; }
.sch-wo-chip {
  display: inline-block;
  padding: 1px 5px;
  background: var(--blue);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
}
.sch-wo-chip:hover { background: var(--teal); }
.sch-day {
  width: 65px; min-width: 65px; padding: 4px 2px !important;
}
.sch-day.sch-today   { background: var(--blue-l) !important; }
.sch-day.sch-weekend { background: #e5e7eb !important; }
.sch-tot-row td { background: var(--bg) !important; font-weight: 700; }
.sch-cell-tot { padding: 6px 4px; }

.sch-legend {
  display: flex; flex-wrap: wrap;
  gap: 14px; align-items: center;
  margin-top: 12px; padding-top: 10px;
  font-size: 11.5px; color: var(--text2);
  border-top: 1.5px solid var(--border);
}
.sch-leg-dot {
  display: inline-block;
  width: 12px; height: 12px; border-radius: 3px;
  border: 1px solid var(--border);
  margin-right: 5px;
  vertical-align: -2px;
}

@media (max-width: 1100px) {
  .sched-wrap { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
 * KPI ROW (asset detail)
 * ══════════════════════════════════════════════════════════ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 10px 0 14px;
}
@media (max-width: 800px) { .kpi-row { grid-template-columns: 1fr 1fr; } }

/* ══════════════════════════════════════════════════════════
 * SIDEBAR PIPS (numeric badges)
 * ══════════════════════════════════════════════════════════ */
.sb-pip {
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-left: auto;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  font-family: 'DM Mono', monospace;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--border);
  color: var(--text2);
}
.sb-pip.pip-red    { background: var(--red-l);    color: var(--red); }
.sb-pip.pip-amber  { background: var(--amber-l);  color: var(--amber); }
.sb-pip.pip-blue   { background: var(--blue-l);   color: var(--blue); }
.sb-pip.pip-teal   { background: var(--teal-l);   color: var(--teal); }
.sb-pip.pip-purple { background: #ede9fe;         color: #7c3aed; }
.sb-pip.pip-slate  { background: #f1f5f9;         color: #64748b; }

/* ══════════════════════════════════════════════════════════
 * PM CALENDAR
 * ══════════════════════════════════════════════════════════ */
.cal-hdr {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 12px;
}
.cal-month {
  font-size: 18px; font-weight: 800; color: var(--text);
  flex: 1; text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.cal-dow {
  background: var(--bg);
  padding: 8px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  text-align: center;
  color: var(--text3);
}
.cal-day {
  background: var(--surface);
  min-height: 90px;
  padding: 6px;
  font-size: 11px;
}
.cal-day.other { background: var(--bg); opacity: .35; }
.cal-day.today { background: var(--blue-l); }
.cal-day-num   { font-weight: 800; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.cal-pm-chip {
  display: block;
  font-size: 10px; font-weight: 700;
  padding: 2px 5px;
  margin-bottom: 2px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-pm-chip.pm-ok    { background: var(--blue-l);  color: var(--blue); }
.cal-pm-chip.pm-soon  { background: var(--amber-l); color: var(--amber); }
.cal-pm-chip.pm-over  { background: var(--red-l);   color: var(--red); }

/* ══════════════════════════════════════════════════════════
 * MISC EXTRAS for completeness
 * ══════════════════════════════════════════════════════════ */
.detail-pane { display: none; }
.detail-pane.active { display: block; }
.req { color: var(--red); }
.fsec {
  font-size: 11.5px; font-weight: 800; color: var(--text2);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--border);
}
.fgrid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 12px; }
.fgrid-3 .span2 { grid-column: span 2; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fgrid .span2 { grid-column: span 2; }
.x-wide { max-width: 1100px !important; }
.narrow { max-width: 480px !important; }
.modal { max-width: 760px; }
.sp { background: var(--bg); padding: 10px 12px; border-radius: 8px; display: flex; flex-direction: column; }
.sp-l { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sp-v { font-size: 16px; font-weight: 800; color: var(--text); margin-top: 3px; font-family: 'DM Mono', monospace; }

/* Approval stepper */
.appr-stepper { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 12px; background: var(--bg); border-radius: 10px; margin-bottom: 14px; }
.appr-step { padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--surface); color: var(--text3); border: 1.5px solid var(--border); }
.appr-step.done { background: var(--green-l); color: var(--green); border-color: var(--green); }
.appr-step.cur  { background: var(--blue-l);  color: var(--blue);  border-color: var(--blue); }
.appr-step.rej  { background: var(--red-l);   color: var(--red);   border-color: var(--red); }
.appr-arrow { font-weight: 800; color: var(--text4); }

/* Location tree */
.loc-children { padding-left: 14px; border-left: 2px dashed var(--border); margin: 6px 0 6px 8px; }
.loc-node     { padding: 6px 0; }
.loc-node-hdr { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; cursor: pointer; transition: background .12s; }
.loc-node-hdr:hover { background: var(--bg); }
.loc-node-name { font-weight: 700; color: var(--text); }
.loc-node-type { font-size: 11px; color: var(--text3); padding: 2px 7px; background: var(--bg); border-radius: 4px; }
.loc-asset-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; margin: 2px;
  background: var(--blue-l); color: var(--blue);
  font-size: 11px; font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
}
.loc-asset-chip:hover { background: var(--blue); color: white; }

/* Task list (PM tasks) */
.task-list { display: flex; flex-direction: column; gap: 4px; }
.task-row {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 7px;
  border-left: 3px solid var(--border);
}
.task-row.done { opacity: .6; }
.task-row.done .task-desc { text-decoration: line-through; }
.task-row.crit { border-left-color: var(--red); }
.task-chk { width: 16px; height: 16px; }
.task-desc { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.task-meta { font-size: 11px; color: var(--text3); }

.attach-list { display: flex; flex-direction: column; gap: 6px; }
.attach-row {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px;
  background: var(--bg); border-radius: 7px;
}
.attach-icon { font-size: 22px; }
.dropzone {
  padding: 18px;
  border: 2px dashed var(--border);
  border-radius: 9px;
  text-align: center;
  color: var(--text3);
  font-size: 12.5px;
  background: var(--bg);
}

/* Asset detail KPI strip */
.ad-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 10px 0;
}
.ad-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.ad-card h4 {
  font-size: 12px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text);
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1.5px solid var(--border);
}
.ad-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12.5px; }
.ad-k   { color: var(--text3); font-weight: 600; }
.ad-v   { color: var(--text); font-weight: 700; }

/* Repair centre cards grid */
#rc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.rc-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.rc-card:hover { transform: translateY(-2px); border-color: var(--blue); }
.rc-hdr { display: flex; gap: 10px; align-items: center; }

/* Labour cards grid */
#lb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.lb-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.lb-card:hover { transform: translateY(-2px); border-color: var(--teal); }
.lb-hdr { display: flex; gap: 10px; align-items: center; }
.lb-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  position: relative;
}
.lb-dot {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
}
.lb-dot.av    { background: var(--green); }
.lb-dot.busy  { background: var(--amber); }
.lb-dot.off   { background: var(--text4); }

/* Stock room cards */
#sr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.sr-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.sr-card:hover { transform: translateY(-2px); border-color: var(--blue); }
.sr-hdr { display: flex; gap: 12px; align-items: flex-start; }
.sr-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--blue);
  color: white;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sr-icon.wa { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.sr-icon.wb { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.sr-icon.fs { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.sr-icon.ws { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.sr-icon.cr { background: linear-gradient(135deg, #ef4444, #f87171); }
.sr-icon svg { width: 22px; height: 22px; }
.sr-title { font-weight: 800; font-size: 14px; color: var(--text); }
.sr-code  { font-size: 11px; color: var(--text3); margin-top: 2px; font-family: 'DM Mono', monospace; }
.sr-loc   { font-size: 11.5px; color: var(--text3); margin-top: 4px; }
.sr-body { display: flex; flex-direction: column; gap: 9px; }
.sr-meter-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.sr-meter-label { font-size: 11px; color: var(--text3); font-weight: 600; }
.sr-meter-bar { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.sr-meter-fill { height: 100%; background: var(--green); }
.sr-meter-val { font-size: 11px; font-weight: 700; color: var(--text2); }
.sr-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.sr-stat-item {
  background: var(--bg);
  padding: 6px 8px;
  border-radius: 6px;
  display: flex; flex-direction: column;
}
.sr-stat-lbl { font-size: 10px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.sr-stat-n   { font-size: 13px; font-weight: 800; color: var(--text); margin-top: 2px; font-family: 'DM Mono', monospace; }
.sr-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; border-top: 1.5px solid var(--border); }

/* Stock-room detail */
#sr-detail { display: none; }
#sr-detail.active { display: block; }
.rd-icon { width: 56px; height: 56px; border-radius: 12px; background: var(--blue); color: white; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rd-icon svg { width: 28px; height: 28px; }
.rd-icon.wa { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.rd-icon.wb { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.rd-icon.fs { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.rd-icon.ws { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.rd-icon.cr { background: linear-gradient(135deg, #ef4444, #f87171); }

/* Supplier cards */
#sup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.sup-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.sup-card:hover { transform: translateY(-2px); border-color: var(--blue); }
.sup-hdr { display: flex; gap: 10px; align-items: center; }

/* Form labels & inputs (in case missing) */
.fg label { display: block; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.fg .fi   { width: 100%; }
.fi {
  height: 36px;
  padding: 0 10px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 13px; font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
.fi:focus { outline: none; border-color: var(--blue); }
textarea.fi { min-height: 70px; padding: 8px 10px; resize: vertical; height: auto; }
select.fi { padding-right: 26px; }

/* WO/PO line tables (in modals) */
.wo-line-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.wo-line-table th, .wo-line-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.wo-line-table th { background: var(--bg); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); }
.wo-line-table input, .wo-line-table select {
  width: 100%; height: 30px; padding: 0 6px;
  border: 1.5px solid var(--border); border-radius: 5px;
  font-size: 12px; background: var(--surface);
}
