/* 새 관리 화면 4종(재생목록·프로그램·스케줄·그룹·기기) 공용 스타일.
   색 변수·다크모드·버튼 모양은 index.html·device.html 과 같은 값을 씀 — 화면을 옮겨 다녀도 같은 도구로 보이게 함.
   톤(2026-10-11, "모던 미니멀" 방향 — Linear·Vercel류): 중립 그레이 바탕 + 보라·인디고 계열 강조색 1개만,
   테두리는 거의 안 보일 만큼 옅게 하고 대신 그림자로 카드 높낮이를 줌. 선택자 이름은 전부 그대로 두고
   값만 바꿈(JS 쪽 class 참조를 건드리지 않음). */
:root {
  --bg: #f6f6f8; --card: #fff; --sunk: #fafafb;
  --ink: #1a1b1f; --dim: #71717a; --edge: #e8e8ec;
  --accent: #5a5fe8; --accent-soft: rgba(90, 95, 232, .1); --accent-ink: #4345c4;
  --danger: #d6373f; --warn: #b4620a; --ok: #1a8f52;
  --shadow-sm: 0 1px 2px rgba(20, 20, 30, .04), 0 1px 1px rgba(20, 20, 30, .03);
  --shadow-md: 0 8px 24px rgba(20, 20, 30, .08), 0 2px 6px rgba(20, 20, 30, .04);
  --font: "Pretendard Variable", "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0c; --card: #18191c; --sunk: #141417;
    --ink: #ededf0; --dim: #8e8e96; --edge: #232328;
    --accent: #8386f0; --accent-soft: rgba(131, 134, 240, .16); --accent-ink: #b1b3f7;
    --danger: #ff7a7f; --warn: #e3a238; --ok: #4fcf87;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 1px rgba(0, 0, 0, .3);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.6;
  -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 32px 24px 80px; }
h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
/* text-transform:uppercase 를 안 씀 — h2 안에 "s-default" 같은 실제 id 문자열이 그대로 들어가는
   화면이 있어, 전부 대문자로 바꾸면 보이는 글자가 실제 값과 달라짐(복붙 혼동) */
