
:root{
  --bg-deep:#E5EAF3;
  --bg-panel:#FFFFFF;
  --bg-elevated:#FFFFFF;
  --bg-hover:#EEF2FA;
  --border:#C4D0E3;
  --border-soft:#DAE2F0;
  --text-hi:#0A1830;
  --text-mid:#334463;
  --text-dim:#5E6E8C;
  --ice:#2354C7;
  --ice-dim:#123B8F;
  --ice-glow:rgba(35,84,199,0.10);
  --amber:#9A4A08;
  --amber-glow:rgba(154,74,8,0.11);
  --red:#A31515;
  --red-glow:rgba(163,21,21,0.10);
  --green:#0F6B32;
  --green-glow:rgba(15,107,50,0.11);
  --purple:#7C3AED;
  --purple-glow:rgba(124,58,237,0.10);
  --gold:#8A6A00;
  --gold-glow:rgba(138,106,0,0.13);
  /* Chart-mark steps of the status hues (donut, stacked bars). Brighter than the text
     tokens above so adjacent fills stay distinguishable, incl. colour-blind vision. */
  --mark-validated:#8B5CF6;
  --mark-completed:#A67C00;
  --mark-partial:#2563EB;
  --mark-ok:#15803D;
  --mark-due:#F59E0B;
  --mark-overdue:#B91C1C;
  --shadow-card:0 1px 2px rgba(10,24,48,0.05), 0 4px 14px rgba(10,24,48,0.06);
  --shadow-lg:0 10px 30px rgba(10,24,48,0.12), 0 2px 8px rgba(10,24,48,0.08);
  --radius:10px;
  --font-display:'Oswald',sans-serif;
  --font-body:'Inter',sans-serif;
  --font-mono:'IBM Plex Mono',monospace;
}
*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(35,84,199,0.05), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(154,74,8,0.04), transparent 55%),
    var(--bg-deep);
  color:var(--text-hi);
  font-family:var(--font-body);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
::selection{background:var(--ice-glow);color:var(--text-hi);}
a{color:inherit;}
button{font-family:inherit;}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar{width:10px;height:10px;}
::-webkit-scrollbar-track{background:transparent;}
::-webkit-scrollbar-thumb{background:var(--border);border-radius:6px;}
::-webkit-scrollbar-thumb:hover{background:var(--ice-dim);}

/* ---------- Top bar ---------- */
.topbar{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; gap:18px;
  padding:14px 24px;
  background:rgba(255,255,255,0.86);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border-soft);
}
.brand{display:flex;align-items:center;gap:12px;}
.brand-mark{
  width:38px;height:38px;border-radius:8px;
  background:linear-gradient(155deg, var(--ice) 0%, var(--ice-dim) 100%);
  display:flex;align-items:center;justify-content:center;
  box-shadow:0 0 0 1px rgba(255,255,255,0.18) inset, 0 4px 14px rgba(27,59,111,0.22);
  flex-shrink:0;
}
.brand-mark svg{width:22px;height:22px;}
.brand-logo{display:block; height:40px; width:auto; max-width:260px; object-fit:contain;}
.brand-text{line-height:1.1;}
.brand-text .t1{
  font-family:var(--font-display); font-weight:600; font-size:16.5px;
  letter-spacing:0.4px; text-transform:uppercase; color:var(--text-hi);
}
.brand-text .t2{
  font-family:var(--font-mono); font-size:10.5px; color:var(--text-dim);
  letter-spacing:1.2px; text-transform:uppercase; margin-top:2px;
}
.topbar-spacer{flex:1;}
.topbar-search{
  display:flex; align-items:center; gap:8px;
  background:var(--bg-panel); border:1px solid var(--border);
  border-radius:8px; padding:8px 12px; min-width:230px;
}
.topbar-search input{
  background:transparent;border:none;outline:none;color:var(--text-hi);
  font-family:var(--font-body);font-size:13px;width:100%;
}
.topbar-search input::placeholder{color:var(--text-dim);}
.topbar-search svg{width:15px;height:15px;color:var(--text-dim);flex-shrink:0;}
.plant-clock{
  font-family:var(--font-mono); font-size:11.5px; color:var(--text-mid);
  text-align:right; line-height:1.3; letter-spacing:0.3px;
}
.plant-clock .d{color:var(--text-dim);font-size:10px;}

