/*
 * ACE (Automation Control Engineering) Suite
 * Copyright (c) 2026 ACE Systems. All rights reserved.
 * Property of ACE Systems - Whakatane, Bay of Plenty, New Zealand.
 *
 * Proprietary and confidential. Unauthorised copying, distribution or
 * modification of this file, in whole or in part, is prohibited.
 */
/* ============================================
   PCS FLEET HEALTH — risk / obsolescence / spare capacity
   Reuses the ACE palette; reads the same fleet dataset the CPU Report builds.
   ============================================ */
:root {
    --header-bg: linear-gradient(135deg, #2c3e50 0%, #4a6491 100%);
    --main-bg: #eaf2fa;
    --border-color: #ddd;
    --text-dark: #333;
    --text-light: #555;
    --primary-accent: #0056b3;
    --primary-btn: #3498db;
    --secondary-btn: #6c757d;
    --crit-bg: #f8d7da; --crit-txt: #842029; --crit-bd: #f1aeb5;
    --warn-bg: #fff3cd; --warn-txt: #664d03; --warn-bd: #ffe69c;
    --ok-bg:   #d1e7dd; --ok-txt:   #0f5132; --ok-bd:  #a3cfbb;
    --info-bg: #e2e8f0; --info-txt: #334155; --info-bd: #cbd5e1;
}
body, html {
    height: 100%; margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--main-bg); color: var(--text-dark);
    display: flex; flex-direction: column;
}
.header {
    flex-shrink: 0; display: flex; justify-content: space-between; align-items: center;
    background: var(--header-bg); color: white; padding: 12px 30px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.header h1 { margin: 0; font-size: 1.5em; font-weight: 600; }
.header a {
    padding: 8px 16px; border-radius: 5px; font-weight: 500; color: white;
    text-decoration: none; background-color: var(--secondary-btn); font-size: 0.9em;
    transition: background-color 0.2s ease;
}
.header a:hover { background-color: #5a6268; }
.main-container {
    flex-grow: 1; overflow-y: auto; padding: 26px 30px;
    max-width: 96%; margin: 0 auto; width: 100%; box-sizing: border-box;
}
.content-section {
    background: white; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 26px 30px; margin-bottom: 26px;
}
h2 { border-bottom: 2px solid var(--primary-accent); padding-bottom: 10px; margin-top: 0; font-size: 1.4rem; }
.page-intro { color: #666; line-height: 1.5; max-width: 1100px; }
.page-intro code { background: #eef1f4; padding: 1px 5px; border-radius: 3px; font-size: 0.9em; }

/* controls */
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 6px 0 18px; }
.control-group { display: flex; flex-direction: column; }
.control-group label { font-weight: 600; margin-bottom: 6px; color: var(--text-light); font-size: 0.86em; }
.control-group input[type="text"], .control-group select {
    padding: 8px 10px; font-size: 0.95em; border: 1px solid var(--border-color); border-radius: 5px; min-width: 240px;
}
.btn { padding: 9px 16px; border-radius: 5px; cursor: pointer; font-size: 0.92em; font-weight: 600; border: 1px solid transparent; color: #fff; }
.btn-primary { background: var(--primary-btn); } .btn-primary:hover { background: #217bbe; }
.btn-secondary { background: var(--secondary-btn); } .btn-secondary:hover { background: #5a6268; }

/* summary tiles */
.summary-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 4px 0 22px; }
.summary-tile { border-radius: 8px; padding: 14px 18px; display: flex; flex-direction: column; gap: 3px;
    background: linear-gradient(135deg,#f0f7ff 0%,#dfeeff 100%); border: 1px solid #cfe2ff; }
.summary-tile.crit { background: linear-gradient(135deg,#fdf0f1 0%,#f8dcdf 100%); border-color: var(--crit-bd); }
.summary-tile.warn { background: linear-gradient(135deg,#fffaf0 0%,#fff1cf 100%); border-color: var(--warn-bd); }
.summary-tile.ok   { background: linear-gradient(135deg,#f0f9f4 0%,#dcefe4 100%); border-color: var(--ok-bd); }
.summary-tile .st-label { font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.04em; color: #446; }
.summary-tile .st-value { font-size: 1.7em; font-weight: 700; color: var(--primary-accent); }
.summary-tile.crit .st-value { color: var(--crit-txt); }
.summary-tile.warn .st-value { color: var(--warn-txt); }
.summary-tile.ok   .st-value { color: var(--ok-txt); }
.summary-tile .st-sub { font-size: 0.78em; color: #555; }

/* section blocks */
.fh-section { margin-bottom: 26px; }
.fh-section h3 { font-size: 1.12rem; color: var(--primary-accent); margin: 0 0 4px; }
.fh-section .fh-sub { color: #777; font-size: 0.85em; margin: 0 0 12px; }

/* tables */
.fh-table-wrap { overflow-x: auto; }
table.fh { width: 100%; border-collapse: collapse; font-size: 0.87em; background: #fff; }
table.fh th, table.fh td { border: 1px solid #dcdcdc; padding: 6px 10px; text-align: left; vertical-align: middle; white-space: nowrap; }
table.fh th { background: #f0f0f0; color: #222; font-weight: 700; position: sticky; top: 0; z-index: 1; cursor: pointer; user-select: none; }
table.fh th.sortable::after { content: '\2195'; margin-left: 4px; color: #999; font-weight: normal; font-size: 0.85em; }
table.fh th.sorted-asc::after { content: '\25B2'; color: #333; }
table.fh th.sorted-desc::after { content: '\25BC'; color: #333; }
table.fh td.name { font-family: 'Consolas','Courier New',monospace; font-weight: 700; color: #114; }
table.fh td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.fh tbody tr:nth-child(even) { background: #f8fbff; }
table.fh tbody tr:hover { background: #eef5fd; }
table.fh td.subtle { color: #8a8a8a; }

/* severity + chips */
.sev-dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; vertical-align:middle; }
.sev-crit .sev-dot { background: #dc3545; } .sev-warn .sev-dot { background: #f0ad4e; }
.sev-ok   .sev-dot { background: #28a745; } .sev-info .sev-dot { background: #94a3b8; }
tr.sev-crit td.name { border-left: 3px solid #dc3545; }
tr.sev-warn td.name { border-left: 3px solid #f0ad4e; }

.chip { display:inline-block; font-size:0.76em; font-weight:700; padding:2px 8px; border-radius:10px; margin:1px 3px 1px 0; border:1px solid transparent; }
.chip.crit { background: var(--crit-bg); color: var(--crit-txt); border-color: var(--crit-bd); }
.chip.warn { background: var(--warn-bg); color: var(--warn-txt); border-color: var(--warn-bd); }
.chip.ok   { background: var(--ok-bg);   color: var(--ok-txt);   border-color: var(--ok-bd); }
.chip.info { background: var(--info-bg); color: var(--info-txt); border-color: var(--info-bd); }

.bar { position: relative; display:inline-block; width: 90px; height: 10px; background:#eee; border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right:6px; }
.bar > span { position:absolute; left:0; top:0; bottom:0; border-radius:3px; }
.bar.lo > span { background:#28a745; } .bar.mid > span { background:#f0ad4e; } .bar.hi > span { background:#dc3545; }

.no-data { text-align:center; color: var(--text-light); padding: 30px; background:#f8f9fa; border-radius:6px; border:1px dashed #ccc; }
.no-data a { color: var(--primary-accent); font-weight:600; }
.empty-row td { text-align:center; color:#999; padding:14px; font-style: italic; }
