/* ============================================================
   POTTS ELECTRIC COMMAND CENTER — Design System v1.0
   Navy panel-board · sky-blue current · gold energized accents
   ============================================================ */

:root {
  /* palette */
  --navy-900: #071224;      /* deepest — sidebar footer, hovers */
  --navy-800: #0B1B33;      /* sidebar */
  --navy-700: #102547;      /* sidebar cards, topbar on mobile */
  --navy-line: #1E3A66;
  --blue: #1D7FE0;          /* primary action */
  --sky: #29ABE2;           /* Potts brand sky blue */
  --gold: #FFD700;          /* Potts brand gold — energized indicator only */
  --page: #F2F5FA;
  --card: #FFFFFF;
  --ink: #13233C;
  --ink-soft: #5B6B84;
  --ink-faint: #8B99AF;
  --line: #E3E9F2;
  --green: #16A34A; --green-bg: #EAF7EF;
  --amber: #D97706; --amber-bg: #FDF3E3;
  --red: #DC2626;   --red-bg: #FDEBEB;
  --neutral: #94A3B8; --neutral-bg: #F1F5F9;

  /* type */
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(19, 35, 60, 0.05), 0 4px 14px rgba(19, 35, 60, 0.06);
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--page);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
a { color: var(--blue); }

/* ---------------------------------------------------------- login ---- */

.login-body {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(41, 171, 226, 0.14), transparent 60%),
    var(--navy-800);
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: #EAF1FA;
}
.login-card {
  width: min(400px, 92vw);
  background: var(--navy-700);
  border: 1px solid var(--navy-line);
  border-radius: 18px;
  padding: 36px 34px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}
