/* 2026-12 개편 2단계: 기기 상세 = 왼쪽 메뉴 옆의 전체 화면 + 탭. 시안 D02·D05·D06·D19. */
#detail-modal { left: 232px; padding: 0; background: var(--bg); align-items: flex-start; justify-content: flex-start; animation: none; }
#detail-modal > .modal {
  max-width: 1500px; width: 100%; background: transparent; border-radius: 0; box-shadow: none; padding: 0 28px; animation: none;
  min-height: 100%; display: flex; flex-direction: column;
}

.dt-head { padding-top: 18px; margin-bottom: 14px; }
.dt-back { background: none; border: 0; padding: 0; margin: 0 0 6px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; }
.dt-back:hover { color: var(--accent); }
.dt-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dt-name { min-width: 0; }
.dt-title-row { display: flex; align-items: center; gap: 10px; }
#detail-modal .dt-title-row h2 { margin: 0; font-size: 22px; font-weight: 800; display: block; overflow-wrap: anywhere; }
.dt-badge { flex: none; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 20px; background: #eceef1; color: var(--text-dim); }
.dt-badge.on { background: #e3f6ea; color: #137a3e; }
.dt-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 3px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.dt-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dt-tabs { display: flex; gap: 22px; margin-top: 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.dt-tabs::-webkit-scrollbar { display: none; }
.dt-tabs button {
  flex: none; background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0; margin: 0; padding: 9px 0 8px;
  font-size: 14px; font-weight: 500; color: var(--text-dim); cursor: pointer; white-space: nowrap;
}
.dt-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 800; }

#detail-panels { flex: 1; display: flex; flex-direction: column; }
.dt-panel { display: none; padding-bottom: 28px; }
.dt-panel.active { display: block; }
.dt-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
.dt-card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 800; }
.dt-card p { margin: 0; font-size: 12.5px; color: var(--text-dim); line-height: 1.55; }
.dt-card p b { color: var(--text); font-size: 13px; }

/* 콘텐츠 */
.dt-panel[data-dpanel="content"].active { flex: 1; display: flex; flex-direction: column; padding-bottom: 0; }
.dt-cols { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; }
.dt-areas { align-self: start; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 12px; margin: 0; }
.dt-areas h3 { margin: 0; font-size: 13px; }
.dt-areas #split-diagram-wrap { margin: 0; width: 100%; }
.dt-areas .cell-tabs { flex-wrap: wrap; margin: 0; }
.dt-main { min-width: 0; display: flex; flex-direction: column; }
.dt-sendbar {
  position: sticky; bottom: 0; z-index: 3; margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: 12px 12px 0 0; background: #1b1e26; color: #c9ccd4;
}
.dt-sendnote { font-size: 12px; }
.dt-sendbtns { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

/* 기기 정보 · 원격 제어 */
.dt-panel[data-dpanel="info"], .dt-panel[data-dpanel="remote"] { max-width: 860px; }
#dt-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin: 0; }
#dt-fields > div { flex: 1; min-width: 150px; }
#detail-readonly { margin: 0; }
.dt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.dt-row > div:first-child, .dt-row > p { flex: 1; min-width: 200px; }
.dt-row > div:first-child h3 { margin-bottom: 4px; }
.dt-card > .dt-row { padding: 10px 0; border-top: 1px solid var(--border); }
.dt-card > .dt-row:last-child { padding-bottom: 0; }
.dt-row .cmd-buttons { margin: 0; }
.dt-danger { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-color: #f1c4c9; }
.dt-danger h3 { margin-bottom: 4px; }

/* 탭 안으로 들어온 예전 창들. z-index 는 상세(10)와 같게 두어 ESC 가 안쪽 것부터 닫게 한다 */
#detail-panels .modal-backdrop { position: relative; inset: auto; z-index: 10; padding: 0; background: none; overflow: visible; justify-content: flex-start; animation: none; }
#detail-panels .modal-backdrop > .modal { width: 100%; box-shadow: none; border: 1px solid var(--border); border-radius: 12px; animation: none; }
#detail-panels .hero-banner { display: none; }

/* 예약. 시안 D05·M21: 영역 → 예약 칸 4개 | 고른 칸 편집(발동 시각 · 콘텐츠 탭과 같은 올리기·목록 · 취소/확정) */
.dt-panel[data-dpanel="reserve"].active { flex: 1; display: flex; flex-direction: column; padding-bottom: 0; }
#detail-panels #reserve-modal { flex: 1; align-items: stretch; }
#detail-panels #reserve-modal > .modal { max-width: none; max-height: none; overflow: visible; padding: 0; background: none; border: 0; border-radius: 0; display: flex; flex-direction: column; }
#reserve-cell-tabs { margin-bottom: 12px; }
.rs-cols { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; }
.rs-slots { align-self: start; position: sticky; top: 12px; }
#reserve-slot-picker { display: flex; flex-direction: column; gap: 8px; }
.rs-slot { border: 1px solid var(--border); border-radius: 10px; background: var(--panel-alt); padding: 10px 12px; min-width: 0; }
.rs-slot.active { border-color: var(--accent); background: var(--accent-dim); }
.rs-pick { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; width: 100%; margin: 0; padding: 0; background: none; border: 0; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.rs-pick b { font-size: 13.5px; }
.rs-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; background: #eceef1; color: var(--text-dim); white-space: nowrap; }
.rs-slot.taken .rs-badge { background: #e3f6ea; color: #137a3e; }
.rs-when { flex: 0 0 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rs-sub { flex: 0 0 100%; font-size: 11.5px; color: var(--text-dim); }
.rs-slot > button.danger { margin-top: 8px; font-size: 12px; padding: 5px 12px; }
.rs-edit { display: flex; flex-direction: column; min-width: 0; }
.rs-time { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.rs-time label { margin: 0; color: var(--text); font-weight: 700; }
#reserve-time-input { flex: 0 1 260px; min-width: 0; padding: 8px 10px; font: inherit; font-size: 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); }
.dt-card p.rs-note { margin-bottom: 10px; }
.rs-foot {
  position: sticky; bottom: 0; z-index: 3; margin: auto -18px -16px; display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; background: var(--panel); border-top: 1px solid var(--border); border-radius: 0 0 12px 12px;
}
#detail-panels #log-modal > .modal { max-width: 960px !important; padding: 18px 20px; }
#detail-panels #log-modal h2 { display: none; }
#detail-panels #screen-settings-modal > .modal.ss { max-width: 1200px; height: calc(100vh - 190px); height: calc(100dvh - 190px); min-height: 520px; padding: 0; }
#detail-panels #screen-settings-modal .ss-head { display: none; }

@media (max-width: 1100px) {
  .dt-cols { grid-template-columns: 240px minmax(0, 1fr); gap: 12px; }
}

@media (max-width: 899px) {
  #detail-modal { left: 0; }
  #detail-modal > .modal { padding: 0 12px; }
  .dt-head { margin: 0 -12px 12px; padding: 12px 16px 0; background: var(--panel); border-bottom: 1px solid var(--border); }
  #detail-modal .dt-title-row h2 { font-size: 17px; }
  .dt-actions { width: 100%; }
  .dt-actions button { flex: 1; }
  .dt-tabs { margin-top: 8px; border-bottom: 0; gap: 20px; }
  .dt-cols { display: flex; flex-direction: column; }
  .dt-areas { position: static; align-self: stretch; }
  .dt-main { flex: 1; }
  .dt-sendbar { margin: auto -12px 0; border-radius: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .dt-sendbtns { width: 100%; }
  .dt-sendbtns button { flex: 1; }
  #detail-panels #screen-settings-modal > .modal.ss { height: auto; min-height: 0; overflow: visible; max-width: 100%; border-radius: 12px; }
  #detail-panels #screen-settings-modal .ss-body { display: block; }
  #detail-panels #screen-settings-modal .ss-pane:not([hidden]) { display: block; overflow: visible; }
  #detail-panels #screen-settings-modal .ss-pane.ss-split:not([hidden]) { display: flex; }
  #detail-panels #screen-settings-modal .ss-foot { position: sticky; bottom: 0; z-index: 4; background: var(--panel); flex-wrap: wrap; }
  .rs-cols { display: flex; flex-direction: column; gap: 0; }
  .rs-slots { position: static; align-self: stretch; padding: 12px; }
  #reserve-slot-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rs-slot { padding: 9px 10px; }
  .rs-edit.dt-card { flex: 1; padding: 0; margin: 0; background: none; border: 0; }
  #reserve-time-input { flex: 1 1 100%; min-height: 42px; }
  .rs-foot { margin: auto -12px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .rs-foot button { flex: 1; min-height: 42px; }
}

/* 휴대폰 상세 탭 6개: 옆으로 숨지 않게 3칸 × 2줄 */
@media (max-width: 560px) {
  .dt-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .dt-tabs button { min-height: 40px; padding: 9px 2px 6px; font-size: 13.5px; }
}

/* 콘텐츠 올리기(3단계) */
.up-drop {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; min-height: 0;
  padding: 14px 16px; border: 2px dashed #f0a3ab; border-radius: 12px; background: var(--panel); margin-bottom: 8px;
}
.up-drop.dragover { border-color: var(--accent); background: var(--accent-dim); }
.up-drop b { font-size: 14px; }
.up-drop p { margin: 3px 0 0; font-size: 12px; color: var(--text-dim); }
.up-quick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.up-quick .up-time { margin: 0 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; }
.up-quick .up-time input { width: 70px; }
.composer .add-item-form { margin-bottom: 12px; }
.composer .add-item-form[hidden] { display: none; }
.composer .item-list { margin-bottom: 10px; }
.up-listhead { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.up-listhead b { font-size: 14px; }
.up-listhead span { font-size: 12px; color: var(--text-dim); }
.up-listhead button { margin-left: auto; font-size: 12px; padding: 6px 11px; }

/* 목록 한 줄 (콘텐츠·예약 공통) */
#detail-panels .item-row .thumb { width: 64px; height: 40px; }
#detail-panels .item-row .thumb-text { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--text-dim); background: #e9ebee; }
#detail-panels .item-row .meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; white-space: normal; }
.item-name { color: var(--text); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; }
.item-row.removed { opacity: 0.45; }
.item-row.pending, .item-row.changed { background: #fff8e6; }
.item-row.upload-failed { border-color: var(--accent); }
.item-row.upload-failed .up-status { color: var(--danger); font-weight: 700; }
.up-bar { display: block; height: 4px; border-radius: 4px; background: #e4e6ea; overflow: hidden; max-width: 260px; }
.up-bar[hidden], .up-retry[hidden] { display: none; }
.up-bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.item-time { display: flex; align-items: center; gap: 4px; margin: 0; flex: none; font-size: 11.5px; color: var(--text-dim); }
.item-time input[type=number] { width: 68px; padding: 5px 6px; font-size: 13px; }
.dt-sendbar #revert-changes-btn[hidden] { display: none; }

@media (max-width: 899px) {
  .up-drop { justify-content: center; text-align: center; }
  .up-drop button { width: 100%; }
  .up-drop b { font-size: 13px; }
  .up-quick .up-time { margin-left: 0; width: 100%; }
  .up-listhead span { display: none; }
  #detail-panels .item-row { flex-wrap: wrap; row-gap: 8px; }
  #detail-panels .item-row .meta { flex: 1 1 calc(100% - 170px); }
  #detail-panels .item-row .item-time { margin-left: auto; }
  .dt-sendnote { display: block; width: 100%; }
  .dt-sendbtns button { padding-left: 8px; padding-right: 8px; }
  #detail-panels .item-row .meta + button { margin-left: auto; }
}