h2 { font-size: 13px; margin: 0 0 10px; color: var(--dim); font-weight: 600; letter-spacing: .02em; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }
.sub { color: var(--dim); font-size: 13px; margin: 4px 0 20px; }
a { color: var(--accent); }
.mono { font-family: var(--mono); }
::selection { background: var(--accent); color: #fff; }
/* 키보드 포커스만 강조 링을 줌(마우스 클릭은 안 보여도 되는 포인트 — 전보다 또렷한 상태 구분) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 4px; }

/* 왼쪽 목록 + 오른쪽 편집 — 목록이 길어도 편집 영역이 밀려나지 않게 두 칸으로 나눔 */
.split { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--edge); border-radius: 12px; padding: 18px;
  min-width: 0; margin-bottom: 16px; box-shadow: var(--shadow-sm); }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.list li {
  background: transparent; border: 1px solid transparent; border-radius: 9px; padding: 9px 11px;
  cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: background-color .12s ease;
}
.list li:hover { background: var(--sunk); }
.list li.on { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.list .nm { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .meta { font-size: 11.5px; color: var(--dim); font-family: var(--mono); }

.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.row:last-child { margin-bottom: 0; }
button, input, select, textarea {
  font: inherit; font-size: 13px; color: var(--ink);
  background: var(--card); border: 1px solid var(--edge); border-radius: 7px; padding: 6px 11px;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
button { cursor: pointer; }
button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--edge) 40%, var(--ink)); }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; box-shadow: var(--shadow-sm); }
button.primary:hover:not(:disabled) { background: var(--accent-ink); border-color: transparent; }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.mini { padding: 3px 8px; font-size: 12px; line-height: 1.3; color: var(--dim); border-color: transparent; background: transparent; }
.mini:hover:not(:disabled) { color: var(--ink); background: var(--sunk); border-color: transparent; }
input.grow { flex: 1; min-width: 120px; }
input.num { width: 72px; font-family: var(--mono); text-align: right; }
input.time { width: 96px; font-family: var(--mono); }
textarea { width: 100%; min-height: 40px; resize: vertical; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.badge {
  display: inline-block; font-size: 10.5px; padding: 1px 9px; border-radius: 999px; margin-left: 6px;
  border: 1px solid var(--edge); color: var(--dim); font-weight: 500; vertical-align: 1px;
}
.badge.shared { border-color: transparent; background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.def { border-color: transparent; background: var(--accent-soft); color: var(--accent-ink); }

.hint { color: var(--dim); font-size: 12px; }
.note { font-size: 12.5px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--edge); background: var(--sunk); margin: 0 0 10px; }
.note.warn { border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.note.err { border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.warns { margin: 0 0 10px; padding-left: 18px; font-size: 12.5px; color: var(--warn); }
.warns li { margin: 2px 0; }
/* 묶음 경고 [자세히] 원문 목록(FIX-10) — 500대면 2,000줄이라 펼쳐도 화면을 덮지 않게 높이를 제한함 */
.warns-more { margin: 4px 0 0; padding-left: 18px; max-height: 320px; overflow: auto; overflow-wrap: anywhere; }

.msg { min-height: 22px; font-size: 13px; color: var(--accent); margin: 8px 0; }
.msg.err, #msg.err { color: var(--danger); }
#msg { min-height: 22px; font-size: 13px; color: var(--accent); margin: 0 0 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 열이 13개인 기기 표는 왼쪽 메뉴(184px)만큼 좁아진 본문을 넘을 수 있음 — 페이지 대신 표만 가로로 밀리게 함 */
.scroll-x { overflow-x: auto; }
th { text-align: left; font-size: 11px; color: var(--dim); font-weight: 600; letter-spacing: .02em;
  padding: 9px 8px; border-bottom: 1px solid var(--edge); }
td { padding: 10px 8px; border-bottom: 1px solid var(--edge); vertical-align: middle; }
td.dim { color: var(--dim); font-size: 12px; }
tbody tr { transition: background-color .1s ease; }
tbody tr:hover { background: var(--sunk); }

/* 레이아웃 축소도 — 실제 좌표를 비율로 그림 (layout.html 미리보기와 같은 방식) */
.preview { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #101114; border: 1px solid var(--edge); border-radius: 10px; overflow: hidden; }
.pz { position: absolute; color: #e6ebf1; font-size: 11px; padding: 4px 6px; overflow: hidden; display: flex; flex-direction: column; gap: 1px; }
.pz b { font-size: 12px; }
.pz span { font-family: var(--mono); font-size: 10px; opacity: .85; }
.pz.empty { border-style: dashed !important; }

/* 재생목록 항목 — index.html 구역 카드의 항목 줄과 같은 모양 */
.items { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--sunk); border: 1px solid var(--edge); border-radius: 9px; padding: 9px 11px; }
.idx { flex: none; width: 18px; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.thumb { flex: none; width: 46px; height: 30px; border-radius: 3px; object-fit: cover; background: #0b0e12; display: flex; align-items: center; justify-content: center; font-size: 9px; color: #fff; font-family: var(--mono); }
.it-main { flex: 1 1 160px; min-width: 0; }
.it-name { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it-sub { display: block; font-size: 11px; color: var(--dim); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it-ops { margin-left: auto; display: flex; gap: 3px; align-items: center; }
.dur { width: 56px; font-family: var(--mono); font-size: 12px; padding: 3px 5px; text-align: right; }
.empty { color: var(--dim); font-size: 12.5px; padding: 18px; text-align: center; }

/* 기기·그룹 일정 미리보기(schedule-view.js, 2026-09-26). 칸 색은 --c 로 받음(프로그램마다 다름) */
.sc-card .sc-seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; }
.sc-seg button { border: 0; border-radius: 0; padding: 5px 14px; }
.sc-seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.sc-range { font-size: 13.5px; margin-left: 4px; }
.sc-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 5px; vertical-align: -1px; flex: none; }
.sc-bar { position: relative; height: 46px; background: var(--sunk); border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; }
.sc-bar.mini { height: 8px; border-radius: 3px; margin: 3px 0 4px; }
.sc-blk { position: absolute; top: 0; bottom: 0; background: var(--c); border-right: 1px solid var(--card); overflow: hidden; }
.sc-blk span { display: block; padding: 4px 6px; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.sc-blk.fb, .sc-vblk.fb { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.35) 0 6px, transparent 6px 12px); opacity: .75; }
.sc-now, .sc-hnow { position: absolute; background: var(--danger); z-index: 2; pointer-events: none; }
.sc-now { top: 0; bottom: 0; width: 2px; }
.sc-hnow { left: 0; right: 0; height: 2px; }
.sc-daywrap { margin: 8px 0 22px; }
.sc-ticks { position: relative; height: 14px; }
.sc-ticks span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--dim); top: 2px; white-space: nowrap; }
.sc-ticks span:last-child { transform: translateX(-100%); }
.sc-cell.past, .sc-daycol.past, .past .sc-bar { opacity: .5; }
.sc-table { margin-top: 6px; }
.sc-table td { font-size: 12.5px; vertical-align: top; }
.sc-week { display: grid; grid-template-columns: 44px repeat(7, minmax(92px, 1fr)); gap: 4px; min-width: 720px; margin-top: 8px; }
.sc-gcol { display: flex; flex-direction: column; }
.sc-gutter { position: relative; height: 528px; }
.sc-gutter span { position: absolute; right: 4px; transform: translateY(-50%); font-size: 11px; color: var(--dim); }
.sc-daycol { display: flex; flex-direction: column; min-width: 0; }
.sc-dhead { height: 30px; margin-bottom: 4px; font-size: 12.5px; padding: 2px 4px; }
.sc-dhead.sp { visibility: hidden; }
.sc-dhead.today, .sc-cell.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.sc-col { position: relative; height: 528px; background: var(--sunk); border: 1px solid var(--edge); border-radius: 8px; overflow: hidden;
  background-image: repeating-linear-gradient(to bottom, transparent 0 65px, var(--edge) 65px 66px); }
.sc-vblk { position: absolute; left: 2px; right: 2px; background: var(--c); border-radius: 6px; border-bottom: 1px solid var(--card); overflow: hidden; color: #fff; font-size: 11.5px; line-height: 1.3; padding: 2px 5px; box-sizing: border-box; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.sc-vblk b { display: block; font-weight: 600; font-size: 11px; }
.sc-vblk span { display: block; overflow: hidden; text-overflow: ellipsis; }
.sc-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.sc-month.head { margin-top: 8px; margin-bottom: 4px; }
.sc-mh { font-size: 12px; color: var(--dim); text-align: center; }
.sc-cell { text-align: left; min-height: 92px; display: flex; flex-direction: column; align-items: stretch; padding: 5px 6px; background: var(--card); border-radius: 8px; overflow: hidden; }
.sc-cell.out { opacity: .45; }
.sc-dnum { font-size: 12.5px; font-weight: 600; }
.sc-line { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; }
.sc-line.fb { color: var(--dim); }
.sc-more { font-size: 11px; color: var(--dim); }
.sc-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; align-items: center; }
tr.picked td { background: var(--sunk); }
@media (max-width: 760px) { .sc-cell { min-height: 64px; } .sc-line { display: none; } }

/* 모달·도움말·작업 버튼(admin-ui.js, 관리화면 재구성 F2).
   모달 층은 body 바로 아래 — 왼쪽 메뉴(z 50)보다 위. 760px 이하는 전체 화면(제안 3.2 "모바일"). */
html.modal-open { overflow: hidden; }
.modal-layer { position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 20, .45);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto; }
.modal { background: var(--card); color: var(--ink); border: 1px solid var(--edge); border-radius: 14px;
  width: 100%; max-width: 560px; padding: 16px 18px 18px; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: 8px; }
.modal-head { display: flex; align-items: center; gap: 8px; }
.modal-head h3 { flex: 1; min-width: 0; }
.modal-x { font-size: 14px; }
.modal-body { min-width: 0; }
.modal-body label { display: block; font-size: 12px; color: var(--dim); margin: 8px 0 3px; }
.modal-body input:not([type=checkbox]):not([type=radio]), .modal-body select, .modal-body textarea { width: 100%; }
.modal-warns:empty, .modal-force:empty, .modal-msg:empty { display: none; }
.modal-msg { margin: 0; font-size: 12.5px; color: var(--accent); }
.modal-msg.warn { color: var(--warn); }
.modal-msg.err { color: var(--danger); }
.modal-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.modal-actions:empty { display: none; }
.help-p { font-size: 13px; margin: 0 0 8px; }
@media (max-width: 760px) {
  .modal-layer { padding: 0; align-items: stretch; }
  .modal { max-width: none; min-height: 100%; border-radius: 0; border: 0; }
}
.help-btn { width: 22px; height: 22px; padding: 0; border-radius: 50%; font-weight: 700; line-height: 1; }
button.armed { border-color: var(--warn); color: var(--warn); font-weight: 600; }
.conflict-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
button.primary.armed { color: #fff; background: var(--warn); }

/* 보기 상태 필드 목록(관리화면 재구성 — 보기·수정 분리). 편집 컨트롤 없이 값만 보임 */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--dim); font-size: 12.5px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head h2 { margin: 0; flex: 1; }
.page-head { display: flex; align-items: center; gap: 8px; }
.page-head h1 { margin: 0; }
.modal-body .check { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; color: var(--ink); margin-top: 10px; }
.modal-body .check input { width: auto; margin-top: 4px; }

/* 레이아웃 편집기(layout-editor.js, 관리화면 재구성 P12) — layouts.html?id=…&edit=1 */
.lay-msg { min-height: 22px; font-size: 13px; color: var(--accent); margin: 0 0 8px; }
.lay-msg.err { color: var(--danger); }
.lay-warn:empty, .lay-conflict:empty { display: none; }
.lay-bar { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; font-size: 12px; color: var(--dim); }
.lay-bar b { color: var(--ink); }
.lay-preview { max-width: 760px; }
.lay-preview .pz { border-width: 1px; }
.lay-table { min-width: 760px; }
.lay-table th { white-space: nowrap; }
.lay-table input, .lay-table select { width: 100%; min-width: 0; }
.lay-table input[type=number] { font-family: var(--mono); }
.lay-table input.lay-color { padding: 2px; height: 30px; }
.lay-table .used { color: var(--warn); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.lay-actions { margin-top: 4px; }
.edit-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.edit-bar .dirty { flex: 1; min-width: 160px; font-size: 12.5px; color: var(--dim); }
.edit-bar .dirty.on { color: var(--warn); font-weight: 600; }
.orphans { margin: 0 0 12px; padding: 14px; border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); border-radius: 12px; background: var(--card); box-shadow: var(--shadow-sm); }
.orphans .orph-msg { font-size: 13px; margin-bottom: 8px; }
.orphans .orph-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.orphans .orph-hint { font-size: 12px; color: var(--dim); }
.orphans select { width: auto; min-width: 160px; }
/* 미디어 종류 칸(kindCell) — 전체 미디어·재생목록 항목 줄 공용. 아이콘 글자 + 글 */
.kind { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.kind-ico { flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 6px;
  font-size: 11px; font-weight: 700; color: #fff; line-height: 1; }
.kind-image .kind-ico { background: #2f7d4f; }
.kind-video .kind-ico { background: #b4412f; }
.kind-text .kind-ico { background: #4a5a6a; }
.kind-web .kind-ico { background: #3a2f8f; }