/* ---------- Layout ---------- */
.shell{display:flex; min-height:calc(100vh - 66px);}
.sidebar{
  width:250px; flex-shrink:0;
  background:#0B1626;
  border-right:1px solid #182740;
  padding:20px 14px 24px;
  position:sticky; top:66px; align-self:flex-start;
  height:calc(100vh - 66px); overflow-y:auto;
}
.side-section-label{
  font-family:var(--font-mono); font-size:10px; letter-spacing:1.5px;
  color:#5B6E8C; text-transform:uppercase; margin:18px 10px 8px;
}
.side-section-label:first-child{margin-top:2px;}
.nav-item{
  display:flex; align-items:center; gap:10px;
  padding:9px 10px; border-radius:8px; cursor:pointer;
  font-size:13.5px; color:#B9C6DC; font-weight:500;
  transition:background .12s, color .12s;
  user-select:none;
}
.nav-item:hover{background:rgba(255,255,255,0.07); color:#FFFFFF;}
.nav-item.active{background:#2563EB; color:#FFFFFF; box-shadow:0 2px 10px rgba(37,99,235,0.35);}
.nav-item svg{width:16px;height:16px;flex-shrink:0;}
.nav-item .count{
  margin-left:auto; font-family:var(--font-mono); font-size:10.5px;
  color:#8DA0BE; background:rgba(255,255,255,0.08);
  padding:1px 7px; border-radius:20px;
}
.nav-item.active .count{color:#FFFFFF; background:rgba(255,255,255,0.22);}
.cat-dot{width:7px;height:7px;border-radius:50%;flex-shrink:0; box-shadow:0 0 0 2px rgba(255,255,255,0.3);}

.main{flex:1; padding:26px 30px 60px; min-width:0;}
.page-head{margin-bottom:22px;}
.page-eyebrow{
  font-family:var(--font-mono); font-size:11px; color:var(--ice);
  letter-spacing:1.5px; text-transform:uppercase; margin-bottom:6px;
}
.page-title{
  font-family:var(--font-display); font-size:26px; font-weight:600;
  letter-spacing:0.3px; color:var(--text-hi); margin:0;
}
.page-sub{color:var(--text-mid); font-size:13.5px; margin-top:6px; max-width:640px; line-height:1.5;}

/* ---------- KPI row ---------- */
.kpi-row{display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:26px;}
.kpi-card{
  background:var(--bg-panel); border:1px solid var(--border-soft);
  border-radius:var(--radius); padding:16px 18px;
  position:relative; overflow:hidden;
}
.kpi-card::before{
  content:''; position:absolute; top:0; left:0; right:0; height:2px;
  background:var(--kpi-color, var(--ice));
}
.kpi-label{
  font-family:var(--font-mono); font-size:10px; letter-spacing:1px;
  text-transform:uppercase; color:var(--text-dim);
}
.kpi-value{
  font-family:var(--font-display); font-size:30px; font-weight:600;
  margin-top:6px; color:var(--text-hi); line-height:1;
}
.kpi-value small{font-size:14px;color:var(--text-dim);font-weight:400;}
.kpi-foot{font-size:11.5px; color:var(--text-mid); margin-top:6px;}

/* ---------- Gauge ---------- */
.gauge-wrap{display:flex; align-items:center; gap:14px;}
.gauge-ring{position:relative; width:64px; height:64px; flex-shrink:0;}
.gauge-ring svg{transform:rotate(-90deg);}
.gauge-ring .pct{
  position:absolute; inset:0; display:flex; align-items:center; justify-content:center;
  font-family:var(--font-mono); font-size:13px; font-weight:600; color:var(--text-hi);
}

/* ---------- Category grid (dashboard) ---------- */
.cat-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(268px,1fr)); gap:14px;}
.cat-card{
  background:linear-gradient(180deg, var(--bg-elevated), var(--bg-panel));
  border:1px solid var(--border-soft); border-left:3px solid var(--cat-color, var(--border-soft)); border-radius:10px;
  padding:15px 16px 14px; cursor:pointer; position:relative;
  transition:border-color .15s, transform .12s, box-shadow .15s;
}
.cat-card:hover{border-color:var(--ice-dim); transform:translateY(-2px); box-shadow:0 8px 24px rgba(0,0,0,0.28);}
.cat-card::after{
  content:''; position:absolute; top:10px; right:10px; width:6px; height:6px; border-radius:50%;
  background:var(--status-color,var(--green)); box-shadow:0 0 8px var(--status-color,var(--green));
}
.cat-card-top{display:flex; align-items:flex-start; justify-content:space-between; gap:10px;}
.cat-card-name{display:flex; align-items:center; gap:7px; font-family:var(--font-display); font-size:15.5px; font-weight:500; color:var(--text-hi); letter-spacing:0.2px;}
.cat-card-meta{font-size:11.5px; color:var(--text-dim); margin-top:4px;}
.cat-card-bottom{
  display:flex; align-items:center; justify-content:space-between;
  margin-top:14px; padding-top:12px; border-top:1px solid var(--border-soft);
}
.status-pills{display:flex; gap:6px;}
.pill{
  font-family:var(--font-mono); font-size:10.5px; padding:3px 8px; border-radius:20px;
  font-weight:600; display:flex; align-items:center; gap:4px;
}
.pill.ok{background:var(--green-glow); color:var(--green);}
.pill.due{background:var(--amber-glow); color:var(--amber);}
.pill.overdue{background:var(--red-glow); color:var(--red);}
.pill.completed{background:var(--gold-glow); color:var(--gold);}
.pill.validated{background:var(--purple-glow); color:var(--purple);}
.pill.partial{background:var(--ice-glow); color:var(--ice);}
.pill-dot{width:5px;height:5px;border-radius:50%;background:currentColor;}

/* ---------- Toolbar ---------- */
.toolbar{display:flex; align-items:center; gap:10px; margin-bottom:18px; flex-wrap:wrap;}
.chip-filter{
  font-family:var(--font-display); font-size:13px; font-weight:500; letter-spacing:0.2px;
  padding:7px 14px; border-radius:8px; border:1px solid var(--border);
  border-left:3px solid var(--cat-color, var(--border));
  background:var(--bg-panel); color:var(--text-mid); cursor:pointer;
  transition:all .12s;
  display:inline-flex; align-items:center; gap:6px;
}
.chip-filter:hover{border-color:var(--cat-color, var(--ice-dim)); border-left-color:var(--cat-color, var(--ice-dim)); color:var(--text-hi);}
.chip-filter.active{background:var(--ice-glow); border-color:var(--cat-color, var(--ice-dim)); border-left-color:var(--cat-color, var(--ice-dim)); color:var(--cat-color, var(--ice));}
.chip-dot{width:7px; height:7px; border-radius:50%; flex-shrink:0; box-shadow:0 0 0 2px rgba(255,255,255,0.3);}
.toolbar-spacer{flex:1;}
.view-toggle{display:flex; border:1px solid var(--border); border-radius:8px; overflow:hidden;}
.view-toggle button{
  background:var(--bg-panel); border:none; color:var(--text-dim); padding:7px 10px; cursor:pointer;
  display:flex; align-items:center;
}
.view-toggle button.active{background:var(--ice-glow); color:var(--ice);}
.view-toggle svg{width:15px;height:15px;}

/* ---------- Asset grid / cards (nameplate style) ---------- */
.asset-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(268px,1fr)); gap:14px;}
.asset-card{
  background:linear-gradient(180deg, var(--bg-elevated), var(--bg-panel));
  border:1px solid var(--border-soft); border-left:3px solid var(--cat-color, var(--border-soft)); border-radius:10px;
  padding:15px 16px 14px; cursor:pointer; position:relative;
  transition:border-color .15s, transform .12s, box-shadow .15s;
}
.asset-card:hover{border-color:var(--ice-dim); transform:translateY(-2px); box-shadow:0 8px 24px rgba(0,0,0,0.28);}
.asset-card::after{
  content:''; position:absolute; top:10px; right:10px; width:6px; height:6px; border-radius:50%;
  background:var(--status-color,var(--green)); box-shadow:0 0 8px var(--status-color,var(--green));
}
.asset-code{
  font-family:var(--font-mono); font-size:11px; color:var(--ice); letter-spacing:0.6px;
  background:rgba(52,211,153,0.08); display:inline-block; padding:2px 7px; border-radius:4px;
  border:1px solid rgba(52,211,153,0.18);
}
.asset-name{
  font-family:var(--font-display); font-size:15.5px; font-weight:500; color:var(--text-hi);
  margin-top:10px; line-height:1.25;
}
.asset-loc{font-size:11.5px; color:var(--text-dim); margin-top:4px; display:flex; align-items:center; gap:6px;}
.asset-card-foot{
  display:flex; align-items:center; justify-content:space-between;
  margin-top:14px; padding-top:12px; border-top:1px solid var(--border-soft);
}
.asset-progress{flex:1; margin-right:10px;}
.progress-track{height:4px; background:var(--bg-deep); border-radius:3px; overflow:hidden;}
.progress-fill{height:100%; border-radius:3px; background:var(--ice); transition:width .3s;}
.progress-label{font-family:var(--font-mono); font-size:9.5px; color:var(--text-dim); margin-top:5px;}
.due-tag{
  font-family:var(--font-mono); font-size:10px; font-weight:600; padding:3px 7px; border-radius:5px;
  white-space:nowrap;
}
.due-tag.ok{background:var(--green-glow); color:var(--green);}
.due-tag.due{background:var(--amber-glow); color:var(--amber);}
.due-tag.overdue{background:var(--red-glow); color:var(--red);}

/* ---------- Table view ---------- */
.asset-table{width:100%; border-collapse:collapse; font-size:13px;}
.asset-table thead th{
  text-align:left; font-family:var(--font-mono); font-size:10px; letter-spacing:1px;
  text-transform:uppercase; color:var(--text-dim); padding:11px 16px; border-bottom:1px solid var(--border);
}
.asset-table tbody tr{border-bottom:1px solid var(--border-soft); cursor:pointer; transition:background .12s;}
.asset-table tbody tr:hover{background:var(--bg-hover);}
.asset-table tbody tr:last-child{border-bottom:none;}
.asset-table td{padding:13px 16px; color:var(--text-mid);}
.asset-table td.name-cell{color:var(--text-hi); font-weight:500;}
.asset-table td .id-mono{font-family:var(--font-mono); font-size:11px; color:var(--ice);}

/* ---------- Default table styling - applies to any <table> that isn't one of the styled
   variants above/below, so every plain data listing across the app (Categories, checklist/safety
   items, completion history, cadence analysis, technician workload, etc.) gets the same row
   separation, even column spacing, and hover treatment without needing its own CSS class. ---------- */
table:not([class]){width:100%; border-collapse:collapse; font-size:13px;}
table:not([class]) thead th{
  text-align:left; font-family:var(--font-mono); font-size:10px; letter-spacing:1px; text-transform:uppercase;
  color:var(--text-dim); padding:11px 16px; border-bottom:1px solid var(--border);
}
table:not([class]) td{padding:13px 16px; border-bottom:1px solid var(--border-soft); color:var(--text-mid); vertical-align:middle;}
table:not([class]) tbody tr{transition:background .12s;}
table:not([class]) tbody tr:hover{background:var(--bg-hover);}
table:not([class]) tbody tr:last-child td{border-bottom:none;}

