/* AILO Dashboard D12 — FactoryView SCADA
   원형: 아이콘 레일 + 2단 패널(작업 영역 | 알람·로그 고정 열) / 타이포: Barlow Semi Condensed(+Pretendard) / 컬러: 블루그레이 다크, 정상은 회색·비정상만 색(HMI 원칙) */

:root {
  --ailo-bg: #121922;
  --ailo-fg: #e1e8f0;
  --ailo-muted: #97a8bc;
  --ailo-line: rgba(148, 170, 196, .16);
  --ailo-accent: #4aa3ee;
  --ailo-accent-ink: #06111c;
  --ailo-header-h: 68px;

  --d12-font: "Barlow Semi Condensed", "Pretendard Variable", Pretendard, system-ui, sans-serif;
  --d12-panel: #1c2531;
  --d12-panel-2: #232e3c;
  --d12-hover: #26323f;
  --d12-grid: #2a3543;
  --d12-axis: #3c4a5c;
  --d12-track: #2c3a4a;
  --d12-neutral: #71859c;
  --d12-spark: #71859c;
  --d12-plan-grid: rgba(148, 170, 196, .055);
  --d12-flow: #4f627a;
  /* 차트 범주색 — 검증: dark / surface #1c2531 / adjacent 통과 */
  --d12-s1: #3a92dd;
  --d12-s2: #c27f14;
  --d12-s3: #25a58a;
  --d12-s4: #a678e0;
  /* 설비 상태 — 정상 계열은 무채색, 이상만 상태색 */
  --d12-run: #71859c;
  --d12-idle: #45566b;
  --d12-stop: #33404f;
  --d12-warn: #fab219;
  --d12-serious: #ec835a;
  --d12-crit: #d03b3b;
  --d12-rail: 76px;
  --d12-side: 340px;
  --d12-r: 8px;
}

body {
  font-family: var(--d12-font);
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: .005em;
  background: var(--ailo-bg);
}
.dim { color: var(--ailo-muted); }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ===== App shell ===== */
.app { display: grid; grid-template-columns: var(--d12-rail) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .3s var(--ailo-ease); }
html.rail-wide { --d12-rail: 220px; }
.frame { min-width: 0; display: flex; flex-direction: column; }

/* ===== Icon rail ===== */
.rail {
  position: sticky; top: 0; height: 100vh; z-index: 50;
  background: #0d131a; border-right: 1px solid var(--ailo-line);
  display: flex; flex-direction: column; padding: 14px 12px; gap: 18px;
}
.rail__top { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rail__logo { display: flex; align-items: center; gap: 10px; color: var(--ailo-accent); }
.rail__logo svg { flex: none; }
.rail__brand { display: none; font-weight: 700; font-size: 17px; color: var(--ailo-fg); line-height: 1.05; white-space: nowrap; }
.rail__brand small { display: block; font-size: 11px; letter-spacing: .2em; color: var(--ailo-accent); }
.rail__x { display: none; margin-left: auto; width: 38px; height: 38px; border: 1px solid var(--ailo-line); border-radius: 8px; background: transparent; }
.rail__nav { display: grid; gap: 4px; }
.rail__nav a {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 12px;
  height: 46px; border-radius: 10px; color: var(--ailo-muted); font-size: 18px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.rail__nav a span { display: none; font-size: 15px; font-weight: 600; }
.rail__nav a:hover { background: var(--d12-hover); color: var(--ailo-fg); }
.rail__nav a.is-active { background: rgba(74, 163, 238, .16); color: var(--ailo-accent); }
.rail__nav a.is-active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ailo-accent); }
.rail__badge {
  position: absolute; top: 5px; right: 8px; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
  font-style: normal; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; background: var(--d12-crit); color: #fff;
}
/* 레일 툴팁 */
@media (min-width: 992px) {
  html:not(.rail-wide) .rail__nav a::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; translate: -4px -50%;
    background: #06090d; color: var(--ailo-fg); font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 6px;
    border: 1px solid var(--d12-axis); opacity: 0; pointer-events: none; transition: opacity .15s, translate .15s; z-index: 5;
  }
  html:not(.rail-wide) .rail__nav a:hover::after,
  html:not(.rail-wide) .rail__nav a:focus-visible::after { opacity: 1; translate: 0 -50%; }
}
.rail__bottom { margin-top: auto; display: grid; gap: 10px; }
.rail__conn { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--ailo-muted); }
.rail__conn i { color: var(--ailo-muted); font-size: 15px; }
.rail__conn span { display: none; white-space: nowrap; }
.rail__expand {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 40px; border-radius: 10px;
  border: 1px solid var(--ailo-line); background: transparent; color: var(--ailo-muted); font-size: 14px; white-space: nowrap;
}
.rail__expand:hover { color: var(--ailo-fg); background: var(--d12-hover); }
.rail__expand span { display: none; }
.rail__expand i { transition: rotate .3s; }

