/* 덕성LNC MES — v2 디자인 시스템
   ─────────────────────────────────────────────────────────────
   app.css 뒤에 얹는 레이어. app.css 가 이미 토큰(--accent, --border …)으로
   짜여 있어서, 토큰을 덮는 것만으로 93개 화면이 한 번에 새 톤으로 바뀐다.
   그 위에 새 셸(좌측 레일)·새 컴포넌트 문법을 추가한다.

   원칙
   1. 따뜻한 중립색 위에 흙빛 강조 하나. 색으로 떠들지 않는다.
   2. 그림자 대신 1px 경계선. 그림자는 떠 있는 것(모달·드롭다운)에만.
   3. 숫자가 주인공 — 표·금액은 고정폭 숫자, 큰 글씨는 자간을 조인다.
   4. 360px 에서 가로 스크롤 0 (§11.1).
   ───────────────────────────────────────────────────────────── */

:root {
    /* ── 강조: 흙빛 클레이 ── */
    --accent: #c2603d;
    --accent-hover: #a94f2f;
    --accent-active: #8d4126;
    --accent-soft: #fbf0ea;
    --accent-ring: rgba(194, 96, 61, .20);

    /* ── 표면: 따뜻한 아이보리 ── */
    --body-bg: #faf9f6;
    --card-bg: #ffffff;
    --surface-2: #f6f4f0;
    --surface-3: #efece6;

    /* ── 잉크 ── */
    --text-main: #1c1b18;
    --text: #403d38;
    --text-muted: #7b756b;
    --text-faint: #a9a297;

    --border: #e9e4db;
    --border-strong: #d8d1c5;

    /* ── 의미색 (채도를 낮춰 아이보리와 같은 온도로) ── */
    --green: #2f7250;  --green-soft: #eaf3ed;
    --red:   #b03a2e;  --red-soft:   #fbeeec;
    --amber: #a2670f;  --amber-soft: #fbf2e2;
    --blue:  #3a6591;  --blue-soft:  #eef2f7;

    /* ── 레일(좌측 네비) ── */
    --rail-bg: #211f1c;
    --rail-text: rgba(236, 231, 222, .62);
    --rail-text-strong: #f6f2ec;
    --rail-hover: rgba(255, 255, 255, .07);
    --rail-line: rgba(255, 255, 255, .08);
    --rail-w: 236px;

    /* ── 그림자: 떠 있는 것에만 ── */
    --shadow-sm: none;
    --shadow: none;
    --shadow-md: 0 4px 14px rgba(40, 32, 22, .08);
    --shadow-lg: 0 18px 44px rgba(40, 32, 22, .16);

    --radius: 12px;
    --radius-sm: 9px;
    --radius-xs: 7px;

    --nav-h: 56px;      /* 상단 바 — app.css 의 #topbar sticky 기준 */
    --topbar-h: 50px;
}

* { scrollbar-color: #cfc8bb transparent; }
*::-webkit-scrollbar-thumb { background: #d5cec2; }
*::-webkit-scrollbar-thumb:hover { background: #bcb3a4; }

body { letter-spacing: -.006em; }
::selection { background: var(--accent-soft); color: var(--accent-active); }

/* ══════════════════════ 셸 ══════════════════════ */

.v2-rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail-w);
    background: var(--rail-bg);
    display: flex;
    flex-direction: column;
    z-index: 1200;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.v2-rail::-webkit-scrollbar { width: 6px; }
.v2-rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); }

