:root {
  --bg: #14171c; --panel: #1c2027; --panel2: #232831; --line: #2e343f;
  --text: #e4e7ec; --muted: #8b93a1; --accent: #6ea8fe;
  --red: #ff6b6b; --amber: #f0b354; --green: #5fcf8a; --blue: #6ea8fe;
}
* { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text); display: flex;
  font: 14px/1.55 "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 14px; margin: 0 0 10px; font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
h2 .more { margin-left: auto; font-weight: 400; font-size: 12px; }
h2.mt { margin-top: 18px; }
.muted { color: var(--muted); font-weight: 400; }
.red { color: var(--red); } .amber { color: var(--amber); }
.sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.sub.red { color: var(--red); } .sub.amber { color: var(--amber); }
.nowrap { white-space: nowrap; } .hide { display: none; }
.m-only { display: none; }

.side { width: 190px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 0; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 16px; font-weight: 800; padding: 0 18px 16px; letter-spacing: .2px; }
.side nav { display: flex; flex-direction: column; }
.side nav a { color: var(--text); padding: 9px 18px; border-left: 3px solid transparent; }
.side nav a:hover { background: var(--panel2); text-decoration: none; }
.side nav a.on { border-left-color: var(--accent); background: var(--panel2); color: var(--accent); font-weight: 700; }
.nav-sep { color: var(--muted); font-size: 11px; padding: 16px 18px 4px; }
.logout { margin-top: auto; padding: 0 18px; }
.logout button { width: 100%; }

main { flex: 1; min-width: 0; padding: 20px 24px 40px; }
.top { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }

.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.kpi .k { color: var(--muted); font-size: 12px; }
.kpi .v { font-size: 30px; font-weight: 800; line-height: 1.25; }
.kpi .s { color: var(--muted); font-size: 12px; }
.kpi-red { border-color: var(--red); } .kpi-red .v { color: var(--red); }
.kpi-amber { border-color: var(--amber); } .kpi-amber .v { color: var(--amber); }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 400; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.c-num { text-align: right; white-space: nowrap; } .c-lv { width: 62px; }
.c-title a { color: var(--text); font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 18px 0; }
.row-urgent td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.row-closed { opacity: .55; }
.row-done td { color: var(--muted); } .row-over td:first-child { color: var(--red); }