/* ---------- Modal / drawer ---------- */
.overlay{
  position:fixed; inset:0; background:rgba(4,8,13,0.72); backdrop-filter:blur(3px);
  z-index:100; display:none; align-items:stretch; justify-content:flex-end;
}
.overlay.open{display:flex;}
.drawer{
  width:min(680px, 94vw); background:var(--bg-deep); border-left:1px solid var(--border);
  height:100%; overflow-y:auto; box-shadow:-20px 0 50px rgba(0,0,0,0.4);
  animation:slideIn .22s ease-out;
}
@keyframes slideIn{from{transform:translateX(30px); opacity:0;} to{transform:translateX(0); opacity:1;}}
.drawer-head{
  padding:22px 26px 18px; border-bottom:1px solid var(--border-soft);
  position:sticky; top:0; background:rgba(255,255,255,0.96); backdrop-filter:blur(8px); z-index:5;
}
.drawer-close{
  position:absolute; top:20px; right:22px; width:32px; height:32px; border-radius:8px;
  background:var(--bg-panel); border:1px solid var(--border); color:var(--text-mid);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.drawer-close:hover{color:var(--text-hi); border-color:var(--ice-dim);}
.drawer-close svg{width:15px;height:15px;}
.drawer-eyebrow{font-family:var(--font-mono); font-size:11px; color:var(--ice); letter-spacing:1px; text-transform:uppercase;}
.drawer-title{font-family:var(--font-display); font-size:22px; font-weight:600; margin:6px 0 0; color:var(--text-hi); padding-right:50px;}
.drawer-meta-row{display:flex; flex-wrap:wrap; gap:8px; margin-top:12px;}
.meta-chip{
  font-family:var(--font-mono); font-size:10.5px; color:var(--text-mid); background:var(--bg-panel);
  border:1px solid var(--border); padding:4px 9px; border-radius:20px; display:flex; align-items:center; gap:5px;
}
.meta-chip svg{width:11px;height:11px; color:var(--text-dim);}
.drawer-body{padding:20px 26px 40px;}
.section-title{
  font-family:var(--font-display); font-size:14px; font-weight:600; text-transform:uppercase;
  letter-spacing:0.6px; color:var(--text-hi); margin:26px 0 12px; display:flex; align-items:center; gap:8px;
}
.section-title:first-child{margin-top:0;}
.section-title svg{width:15px;height:15px; color:var(--ice);}
.summary-bar{
  display:flex; align-items:center; gap:14px; background:var(--bg-panel); border:1px solid var(--border-soft);
  border-radius:10px; padding:14px 16px;
}
.summary-ring{position:relative; width:52px; height:52px; flex-shrink:0;}
.summary-ring svg{transform:rotate(-90deg);}
.summary-ring .pct{position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-family:var(--font-mono); font-size:11px; font-weight:600;}
.summary-text{flex:1;}
.summary-text .big{font-family:var(--font-display); font-size:15px; color:var(--text-hi); font-weight:500;}
.summary-text .small{font-size:12px; color:var(--text-mid); margin-top:2px;}
.due-badge{font-family:var(--font-mono); font-size:11px; font-weight:600; padding:5px 11px; border-radius:6px;}

/* Checklist items */
.check-item{
  display:flex; gap:12px; padding:12px 0; border-bottom:1px solid var(--border-soft);
}
.check-item:last-child{border-bottom:none;}
.check-box{
  width:22px; height:22px; border-radius:6px; border:1.5px solid var(--border); flex-shrink:0;
  display:flex; align-items:center; justify-content:center; cursor:pointer; margin-top:1px;
  transition:all .12s; background:var(--bg-panel);
}
.check-box.checked{background:var(--green); border-color:var(--green);}
.check-box svg{width:13px;height:13px; color:var(--bg-deep); opacity:0; transition:opacity .1s;}
.check-box.checked svg{opacity:1;}
.check-content{flex:1; min-width:0;}
.check-text{font-size:13.5px; color:var(--text-hi); line-height:1.45;}
.check-item.done .check-text{color:var(--text-dim); text-decoration:line-through; text-decoration-color:var(--border);}
.check-num{font-family:var(--font-mono); color:var(--text-dim); font-size:11px; margin-right:6px;}
.check-sub{display:flex; gap:14px; margin-top:5px; flex-wrap:wrap;}
.check-sub input{
  background:var(--bg-panel); border:1px solid var(--border-soft); border-radius:5px;
  color:var(--text-mid); font-size:11px; padding:4px 7px; font-family:var(--font-mono);
  width:130px;
}
.check-sub input::placeholder{color:var(--text-dim);}
.check-sub input:focus{outline:none; border-color:var(--ice-dim); color:var(--text-hi);}

.safety-item{display:flex; gap:10px; padding:8px 0; font-size:12.5px; color:var(--text-mid); align-items:flex-start;}
.safety-item svg{width:14px; height:14px; color:var(--amber); flex-shrink:0; margin-top:2px;}

.spec-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px 18px;}
.spec-row{display:flex; flex-direction:column; gap:2px; padding:8px 0; border-bottom:1px solid var(--border-soft);}
.spec-k{font-family:var(--font-mono); font-size:10px; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.5px;}
.spec-v{font-size:13px; color:var(--text-hi);}