/* 펼친 레일 (데스크톱) + 오프캔버스 공통 */
html.rail-wide .rail__nav a, html.dash-open .rail__nav a { justify-content: flex-start; padding: 0 14px; }
html.rail-wide .rail__nav a span, html.rail-wide .rail__brand, html.rail-wide .rail__conn span, html.rail-wide .rail__expand span,
html.dash-open .rail__nav a span, html.dash-open .rail__brand, html.dash-open .rail__conn span { display: block; }
html.rail-wide .rail__top, html.rail-wide .rail__conn { justify-content: flex-start; padding-left: 6px; }
html.rail-wide .rail__expand i { rotate: 180deg; }
html.rail-wide .rail__badge, html.dash-open .rail__badge { top: 14px; right: 12px; }

.scrim { display: none; }

/* ===== Topbar ===== */
.top {
  position: sticky; top: 0; z-index: 40; min-height: var(--ailo-header-h);
  display: flex; align-items: center; gap: 18px; padding: 10px clamp(16px, 2vw, 24px);
  background: rgba(18, 25, 34, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ailo-line);
}
.top__menu { display: none; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--ailo-line); background: transparent; flex: none; }
.top__title { min-width: 0; }
.bc { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--ailo-muted); }
.bc li + li::before { content: "›"; margin-right: 6px; }
.bc a:hover { color: var(--ailo-accent); }
.top h1 { font-size: clamp(19px, 1.7vw, 23px); font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.top__shift { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ailo-muted); white-space: nowrap; padding-left: 18px; border-left: 1px solid var(--ailo-line); }
.top__shift b { color: var(--ailo-fg); font-weight: 600; }
.shift-chip { background: var(--ailo-accent); color: var(--ailo-accent-ink); font-weight: 700; border-radius: 6px; padding: 1px 8px; }
.top__clock { font-variant-numeric: tabular-nums; color: var(--ailo-fg); font-weight: 600; font-size: 16px; }
.top__clock i { color: var(--ailo-muted); font-size: 13px; }
.top__search {
  margin-left: auto; display: flex; align-items: center; gap: 8px; width: min(300px, 26vw); height: 40px;
  border-radius: 10px; background: var(--d12-panel); border: 1px solid var(--ailo-line); padding: 0 12px;
}
.top__search:focus-within { border-color: var(--ailo-accent); }
.top__search i { color: var(--ailo-muted); font-size: 14px; }
.top__search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ailo-fg); font: inherit; font-size: 14px; outline: none; }
.top__search input::placeholder { color: #7d8ea3; }
.top__tools { display: flex; align-items: center; gap: 12px; }
.top__btn { position: relative; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--ailo-line); background: transparent; font-size: 16px; }
.top__btn:hover, .top__menu:hover { border-color: var(--ailo-accent); color: var(--ailo-accent); }
.dot-badge { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; border-radius: 10px; background: var(--d12-crit); color: #fff; font-size: 11px; font-weight: 700; line-height: 19px; padding: 0 5px; border: 2px solid var(--ailo-bg); }
.pop { position: relative; }
.pop__panel {
  position: absolute; right: 0; top: calc(100% + 10px); width: min(360px, calc(100vw - 32px)); z-index: 70;
  background: var(--d12-panel-2); border: 1px solid var(--d12-axis); border-radius: 12px; box-shadow: 0 24px 48px rgba(0, 0, 0, .5); overflow: hidden;
}
.pop__hd { display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--ailo-line); }
.pop__hd span { color: var(--ailo-muted); font-size: 13px; }
.pop__list li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 11px 16px; border-bottom: 1px solid var(--ailo-line); font-size: 14px; }
.pop__list li:last-child { border-bottom: 0; }
.pop__list p { grid-column: 2; }
.pop__list time { grid-column: 2; color: var(--ailo-muted); font-size: 12px; }
.pop__list .sev { grid-row: 1 / 3; align-self: start; }
.top__me { display: flex; align-items: center; gap: 10px; background: transparent; border: 0; padding: 0; text-align: left; }
.ava { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #2c4561; color: #cfe4f7; font-weight: 700; font-family: "Pretendard Variable", Pretendard, sans-serif; flex: none; }
.top__who { display: grid; line-height: 1.2; white-space: nowrap; }
.top__who small { color: var(--ailo-muted); font-size: 12px; }

/* ===== Split ===== */
.split { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) var(--d12-side); align-items: start; }
.work { min-width: 0; padding: clamp(14px, 1.6vw, 22px); display: grid; gap: 14px; }

