/* 임시 저장 전용 UI. 기존 페이지·에디터의 스타일과 분리합니다. */
.kx-draft-modal,.kx-draft-status{font-family:inherit;box-sizing:border-box;letter-spacing:-.025em}
.kx-draft-modal *,.kx-draft-status *{box-sizing:border-box}
.kx-draft-modal{position:fixed;inset:0;z-index:2147483646;display:flex;align-items:center;justify-content:center;padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom));background:rgba(15,23,42,.5);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);overscroll-behavior:contain}
.kx-draft-dialog{width:100%;max-width:440px;max-height:calc(100dvh - 32px);overflow:auto;background:#fff;color:#172033;border:1px solid #e8edf3;border-radius:18px;padding:22px 22px 18px;box-shadow:0 22px 60px rgba(15,23,42,.24);animation:kx-draft-enter .2s ease-out;text-align:left}
.kx-draft-dialog-head{display:flex;align-items:flex-start;gap:12px;margin:0 0 12px}
.kx-draft-dialog .kx-draft-icon{display:flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;border-radius:12px;background:#fff4e8;color:#b45309;margin:0}
.kx-draft-icon svg,.kx-draft-status-icon svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.kx-draft-head-text{min-width:0;flex:1;padding-top:1px}
.kx-draft-dialog .kx-draft-eyebrow{display:block;margin:0 0 4px;color:#9a3412;font-size:12px;font-weight:700;letter-spacing:.01em;line-height:1.4}
.kx-draft-dialog .kx-draft-title{margin:0;padding:0;color:#0f172a;font-size:20px;font-weight:700;line-height:1.35;word-break:keep-all}
.kx-draft-dialog .kx-draft-copy{margin:0 0 14px;color:#475569;font-size:13px;line-height:1.7;word-break:keep-all}
.kx-draft-dialog .kx-draft-meta{display:flex;gap:8px;align-items:baseline;justify-content:space-between;margin:0 0 12px;padding:10px 12px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;color:#334155;font-size:12px;line-height:1.5;flex-wrap:wrap}
.kx-draft-meta-label{color:#64748b;font-weight:600}
.kx-draft-last-saved{color:#0f172a;font-weight:600}
.kx-draft-dialog .kx-draft-warning{margin:0 0 16px;padding:12px 13px;border-radius:12px;border:1px solid #fdba74;background:linear-gradient(180deg,#fff7ed 0%,#ffedd5 100%);color:#9a3412;font-size:12px;line-height:1.55;word-break:keep-all}
.kx-draft-warning strong{display:block;margin:0 0 8px;font-size:13px;font-weight:700;color:#c2410c}
.kx-draft-warn-list{margin:0;padding:0 0 0 17px}
.kx-draft-warn-list li{margin:0 0 5px}
.kx-draft-warn-list li:last-child{margin-bottom:0}
.kx-draft-warn-list em{font-style:normal;font-weight:700;color:#9a3412}
.kx-draft-actions{display:grid;grid-template-columns:1fr 1.15fr;gap:8px}
.kx-draft-dialog .kx-draft-button{appearance:none;display:flex;align-items:center;justify-content:center;gap:6px;width:100%;min-height:44px;height:auto;margin:0;padding:11px 14px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:#334155;font-family:inherit;font-size:14px;font-weight:600;line-height:1.4;text-decoration:none;cursor:pointer;transition:background .15s,border-color .15s,box-shadow .15s}
.kx-draft-dialog .kx-draft-button:hover{background:#f8fafc;border-color:#94a3b8}
.kx-draft-dialog .kx-draft-primary{background:#b81832;border-color:#b81832;color:#fff;box-shadow:0 6px 14px rgba(184,24,50,.18)}
.kx-draft-dialog .kx-draft-primary:hover{background:#9d1128;border-color:#9d1128}
.kx-draft-dialog .kx-draft-button:focus-visible{outline:3px solid #fda4af;outline-offset:2px}

.kx-draft-status{
  position:fixed;right:24px;bottom:24px;z-index:2147483644;
  display:flex;align-items:center;gap:10px;
  max-width:min(360px,calc(100vw - 32px));
  min-height:48px;padding:12px 14px 12px 12px;
  border-radius:14px;border:1px solid rgba(226,232,240,.95);
  background:rgba(255,255,255,.96);
  backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px);
  box-shadow:0 8px 28px rgba(15,23,42,.12);
  color:#475467;text-align:left;
  pointer-events:auto;cursor:grab;touch-action:none;user-select:none;
  transition:opacity .2s,background .2s,box-shadow .2s;
}
.kx-draft-status.kx-draft-dragging{cursor:grabbing;opacity:1;box-shadow:0 12px 36px rgba(15,23,42,.18);z-index:2147483645}
.kx-draft-status.kx-draft-moved{right:auto;bottom:auto}
.kx-draft-status-icon{display:flex;align-items:center;justify-content:center;flex:none;width:32px;height:32px;background:#f1f4f8;border-radius:50%;color:#667085}
.kx-draft-status-icon svg{width:18px;height:18px}
.kx-draft-status-text{display:flex;flex-direction:column;gap:1px;min-width:0;flex:1}
.kx-draft-status .kx-draft-status-title{display:block;margin:0;padding:0;color:#344054;font-size:13px;font-weight:600;line-height:1.45;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.kx-draft-status .kx-draft-status-detail{display:block;margin:0;padding:0;color:#667085;font-size:11px;font-weight:400;line-height:1.45;white-space:normal;word-break:keep-all}
.kx-draft-status-grip{flex:none;width:14px;height:18px;opacity:.35;background:
  radial-gradient(circle,#94a3b8 1.2px,transparent 1.3px) 0 0/6px 6px,
  radial-gradient(circle,#94a3b8 1.2px,transparent 1.3px) 3px 3px/6px 6px;
  background-size:6px 6px;background-repeat:repeat;border-radius:2px
}
.kx-draft-status[data-state=idle]{opacity:.92}
.kx-draft-status[data-state=pending] .kx-draft-status-icon{color:#2455a6;background:#eff5ff}
.kx-draft-status[data-state=saving] .kx-draft-status-icon{color:#b81832;background:#fdf0f1}
.kx-draft-status[data-state=saving] .kx-draft-status-icon svg{animation:kx-draft-spin .85s linear infinite}
.kx-draft-status[data-state=saved] .kx-draft-status-icon,.kx-draft-status[data-state=restored] .kx-draft-status-icon{color:#168366;background:#eaf7f1}
.kx-draft-status[data-state=warning] .kx-draft-status-icon{color:#a96713;background:#fff4df}
.kx-draft-status[data-state=error]{border-color:#efb4bc;background:rgba(255,247,248,.97)}
.kx-draft-status[data-state=error] .kx-draft-status-icon{color:#b81832;background:#fce7eb}
.kx-draft-status[data-state=error] .kx-draft-status-title{color:#a1122b}

@keyframes kx-draft-spin{to{transform:rotate(360deg)}}
@keyframes kx-draft-enter{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}

/* 모바일: 하단을 가리지 않도록 기본은 상단 롱버튼, 끌어서 이동 가능 */
@media(max-width:540px){
  .kx-draft-modal{
    align-items:flex-end;
    padding:0;
    background:rgba(15,23,42,.55);
  }
  .kx-draft-dialog{
    max-width:none;
    width:100%;
    max-height:min(88dvh,calc(100dvh - env(safe-area-inset-top) - 12px));
    margin:0;
    border-radius:18px 18px 0 0;
    border-left:0;border-right:0;border-bottom:0;
    padding:18px 16px calc(14px + env(safe-area-inset-bottom));
    box-shadow:0 -10px 40px rgba(15,23,42,.2);
  }
  .kx-draft-dialog-head{gap:10px;margin-bottom:10px}
  .kx-draft-dialog .kx-draft-icon{width:40px;height:40px;border-radius:11px}
  .kx-draft-dialog .kx-draft-title{font-size:18px}
  .kx-draft-dialog .kx-draft-copy{font-size:13px;margin-bottom:12px}
  .kx-draft-dialog .kx-draft-meta{margin-bottom:10px}
  .kx-draft-dialog .kx-draft-warning{margin-bottom:14px;padding:11px 12px}
  .kx-draft-actions{grid-template-columns:1fr;gap:8px}
  .kx-draft-dialog .kx-draft-primary{order:-1}
  .kx-draft-dialog .kx-draft-button{min-height:46px;font-size:14px}

  .kx-draft-status,
  .kx-draft-status.kx-draft-mobile{
    left:12px;right:12px;top:max(10px,env(safe-area-inset-top));bottom:auto;
    width:auto;max-width:none;min-height:44px;
    padding:10px 12px;border-radius:12px;
    box-shadow:0 4px 18px rgba(15,23,42,.12);
  }
  .kx-draft-status.kx-draft-moved{
    left:auto;right:auto;width:calc(100vw - 24px);max-width:calc(100vw - 24px);
  }
  .kx-draft-status .kx-draft-status-title{white-space:nowrap}
  .kx-draft-status .kx-draft-status-detail{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
}

@media(prefers-reduced-motion:reduce){
  .kx-draft-dialog,.kx-draft-status,.kx-draft-button{animation:none;transition:none}
  .kx-draft-status[data-state=saving] .kx-draft-status-icon svg{animation:none}
}