.drawer-actions{display:flex; gap:10px; margin-top:24px; flex-wrap:wrap;}
.btn{
  font-family:var(--font-body); font-size:12px; font-weight:600; padding:7px 14px; border-radius:8px;
  border:1px solid var(--border); background:var(--bg-panel); color:var(--text-mid); cursor:pointer;
  display:inline-flex; align-items:center; gap:7px; transition:all .12s;
  /* Never stretch to fill a flex/grid cell (a .field-row column, a .field's column-direction
     cross axis, a table cell) - a button's size always follows its label, everywhere it appears. */
  align-self:flex-start; justify-self:start; flex:0 0 auto; width:auto;
}
.btn:hover{color:var(--text-hi); border-color:var(--ice-dim);}
.btn.primary{background:var(--ice); border-color:var(--ice); color:#FFFFFF;}
.btn.primary:hover{filter:brightness(1.08);}
.btn svg{width:13px; height:13px;}

/* Shared action-button styles used everywhere in the app: primary = Save/confirm,
   danger = Remove/Delete, icon = a compact icon-only Edit toggle. Any Save, Remove
   or Edit button should use these three classes rather than one-off inline styles. */
.btn.danger{border-color:var(--red); color:var(--red); background:var(--bg-panel);}
.btn.danger:hover{background:var(--red); border-color:var(--red); color:#FFFFFF;}
.btn.icon{
  padding:6px; width:28px; height:28px; justify-content:center;
  border-color:var(--border); color:var(--text-dim); background:var(--bg-panel);
}
.btn.icon:hover{color:var(--ice); border-color:var(--ice-dim);}
.btn.icon svg{width:14px; height:14px; margin:0;}

/* ---------- Editable list rows (Checklist Items / Safety Notes, etc.) ---------- */
.edit-list{display:flex; flex-direction:column;}
.edit-list-item{
  display:flex; align-items:center; gap:10px; padding:10px 18px;
  border-bottom:1px solid var(--border-soft);
}
.edit-list-item:last-child{border-bottom:none;}
.edit-list-item:hover{background:var(--bg-hover);}
.edit-list-form{flex:1; display:flex; align-items:center; min-width:0;}
.edit-list-text{
  flex:1; font-size:12.5px; color:var(--text-hi); word-break:break-word;
  padding:7px 0;
}
.edit-list-input{
  display:none; flex:1; font-family:var(--font-body); font-size:12.5px; padding:6px 10px;
  border-radius:6px; border:1px solid var(--border); background:var(--bg-base); color:var(--text-hi);
}
.edit-list-item.editing .edit-list-text{display:none;}
.edit-list-item.editing .edit-list-input{display:block;}
.edit-list-actions{display:flex; align-items:center; gap:8px; flex-shrink:0;}
.edit-list-item.editing .edit-toggle-btn{display:none;}
.edit-list-save-btn{display:none;}
.edit-list-item.editing .edit-list-save-btn{display:inline-flex;}

/* ---------- Editable table rows (Categories) ---------- */
.cat-save-btn{display:none;}
tr.editing .cat-edit-view{display:none;}
tr.editing .cat-edit-field{display:inline-block;}
tr.editing .cat-edit-toggle{display:none;}
tr.editing .cat-save-btn{display:inline-flex;}
.cat-manager-field{max-width:160px;}
.cat-edit-view{font-weight:500;}
.cat-color-field:disabled{opacity:0.5; cursor:not-allowed;}
.remark-box{
  width:100%; background:var(--bg-panel); border:1px solid var(--border-soft); border-radius:8px;
  color:var(--text-hi); font-family:var(--font-body); font-size:12.5px; padding:10px 12px; resize:vertical;
  min-height:60px; margin-top:6px;
}
.remark-box:focus{outline:none; border-color:var(--ice-dim);}

/* ---------- Calendar ---------- */
.cal-head{display:flex; align-items:center; gap:14px; margin-bottom:18px;}
.cal-nav-btn{
  width:32px; height:32px; border-radius:8px; background:var(--bg-panel); border:1px solid var(--border);
  color:var(--text-mid); display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.cal-nav-btn:hover{color:var(--ice); border-color:var(--ice-dim);}
.cal-nav-btn svg{width:15px;height:15px;}
.cal-month-label{font-family:var(--font-display); font-size:18px; font-weight:600; min-width:200px;}
.cal-table{width:100%; border-collapse:collapse;}
.cal-table th{
  font-family:var(--font-mono); font-size:10px; color:var(--text-dim); text-transform:uppercase;
  padding:8px; text-align:center; letter-spacing:0.6px;
}
.cal-day{
  border:1px solid var(--border-soft); vertical-align:top; height:92px; width:14.28%; padding:6px;
  background:var(--bg-panel);
}
.cal-day.weekend{background:var(--bg-deep); opacity:0.55;}
.cal-day.other-month{opacity:0.25;}
.cal-daynum{font-family:var(--font-mono); font-size:11px; color:var(--text-dim);}
.cal-events{display:flex; flex-direction:column; gap:3px; margin-top:5px; max-height:60px; overflow-y:auto;}
.cal-ev{
  font-size:9.5px; padding:2px 5px; border-radius:4px; font-family:var(--font-mono); white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; cursor:pointer;
}
.cal-ev.ok{background:var(--green-glow); color:var(--green);}
.cal-ev.due{background:var(--amber-glow); color:var(--amber);}
.cal-ev.overdue{background:var(--red-glow); color:var(--red);}
.cal-ev.completed{background:var(--gold-glow); color:var(--gold); text-decoration:line-through;}
.cal-ev.partial{background:var(--ice-glow); color:var(--ice);}
.cal-ev.validated{background:var(--purple-glow); color:var(--purple); font-weight:600;}

/* ---------- Empty state ---------- */
.empty-state{
  text-align:center; padding:70px 20px; color:var(--text-dim);
}
.empty-state svg{width:44px;height:44px; margin-bottom:14px; opacity:0.5;}
.empty-state .t{font-family:var(--font-display); font-size:16px; color:var(--text-mid);}

/* ---------- Toast ---------- */
.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px);
  background:var(--bg-elevated); border:1px solid var(--ice-dim); color:var(--text-hi);
  padding:11px 20px; border-radius:8px; font-size:13px; z-index:200; opacity:0; pointer-events:none;
  transition:all .25s; display:flex; align-items:center; gap:8px; box-shadow:0 10px 30px rgba(0,0,0,0.4);
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}
.toast svg{width:15px;height:15px; color:var(--green);}

/* ---------- Config Page ---------- */
.config-tabs{display:flex; gap:6px; border-bottom:1px solid var(--border-soft); margin-bottom:22px; flex-wrap:wrap;}
.config-tab{
  font-family:var(--font-mono); font-size:11.5px; letter-spacing:0.5px; text-transform:uppercase;
  padding:10px 16px; color:var(--text-dim); cursor:pointer; border-bottom:2px solid transparent;
  display:flex; align-items:center; gap:7px; transition:color .12s, border-color .12s;
}
.config-tab svg{width:14px;height:14px;}
.config-tab:hover{color:var(--text-hi);}
.config-tab.active{color:var(--ice); border-bottom-color:var(--ice);}

.config-panel{background:var(--bg-panel); border:1px solid var(--border-soft); border-radius:var(--radius); padding:22px;}
.config-panel + .config-panel{margin-top:16px;}
.config-panel-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; gap:10px; flex-wrap:wrap;}
.config-panel-title{font-family:var(--font-display); font-size:16px; font-weight:600; color:var(--text-hi);}
.config-panel-sub{font-size:12px; color:var(--text-dim); margin-top:3px;}

.field-row{display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px;}
.field-row.single{grid-template-columns:1fr;}
.field{display:flex; flex-direction:column; gap:6px;}
.field label{font-family:var(--font-mono); font-size:10px; letter-spacing:0.6px; text-transform:uppercase; color:var(--text-dim);}
.field input[type=text], .field input[type=number], .field select, .field textarea{
  background:var(--bg-elevated); border:1px solid var(--border); border-radius:7px;
  color:var(--text-hi); font-family:var(--font-body); font-size:13px; padding:9px 11px;
}
.field input:focus, .field select:focus, .field textarea:focus{outline:none; border-color:var(--ice-dim);}
.field textarea{resize:vertical; min-height:50px; font-family:var(--font-body);}
.field-hint{font-size:11px; color:var(--text-dim);}

.editable-list{display:flex; flex-direction:column; gap:8px; margin-top:6px;}
.editable-row{display:flex; gap:8px; align-items:center;}
.editable-row input{
  flex:1; background:var(--bg-elevated); border:1px solid var(--border); border-radius:7px;
  color:var(--text-hi); font-family:var(--font-body); font-size:12.5px; padding:8px 10px;
}
.editable-row input:focus{outline:none; border-color:var(--ice-dim);}
.icon-btn{
  width:30px; height:30px; border-radius:7px; background:var(--bg-elevated); border:1px solid var(--border);
  color:var(--text-dim); display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0;
  transition:all .12s;
}
.icon-btn:hover{color:var(--text-hi); border-color:var(--ice-dim);}
.icon-btn.danger:hover{color:var(--red); border-color:var(--red);}
.icon-btn svg{width:14px;height:14px;}
.add-row-btn{
  display:flex; align-items:center; gap:7px; font-size:12px; color:var(--ice); cursor:pointer;
  padding:8px 0; font-weight:600;
}
.add-row-btn svg{width:14px;height:14px;}

.config-table{width:100%; border-collapse:collapse; font-size:13px;}
.config-table thead th{
  text-align:left; font-family:var(--font-mono); font-size:10px; letter-spacing:1px; text-transform:uppercase;
  color:var(--text-dim); padding:11px 16px; border-bottom:1px solid var(--border);
}
.config-table td{padding:13px 16px; border-bottom:1px solid var(--border-soft); color:var(--text-mid); vertical-align:middle;}
.config-table td.name-cell{color:var(--text-hi); font-weight:500;}
.config-table tbody tr{transition:background .12s;}
.config-table tr:hover{background:var(--bg-hover);}
.config-table tbody tr:last-child td{border-bottom:none;}
.row-actions{display:flex; gap:6px; justify-content:flex-end;}