.bar-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.bar-row__line { font-size: 14px; color: var(--ailo-muted); }
.bar-row__line i { color: var(--ailo-fg); }
.bar-row__line b { color: var(--ailo-fg); font-weight: 600; }
.segbar { display: inline-flex; background: var(--d12-panel); border: 1px solid var(--ailo-line); border-radius: 10px; padding: 3px; gap: 2px; }
.segbar button { border: 0; background: transparent; color: var(--ailo-muted); font-size: 14px; font-weight: 600; padding: 6px 14px; border-radius: 7px; white-space: nowrap; }
.segbar button:hover { color: var(--ailo-fg); }
.segbar button[aria-pressed="true"] { background: var(--ailo-accent); color: var(--ailo-accent-ink); }

/* ===== KPI ===== */
.kpi-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--ailo-line); border: 1px solid var(--ailo-line); border-radius: var(--d12-r); overflow: hidden; }
.kp { background: var(--d12-panel); padding: 12px 14px 10px; display: grid; gap: 2px; min-width: 0; }
.kp h2 { font-size: 13px; font-weight: 600; color: var(--ailo-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp__v { font-size: clamp(24px, 2vw, 30px); font-weight: 700; line-height: 1.1; white-space: nowrap; }
.kp__v small { font-size: 14px; font-weight: 600; color: var(--ailo-muted); margin-left: 3px; }
.kp--alert .kp__v { color: #ffb199; }
.kp__d { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp__d.is-good { color: #7fd8a4; }
.kp__d.is-bad { color: #ffab8f; }
.kp__d.is-flat { color: var(--ailo-muted); }
.kp__sp { position: relative; display: block; height: 26px; margin-top: 4px; }
.kp__sp svg { width: 100%; height: 100%; overflow: visible; }
.kp__sp i { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--ailo-accent); box-shadow: 0 0 0 2px var(--d12-panel); }
.kp__sp i.is-hot { background: var(--d12-serious); }

/* ===== Panels ===== */
.pnl { background: var(--d12-panel); border: 1px solid var(--ailo-line); border-radius: var(--d12-r); padding: 14px 16px 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pnl__hd { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 14px; }
.pnl__hd h2 { font-size: 17px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pnl__hd h2 small { font-size: 13px; font-weight: 500; color: var(--ailo-muted); }
.cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.c-4 { grid-column: span 4; } .c-6 { grid-column: span 6; } .c-8 { grid-column: span 8; } .c-12 { grid-column: span 12; }
.cv { position: relative; width: 100%; }
.cv--lg { height: 280px; }
.cv--md { height: 270px; }

.key, .lgd, .seg-lgd { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--ailo-fg); }
.key li, .lgd li, .seg-lgd li { display: inline-flex; align-items: center; gap: 6px; }
.lgd i { width: 16px; height: 2px; border-radius: 1px; background: var(--c); }
.lgd i.sq { width: 10px; height: 10px; border-radius: 2px; }
.lgd b { font-weight: 700; font-variant-numeric: tabular-nums; }
.lgd small { color: var(--ailo-muted); }
.lgd--line i.ln { width: 16px; height: 2px; }
.ln--warn { background: var(--d12-serious) !important; }
.ln--crit { background: var(--d12-crit) !important; }
.tabs { display: inline-flex; border: 1px solid var(--ailo-line); border-radius: 8px; overflow: hidden; }
.tabs button { border: 0; background: transparent; color: var(--ailo-muted); font-weight: 600; font-size: 14px; padding: 5px 14px; }
.tabs button + button { border-left: 1px solid var(--ailo-line); }
.tabs button[aria-pressed="true"] { background: rgba(74, 163, 238, .18); color: var(--ailo-accent); }

/* ===== Floor plan ===== */
.plan { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 14px; }
.plan__map { overflow-x: auto; border-radius: 6px; background: #161e28; border: 1px solid var(--ailo-line); scrollbar-width: thin; scrollbar-color: var(--d12-axis) transparent; }
.plan__map svg { min-width: 640px; width: 100%; height: auto; display: block; font-family: var(--d12-font); }
.zones rect { fill: rgba(148, 170, 196, .025); stroke: rgba(148, 170, 196, .22); stroke-width: 1; }
.zones text { fill: var(--ailo-muted); font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.flow path { fill: none; stroke: var(--d12-flow); stroke-width: 2; stroke-linejoin: round; }
.eq { cursor: pointer; outline: none; }
.eq rect { stroke-width: 1.2; transition: stroke .15s, stroke-width .15s; }
.eq__id { font-size: 15px; font-weight: 700; fill: var(--ailo-fg); pointer-events: none; }
.eq__st { font-size: 12.5px; font-weight: 600; fill: var(--ailo-muted); pointer-events: none; }
.eq.is-run rect { fill: #2a3646; stroke: #5d6f86; }
.eq.is-idle rect { fill: #1d2631; stroke: #45566b; }
.eq.is-idle .eq__id { fill: var(--ailo-muted); }
.eq.is-stop rect { fill: #182029; stroke: #5d6f86; stroke-width: 1; }
.eq.is-stop .eq__id { fill: var(--ailo-muted); }
.eq.is-warn rect { fill: rgba(236, 131, 90, .22); stroke: var(--d12-serious); stroke-width: 1.6; }
.eq.is-warn .eq__st { fill: #ffc2a8; }
.eq.is-fault rect { fill: rgba(208, 59, 59, .38); stroke: #ff7b7b; stroke-width: 1.8; animation: d12-blink 1.2s steps(2) infinite; }
.eq.is-fault .eq__st { fill: #ffd0d0; }
.eq__pin { stroke: #161e28; stroke-width: 2; }
.eq.is-warn .eq__pin { fill: var(--d12-serious); }
.eq.is-fault .eq__pin { fill: var(--d12-crit); }
.eq__bang { font-size: 12px; font-weight: 800; fill: #fff; pointer-events: none; }
.eq:hover rect, .eq:focus-visible rect { stroke: var(--ailo-accent); stroke-width: 2; }
.eq.is-sel rect { stroke: var(--ailo-accent); stroke-width: 2.6; }
@keyframes d12-blink { 50% { fill: rgba(208, 59, 59, .16); } }

.eq-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid; flex: none; }
.eq-key.is-run { background: #2a3646; border-color: #5d6f86; }
.eq-key.is-idle { background: #1d2631; border-color: #45566b; }
.eq-key.is-stop { background: #182029; border-color: #5d6f86; }
.eq-key.is-warn { background: rgba(236, 131, 90, .35); border-color: var(--d12-serious); }
.eq-key.is-fault { background: rgba(208, 59, 59, .6); border-color: #ff7b7b; }

.eqd { background: var(--d12-panel-2); border: 1px solid var(--ailo-line); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.eqd__id { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; }
.eqd h3 { font-size: 14px; font-weight: 500; color: var(--ailo-muted); margin-top: -6px; }
.st-tag { margin-left: auto; font-style: normal; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--d12-idle); color: var(--ailo-fg); }
.st-tag--warn { background: var(--d12-serious); color: #fff; }
.st-tag--fault { background: var(--d12-crit); color: #fff; }
.st-tag--run { background: var(--d12-run); color: #fff; }
.eqd dl { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--ailo-line); border-radius: 6px; overflow: hidden; margin: 0; }
.eqd dl div { background: var(--d12-panel); padding: 8px 10px; }
.eqd dt { font-size: 12px; font-weight: 500; color: var(--ailo-muted); }
.eqd dd { margin: 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.eqd dl div.is-hot dd { color: #ffb199; }
.eqd dl div.is-hot dd::after { content: " ▲"; font-size: 11px; }
.eqd__mt { font-size: 13px; color: var(--ailo-muted); }
.eqd__act { display: flex; gap: 8px; margin-top: auto; }
.btn-o, .btn-g { flex: 1; text-align: center; border-radius: 8px; padding: 8px 10px; font-size: 14px; font-weight: 600; }
.btn-o { background: var(--ailo-accent); color: var(--ailo-accent-ink); border: 0; }
.btn-o:hover { background: #73b8f3; }
.btn-g { border: 1px solid var(--d12-axis); color: var(--ailo-fg); }
.btn-g:hover { border-color: var(--ailo-accent); color: var(--ailo-accent); }

/* ===== Gauges ===== */
.gauges { display: grid; gap: 10px; }
.gauge { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 12px; margin: 0; padding: 8px 0; border-bottom: 1px solid var(--ailo-line); }
.gauge:last-child { border-bottom: 0; }
.gauge__cv { position: relative; height: 66px; }
.gauge figcaption { font-size: 13px; color: var(--ailo-muted); line-height: 1.3; }
.gauge figcaption b { font-size: 26px; font-weight: 700; color: var(--ailo-fg); }
.gauge figcaption span { display: block; margin-top: 2px; }
.gauge figcaption .is-warn { color: #ffb199; }

/* ===== Severity / ACK ===== */
.sev { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.sev--crit { background: var(--d12-crit); color: #fff; }
.sev--serious { background: var(--d12-serious); color: #fff; }
.sev--warn { background: var(--d12-warn); color: #0b0b0b; }
.sev--info { background: var(--d12-track); color: var(--ailo-fg); }
.ack { font-size: 13px; font-weight: 600; white-space: nowrap; }
.ack--no { color: #ffb199; }
.ack--no::before { content: "● "; }
.ack--yes { color: var(--ailo-fg); }
.ack--clr { color: var(--ailo-muted); }
.btn-ack { border: 1px solid var(--d12-axis); background: transparent; color: var(--ailo-fg); border-radius: 6px; padding: 3px 12px; font-size: 13px; font-weight: 600; }
.btn-ack:hover { background: var(--ailo-accent); border-color: var(--ailo-accent); color: var(--ailo-accent-ink); }

/* ===== Table ===== */
.fsearch { display: flex; align-items: center; gap: 8px; height: 36px; border-radius: 8px; padding: 0 12px; background: var(--d12-panel-2); border: 1px solid var(--ailo-line); }
.fsearch:focus-within { border-color: var(--ailo-accent); }
.fsearch i { color: var(--ailo-muted); font-size: 13px; }
.fsearch input { border: 0; background: transparent; color: var(--ailo-fg); font: inherit; font-size: 14px; outline: none; width: 200px; }
.tscroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--d12-axis) transparent; }
.grid-t { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 14px; }
.grid-t th { text-align: left; padding: 0; border-bottom: 1px solid var(--d12-axis); white-space: nowrap; background: var(--d12-panel-2); }
.grid-t th:first-child { border-radius: 6px 0 0 0; }
.grid-t th:last-child { border-radius: 0 6px 0 0; }
.grid-t th button, .th-plain { display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--ailo-muted); font-size: 13px; font-weight: 600; text-align: left; }
.grid-t th button:hover { color: var(--ailo-fg); }
.grid-t th button i { font-size: 11px; opacity: .55; }
.grid-t th[aria-sort="ascending"] button, .grid-t th[aria-sort="descending"] button { color: var(--ailo-accent); }
.grid-t th[aria-sort="ascending"] i, .grid-t th[aria-sort="descending"] i { opacity: 1; }
.grid-t td { padding: 9px 10px; border-bottom: 1px solid var(--ailo-line); white-space: nowrap; vertical-align: middle; }
.grid-t tbody tr:hover { background: var(--d12-hover); }
.tbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 13px; color: var(--ailo-muted); }
.pg { display: flex; gap: 4px; }
.pg button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--ailo-line); background: transparent; color: var(--ailo-muted); font-size: 13px; font-weight: 600; }
.pg button:hover:not(:disabled) { color: var(--ailo-fg); border-color: var(--d12-axis); }
.pg button[aria-current="page"] { background: var(--ailo-accent); border-color: var(--ailo-accent); color: var(--ailo-accent-ink); }
.pg button:disabled { opacity: .35; cursor: default; }

/* ===== Side column ===== */
.side {
  position: sticky; top: var(--ailo-header-h); height: calc(100vh - var(--ailo-header-h)); overflow-y: auto;
  border-left: 1px solid var(--ailo-line); background: #161e28; display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: var(--d12-axis) transparent;
}
.side__blk { padding: 16px 18px; border-bottom: 1px solid var(--ailo-line); display: grid; gap: 12px; }
.side__hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side__hd h2 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.side__hd h2 i { color: var(--ailo-muted); font-size: 14px; }
.cnt { background: var(--d12-crit); color: #fff; border-radius: 10px; font-size: 12px; padding: 0 7px; line-height: 19px; }
.txt-btn { border: 0; background: none; padding: 0; color: var(--ailo-accent); font-size: 13px; font-weight: 600; }
.txt-btn:hover { text-decoration: underline; }
.act { display: grid; gap: 8px; }
.act__i { position: relative; display: grid; gap: 3px; padding: 10px 12px 10px 14px; border-radius: 8px; background: var(--d12-panel); border: 1px solid var(--ailo-line); font-size: 14px; }
.act__i::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; }
.act__i.is-crit::before { background: var(--d12-crit); }
.act__i.is-serious::before { background: var(--d12-serious); }
.act__i.is-warn::before { background: var(--d12-warn); }
.act__i.is-crit:not(.is-acked) { border-color: rgba(208, 59, 59, .55); background: linear-gradient(90deg, rgba(208, 59, 59, .14), var(--d12-panel) 60%); }
.act__i.is-acked { opacity: .72; }
.act__sev { display: flex; justify-content: space-between; align-items: center; }
.act__sev time { font-size: 12px; color: var(--ailo-muted); }
.act__tag { font-size: 12px; color: var(--ailo-muted); }
.act__i .btn-ack, .act__i .acked { position: absolute; right: 10px; bottom: 9px; }
.act__i p:nth-of-type(2) { padding-right: 64px; }
.acked { font-size: 12px; color: var(--ailo-muted); }

.seg-bar { display: flex; gap: 2px; height: 28px; }
.seg-bar span { flex: var(--w) 1 0; background: var(--c); border-radius: 4px; color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; padding-left: 8px; min-width: 0; overflow: visible; }
.seg-lgd { font-size: 13px; }
.seg-lgd i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }

.side__blk--log { border-bottom: 0; }
.oplog { display: grid; gap: 0; }
.oplog li { display: grid; grid-template-columns: 46px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--ailo-line); font-size: 14px; position: relative; }
.oplog li:last-child { border-bottom: 0; }
.oplog time { font-variant-numeric: tabular-nums; color: var(--ailo-muted); font-weight: 600; }
.oplog b { font-weight: 700; }
.oplog em { font-style: normal; font-weight: 700; color: var(--ailo-accent); }

/* ===== Footer ===== */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 14px clamp(16px, 2vw, 24px) 20px; border-top: 1px solid var(--ailo-line); font-size: 13px; color: var(--ailo-muted); }
.foot a:hover { color: var(--ailo-accent); }
.foot b { color: var(--ailo-fg); }

.swal2-popup { font-family: var(--d12-font); border-radius: 12px !important; }

/* ===== Responsive ===== */
@media (max-width: 1499.98px) {
  .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .top__shift > span:nth-child(2) { display: none; }
}
@media (max-width: 1279.98px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; border-left: 0; border-top: 1px solid var(--ailo-line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side__blk:first-child { grid-row: span 2; border-right: 1px solid var(--ailo-line); }
  .top__shift { display: none; }
}
@media (max-width: 1199.98px) {
  .c-4, .c-6, .c-8 { grid-column: span 12; }
  .gauges { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gauge { grid-template-columns: minmax(0, 1fr); border-bottom: 0; text-align: center; } /* 1fr(=min auto)이면 차트 캔버스 기본 폭 300px 이 칸을 밀어내 576~700px 에서 넘침 */
  .gauge__cv { height: 72px; }
  .plan { grid-template-columns: 1fr; }
  .eqd { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); align-items: start; }
  .eqd dl { grid-row: 1 / 5; grid-column: 2; }
  .eqd__act { margin-top: 0; }
}
@media (max-width: 991.98px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 84vw); height: auto; z-index: 95;
    translate: -100% 0; visibility: hidden; transition: translate .3s var(--ailo-ease), visibility .3s; box-shadow: 24px 0 48px rgba(0, 0, 0, .5);
  }
  html.dash-open .rail { translate: 0 0; visibility: visible; transition: translate .3s var(--ailo-ease), visibility 0s; }
  .rail__top { justify-content: flex-start; padding-left: 4px; }
  .rail__x { display: grid; place-items: center; }
  .rail__expand { display: none; }
  .rail__conn { justify-content: flex-start; padding-left: 8px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 90; background: rgba(4, 8, 12, .62); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
  html.dash-open .scrim { opacity: 1; visibility: visible; }
  html.dash-open body { overflow: hidden; }
  .top__menu { display: grid; place-items: center; }
  .top__shift { display: none; }
  .top__tools { margin-left: auto; }
}
@media (max-width: 767.98px) {
  .side { grid-template-columns: 1fr; }
  .side__blk:first-child { grid-row: auto; border-right: 0; }
  .eqd { grid-template-columns: 1fr; }
  .eqd dl { grid-row: auto; grid-column: auto; }
  .top__who { display: none; }
  .top { gap: 10px 12px; flex-wrap: wrap; }
  .top__title { flex: 1 1 0; }
  .top__search { order: 5; flex-basis: 100%; width: auto; margin-left: 0; }
  .bc li:first-child { display: none; }
  .bc li:nth-child(2)::before { display: none; }
}
@media (max-width: 575.98px) {
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kp { padding: 10px 12px; }
  .kp__d .dim { display: none; }
  .bar-row { flex-direction: column; align-items: stretch; }
  .segbar { display: grid; grid-template-columns: repeat(4, 1fr); }
  .segbar button { padding: 7px 2px; font-size: 13px; }
  .gauges { grid-template-columns: 1fr; }
  .gauge { grid-template-columns: 110px 1fr; text-align: left; border-bottom: 1px solid var(--ailo-line); }
  .gauge__cv { height: 62px; }
  .fsearch { width: 100%; }
  .fsearch input { width: 100%; flex: 1; }
  .cv--lg, .cv--md { height: 240px; }
  .foot { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  .eq.is-fault rect { animation: none; }
}