.lv { display: inline-block; min-width: 40px; text-align: center; border-radius: 4px; padding: 1px 6px; font-size: 12px; font-weight: 700; }
.lv-urgent { background: var(--red); color: #1a0d0d; }
.lv-normal { background: #3b4658; color: var(--text); }
.lv-low { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.tag-red { border-color: var(--red); color: var(--red); }
.tag-amber { border-color: var(--amber); color: var(--amber); }
.tag-blue { border-color: var(--blue); color: var(--blue); }
.tag-green { border-color: var(--green); color: var(--green); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.ball { font-weight: 700; } .ball-us { color: var(--amber); } .ball-customer, .ball-vendor, .ball-mdr { color: var(--muted); }

.strip { display: flex; gap: 2px; margin: 3px 0 6px; }
.st { flex: 1; text-align: center; font-size: 11px; padding: 2px 4px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.st:first-child { border-radius: 4px 0 0 4px; } .st:last-child { border-radius: 0 4px 4px 0; }
.st-done { background: #2c4a3a; color: #a9e4c1; }
.st-current { background: var(--accent); color: #0d1b30; font-weight: 700; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li.empty { border: 0; }
.news .src { font-size: 11px; color: var(--muted); display: block; }
.status .led { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--muted); }
.led.ok { background: var(--green); } .led.bad { background: var(--red); } .led.off { background: var(--muted); }
.status li.plain { color: var(--muted); font-size: 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 6px; }
.tabs button, .tabs a, .pill { background: transparent; color: var(--muted); border: 1px solid var(--line); border-radius: 14px; padding: 2px 12px; font: inherit; font-size: 12px; cursor: pointer; }
.tabs .on, .pill.on { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }

button, select, input, textarea { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; }
button { cursor: pointer; } button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0d1b30; font-weight: 700; }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; }
input[type=date] { color-scheme: dark; }
.stack { display: flex; flex-direction: column; gap: 9px; }
.stack label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.inline-form { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.inline-form input[type=text] { flex: 1; min-width: 160px; }
.deadlines input[type=text] { width: 100%; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; margin: 0; }
.kv.narrow { grid-template-columns: 84px 1fr; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.notice { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; margin: 0 0 10px; }
.notice.amber { border-color: var(--amber); color: var(--amber); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair > div:only-child { grid-column: 1 / -1; }
.label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.6; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 5px 0 5px 12px; border-left: 2px solid var(--line); }
.timeline .at { color: var(--muted); font-size: 12px; margin-right: 6px; }
.timeline .ev-correct, .timeline .ev-guard { border-left-color: var(--amber); }
.timeline .ev-ack { border-left-color: var(--green); }
details summary { cursor: pointer; } details pre { margin-top: 6px; }
.terms span { display: inline-block; margin: 0 10px 4px 0; font-size: 12px; color: var(--muted); }

.monthnav { display: flex; gap: 14px; align-items: baseline; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { color: var(--muted); font-size: 12px; font-weight: 400; padding: 4px; }
.cal td { border: 1px solid var(--line); height: 96px; vertical-align: top; padding: 4px; }
.cal .out { background: #171a1f; } .cal .out .daynum { opacity: .35; }
.cal .today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .we .daynum, .cal th.we { color: #c98f8f; }
.daynum { font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.hol { font-size: 10px; color: var(--amber); }
.chip { display: block; font-size: 11px; color: var(--text); background: var(--panel2); border-left: 3px solid var(--c, var(--muted)); border-radius: 3px; padding: 1px 5px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-done { opacity: .45; } .chip-over { color: var(--red); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; }
.cal .hday .daynum { color: var(--amber); }
.agenda li.done { opacity: .5; }
.agenda a { color: inherit; }
details.fold > summary { color: var(--muted); font-size: 12px; padding: 4px 0; }

.login-body { align-items: center; justify-content: center; }
.login-body { min-height: 100vh; }
.login-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: 320px; max-width: calc(100% - 32px); display: flex; flex-direction: column; gap: 10px; }
.login-box h1 { margin-bottom: 8px; }
.warn { color: var(--amber); margin: 0; }

@media (max-width: 1180px) {
  .cols, .two, .pair { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
/* 휴대폰: 위쪽 메뉴 띠, 표는 항목별 카드로 */
@media (max-width: 760px) {
  body { flex-direction: column; font-size: 15px; }
  .m-only { display: block; }

  .side { width: 100%; height: auto; position: sticky; top: 0; z-index: 20; display: grid;
    grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 0;
    border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 9px 14px 2px; font-size: 15px; }
  .logout { margin: 0; padding: 6px 12px 0; }
  .logout button { width: auto; padding: 2px 10px; font-size: 12px; }
  .side nav { grid-column: 1 / -1; flex-direction: row; overflow-x: auto; padding: 0 6px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .side nav::-webkit-scrollbar { display: none; }
  .side nav a { flex: none; white-space: nowrap; padding: 8px 10px 7px; border-left: 0; border-bottom: 3px solid transparent; }
  .side nav a.on { border-bottom-color: var(--accent); background: transparent; }
  .nav-sep { display: none; }

  main { width: 100%; padding: 12px 12px 32px; }
  h1 { font-size: 18px; overflow-wrap: anywhere; }
  h2 { flex-wrap: wrap; }
  .top { gap: 6px 12px; margin-bottom: 12px; }
  .card { padding: 12px; margin-bottom: 10px; }
  .cols, .two { gap: 10px; }

  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
  .kpi { padding: 10px 12px; }
  .kpi .v { font-size: 24px; }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; }
  .kpi:last-child:nth-child(odd) .s { margin-left: auto; }

  .tbl, .tbl tbody { display: block; }
  .tbl thead { display: none; }
  .tbl tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .tbl td:empty { display: none; }
  .tbl td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--muted); }
  .tbl td.wide, .tbl td.c-title, .tbl td.empty { grid-column: 1 / -1; }
  .tbl .c-num { text-align: left; }
  .tbl .c-lv { width: auto; }
  .tbl.c3 tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tbl.c4 tr { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .row-urgent td:first-child { box-shadow: none; }
  .tbl tr.row-urgent { box-shadow: inset 3px 0 0 var(--red); padding-left: 10px; }

  .tbl.queue tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .tbl.queue td { order: 5; }
  .tbl.queue td.c-lv { order: 1; flex: none; }
  .tbl.queue td.q-cust { order: 2; flex: 1; }
  .tbl.queue td.q-age { order: 3; flex: none; color: var(--muted); font-size: 12px; }
  .tbl.queue td.c-title { order: 4; flex: 0 0 100%; }
  .tbl.queue td.empty { flex: 0 0 100%; }
  .tbl.queue td[data-label] { font-size: 12px; }
  .tbl.queue td[data-label]::before { display: inline; margin-right: 5px; }

  .tbl.deadlines tr { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto; align-items: end; }
  .tbl.deadlines td.d-title { font-weight: 700; }
  .tbl.deadlines td.d-date { grid-column: 1; }
  .tbl.deadlines td.d-dday { grid-column: 2; }
  .tbl.deadlines td.d-done { grid-column: 3; }
  .tbl.deadlines td.d-memo { grid-column: 1 / 3; }
  .tbl.deadlines td.d-save { grid-column: 3; }
  .tbl.deadlines input[type=date] { width: 100%; }

  .strip .st { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 10px; padding: 2px 1px; }

  .monthnav { flex-wrap: wrap; gap: 4px 14px; }
  .cal td { height: 50px; padding: 2px; }
  .cal th { padding: 2px; }
  .cal .hol { display: none; }
  .cal .chip { height: 5px; padding: 0; margin: 2px 1px 0; border: 0; border-radius: 2px; font-size: 0; background: var(--c, var(--muted)); }
  .cal .chip-over { outline: 1px solid var(--red); }

  input, select, textarea { font-size: 16px; }
  button { min-height: 34px; }
  .tabs button, .tabs a, .pill { padding: 5px 12px; min-height: 0; }
  .kv, .kv.narrow { grid-template-columns: 78px minmax(0, 1fr); }
  .inline-form input[type=text] { min-width: 0; flex: 1 1 100%; }
}