.swatch{width:20px; height:20px; border-radius:6px; display:inline-block; border:1px solid rgba(255,255,255,0.15); cursor:pointer;}
.swatch-row{display:flex; gap:8px; flex-wrap:wrap;}
.swatch.selected{box-shadow:0 0 0 2px var(--bg-panel), 0 0 0 3.5px var(--ice);}
.cat-tag{
  display:inline-flex; align-items:center; gap:6px; font-family:var(--font-mono); font-size:11px;
  padding:3px 9px; border-radius:20px;
}

.editor-overlay{
  position:fixed; inset:0; background:rgba(4,8,13,0.72); backdrop-filter:blur(3px);
  z-index:110; display:none; align-items:center; justify-content:center; padding:24px;
}
.editor-overlay.open{display:flex;}
.editor-modal{
  width:min(720px,94vw); max-height:88vh; overflow-y:auto; background:var(--bg-deep);
  border:1px solid var(--border); border-radius:14px; box-shadow:0 30px 70px rgba(0,0,0,0.5);
  animation:popIn .18s ease-out;
}
@keyframes popIn{from{transform:scale(0.97); opacity:0;} to{transform:scale(1); opacity:1;}}
.editor-head{
  padding:20px 24px 16px; border-bottom:1px solid var(--border-soft);
  position:sticky; top:0; background:rgba(10,15,14,0.97); backdrop-filter:blur(8px); z-index:2;
  display:flex; align-items:flex-start; justify-content:space-between; gap:12px;
}
.editor-title{font-family:var(--font-display); font-size:19px; font-weight:600; color:var(--text-hi);}
.editor-sub{font-size:12px; color:var(--text-dim); margin-top:4px;}
.editor-body{padding:20px 24px 26px;}
.editor-foot{
  padding:16px 24px 22px; display:flex; gap:10px; justify-content:flex-end; border-top:1px solid var(--border-soft); margin-top:6px;
}

.data-stat-row{display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:6px;}
.data-stat{background:var(--bg-elevated); border:1px solid var(--border-soft); border-radius:8px; padding:12px 14px;}
.data-stat .n{font-family:var(--font-display); font-size:20px; color:var(--text-hi); font-weight:600;}
.data-stat .l{font-family:var(--font-mono); font-size:10px; color:var(--text-dim); text-transform:uppercase; margin-top:3px;}

.badge-soft{font-family:var(--font-mono); font-size:10px; padding:2px 8px; border-radius:20px; background:var(--bg-elevated); color:var(--text-dim);}
.hidden-file-input{display:none;}

/* ---------- Organization chart ---------- */
.org-chart-wrap{position:relative; padding:12px 8px 8px;}
#orgConnectors{position:absolute; top:0; left:0; pointer-events:none; overflow:visible;}
.org-line{stroke:var(--border); stroke-width:1.5;}
.org-tier{display:flex; justify-content:center; align-items:flex-start; gap:16px; flex-wrap:wrap; position:relative; z-index:1; margin-bottom:64px;}
.org-tier:last-child{margin-bottom:0;}
.org-node{
  background:var(--bg-elevated); border:1px solid var(--border-soft); border-radius:10px;
  padding:14px 18px; min-width:168px; text-align:center; position:relative;
  transition:border-color .15s;
}
.org-node:hover{border-color:var(--org-accent, var(--ice-dim));}
.org-node-icon{width:32px; height:32px; border-radius:50%; display:flex; align-items:center; justify-content:center; margin:0 auto 9px;}
.org-node-icon svg{width:16px;height:16px;}
.org-node-name{font-family:var(--font-display); font-size:14.5px; font-weight:600; color:var(--text-hi); line-height:1.3;}
.org-node-title{font-family:var(--font-mono); font-size:10px; color:var(--text-dim); text-transform:uppercase; letter-spacing:0.5px; margin-top:4px;}

/* ---------- Login ---------- */
.login-overlay{
  position:fixed; inset:0; z-index:1000; display:flex; align-items:center; justify-content:center;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(52,211,153,0.08), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 100%, rgba(240,169,59,0.05), transparent 55%),
    var(--bg-deep);
  padding:20px;
}
.login-card{
  width:380px; max-width:100%; background:var(--bg-panel); border:1px solid var(--border-soft);
  border-radius:14px; padding:30px 28px 26px; box-shadow:0 30px 70px rgba(0,0,0,0.5);
}
.login-brand{display:flex; align-items:center; gap:12px;}
.login-title{font-family:var(--font-display); font-weight:600; font-size:17px; color:var(--text-hi); letter-spacing:0.3px;}
.login-sub{font-family:var(--font-mono); font-size:10px; color:var(--text-dim); letter-spacing:1px; text-transform:uppercase; margin-top:3px;}
.login-error{min-height:18px; color:var(--red); font-size:12px; margin-top:10px;}
.form-success{
  background:var(--green-glow); color:var(--green); border:1px solid var(--green);
  border-radius:var(--radius); padding:10px 16px; font-size:12.5px; font-weight:500; margin-bottom:18px;
}
.login-btn{width:100%; justify-content:center; margin-top:6px; padding:11px;}
.login-hint{font-size:11px; color:var(--text-dim); margin-top:16px; line-height:1.5; text-align:center;}