.v2-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    height: var(--nav-h);
    flex-shrink: 0;
    padding: 0 18px;
    color: var(--rail-text-strong);
    text-decoration: none;
    border-bottom: 1px solid var(--rail-line);
}
.v2-brand:hover { color: var(--rail-text-strong); }
.v2-brand-mark {
    width: 26px; height: 26px; flex-shrink: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: grid; place-items: center;
}
/* 마크(병 실루엣)는 세로가 긴 형태라 담는 사각의 66% 높이로 앉힌다 — 사각 어디에 써도 같은 여백. */
.ds-mark { height: 66%; width: auto; display: block; }
.v2-brand-name { font-size: 15px; font-weight: 700; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
/* 버전은 숫자만 — 이름 뒤에 조용히 붙는다. */
.v2-brand-ver {
    font-size: 11px; font-weight: 500; line-height: 1;
    color: rgba(236, 231, 222, .42);
    font-variant-numeric: tabular-nums;
}

/* 공장 전환 — 레일 상단. "지금 어느 공장을 보고 있나"가 가장 중요한 맥락이다. */
.v2-factory { padding: 14px 12px; border-bottom: 1px solid var(--rail-line); }
.v2-factory-seg {
    display: flex;
    background: rgba(255,255,255,.06);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 3px;
}
.v2-factory-seg a {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--rail-text);
    text-decoration: none;
    white-space: nowrap;
    transition: background .14s, color .14s;
}
.v2-factory-seg a:hover { color: var(--rail-text-strong); background: var(--rail-hover); }
.v2-factory-seg a.active { background: var(--accent); color: #fff; }
.v2-factory-one {
    display: flex; align-items: center; gap: 7px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,.05);
    color: var(--rail-text-strong);
    font-size: 12.5px; font-weight: 600;
}

.v2-nav { padding: 12px 10px 18px; flex: 1; }
.v2-nav-group + .v2-nav-group { margin-top: 18px; }
.v2-nav-label {
    padding: 0 10px 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: rgba(236, 231, 222, .34);
}
.v2-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    border-radius: var(--radius-xs);
    color: var(--rail-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    transition: background .14s, color .14s;
}
.v2-nav a i { font-size: 15px; width: 18px; text-align: center; opacity: .72; flex-shrink: 0; }
.v2-nav a:hover { background: var(--rail-hover); color: var(--rail-text-strong); }
.v2-nav a:hover i { opacity: 1; }
.v2-nav a.active {
    background: rgba(255,255,255,.10);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 2px 0 0 var(--accent);
}
.v2-nav a.active i { opacity: 1; color: var(--accent); }