.brand-mark {
  display: flex; align-items: center; gap: 12px; margin-bottom: 26px;
}
.brand-bolt {
  width: 42px; height: 42px; border-radius: 11px;
  background: linear-gradient(145deg, var(--sky), #1668B3);
  display: grid; place-items: center;
  color: var(--gold); font-size: 22px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.15);
}
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; }
.brand-sub { font-size: 11.5px; color: #9FB4D0; letter-spacing: 0.14em; text-transform: uppercase; }
.login-card label { display: block; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: #9FB4D0; margin: 16px 0 6px; }
.login-card input {
  width: 100%; padding: 12px 13px; border-radius: 9px; font-size: 15px;
  border: 1px solid #2A4A7C; background: var(--navy-800); color: #fff;
}
.login-card input:focus { outline: 2px solid var(--sky); outline-offset: 1px; border-color: var(--sky); }
.btn-primary {
  margin-top: 24px; width: 100%; padding: 13px; border: 0; border-radius: 9px;
  background: var(--sky); color: #04121F; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.08); }
.login-msg { min-height: 22px; margin-top: 14px; font-size: 14px; color: #F87171; }
.login-foot { margin-top: 18px; font-size: 12px; color: #647B9C; text-align: center; }

/* ----------------------------------------------------------- shell ---- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-800);
  color: #C9D7EA;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-mark { padding: 20px 18px 14px; margin: 0; border-bottom: 1px solid var(--navy-line); }
.sidebar .brand-name { font-size: 18px; color: #fff; }

.nav-list { flex: 1; overflow-y: auto; padding: 10px 0 14px; margin: 0; list-style: none; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 18px 10px 15px;
  border-left: 3px solid transparent;
  font-size: 14px; color: #AEC1DB; cursor: pointer;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}
.nav-item:hover { background: var(--navy-900); color: #fff; }
.nav-item.active {
  border-left-color: var(--gold);          /* energized breaker */
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.09), transparent 70%);
  color: #fff; font-weight: 600;
}
.nav-item .ni-icon { width: 19px; text-align: center; opacity: 0.9; }
.nav-phase { margin-left: auto; font-size: 10px; color: #5F7699; border: 1px solid #2A4A7C; border-radius: 5px; padding: 1px 5px; }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid var(--navy-line); font-size: 12.5px; color: #7E93B3; }
.sidebar-foot b { color: #D6E2F2; display: block; font-size: 13.5px; }
.link-quiet { background: none; border: 0; color: #7E93B3; font-size: 12.5px; cursor: pointer; padding: 0; margin-top: 6px; text-decoration: underline; }
.link-quiet:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 26px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; margin: 0; }
.topbar .today { margin-left: auto; font-size: 13px; color: var(--ink-soft); }
.hamburger { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; font-size: 18px; padding: 5px 10px; cursor: pointer; }

.content { padding: 24px 26px 60px; max-width: 1420px; width: 100%; margin: 0 auto; }

/* ------------------------------------------------------- dashboard ---- */

.section-label {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 16px; font-weight: 600; color: var(--ink-soft);
  display: flex; align-items: center; gap: 10px; margin: 30px 0 12px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-label:first-child { margin-top: 4px; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }

.kpi-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px 13px 18px; position: relative; overflow: hidden;
}
.kpi-card::before {                       /* status breaker edge */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: var(--neutral);
}
.kpi-card.s-green::before { background: var(--green); }
.kpi-card.s-yellow::before { background: var(--amber); }
.kpi-card.s-red::before { background: var(--red); }

.kpi-name { font-size: 12px; color: var(--ink-soft); letter-spacing: 0.02em; margin-bottom: 6px; min-height: 28px; display: flex; align-items: flex-end; }
.kpi-value { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.kpi-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px; flex-wrap: wrap; }
.kpi-target { color: var(--ink-faint); }
.chip { border-radius: 6px; padding: 2px 7px; font-weight: 600; font-size: 11.5px; }
.chip.c-green { background: var(--green-bg); color: var(--green); }
.chip.c-yellow { background: var(--amber-bg); color: var(--amber); }
.chip.c-red { background: var(--red-bg); color: var(--red); }
.chip.c-neutral { background: var(--neutral-bg); color: var(--ink-soft); }
.trend { font-size: 12px; font-weight: 600; }
.trend.up { color: var(--green); } .trend.down { color: var(--red); } .trend.flat { color: var(--ink-faint); }
.trend.inv-up { color: var(--red); } .trend.inv-down { color: var(--green); }

/* action center */
.alert-list { display: grid; gap: 10px; }
.alert-row {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 16px 13px 18px; position: relative; overflow: hidden;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
}
.alert-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.alert-row.red::before { background: var(--red); }
.alert-row.yellow::before { background: var(--amber); }
.alert-row.green::before { background: var(--green); }
.alert-title { font-weight: 600; font-size: 14.5px; }
.alert-detail { grid-column: 1 / -1; font-size: 13px; color: var(--ink-soft); }
.alert-who { font-size: 12px; color: var(--ink-faint); white-space: nowrap; text-align: right; }
.alert-who b { color: var(--ink); }

/* trend chart card */
.chart-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.chart-card h3 { margin: 0 0 4px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 15px; color: var(--ink-soft); font-weight: 600; }
.chart-wrap { height: 240px; }

/* ----------------------------------------------------- stub / misc ---- */

.stub {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 40px; text-align: center; color: var(--ink-soft); max-width: 620px; margin: 40px auto;
}
.stub .stub-icon { font-size: 34px; margin-bottom: 10px; }
.stub h2 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink); margin: 0 0 8px; }
.stub .phase-tag { display: inline-block; margin-top: 14px; background: var(--neutral-bg); color: var(--ink-soft); border-radius: 7px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; }

.loading, .error-panel { text-align: center; color: var(--ink-soft); padding: 60px 20px; }
.error-panel { color: var(--red); }

/* -------------------------------------------------------- settings ---- */

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px; }
.panel h3 { margin: 0 0 14px; font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.05em; font-size: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); }
.role-pill { background: var(--neutral-bg); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: capitalize; }
.badge-off { color: var(--red); font-size: 12px; font-weight: 600; }
.badge-on { color: var(--green); font-size: 12px; font-weight: 600; }
.btn-small { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; }
.btn-small:hover { background: var(--page); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-faint); margin-bottom: 5px; }
.form-grid input, .form-grid select { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: #fff; }
.form-grid input:focus, .form-grid select:focus { outline: 2px solid var(--sky); outline-offset: 1px; }
.btn-blue { background: var(--blue); color: #fff; border: 0; border-radius: 8px; padding: 11px 18px; font-weight: 600; font-size: 14px; cursor: pointer; }
.btn-blue:hover { filter: brightness(1.07); }
.form-msg { font-size: 13.5px; margin-top: 10px; min-height: 18px; }
.form-msg.ok { color: var(--green); } .form-msg.err { color: var(--red); }

/* ------------------------------------------------------ responsive ---- */

@media (max-width: 900px) {
  .sidebar {
    position: fixed; z-index: 30; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 0 0 50px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(7, 18, 36, 0.55); z-index: 25; }
  .scrim.show { display: block; }
  .hamburger { display: inline-block; }
  .topbar { padding: 13px 16px; }
  .topbar h1 { font-size: 20px; }
  .content { padding: 16px 14px 60px; }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .kpi-value { font-size: 28px; }
  .alert-row { grid-template-columns: 1fr; }
  .alert-who { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --------------------------------------------------- phase 2 tables ---- */
.scroll-x { overflow-x: auto; }
.table-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.table-tools .btn-blue { margin-left: auto; }
.hint { font-size: 12.5px; color: var(--ink-faint); }
.file-btn { display: inline-block; }
.cf-table th { white-space: nowrap; }
.cf-table td { padding: 4px 6px; white-space: nowrap; }
.cf-week { font-weight: 600; font-size: 13px; }
.cf-in, .db-in, .sc-in { width: 92px; padding: 6px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-variant-numeric: tabular-nums; background: #fff; }
.db-in { width: 100%; min-width: 90px; }
.cf-in:focus, .db-in:focus, .sc-in:focus { outline: 2px solid var(--sky); outline-offset: 1px; }
.cf-ro { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cf-bad { color: var(--red); font-weight: 700; font-variant-numeric: tabular-nums; }
.cf-good { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; }
.sc-name { font-weight: 600; white-space: nowrap; }
.sc-in { width: 78px; }
.sc-in.sc-green { border-color: var(--green); background: var(--green-bg); }
.sc-in.sc-yellow { border-color: var(--amber); background: var(--amber-bg); }
.sc-in.sc-red { border-color: var(--red); background: var(--red-bg); }

/* --------------------------------------------------- phase 3: sop ---- */
.sop-grid, .course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.sop-card { background: var(--page); border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px; cursor: pointer; transition: box-shadow .12s, transform .12s; }
.sop-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.sop-dept { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--blue); font-weight: 700; margin-bottom: 6px; }
.sop-title { font-weight: 700; font-size: 15.5px; margin-bottom: 5px; }
.sop-sum { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.sop-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-faint); }
.sop-h { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .03em; margin: 4px 0 6px; font-size: 26px; }
.sop-steps { margin: 16px 0 0; padding-left: 22px; }
.sop-steps li { margin-bottom: 10px; line-height: 1.55; }
.se-ta { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: var(--font-body); }
.role-checks { display: flex; flex-wrap: wrap; gap: 12px; }
.rc { font-size: 13.5px; display: flex; align-items: center; gap: 5px; text-transform: capitalize; }
/* training */
.prog-bar { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 9px; }
.prog-fill { height: 100%; background: linear-gradient(90deg, var(--sky), var(--blue)); border-radius: 4px; }
.module-list { margin-top: 14px; }
.module-row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: var(--page); }
.module-row:hover { box-shadow: var(--shadow); }
.mod-num { width: 26px; height: 26px; border-radius: 50%; background: var(--navy-800); color: var(--gold); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.mod-title { flex: 1; font-weight: 600; font-size: 14px; }
.lesson-p { line-height: 1.65; }
.quiz-q { font-weight: 700; margin: 18px 0 6px; }
.quiz-opt { display: block; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; font-size: 14px; }
.quiz-opt:hover { background: var(--page); }
/* org chart */
.org-node { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 17px; }
.org-node b { display: block; font-size: 16px; }
.org-node span { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); font-weight: 700; }
.org-node p { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; line-height: 1.5; }
.org-ceo { border-top: 4px solid var(--gold); max-width: 560px; margin-bottom: 18px; }
.org-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.org-branch > .org-node { border-top: 4px solid var(--sky); }
.org-reports { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.org-sub { background: var(--page); border: 1px solid var(--line); box-shadow: none; }
.org-conf { border-left: 3px solid var(--gold); padding-left: 10px; background: #FFFBEA; border-radius: 4px; }
@media (max-width: 900px) { .org-row { grid-template-columns: 1fr; } }