/* ---------- User badge / logout ---------- */
.user-badge{display:flex; align-items:center; gap:10px; padding-left:18px; border-left:1px solid var(--border-soft);}
.user-badge-info{text-align:right; line-height:1.25;}
.user-badge-name{font-family:var(--font-body); font-size:12.5px; font-weight:600; color:var(--text-hi);}
.user-badge-role{font-family:var(--font-mono); font-size:9.5px; color:var(--ice); text-transform:uppercase; letter-spacing:0.6px;}
.logout-btn{
  width:30px; height:30px; border-radius:8px; background:var(--bg-panel); border:1px solid var(--border);
  color:var(--text-dim); display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.logout-btn:hover{color:var(--red); border-color:var(--red);}
.logout-btn svg{width:14px;height:14px;}

/* ---------- Permission table ---------- */
.perm-table{width:100%; border-collapse:collapse; font-size:12.5px;}
.perm-table th{font-family:var(--font-mono); font-size:10px; letter-spacing:0.6px; text-transform:uppercase; color:var(--text-dim); padding:9px 10px; text-align:center; border-bottom:1px solid var(--border);}
.perm-table th:first-child{text-align:left;}
.perm-table td{padding:9px 10px; text-align:center; border-bottom:1px solid var(--border-soft); color:var(--text-mid);}
.perm-table td:first-child{text-align:left; color:var(--text-hi);}
.perm-table tbody tr{transition:background .12s;}
.perm-table tbody tr:hover{background:var(--bg-hover);}
.perm-check{width:17px; height:17px; cursor:pointer; accent-color:var(--ice);}
.role-chip{font-family:var(--font-mono); font-size:10px; padding:2px 8px; border-radius:20px; text-transform:uppercase; letter-spacing:0.4px;}
.locked-note{display:flex; align-items:center; gap:8px; padding:10px 14px; background:var(--bg-elevated); border:1px solid var(--border-soft); border-radius:8px; font-size:12px; color:var(--text-dim); margin-bottom:16px;}
.locked-note svg{width:15px;height:15px; color:var(--text-dim); flex-shrink:0;}

/* ---------- Footer note ---------- */
.footnote{margin-top:40px; padding-top:16px; border-top:1px solid var(--border-soft); font-size:11.5px; color:var(--text-dim); display:flex; justify-content:space-between; flex-wrap:wrap; gap:8px;}
.footnote .fm{font-family:var(--font-mono);}

@media (max-width:980px){
  .sidebar{display:none;}
  .kpi-row{grid-template-columns:repeat(2,1fr);}
  .topbar-search{min-width:0;}
  .plant-clock{display:none;}
}

/* ---------- Additions for the server-rendered app (not present in the static mockup) ---------- */
.flash{
  background:var(--green-glow); color:var(--green); border:1px solid rgba(21,128,61,0.25);
  border-radius:var(--radius); padding:10px 16px; margin-bottom:18px; font-size:13.5px; font-weight:500;
}
.back-link{font-size:12px; font-family:var(--font-mono); color:var(--text-mid); margin-bottom:14px; display:inline-block; text-decoration:none;}
.back-link:hover{color:var(--ice);}
a.nav-item{text-decoration:none;}
a.chip-filter{text-decoration:none;}
a.btn{text-decoration:none;}
input[type=color]{width:40px; height:30px; border:1px solid var(--border); border-radius:6px; padding:2px; background:var(--bg-elevated); cursor:pointer;}
.badge{font-family:var(--font-mono); font-size:10px; font-weight:600; padding:1px 6px; border-radius:20px; margin-left:4px;}
.badge-red{background:#EF4444; color:#FFFFFF;}
.badge-amber{background:#F59E0B; color:#0B1626;}

/* ---------- Photo evidence capture (checklist items) ---------- */
.photo-capture-form{margin-top:10px; margin-left:44px;}
.photo-capture-row{display:flex; gap:8px; flex-wrap:wrap; align-items:center;}
.photo-capture-slot{
  display:flex; align-items:center; gap:6px; padding:9px 14px; border-radius:8px; border:1.5px dashed var(--border);
  font-size:12.5px; color:var(--text-mid); background:var(--bg-elevated); position:relative;
}
.photo-capture-slot.captured{border-style:solid; border-color:var(--green); color:var(--green); background:var(--green-glow);}
.js-camera-btn{background:none; border:none; font:inherit; color:inherit; cursor:pointer; padding:0;}
.js-camera-btn:hover{text-decoration:underline;}
.photo-capture-submit{padding:9px 16px; font-size:12.5px;}
.photo-capture-submit:disabled{opacity:0.45; cursor:not-allowed;}

/* In-page camera capture modal */
.camera-modal{
  display:none; position:fixed; inset:0; background:rgba(11,37,69,0.85); z-index:1000;
  align-items:center; justify-content:center; padding:20px;
}
.camera-modal.open{display:flex;}
.camera-modal-inner{background:#000; border-radius:12px; overflow:hidden; max-width:520px; width:100%;}
.camera-modal-inner video{width:100%; display:block; max-height:70vh; background:#000;}
.camera-modal-actions{display:flex; gap:10px; padding:14px; background:var(--bg-panel); justify-content:flex-end;}

.photo-evidence{display:flex; gap:12px; margin-top:10px; margin-left:44px; flex-wrap:wrap;}
.photo-card{width:140px;}
.photo-card-label{font-size:10.5px; text-transform:uppercase; letter-spacing:0.4px; color:var(--text-dim); margin-bottom:4px; font-weight:600;}
.photo-card img{width:140px; height:100px; object-fit:cover; border-radius:8px; border:1px solid var(--border-soft); display:block;}
.photo-card-meta{font-size:10px; color:var(--text-dim); margin-top:4px; display:flex; flex-direction:column; gap:2px; font-family:var(--font-mono);}
.photo-card-meta a{color:var(--ice); text-decoration:none;}

/* ---------- Asset detail tabs (checklist / report) ---------- */
.tab-bar{display:flex; gap:6px; border-bottom:1px solid var(--border-soft); margin:22px 0 20px; flex-wrap:wrap;}
.tab-btn{
  font-family:var(--font-mono); font-size:11.5px; letter-spacing:0.5px; text-transform:uppercase;
  padding:10px 16px; color:var(--text-dim); cursor:pointer; border-bottom:2px solid transparent;
  background:none; border-left:none; border-right:none; border-top:none;
  transition:color .12s, border-color .12s;
}
.tab-btn:hover{color:var(--text-hi);}
.tab-btn.active{color:var(--ice); border-bottom-color:var(--ice);}

/* ---------- Colorful KPI cards (dashboard) ---------- */
.stat-card-row{display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px;}
.stat-card-v2{
  border-radius:14px; padding:14px 18px; color:#fff; position:relative; overflow:hidden;
  box-shadow:0 8px 20px -8px rgba(0,0,0,0.25);
  display:flex; align-items:center; gap:12px;
}
    .stat-card-v2.green {
        background: #16A34A;
    }
    .stat-card-v2.amber {
        background: #D97706;
    }
    .stat-card-v2.red {
        background: #DC2626;
    }
    .stat-card-v2.purple {
        background: #7C3AED;
    }
    .stat-card-v2.gold {
        background: #946D21;
    }
    .stat-card-v2.blue {
        background: #2354C7;
    }
.stat-card-row.five {
    grid-template-columns: repeat(5, 1fr);
}

    .stat-card-row.five .stat-card-v2 {
        justify-content: space-between;
        padding: 12px 16px;
    }
.stat-card-v2-icon{
  width:32px; height:32px; border-radius:50%; background:rgba(255,255,255,0.25);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.stat-card-v2-icon svg{width:16px; height:16px; color:#fff;}
.stat-card-v2-text{flex:1; display:flex; align-items:center; justify-content:space-between; gap:10px; min-width:0;}
.stat-card-v2-meta{display:flex; flex-direction:column;}
.stat-card-v2-label{font-size:14px; font-weight:600; opacity:0.95; margin-bottom:2px;}
.stat-card-v2-value{font-family:var(--font-display); font-size:30px; font-weight:700; line-height:1.1;}
.stat-card-v2-sub{font-size:12.5px; opacity:0.9; margin-top:1px;}

/* ---------- Two-column dashboard grid ---------- */
.dash-row{display:grid; grid-template-columns:1.1fr 1fr; gap:16px; margin-bottom:16px; align-items:start;}
@media (max-width:1100px){ .dash-row{grid-template-columns:1fr;} .stat-card-row, .stat-card-row.five, .stat-card-row.six{grid-template-columns:repeat(2,1fr);} }

.dash-panel{background:var(--bg-panel); border:1px solid var(--border-soft); border-radius:14px; padding:18px 20px;}
.dash-panel-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px;}
.dash-panel-title{font-family:var(--font-display); font-size:15px; font-weight:600; color:var(--text-hi);}
.dash-panel-link{font-size:12.5px; color:var(--ice); text-decoration:none; font-weight:600;}

/* ---------- Donut chart ---------- */
.donut-row{display:flex; align-items:center; gap:22px;}
.donut-legend{flex:1; display:flex; flex-direction:column; gap:10px;}
.donut-legend-item{display:flex; align-items:center; gap:10px; font-size:13.5px; color:var(--text-hi);}
.donut-legend-dot{width:11px; height:11px; border-radius:3px; flex-shrink:0;}
.donut-legend-pct{margin-left:auto; font-family:var(--font-display); font-weight:700; font-size:14px;}

/* ---------- Alert / work-order tables ---------- */
.alert-table{width:100%; border-collapse:collapse; font-size:13px;}
.alert-table th{text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-dim); padding:6px 8px; border-bottom:1px solid var(--border-soft);}
.alert-table td{padding:10px 8px; border-bottom:1px solid var(--border-soft); vertical-align:middle;}
.alert-table tbody tr{transition:background .12s;}
.alert-table tbody tr:hover{background:var(--bg-hover);}
.alert-table tr:last-child td{border-bottom:none;}
.tag{display:inline-block; padding:3px 10px; border-radius:6px; font-size:11px; font-weight:700; color:#fff;}
.tag.high, .tag.critical{background:var(--red);}
.tag.medium, .tag.warning{background:var(--amber);}
.tag.low, .tag.ok{background:var(--green);}

/* ---------- Trend line chart ---------- */
.trend-chart-wrap{width:100%; overflow-x:auto;}
.trend-legend{display:flex; gap:16px; margin-bottom:10px; font-size:12px; color:var(--text-mid);}
.trend-legend-item{display:flex; align-items:center; gap:6px;}
.trend-legend-swatch{width:14px; height:3px; border-radius:2px;}

/* ---------- Sidebar collapse toggle ---------- */
.sidebar-toggle-btn{
  width:28px; height:28px; border-radius:7px; border:1px solid #26385A; background:rgba(255,255,255,0.05);
  color:#B9C6DC; display:flex; align-items:center; justify-content:center; cursor:pointer; flex-shrink:0;
}
.sidebar-toggle-btn:hover{color:#FFFFFF; border-color:#2563EB; background:rgba(37,99,235,0.18);}
.sidebar-toggle-btn svg{width:14px; height:14px;}

html.sidebar-collapsed .sidebar{width:68px; padding:20px 10px;}
html.sidebar-collapsed .sidebar-header{justify-content:center;}
html.sidebar-collapsed .sidebar-header-label,
html.sidebar-collapsed .side-section-label,
html.sidebar-collapsed .nav-item span:not(.cat-dot),
html.sidebar-collapsed .nav-item .count,
html.sidebar-collapsed .nav-item .badge{
  display:none;
}
html.sidebar-collapsed .nav-item{justify-content:center; padding:10px 6px;}
.sidebar-header{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; padding:0 2px;}
.sidebar-header-label{font-family:var(--font-mono); font-size:10.5px; letter-spacing:0.5px; text-transform:uppercase; color:#5B6E8C;}

/* ---------- Wide-spaced tables (report detail lists) ---------- */
.wide-table{width:100%; border-collapse:collapse;}
.wide-table th{text-align:left; padding:12px 28px; font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-dim); border-bottom:1px solid var(--border-soft); font-weight:600;}
.wide-table td{padding:14px 28px; border-bottom:1px solid var(--border-soft); vertical-align:middle; color:var(--text-mid);}
.wide-table tbody tr{transition:background .12s;}
.wide-table tbody tr:hover{background:var(--bg-hover);}
.wide-table tr:last-child td{border-bottom:none;}

/* ---------- Category Compliance bars (dashboard) ---------- */
.cat-bar-list{display:flex; flex-direction:column; gap:15px;}
.cat-bar-row{display:flex; align-items:center; gap:14px;}
.cat-bar-label{width:170px; flex-shrink:0; font-size:12.5px; color:var(--text-hi); font-weight:500; display:flex; align-items:center; gap:8px;}
.cat-bar-label span:last-child{overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.cat-bar-track{flex:1; height:14px; border-radius:7px; background:var(--bg-elevated); overflow:hidden; display:flex;}
.cat-bar-seg{height:100%; transition:width .3s;}
/* 2px surface gap between stacked segments instead of borders. */
.cat-bar-track.gapped{gap:2px;}
.cat-bar-track.gapped .cat-bar-seg{min-width:4px;}
.cat-bar-total{width:78px; text-align:right; font-family:var(--font-mono); font-size:11px; color:var(--text-dim); flex-shrink:0;}
@media (max-width:640px){ .cat-bar-label{width:120px;} }

/* ---------- Reports drill-down tree (Category -> Asset -> Year -> Month -> Day) ---------- */
.report-tree{padding:6px 10px 14px;}
.rt-cat, .rt-asset, .rt-year, .rt-month{border-bottom:1px solid var(--border-soft);}
.rt-cat:last-child{border-bottom:none;}
.rt-cat-head, .rt-asset-head, .rt-year-head, .rt-month-head{
  display:flex; align-items:center; gap:9px; padding:11px 6px; cursor:pointer; user-select:none;
}
.rt-cat-head:hover, .rt-asset-head:hover, .rt-year-head:hover, .rt-month-head:hover{background:var(--bg-hover);}
.rt-chevron{width:13px; height:13px; flex-shrink:0; color:var(--text-dim); transition:transform .15s;}
.rt-open > .rt-cat-head .rt-chevron,
.rt-open > .rt-asset-head .rt-chevron,
.rt-open > .rt-year-head .rt-chevron,
.rt-open > .rt-month-head .rt-chevron{transform:rotate(90deg);}
.rt-label{font-size:13px; color:var(--text-hi); font-weight:500;}
.rt-cat-head .rt-label{font-size:13.5px; font-weight:600;}
.rt-count{font-family:var(--font-mono); font-size:10.5px; color:var(--text-dim); background:var(--bg-elevated); padding:1px 8px; border-radius:20px; margin-left:4px;}
.rt-children{display:none; padding-left:22px;}
.rt-open > .rt-children{display:block;}
.rt-asset-head{gap:8px;}
.rt-asset-head .asset-code{font-family:var(--font-mono); font-size:10.5px; color:var(--text-dim);}
.rt-loading, .rt-empty{padding:10px 6px; font-size:12px; color:var(--text-dim); font-style:italic;}
.rt-days{display:none; flex-wrap:wrap; gap:8px; padding:10px 6px 14px 22px;}
.rt-open > .rt-days{display:flex;}
.rt-day{
  display:flex; flex-direction:column; align-items:center; gap:2px;
  padding:8px 4px; width:64px; border-radius:8px; border:1px solid var(--border-soft);
  background:var(--bg-panel); text-decoration:none; transition:border-color .12s, box-shadow .12s;
}
.rt-day:hover{border-color:var(--ice); box-shadow:0 0 0 2px var(--ice-glow);}
.rt-day .rt-label{font-size:15px; font-weight:700; color:var(--text-hi);}
.rt-day .rt-count{margin-left:0; font-size:9px; padding:1px 5px;}
/* The day the user just came back from (Day Report → Back to tree). */
.rt-day.rt-day-active{border-color:var(--ice); box-shadow:0 0 0 2px var(--ice-glow); background:var(--ice-glow);}

/* ---------- Day report (single-day checklist + before/after evidence) ---------- */
.day-report-list{display:flex; flex-direction:column; gap:14px;}
.day-report-item{background:var(--bg-panel); border:1px solid var(--border-soft); border-radius:var(--radius); padding:16px 18px;}
.day-report-item-head{margin-bottom:12px;}
.day-report-item-title{font-size:14px; font-weight:600; color:var(--text-hi);}
.day-report-item-meta{font-size:12px; color:var(--text-dim); margin-top:3px;}
.day-report-photos{display:flex; flex-wrap:wrap; gap:14px;}
.day-report-photo-label{font-size:11px; text-transform:uppercase; letter-spacing:0.05em; color:var(--text-dim); font-weight:600; margin-bottom:6px;}
/* Thumbnail: the whole photo scaled down to fit (contain, never cropped); click opens full size. */
.day-report-thumb{
  display:flex; align-items:center; justify-content:center;
  width:180px; height:135px; border-radius:8px; border:1px solid var(--border-soft);
  background:var(--bg-deep); overflow:hidden; transition:border-color .12s, box-shadow .12s;
}
.day-report-thumb:hover{border-color:var(--ice); box-shadow:0 0 0 2px var(--ice-glow);}
.day-report-thumb img{max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; display:block;}
.day-report-photo-empty{
  width:180px; height:135px; border-radius:8px; border:1.5px dashed var(--border);
  display:flex; align-items:center; justify-content:center; color:var(--text-dim); font-size:12px;
}
.day-report-links{display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-bottom:14px;}
.day-report-links .back-link{margin-bottom:0;}

/* ---------- Organization Chart ---------- */
.orgchart{display:flex; flex-direction:column; gap:22px; align-items:center; padding:10px 0 40px;}
.orgchart-connector{width:1px; height:20px; background:var(--border);}
.orgchart-tier{display:flex; flex-wrap:wrap; gap:20px; justify-content:center; width:100%;}
.orgchart-node{
  background:linear-gradient(180deg, var(--bg-elevated), var(--bg-panel));
  border:1px solid var(--border); border-radius:10px; padding:12px 20px; text-align:center; min-width:160px;
}
.orgchart-node.head{border-color:var(--ice); box-shadow:0 4px 18px rgba(63,198,232,0.18);}
.orgchart-node-name{font-family:var(--font-display); font-size:14px; font-weight:600; color:var(--text-hi);}
.orgchart-node-title{font-size:11px; color:var(--text-dim); margin-top:2px; text-transform:uppercase; letter-spacing:0.4px;}

.orgchart-branch{
  display:flex; flex-direction:column; align-items:center; gap:10px;
  background:var(--bg-panel); border:1px solid var(--border-soft); border-radius:12px; padding:14px; width:280px;
}
.orgchart-categories{display:flex; flex-direction:column; gap:8px; width:100%;}
.orgchart-category{border:1px solid var(--border-soft); border-radius:8px; overflow:hidden;}
.orgchart-category-head{
  display:flex; align-items:center; gap:8px; padding:7px 10px; font-size:12px; font-weight:600; color:var(--text-hi);
  background:var(--bg-elevated);
}
.orgchart-category-head .count{margin-left:auto; font-family:var(--font-mono); font-size:10.5px; color:var(--text-dim); background:none; padding:0;}
.orgchart-assets{display:flex; flex-direction:column;}
.orgchart-asset{
  display:flex; justify-content:space-between; gap:8px; padding:5px 10px; font-size:11px;
  border-top:1px solid var(--border-soft); color:var(--text-mid);
}
.orgchart-asset-code{font-family:var(--font-mono); color:var(--text-hi);}
.orgchart-asset-sup{color:var(--text-dim); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:140px;}
.orgchart-empty{font-size:12px; color:var(--text-dim); font-style:italic; padding:8px 0; text-align:center;}
.orgchart-note{font-size:12px; color:var(--amber); text-align:center;}
.orgchart-chip-row{display:flex; flex-wrap:wrap; gap:12px; justify-content:center; width:100%;}
.orgchart-chip{
  background:var(--bg-panel); border:1px solid var(--border-soft); border-radius:10px; padding:10px 18px; min-width:160px; text-align:center;
}

/* ---------- Org chart summary tiles + popup modal ---------- */
.orgchart-summary-tile{
  display:flex; flex-direction:column; align-items:center; gap:2px; width:100%;
  background:var(--bg-elevated); border:1px solid var(--border-soft); border-radius:8px;
  padding:10px 12px; cursor:pointer; font-family:var(--font-body); transition:border-color .12s, background .12s;
}
.orgchart-summary-tile:hover{border-color:var(--ice-dim); background:var(--bg-hover);}
.orgchart-summary-num{font-family:var(--font-display); font-size:20px; font-weight:600; color:var(--ice);}
.orgchart-summary-label{font-size:11px; color:var(--text-dim); text-align:center;}

.simple-modal-overlay{
  position:fixed; inset:0; background:rgba(4,8,13,0.5); backdrop-filter:blur(2px);
  z-index:110; display:none; align-items:center; justify-content:center; padding:20px;
}
.simple-modal-overlay.open{display:flex;}
.simple-modal{
  position:relative; width:min(520px, 100%); max-height:80vh; overflow-y:auto;
  background:var(--bg-deep); border:1px solid var(--border); border-radius:12px;
  padding:22px 24px; box-shadow:var(--shadow-lg);
}
.simple-modal-title{
  font-family:var(--font-display); font-size:17px; font-weight:600; color:var(--text-hi);
  padding-right:40px; margin-bottom:14px;
}
.simple-modal-body .orgchart-categories{gap:10px;}

/* ---------- Dashboard (asset-level) ---------- */
.dash-head{display:flex; align-items:flex-end; justify-content:space-between; gap:16px; flex-wrap:wrap;}
.period-toggle{display:inline-flex; border:1px solid var(--border); border-radius:8px; overflow:hidden; background:var(--bg-panel);}
.period-toggle a{padding:7px 16px; font-size:12.5px; font-weight:600; color:var(--text-mid); text-decoration:none; border-right:1px solid var(--border-soft);}
.period-toggle a:last-child{border-right:none;}
.period-toggle a:hover{background:var(--bg-hover); color:var(--text-hi);}
.period-toggle a.active{background:var(--ice); color:#fff;}
.stat-card-row.six{grid-template-columns:repeat(6, 1fr);}
.stat-card-row.six .stat-card-v2{justify-content:space-between; padding:12px 16px;}
.dash-panel-note{font-size:11.5px; color:var(--text-dim); margin:-8px 0 14px;}
.dash-legend{display:flex; flex-wrap:wrap; gap:6px 16px; font-size:12px; color:var(--text-mid); margin-bottom:14px;}
.dash-legend-item{display:flex; align-items:center; gap:6px;}
.dash-legend-swatch{width:10px; height:10px; border-radius:3px; flex-shrink:0;}
.donut-stack{flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:16px;}
.donut-stack .donut-legend{width:100%; gap:8px;}
.donut-stack .donut-legend-item{font-size:12.5px;}
.donut-legend-count{margin-left:auto; font-family:var(--font-mono); font-size:12px; color:var(--text-mid);}
.donut-stack .donut-legend-pct{margin-left:10px; min-width:38px; text-align:right; font-size:13px;}
.chart-table{margin-top:8px;}
.chart-table summary{font-size:12px; color:var(--ice); cursor:pointer; user-select:none;}
.chart-table table{margin-top:8px; width:100%;}

/* ---------- Monthly report (asset-level rows) ---------- */
.month-nav{display:flex; gap:10px; margin-bottom:22px;}
.mr-table th, .mr-table td{padding-left:14px; padding-right:14px;}
.mr-progress{display:flex; justify-content:space-between; gap:8px; font-size:12px; color:var(--text-hi); margin-bottom:4px; min-width:90px;}
.mr-progress-pct{font-family:var(--font-mono); color:var(--text-dim);}
/* Same meaning and colors as the PM Calendar status codes. */
.mr-status{display:inline-block; font-size:11px; font-weight:600; padding:3px 9px; border-radius:20px; white-space:nowrap;}
.mr-status.validated{background:var(--purple-glow); color:var(--purple);}
.mr-status.completed{background:var(--gold-glow); color:var(--gold);}
.mr-status.partial{background:var(--ice-glow); color:var(--ice);}
.mr-status.pending{background:var(--amber-glow); color:var(--amber);}
.mr-status.overdue{background:var(--red-glow); color:var(--red);}

/* ---------- Plant Settings: company logo ---------- */
.logo-setting{display:flex; align-items:center; gap:22px; padding:16px 18px; flex-wrap:wrap;}
.logo-preview{
  width:260px; height:80px; border:1.5px dashed var(--border); border-radius:10px; background:var(--bg-deep);
  display:flex; align-items:center; justify-content:center; padding:10px; text-align:center;
  font-size:12px; color:var(--text-dim);
}
.logo-preview img{max-width:100%; max-height:100%; object-fit:contain; display:block;}
.logo-actions{display:flex; flex-direction:column; align-items:flex-start; gap:10px; flex:1; min-width:260px;}
.logo-upload-form{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