.v2-rail-foot {
    border-top: 1px solid var(--rail-line);
    padding: 12px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: var(--rail-bg);
}
.v2-user { display: flex; align-items: center; gap: 10px; }
.v2-avatar {
    width: 30px; height: 30px; flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.10);
    color: var(--rail-text-strong);
    display: grid; place-items: center;
    font-size: 12px; font-weight: 700;
}
.v2-user-meta { min-width: 0; flex: 1; }
.v2-user-name { font-size: 12.5px; font-weight: 600; color: var(--rail-text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-user-role { font-size: 10.5px; color: rgba(236,231,222,.40); font-variant-numeric: tabular-nums; }
.v2-icon-btn {
    background: none; border: none; padding: 5px;
    color: rgba(236,231,222,.45);
    border-radius: 6px; cursor: pointer; font-size: 14px;
    text-decoration: none; line-height: 1;
    transition: background .14s, color .14s;
}
.v2-icon-btn:hover { background: var(--rail-hover); color: var(--rail-text-strong); }

/* ── 본문 기둥 ── */
.v2-main { margin-left: var(--rail-w); min-width: 0; }

.v2-top {
    position: sticky; top: 0; z-index: 900;
    height: var(--nav-h);
    display: flex; align-items: center; gap: 12px;
    padding: 0 22px;
    background: rgba(250, 249, 246, .88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.v2-burger { display: none; background: none; border: none; font-size: 21px; color: var(--text-main); padding: 4px 6px; cursor: pointer; }
.v2-crumb { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; min-width: 0; }
.v2-crumb b { color: var(--text-main); font-weight: 600; }
.v2-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* 검색/이동 — Ctrl+K. 메뉴를 외우지 않아도 되게. */
.v2-search {
    display: flex; align-items: center; gap: 8px;
    height: 34px; padding: 0 11px;
    min-width: 210px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--pill);
    color: var(--text-faint);
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color .14s, color .14s;
}
.v2-search:hover { border-color: var(--border-strong); color: var(--text-muted); }
.v2-kbd {
    margin-left: auto;
    font-size: 10.5px; font-weight: 600;
    padding: 2px 6px; border-radius: 5px;
    background: var(--surface-3); color: var(--text-faint);
    font-family: var(--font-sans);
}

.v2-scrim { display: none; }

/* ══════════════════════ 페이지 머리 ══════════════════════ */
#topbar {
    top: var(--nav-h);
    background: var(--body-bg);
    border-bottom: 1px solid var(--border);
    padding: 6px 22px;
    box-shadow: none;
    gap: 10px;
}
.topbar-title { font-size: 19px; font-weight: 700; letter-spacing: -.025em; color: var(--text-main); }
.topbar-help-btn {
    border-color: var(--border);
    background: var(--card-bg);
    border-radius: var(--pill);
    font-size: 12.5px;
}
.topbar-help-btn:hover { background: var(--accent-soft); }

#content { padding: 24px 22px 56px; }

/* ══════════════════════ 컴포넌트 ══════════════════════ */

.card {
    border-color: var(--border);
    border-radius: var(--radius);
}
.card-header {
    background: transparent;
    padding: 14px 18px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--text-main);
}
.card-body { padding: 18px; }
.card-footer { background: var(--surface-2); }

.stat-card {
    padding: 18px;
    border-radius: var(--radius);
    transition: border-color .16s, background .16s;
}
.stat-card:hover { border-color: var(--border-strong); background: #fffdfa; transform: none; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; font-size: 19px; }
.stat-value { font-size: 25px; font-weight: 700; letter-spacing: -.03em; }
.stat-label { font-size: 11.5px; color: var(--text-muted); letter-spacing: .01em; }

/* 표 — 줄무늬 없이 머리글은 얇게, 행 구분은 헤어라인으로. */
.table { font-size: 13px; }
.table thead th {
    background: transparent;
    border-bottom: 1px solid var(--border-strong);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    padding: 9px 13px;
}
.table tbody td { padding: 11px 13px; border-color: var(--border); }
.table tbody tr:hover,
.table-hover > tbody > tr:hover > * { background: var(--surface-2); }

.badge-status {
    font-size: 11px; font-weight: 600;
    padding: 3px 9px;
    border-radius: 6px;
    letter-spacing: .01em;
}

.btn { border-radius: var(--radius-xs); font-weight: 600; }
.btn-primary {
    background: var(--accent); border-color: var(--accent);
    box-shadow: none;
}
.btn-primary:hover, .btn-primary:focus { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-outline-primary { color: var(--accent); border-color: var(--border-strong); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-secondary, .btn-outline-secondary {
    color: var(--text); background: var(--card-bg); border-color: var(--border-strong);
}
.btn-secondary:hover, .btn-outline-secondary:hover { background: var(--surface-2); color: var(--text-main); border-color: var(--text-faint); }

.form-control, .form-select, .filter-select {
    border-color: var(--border-strong);
    border-radius: var(--radius-xs);
    color: var(--text-main);
}
.form-control:focus, .form-select:focus, .filter-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); letter-spacing: .01em; }

.modal-content { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom-color: var(--border); }
.modal-footer { border-top-color: var(--border); background: var(--surface-2); }

.alert { border-radius: var(--radius-sm); border-width: 1px; font-size: 13px; }

/* KPI — 자금 화면. 금액은 크게, 라벨은 조용하게. */
.kpi-card { border-radius: var(--radius); border-color: var(--border); }
.kpi-value { letter-spacing: -.03em; }
.kpi-label { color: var(--text-muted); letter-spacing: .02em; }

/* ══════════════════════ 명령 팔레트 ══════════════════════ */
.v2-cmd-back {
    position: fixed; inset: 0; z-index: 2400;
    background: rgba(33, 31, 28, .34);
    backdrop-filter: blur(2px);
    display: flex; justify-content: center;
    padding: 12vh 16px 16px;
}
.v2-cmd {
    width: 100%; max-width: 520px;
    align-self: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex; flex-direction: column;
    max-height: 68vh;
}
.v2-cmd input {
    border: 0; border-bottom: 1px solid var(--border);
    padding: 15px 18px;
    font-size: 15px; font-family: var(--font-sans);
    outline: none; width: 100%;
    color: var(--text-main);
}
.v2-cmd input::placeholder { color: var(--text-faint); }
.v2-cmd-list { overflow-y: auto; padding: 6px; }
.v2-cmd-list a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-xs);
    color: var(--text); text-decoration: none; font-size: 13.5px;
}
.v2-cmd-list a i { width: 17px; text-align: center; color: var(--text-faint); }
.v2-cmd-list a.on, .v2-cmd-list a:hover { background: var(--accent-soft); color: var(--accent-active); }
.v2-cmd-list a.on i, .v2-cmd-list a:hover i { color: var(--accent); }
.v2-cmd-list a span.g { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.v2-cmd-empty { padding: 22px; text-align: center; color: var(--text-faint); font-size: 13px; }

/* ══════════════════════ 모바일 ══════════════════════ */
@media (max-width: 768px) {
    /* app.css 는 V1 의 #topnav 가 position:fixed 라 body 에 상단 여백(--nav-h)을 준다.
       V2 의 .v2-top 은 sticky 라 제 자리를 스스로 차지하므로 그 여백이 화면 맨 위에
       빈 띠로 남는다(폰에서 56px 공백). V2 에서는 걷어낸다 (2026-09-15). */
    body { padding-top: 0; }
}

@media (max-width: 991px) {
    .v2-rail {
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
    }
    body.rail-open .v2-rail { transform: none; }
    body.rail-open { overflow: hidden; }
    .v2-scrim { display: block; position: fixed; inset: 0; z-index: 1100; background: rgba(33,31,28,.42); opacity: 0; pointer-events: none; transition: opacity .22s; }
    body.rail-open .v2-scrim { opacity: 1; pointer-events: auto; }

    .v2-main { margin-left: 0; }
    .v2-burger { display: block; }
    .v2-search { min-width: 0; width: 34px; padding: 0; justify-content: center; }
    .v2-search span, .v2-kbd { display: none; }
    .v2-top { padding: 0 12px; }
    #topbar { padding: 0 14px; }
    #content { padding: 16px 14px 72px; }
    .topbar-title { font-size: 17px; }
}
@media (max-width: 400px) {
    .v2-crumb { font-size: 11.5px; }
    #content { padding: 14px 12px 72px; }
}

/* ══════════════════════ 오늘(대시보드) ══════════════════════ */

@keyframes mnBlink { 0%,100%{opacity:1;} 50%{opacity:.15;} }
.mn-blink { animation: mnBlink 1s ease-in-out infinite; }

.ds-notice-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 11px;
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--pill);
    font-size: 12.5px; font-weight: 600; color: var(--text-muted);
    cursor: pointer; white-space: nowrap;
}
.ds-notice-btn:hover { border-color: var(--border-strong); color: var(--text-main); }
.ds-notice-btn.on { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }

/* ── 요약 줄 ── */
.ds-summary {
    display: flex; flex-wrap: wrap; align-items: stretch;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.ds-sum-item {
    flex: 1 1 110px;
    min-width: 100px;
    padding: 14px 16px;
    border-right: 1px solid var(--border);
}
.ds-sum-item:last-child { border-right: 0; }
.ds-sum-item.wide { flex: 2 1 190px; }
.ds-sum-n {
    display: block;
    font-size: 24px; font-weight: 700; letter-spacing: -.035em;
    color: var(--text-main); line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.ds-sum-n em { font-style: normal; font-size: 13px; font-weight: 500; color: var(--text-faint); letter-spacing: 0; }
.ds-sum-l { display: block; margin-top: 4px; font-size: 11.5px; color: var(--text-muted); }
.ds-sum-item.warn .ds-sum-n { color: var(--amber); }
.ds-sum-item.bad .ds-sum-n { color: var(--red); }
.ds-sum-sep { display: none; }

/* ── 호출 줄 — 사람 손이 필요한 것만. 평소엔 이 줄 자체가 없다. ── */
.ds-calls {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
    margin-top: 12px; padding: 11px 14px;
    background: var(--amber-soft);
    border: 1px solid rgba(162,103,15,.24);
    border-radius: var(--radius-sm);
}
.ds-calls-label { font-size: 11.5px; font-weight: 700; color: var(--amber); white-space: nowrap; }
.ds-call {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; border-radius: var(--pill);
    background: var(--card-bg);
    border: 1px solid var(--border-strong);
    font-size: 12.5px; color: var(--text); text-decoration: none;
}
.ds-call b { font-weight: 700; color: var(--text-main); }
.ds-call.warn:hover { border-color: var(--amber); color: var(--amber); }
.ds-call.bad { border-color: rgba(176,58,46,.3); color: var(--red); }
.ds-call.bad b { color: var(--red); }
.ds-call.bad:hover { background: var(--red-soft); }

/* ── 기계 카드 ── */
.ds-machines {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(304px, 1fr));
    /* 카드 높이를 줄에서 맞춘다 — 1·2·3호기가 들쭉날쭉하면 비교가 안 된다.
       (꺼진 기계는 내용이 적어 빈 아래가 생기지만, 나란한 편이 더 읽힌다.) */
    align-items: stretch;
    gap: 12px;
    margin-top: 16px;
}
.ds-mc {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border-strong);
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column;
    min-width: 0;
}
.ds-mc.is-active { border-left-color: var(--green); }
.ds-mc.is-stopped { border-left-color: var(--amber); }
.ds-mc.is-unregistered { border-left-color: var(--red); }
.ds-mc.is-maintenance { border-left-color: #6f5f8c; }
/* 꺼져 있는 기계는 물러나 있어야 한다 — 볼 게 없다. */
.ds-mc.is-off, .ds-mc.is-idle { background: var(--surface-2); border-left-color: var(--border); }

.ds-mc-head {
    display: flex; align-items: center; gap: 6px;
    padding: 11px 13px 9px;
    border-bottom: 1px solid var(--border);
}
.ds-mc-name { font-size: 15px; font-weight: 700; letter-spacing: -.02em; color: var(--text-main); }
.ds-mc-tools { display: inline-flex; align-items: center; gap: 1px; }
.ds-tool {
    background: none; border: 0; padding: 3px 4px; line-height: 1;
    color: var(--text-faint); cursor: pointer; font-size: 14px; border-radius: 5px;
}
.ds-tool:hover { background: var(--surface-3); color: var(--text-main); }
.ds-tool.on { color: #6f5f8c; }
.ds-tool.alert { color: var(--amber); }

.ds-state {
    margin-left: auto; flex-shrink: 0;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 6px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: var(--surface-3); color: var(--text-muted);
}
.ds-state i { font-size: 8px; }
.is-active .ds-state { background: var(--green-soft); color: var(--green); }
.is-stopped .ds-state { background: var(--amber-soft); color: var(--amber); }
.is-unregistered .ds-state { background: var(--red-soft); color: var(--red); }
.is-maintenance .ds-state { background: #efecf4; color: #6f5f8c; }

.ds-mc-qty { padding: 12px 13px 2px; display: flex; align-items: baseline; gap: 4px; }
.ds-mc-qty b {
    font-size: 30px; font-weight: 700; letter-spacing: -.04em; line-height: 1;
    color: var(--text-main); font-variant-numeric: tabular-nums;
}
.ds-mc-qty span { font-size: 12px; color: var(--text-muted); }

.ds-plan {
    margin: 10px 13px 0; padding: 8px 10px;
    background: var(--amber-soft); border-radius: var(--radius-xs);
    font-size: 12.5px; color: var(--text); line-height: 1.5;
}
.ds-plan-tag {
    display: inline-block; margin-right: 6px;
    font-size: 10px; font-weight: 700; letter-spacing: .08em;
    color: var(--amber);
}
.ds-plan-memo { display: block; margin-top: 3px; font-size: 12px; color: var(--text-muted); white-space: pre-wrap; word-break: break-word; }
/* 제품명 아래에 붙을 때는 카드 본문의 여백을 따른다(바깥 여백 중복 금지). */
.ds-mc-body .ds-plan { margin: 0; }
.ds-plan-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.ds-plan-name { font-weight: 700; color: var(--text-main); }
.ds-plan-when { margin-left: auto; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
/* 계획 진행 막대 — 박스 진행과 같은 문법(숫자 왼쪽, % 오른쪽, 막대 아래). */
.ds-plan-prog { margin-top: 6px; }
.ds-plan-prog .ds-bar span { background: var(--amber); }

.ds-mc-body { padding: 10px 13px 12px; display: flex; flex-direction: column; gap: 11px; }

.ds-prod { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ds-prod-code { font-size: 19px; font-weight: 700; color: var(--text-main); letter-spacing: -.01em; }
.ds-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: var(--pill);
    background: var(--card-bg); border: 1px solid var(--border-strong);
    font-size: 11.5px; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.ds-chip:hover { border-color: var(--accent); color: var(--accent); }
.ds-chip.icon { padding: 3px 6px; }
.ds-cav { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.ds-cav b { font-size: 15px; color: var(--text-main); font-weight: 700; }

/* 박스 진행 — 현장의 시계 */
.ds-box { background: var(--surface-2); border-radius: var(--radius-xs); padding: 9px 11px; }
.ds-box-top { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-muted); }
.ds-box-left { color: var(--text); }
.ds-box-left b { font-size: 15px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ds-box-pct { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; }
.ds-bar { height: 5px; margin: 7px 0 6px; background: var(--surface-3); border-radius: var(--pill); overflow: hidden; }
.ds-bar span { display: block; height: 100%; background: var(--accent); border-radius: var(--pill); transition: width .4s ease; }
.ds-box-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-faint); }
.ds-box-foot em { font-style: normal; color: var(--amber); font-weight: 600; }

.ds-facts { display: flex; gap: 16px; margin: 0; flex-wrap: wrap; }
.ds-facts dt { font-size: 10.5px; color: var(--text-faint); font-weight: 500; }
.ds-facts dd { margin: 1px 0 0; font-size: 13px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.ds-facts dd.bad { color: var(--red); }
/* "계획" 꼬리표 — 실측 속도로 잰 예상이 아니라 계획에 적힌 종료 시각이라는 표시. */
.ds-fact-note { font-style: normal; font-size: 10.5px; font-weight: 500; color: var(--text-faint); }

.ds-mc-alarm {
    margin: 12px 13px; padding: 14px;
    background: var(--red-soft); border-radius: var(--radius-xs);
    display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
}
.ds-mc-alarm strong { font-size: 13px; color: var(--red); }
.ds-mc-alarm span { font-size: 11.5px; color: var(--text-muted); }
.ds-mc-alarm .btn { margin-top: 6px; }

/* ── 인천: 기계 카드 + 작업 목록 ──
   카드는 기계 수만큼(2대)뿐이라 오른쪽이 비었다. 그 자리를 "아직 안 끝난 작업" 목록으로
   채우고, 목록을 누르면 그 기계 카드가 고른 계획으로 바뀐다(카드는 계속 기계 한 장). */
.ds-mc > .ds-pane { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ds-ic-grid .ds-worklist { grid-column: 3 / -1; }
/* 평택도 같은 목록을 쓴다(읽기 전용). 기계가 3대라 자리는 4번째 칸 — 칸이 그만큼
   안 나오는 화면에서는 억지로 옆에 붙이지 않고 카드 아래 한 줄로 내려 앉힌다. */
.ds-worklist.ds-wl-side { grid-column: 1 / -1; }
@media (min-width: 1560px) { .ds-worklist.ds-wl-side { grid-column: var(--wl-col) / -1; } }
.ds-wl { list-style: none; margin: 0; padding: 6px; overflow-y: auto; max-height: 320px; }
.ds-wl-row {
    width: 100%; display: flex; align-items: center; gap: 8px;
    padding: 8px 9px; border: 1px solid transparent; border-radius: var(--radius-xs);
    background: none; text-align: left; cursor: pointer; font-size: 12.5px; color: var(--text);
}
.ds-wl-row { text-decoration: none; }
.ds-wl-row:hover { background: var(--surface-2); }
.ds-wl-row.on { background: var(--surface-2); border-color: var(--accent); }
.ds-wl-mc { flex-shrink: 0; font-weight: 700; font-size: 11.5px; color: var(--text-muted); }
.ds-wl-name { font-weight: 600; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-wl-when { margin-left: auto; flex-shrink: 0; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ds-wl-when.bad { color: var(--red); }
.ds-wl-tag {
    flex-shrink: 0; padding: 2px 7px; border-radius: var(--pill);
    font-size: 10.5px; font-weight: 700;
    background: var(--green-soft); color: var(--green);
}
.ds-wl-tag.plan { background: var(--amber-soft); color: var(--amber); }
.ds-wl-tag.late { background: var(--red-soft); color: var(--red); }
.ds-wl-tag.done { background: var(--surface-3); color: var(--text-faint); }
/* 오늘 끝낸 줄 — 지우지 않고 그어서 남긴다. 누른 게 먹혔다는 확인이다. */
.ds-wl-row.done { cursor: default; color: var(--text-faint); }
.ds-wl-row.done .ds-wl-mc,
.ds-wl-row.done .ds-wl-name { color: var(--text-faint); text-decoration: line-through; }
.ds-wl-row.done:hover { background: none; }
@media (max-width: 960px) {
    .ds-worklist { grid-column: 1 / -1; }
}

.ds-mc-empty { padding: 26px 13px; text-align: center; font-size: 12.5px; color: var(--text-faint); }

.ds-mc-foot {
    margin-top: auto;
    padding: 9px 11px;
    border-top: 1px solid var(--border);
    /* 6칸 격자 — 윗줄 3개(2칸씩) · 아랫줄 2개(3칸씩)로 두 줄 폭이 정확히 맞는다. */
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
}
.ds-mc-foot > * { grid-column: span 2; }
.ds-mc-foot > .ds-act-wide { grid-column: span 3; }
.ds-mc-foot .btn { display: flex; align-items: center; justify-content: center; width: 100%; white-space: nowrap; }
.ds-btn-defect { border-color: var(--red, #d64545); color: var(--red, #d64545); }
.ds-btn-defect:hover { background: var(--red-soft, #fdecec); border-color: var(--red, #d64545); color: var(--red, #d64545); }
.ds-btn-end { background: var(--card-bg); border: 1px solid var(--border-strong); color: var(--text-muted); }
.ds-btn-end:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }

.ds-mc-none { grid-column: 1/-1; padding: 30px; text-align: center; color: var(--text-faint); }

/* ── 출고 ── */
.ds-ship { margin-top: 28px; }
.ds-ship-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--border-strong); }
.ds-ship-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.02em; color: var(--text-main); }
.ds-ship-sum { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ds-ship-more { font-size: 12.5px; color: var(--text-muted); text-decoration: none; white-space: nowrap; }
.ds-ship-more:hover { color: var(--accent); }

.ds-ship-list { list-style: none; margin: 0; padding: 0; }
.ds-ship-list a {
    display: flex; align-items: baseline; gap: 12px;
    padding: 11px 4px;
    border-bottom: 1px solid var(--border);
    text-decoration: none; color: var(--text);
}
.ds-ship-list a:hover { background: var(--surface-2); }
.ds-ship-cust { font-weight: 600; color: var(--text-main); font-size: 13.5px; }
.ds-ship-meta { font-size: 12px; color: var(--text-faint); }
.ds-ship-amt { margin-left: auto; font-size: 14px; font-weight: 700; color: var(--text-main); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ds-ship-amt em { font-style: normal; font-size: 11px; font-weight: 500; color: var(--text-faint); margin-left: 2px; }
.ds-ship-empty { padding: 26px; text-align: center; color: var(--text-faint); font-size: 13px; }

@media (max-width: 991px) {
    .ds-machines { grid-template-columns: 1fr; }
    /* 한 칸짜리 그리드에서 `grid-column: 3 / -1` 은 없는 칸을 가리켜 **암시적 칸을 만든다**.
       그러면 기계 카드가 옆으로 눌려 폰에서 글자가 한 자씩 세로로 쪼개진다(인천, 2026-09-19).
       가로 스크롤은 안 생겨서 넘침 검사로는 안 잡힌다. */
    .ds-ic-grid .ds-worklist { grid-column: 1 / -1; }
    .ds-sum-item { flex: 1 1 33%; min-width: 0; border-bottom: 1px solid var(--border); }
    .ds-sum-item.wide { flex: 1 1 100%; border-right: 0; }
    .ds-sum-n { font-size: 21px; }
}
