/* 경일정밀 생산·품질 현황: 관제실 다크, 신호색(초록·노랑·빨강)만, 숫자는 고정폭 */
:root {
  --bg: #0B0E11; --panel: #12161A; --panel2: #181D22; --line: #222930; --line2: #2E363E;
  --ink: #E6EAED; --ink2: #A6B0B9; --mute: #7D8892;
  --ok: #34C77B; --warn: #F2B431; --bad: #F0555A;
  --okb: rgba(52, 199, 123, .13); --warnb: rgba(242, 180, 49, .14); --badb: rgba(240, 85, 90, .15);
  --bar: #4E5862; --bar2: #8E9AA5;
  --sans: "IBM Plex Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); word-break: keep-all; -webkit-font-smoothing: antialiased; min-width: 320px; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.n { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.demo { background: #111418; color: #C9CCD1; font-size: 13px; text-align: center; padding: 8px 16px; }
.demo a, .demo button { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.demo button { background: none; border: 0; cursor: pointer; font-size: 13px; }
.demo b { color: #FF5A36; font-family: Menlo, monospace; }

/* 머리글 */
.top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 56px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo .mark { color: var(--ink); flex: none; }
.logo span { display: grid; line-height: 1.15; }
.logo b { font-size: 17px; font-weight: 700; letter-spacing: .08em; }
.logo small { font-size: 11px; color: var(--mute); letter-spacing: .02em; }
.nav { display: flex; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; gap: 6px; padding: 0 12px; text-decoration: none; color: var(--ink2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current] { color: var(--ink); border-bottom-color: var(--ink); }
.badge { background: var(--warn); color: #1A1406; font-size: 11px; font-weight: 600; border-radius: 3px; padding: 0 5px; line-height: 17px; }
.top-r { display: flex; align-items: center; gap: 12px; }
.now { display: grid; text-align: right; line-height: 1.25; }
.now .shift { font-size: 11px; color: var(--ok); }
.now .shift.off { color: var(--mute); }
.now .n { font-size: 13px; }
#role { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 6px 8px; font-size: 13px; max-width: 190px; }

/* 필터 */
.filters { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.fb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 1480px; margin: 0 auto; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 4px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: none; color: var(--ink2); padding: 6px 12px; font-size: 13px; cursor: pointer; border-right: 1px solid var(--line2); white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); background: var(--panel2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
.seg.sm button { padding: 4px 10px; font-size: 12px; }
.custom { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.custom input { background: var(--panel); border: 1px solid var(--line2); border-radius: 4px; padding: 5px 8px; font-size: 13px; font-family: var(--mono); }
.frange { margin-left: auto; color: var(--mute); font-size: 12px; }

.view { max-width: 1480px; margin: 0 auto; padding: 16px 20px 32px; display: grid; gap: 12px; }
.foot { max-width: 1480px; margin: 0 auto; padding: 16px 20px 32px; color: var(--mute); font-size: 12px; border-top: 1px solid var(--line); }

/* 패널 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; min-width: 0; }
.ph { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.ph h2 { font-size: 14px; font-weight: 600; letter-spacing: .01em; }
.ph .sub, .sub { color: var(--mute); font-size: 12px; }
.ph .legend, .ph .more, .ph-r, .ph > .btn:last-child { margin-left: auto; }
.ph .legend + .legend { margin-left: 0; }
.more { color: var(--ink2); font-size: 12px; text-decoration: none; border-bottom: 1px solid var(--line2); }
.more:hover { color: var(--ink); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mutetx { color: var(--mute); }
.warntx { color: var(--warn); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px; border-radius: 3px; font-size: 12px; font-weight: 600; white-space: nowrap; text-decoration: none; line-height: 19px; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--okb); color: var(--ok); }
.chip.warn { background: var(--warnb); color: var(--warn); }
.chip.bad { background: var(--badb); color: var(--bad); }
.chip.none { background: rgba(255, 255, 255, .06); color: var(--ink2); }

.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.ok { background: var(--ok); } .sw.warn { background: var(--warn); } .sw.bad { background: var(--bad); }
.lk { width: 14px; height: 0; border-top: 2px solid var(--ink); display: inline-block; }

.empty { padding: 36px 16px; text-align: center; color: var(--ink2); border: 1px dashed var(--line2); border-radius: 6px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; }
.view > .empty { background: var(--panel); padding: 64px 16px; }
.card .empty { border: 0; padding: 20px 0; }

.lostnote { margin: -4px 0 10px; font-size: 12px; color: var(--ink2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lostnote b { color: var(--bad); display: inline-flex; align-items: center; gap: 5px; }
.lostnote b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); }
.lock { background: var(--warnb); color: var(--warn); font-size: 13px; padding: 8px 10px; border-radius: 4px; margin-bottom: 12px; }
.hint { color: var(--mute); font-size: 12px; }
.err { color: var(--bad); font-size: 12px; }
.err:empty { display: none; }
.sumline { color: var(--ink2); font-size: 13px; margin: -4px 0 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sumline b { color: var(--ink); font-size: 15px; }

/* 현황 */
.ov-top { display: grid; grid-template-columns: 300px 1fr; gap: 12px; }
.ov-mid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 12px; }
.ov-bot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plant { border-top: 3px solid var(--line2); }
.plant.ok { border-top-color: var(--ok); } .plant.warn { border-top-color: var(--warn); } .plant.bad { border-top-color: var(--bad); }
.plant .ph .chip { margin-left: auto; }
.hero { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.hero .n { font-size: 56px; font-weight: 500; line-height: 1; letter-spacing: -.03em; }
.hero .u { font-size: 22px; color: var(--ink2); }
.hero small { flex-basis: 100%; color: var(--mute); font-size: 12px; margin-top: 6px; }
.plant .formula { margin: 10px 0 14px; }
.kv { display: grid; gap: 8px; }
.kv div { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.kv dt { color: var(--ink2); font-size: 13px; }
.kv dd { font-size: 14px; text-align: right; }
.kv.wide dd { text-align: left; flex: 1; }
.kv.wide dt { width: 80px; flex: none; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cards.m2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.m3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--line2); border-radius: 6px; padding: 14px; display: grid; grid-template-areas: "h" "o" "a" "f" "p" "q" "m" "t"; grid-template-rows: repeat(7, auto) 1fr; gap: 10px; cursor: pointer; min-width: 0; }
.card:hover { background: var(--panel2); }
.card.ok { border-top-color: var(--ok); } .card.warn { border-top-color: var(--warn); } .card.bad { border-top-color: var(--bad); }
.card.none { cursor: default; }
.card header { grid-area: h; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card header b { font-size: 15px; }
.card header span:not(.chip) { color: var(--mute); font-size: 12px; margin-right: auto; }
.card .oee { grid-area: o; display: flex; align-items: baseline; gap: 3px; }
.card .big { font-size: 40px; font-weight: 500; line-height: 1; letter-spacing: -.03em; }
.card .u { font-size: 16px; color: var(--ink2); }
.card .oee small { margin-left: 8px; color: var(--mute); font-size: 11px; line-height: 1.25; }
.card .apq { grid-area: a; display: grid; gap: 5px; }
.card .formula { grid-area: f; }
.card .prod { grid-area: p; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--ink2); }
.card .prod b { color: var(--ink); font-size: 15px; font-weight: 500; }
.card .prod .chip { margin-left: auto; }
.card .prod2 { grid-area: q; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--mute); }
.card .prod2 b { color: var(--ink2); font-weight: 500; }
.kv dd .chip { margin-left: 6px; }
.card .mrow { grid-area: m; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.card .mrow .sd { font-family: var(--mono); font-weight: 500; color: var(--ink2); font-size: 12px; }
.card .mrow .sd.ok::before { background: var(--ok); } .card .mrow .sd.warn::before { background: var(--warn); } .card .mrow .sd.bad::before { background: var(--bad); } .card .mrow .sd.none::before { background: var(--mute); }
.card .cfoot { grid-area: t; align-self: end; color: var(--mute); font-size: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.apq-r { display: grid; grid-template-columns: 40px 1fr 36px; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); }
.apq-r .n { text-align: right; color: var(--ink); }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--bar2); border-radius: 0 3px 3px 0; }
.formula { font-size: 12px; color: var(--ink2); }
.formula b { color: var(--ink); font-weight: 600; }
.formula-def { margin: -6px 0 12px; }

/* 차트 */
.chart-box { width: 100%; min-height: 120px; }
.chart { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick, .chart .xl { fill: var(--mute); font: 11px var(--mono); }
.chart .vl { fill: var(--ink); font: 600 12px var(--mono); }
.chart .bar.ok { fill: var(--ok); } .chart .bar.warn { fill: var(--warn); } .chart .bar.bad { fill: var(--bad); } .chart .bar.none { fill: var(--bar); }
.chart .bar.live { opacity: .5; }
.chart .tgt { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.chart .tgt.fut { stroke: var(--bar2); opacity: .45; }
.chart .offband { fill: rgba(255, 255, 255, .025); }
.chart .hit { fill: transparent; }
.chart .hit.hov { fill: rgba(255, 255, 255, .06); }
.chart .ln { fill: none; stroke: var(--bar2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .dot.ok { fill: var(--ok); } .chart .dot.warn { fill: var(--warn); } .chart .dot.bad { fill: var(--bad); }
.chart .dot.hl { stroke: var(--ink); }
.multi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.mini h3 { font-size: 13px; font-weight: 500; color: var(--ink2); margin-bottom: 4px; }

/* 파레토·가로 막대 */
.pareto, .hbars { display: grid; }
.pr, .hb { display: grid; grid-template-columns: 116px minmax(40px, 1fr) 48px 56px 56px; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; text-decoration: none; }
.hb { grid-template-columns: 104px minmax(40px, 1fr) 64px 40px; }
.pr.hd { color: var(--mute); font-size: 11px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pr .n, .hb .n { text-align: right; }
.pr.hd span:nth-child(n+3) { text-align: right; }
.hb .m { color: var(--mute); }
.pl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track { height: 12px; display: block; }
.track i { display: block; height: 100%; min-width: 2px; background: var(--bar); border-radius: 0 3px 3px 0; }
.pr.vital .track i { background: var(--bar2); }
.pr:not(.hd):hover, .hb:hover, .pr.hov, .hb.hov { background: rgba(255, 255, 255, .03); }
a.hb:hover .pl { text-decoration: underline; text-underline-offset: 3px; }
.hb.open .track i { background: var(--warn); }
.hb.open .pl::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-right: 6px; vertical-align: 2px; }
.cut { display: flex; align-items: center; gap: 8px; color: var(--mute); font-size: 11px; margin: 2px 0; }
.cut::before, .cut::after { content: ""; height: 1px; background: var(--line2); flex: 1; }
.cut::before { flex: 0 0 0; }
.cut span { white-space: nowrap; }

/* 설비 상태 */
.mlist { list-style: none; display: grid; }
.ms { display: grid; grid-template-columns: 82px 64px minmax(0, 1fr) auto; grid-template-areas: "s c l n"; column-gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; }
.ms:last-child { border-bottom: 0; }
.ms .sd { grid-area: s; }
.ms b { grid-area: c; font-size: 13px; font-weight: 600; }
.ms .ml { grid-area: l; font-size: 12px; color: var(--mute); }
.ms .mn { grid-area: n; font-size: 12px; color: var(--ink2); text-align: right; }
.ms .rx { color: var(--mute); }
.ms .mn:empty { display: none; }
.ms .mn a { color: var(--warn); }
.sd { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sd::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.sd.ok { color: var(--ok); } .sd.warn { color: var(--warn); } .sd.bad { color: var(--bad); } .sd.none { color: var(--mute); }
.ms.lost .sd::before, .tm.lost .sd::before { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* 표 */
.tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tools select, .tools input, .num, .dr-in input, .dr-in select, .set-row input { background: var(--bg); border: 1px solid var(--line2); border-radius: 4px; padding: 7px 10px; font-size: 13px; color: var(--ink); }
.tools input[type="search"] { flex: 1 1 200px; min-width: 0; max-width: 320px; }
.tools .btn.ghost:last-child { margin-left: auto; }
.st-seg { margin-bottom: 10px; }
.st-seg .n { opacity: .7; margin-left: 2px; }
.tw { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--mute); font-weight: 500; font-size: 12px; padding: 7px 10px; border-bottom: 1px solid var(--line2); white-space: nowrap; }
.tbl th button { background: none; border: 0; color: inherit; cursor: pointer; padding: 0; font-weight: inherit; }
.tbl th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 9px; }
.tbl th[aria-sort="descending"] button::after { content: " ▼"; font-size: 9px; }
.tbl th[aria-sort]:not([aria-sort="none"]) { color: var(--ink); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .n { text-align: right; }
.tbl td.em { color: var(--ink); }
.tbl tr.total td { border-top: 1px solid var(--line2); background: var(--panel2); }
.tbl tbody tr[data-open] { cursor: pointer; }
.tbl tbody tr[data-open]:hover, .tbl tbody tr[data-open]:focus-visible { background: var(--panel2); outline: 0; }
.tbl tr.is-open td:first-child, .tbl tr.is-open td.ck + td { box-shadow: inset 2px 0 0 var(--warn); }
.tbl .ck { width: 28px; }
.tbl .ck input { width: 16px; height: 16px; accent-color: var(--ink); }
.tbl .det { color: var(--ink2); max-width: 280px; }
.oee-t td.n { white-space: nowrap; }
.offrow td { color: var(--mute); }
.more-btn { display: block; margin: 12px auto 0; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 16px; display: grid; gap: 2px; }
.kpi span { color: var(--mute); font-size: 12px; }
.kpi b { font-size: 24px; font-weight: 500; }
.kpi b:not(.n) { font-size: 18px; font-weight: 600; line-height: 1.8; }
.h3 { font-size: 13px; font-weight: 600; margin: 4px 0 8px; }
.h3 small { color: var(--mute); font-weight: 400; margin-left: 6px; }
.set-t .num { width: 76px; text-align: right; font-family: var(--mono); }
.set-t td .err { text-align: right; }
.set-row { margin-top: 16px; }
.set-row label { display: grid; gap: 6px; font-size: 12px; color: var(--ink2); }
.set-row .num { width: 120px; font-family: var(--mono); }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--panel2); border: 1px solid var(--line2); color: var(--ink); padding: 6px 12px; border-radius: 4px; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--bar2); }
.btn.pri { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(240, 85, 90, .45); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line2); }

/* 입력 창 */
.drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 20; display: flex; justify-content: flex-end; }
.dr-in { width: min(440px, 100%); height: 100%; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line2); padding: 18px 20px 32px; }
.dr-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dr-h h2 { font-size: 17px; }
.x { background: none; border: 1px solid var(--line2); border-radius: 4px; padding: 4px 10px; font-size: 13px; color: var(--ink2); cursor: pointer; }
.dr-meta { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; color: var(--ink2); font-size: 13px; }
.dr-time { margin: 12px 0 16px; display: flex; align-items: baseline; gap: 10px; color: var(--ink2); }
.dr-time .big { font-size: 24px; color: var(--ink); }
#dr-form { display: grid; gap: 10px; }
#dr-form label { display: grid; gap: 5px; font-size: 12px; color: var(--ink2); }
.dr-in input:disabled, .dr-in select:disabled, .num:disabled { opacity: .6; }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dr-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dr-act .danger { margin-left: auto; }
.hist { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; }
.hist h3 { font-size: 12px; color: var(--mute); font-weight: 500; margin-bottom: 6px; }
.hist ol { list-style: none; display: grid; gap: 4px; font-size: 12px; color: var(--ink2); }
.hist .n { color: var(--mute); margin-right: 4px; }
body.dr-open { overflow: hidden; }

.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 7px 10px; display: grid; gap: 1px; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); max-width: 260px; }
.tip b { font: 600 13px var(--mono); }
.tip span { font-size: 12px; color: var(--ink2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 4px; font-size: 13px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* TV */
body.is-tv .top, body.is-tv .filters, body.is-tv .foot { display: none; }
body.is-tv .view { max-width: none; padding: 0; }
.tv { min-height: calc(100vh - 35px); display: flex; flex-direction: column; padding: 18px 28px 0; gap: 14px; }
.tv-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-t { display: flex; align-items: center; gap: 10px; font-size: 20px; letter-spacing: .08em; }
.tv-day { color: var(--ink2); font-size: 15px; }
.tv-day [data-shift-now] { color: var(--ok); }
.tv-clock { font-size: 28px; margin-left: auto; }
.tv-btns { display: flex; gap: 6px; }
.tv-title { display: flex; align-items: center; gap: 16px; }
.tv-title h2 { font-size: 24px; font-weight: 600; }
.tv-dots { display: flex; gap: 6px; }
.tv-dots button { width: 28px; height: 6px; border: 0; border-radius: 3px; background: var(--line2); cursor: pointer; }
.tv-dots button[aria-pressed="true"] { background: var(--ink); }
.tv-stage { flex: 1; min-height: 0; padding-bottom: 16px; }
.tv-prog { height: 3px; background: var(--line); margin: 0 -28px; }
.tv-prog i { display: block; height: 100%; background: var(--bar2); width: 0; animation: tvp linear forwards; }
.tv-prog.paused i { animation: none; width: 100%; background: var(--line2); }
@keyframes tvp { to { width: 100%; } }
.tv-oee { display: grid; grid-template-columns: 1.15fr repeat(4, 1fr); gap: 14px; height: 100%; }
.tv-plant, .tv-line { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--line2); border-radius: 6px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.tv-plant.ok, .tv-line.ok { border-top-color: var(--ok); } .tv-plant.warn, .tv-line.warn { border-top-color: var(--warn); } .tv-plant.bad, .tv-line.bad { border-top-color: var(--bad); }
.tv-plant > span { color: var(--ink2); font-size: 18px; }
.tv-plant > b { font-size: 96px; font-weight: 500; line-height: 1; letter-spacing: -.04em; }
.tv-plant small, .tv-line > b small { font-size: .4em; color: var(--ink2); margin-left: 4px; }
.tv-plant p { font-size: 18px; color: var(--ink2); margin-top: auto; }
.tv-plant .chip, .tv-line .chip { align-self: flex-start; font-size: 15px; padding: 3px 10px; }
.tv-line h3 { font-size: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tv-line h3 small { font-size: 14px; color: var(--mute); font-weight: 400; }
.tv-line > b { font-size: 84px; font-weight: 500; line-height: 1; letter-spacing: -.04em; }
.tv-f { font-size: 16px; color: var(--ink2); }
.tv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-hr { display: grid; gap: 8px; margin-top: 8px; }
.tv-hr div { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; font-size: 15px; color: var(--ink2); background: var(--panel2); border-radius: 4px; padding: 10px 12px; }
.tv-hr .k { white-space: nowrap; }
.tv-hr .v { grid-column: 1 / -1; font-size: 16px; }
.tv-hr b { color: var(--ink); font-size: 28px; font-weight: 500; }
.tv-hr .chip { font-size: 13px !important; padding: 1px 7px !important; }
.tv-cnt { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.tv-cnt div { background: var(--panel2); border-radius: 4px; padding: 10px 12px; }
.tv-cnt dt { color: var(--ink2); font-size: 14px; }
.tv-cnt dd { font-size: 30px; }
.tv-line dl { display: grid; gap: 6px; margin-top: auto; }
.tv-line dl div { display: grid; grid-template-columns: 56px 1fr; align-items: center; font-size: 17px; border-top: 1px solid var(--line); padding-top: 8px; }
.tv-line dd { display: grid; grid-template-columns: 1fr 60px; align-items: center; gap: 10px; text-align: right; }
.tv-line .meter { height: 8px; }
.tv-line dt { color: var(--ink2); }
.tv-prod { font-size: 16px; color: var(--ink2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tv-prod b { color: var(--ink); font-size: 20px; }
.tv-line.none p { color: var(--mute); font-size: 18px; }
.tv-ph { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.tv-ph .legend { margin-left: auto; font-size: 15px; }
.tv-sum { font-size: 20px; color: var(--ink2); display: flex; align-items: center; gap: 10px; }
.tv-sum b { color: var(--ink); font-size: 34px; font-weight: 500; }
.tv .chart .tick, .tv .chart .xl { font-size: 15px; }
.tv .chart .vl { font-size: 17px; }
.tv .lostnote { font-size: 16px; }
.tv-mach { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 1fr; gap: 14px; height: 100%; }
.tm { background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--line2); border-radius: 6px; padding: 22px; display: grid; gap: 8px; min-height: 150px; align-content: center; }
.tm.run { border-left-color: var(--ok); } .tm.stop { border-left-color: var(--warn); } .tm.lost { border-left-color: var(--bad); }
.tm .sd { font-size: 20px; }
.tm .sd::before { width: 12px; height: 12px; }
.tm b { font-size: 42px; font-weight: 600; line-height: 1.1; }
.tm > span:not(.sd) { color: var(--ink2); font-size: 17px; }
.tm .tm-n { color: var(--ink); }
.tv-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; height: 100%; }
.tv-two section { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 20px; }
.tv-two h3 { font-size: 20px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }
.tv-two .pr, .tv-two .hb { font-size: 17px; padding: 9px 0; grid-template-columns: 170px minmax(40px, 1fr) 70px 80px 80px; }
.tv-two .hb { grid-template-columns: 150px minmax(40px, 1fr) 90px 60px; }
.tv-two .track { height: 18px; }
.tv-two .pr.hd { font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  .ms.lost .sd::before, .tm.lost .sd::before { animation: none; }
  .toast { transition: none; }
}

/* 반응형 */
@media (max-width: 1240px) {
  .ov-top { grid-template-columns: 1fr; }
  .plant { display: grid; grid-template-columns: auto 1fr; column-gap: 32px; align-items: start; }
  .plant .ph, .plant .hero, .plant .formula { grid-column: 1; }
  .plant .kv { grid-column: 2; grid-row: 1 / span 3; }
  .tv-oee { grid-template-columns: repeat(3, 1fr); }
  .tv-plant { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .top { grid-template-columns: auto 1fr; grid-template-areas: "logo right" "nav nav"; row-gap: 0; padding-top: 8px; }
  .logo { grid-area: logo; }
  .top-r { grid-area: right; justify-self: end; }
  .nav { grid-area: nav; margin: 0 -20px; padding: 0 12px; min-height: 42px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-mid, .ov-bot, .two { grid-template-columns: 1fr; }
  .multi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv-mach { grid-template-columns: repeat(3, 1fr); }
  .tv-two { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .top { padding: 8px 16px 0; gap: 12px; }
  .nav { margin: 0 -16px; padding: 0 6px; }
  .nav a { padding: 0 10px; }
  .now { display: none; }
  #role { max-width: 150px; }
  .filters { padding: 10px 16px; }
  .fb { gap: 8px; }
  .fb > .seg { display: flex; width: 100%; }
  .fb > .seg button { flex: 1; padding: 7px 4px; }
  .frange { margin-left: 0; width: 100%; }
  .view { padding: 12px 16px 24px; gap: 10px; }
  .foot { padding: 16px; }
  .panel { padding: 14px; }
  .plant { display: block; }
  .hero .n { font-size: 48px; }
  .cards, .cards.m2, .cards.m3 { grid-template-columns: 1fr; }
  .card { grid-template-columns: auto 1fr; grid-template-areas: "h h" "o a" "f f" "p p" "q q" "m m" "t t"; grid-template-rows: none; column-gap: 18px; }
  .card .oee { flex-wrap: wrap; align-self: center; }
  .card .oee small { margin-left: 0; flex-basis: 100%; }
  .multi { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .pr { grid-template-columns: 92px minmax(30px, 1fr) 36px 48px 48px; gap: 8px; font-size: 12px; }
  .hb { grid-template-columns: 88px minmax(30px, 1fr) 60px 34px; gap: 8px; font-size: 12px; }
  .ms { grid-template-columns: 76px 58px minmax(0, 1fr); grid-template-areas: "s c l" "s c n"; }
  .ms .mn { text-align: left; }
  .tools input[type="search"] { max-width: none; flex-basis: 100%; order: -1; }
  .tools .btn.ghost:last-child { margin-left: 0; }
  .tw { overflow: visible; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .tbl td { border: 0; padding: 0; text-align: left !important; min-width: 0; }
  .tbl td::before { content: attr(data-l); display: block; font-size: 11px; color: var(--mute); font-family: var(--sans); }
  .tbl td.ck::before, .tbl td[data-l="구분"]::before, .tbl td[data-l="상태"]::before { display: none; }
  .plant .kv { grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .plant .kv div { display: grid; gap: 2px; }
  .plant .kv dd { text-align: left; }
  .tbl tr.total { background: var(--panel2); padding: 10px; }
  .tbl tr.total td { background: none; border: 0; }
  .tbl tr.is-open td:first-child, .tbl tr.is-open td.ck + td { box-shadow: none; }
  .tbl tr.is-open { box-shadow: inset 2px 0 0 var(--warn); }
  .dt-t:not(:has(.ck)) tr.is-open { padding-left: 10px; }
  .hide-m { display: none !important; }
  .oee-t tr { grid-template-columns: repeat(3, 1fr); }
  .oee-t td:first-child, .oee-t td:last-child { grid-column: 1 / -1; }
  .prod-t tr { grid-template-columns: 1.4fr repeat(4, 1fr); }
  .prod-t .offrow { grid-template-columns: 1.4fr 4fr; }
  .dt-t tr { grid-template-columns: 26px 1fr 1fr auto; column-gap: 10px; }
  .dt-t:not(:has(.ck)) tr { grid-template-columns: 0 1fr 1fr auto; column-gap: 0; }
  .dt-t:not(:has(.ck)) td[data-l="설비"] { padding-right: 10px; }
  .dt-t td.ck { grid-column: 1; grid-row: 1 / span 4; }
  .dt-t td[data-l="상태"] { grid-column: 2 / 4; grid-row: 1; display: flex; gap: 6px; flex-wrap: wrap; }
  .dt-t td[data-l="분"] { grid-column: 4; grid-row: 1; }
  .dt-t td[data-l="분"]::after { content: "분"; color: var(--mute); font-size: 12px; margin-left: 2px; }
  .dt-t td[data-l="일시"] { grid-column: 2 / -1; }
  .dt-t td[data-l="설비"] { grid-column: 2; }
  .dt-t td[data-l="사유"] { grid-column: 3 / -1; }
  .dt-t td[data-l="상세"], .dt-t td[data-l="입력"] { grid-column: 2 / -1; }
  .dt-t td[data-l="분"]::before, .dt-t td[data-l="일시"]::before, .dt-t td[data-l="상세"]::before { display: none; }
  .dt-t td[data-l="입력"] { font-size: 12px; color: var(--ink2); }
  .dt-t td[data-l="입력"]::before { display: inline; margin-right: 6px; }
  .dt-t td[data-l="상세"]:empty { display: none; }
  .st-seg { display: flex; width: 100%; }
  .st-seg button { flex: 1; padding: 6px 2px; font-size: 12px; }
  .set-t tr { grid-template-columns: 1fr 1fr 1fr; }
  .set-t td[data-l="품명"] { grid-column: span 2; }
  .set-t td .err { text-align: left; }
  .row2 { grid-template-columns: 1fr; }
  .set-row { grid-template-columns: 1fr 1fr; }
  .dr-in { padding: 16px; }
  .kv.wide div { flex-wrap: wrap; }
  .tv { padding: 12px 16px 0; }
  .tv-clock { font-size: 20px; margin-left: 0; }
  .tv-btns { width: 100%; }
  .tv-oee { grid-template-columns: minmax(0, 1fr); }
  .tv-mach { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv-hr { grid-template-columns: 1fr 1fr; }
  .tv-line dl { margin-top: 4px; }
  .tv-plant > b { font-size: 64px; }
  .tv-line > b { font-size: 52px; }
  .tv-line h3 { font-size: 17px; }
  .tv-line dl div { font-size: 14px; }
  .tm b { font-size: 24px; }
  .tm { padding: 14px; min-height: 0; }
  .tm .sd { font-size: 15px; }
  .tv-mach { height: auto; }
  .tv-two .pr { grid-template-columns: 96px minmax(30px, 1fr) 36px 48px 48px; font-size: 13px; }
  .tv-two .hb { grid-template-columns: 88px minmax(30px, 1fr) 60px 34px; font-size: 13px; }
  .tv-prog { margin: 0 -16px; }
}
