/* ═══════════════════════════════════════════════
   TKD UPGRADE — 정밀 스타일 레이어
   기존 레이아웃/기능 변경 없음
   새 UI (명령 팔레트·알림·FAB)만 추가 정의
   ═══════════════════════════════════════════════ */

/* ── 타이포그래피 통일 ── */
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.trDashSection h3,
.trDashWelcome h2,
.trOwnerSummaryPanel h3 {
  letter-spacing: -.04em !important;
}

/* ── 메트릭 카드: 상단 4px 컬러 라인만 추가 ── */
.trDashMetric { position: relative; overflow: hidden; }
.trDashMetric::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg,
    var(--tr-brand-primary, #0f2a5f),
    var(--tr-brand-secondary, #2563eb));
  border-radius: 22px 22px 0 0;
}
.trDashMetricAttendance::before { background: linear-gradient(90deg, #059669, #10b981); }
.trDashMetricAbsent::before     { background: linear-gradient(90deg, #dc2626, #f87171); }
.trDashMetricPromotion::before  { background: linear-gradient(90deg, #d97706, #fbbf24); }
.trDashMetricPayment::before    { background: linear-gradient(90deg, #7c3aed, #a78bfa); }

/* ── 카드·메트릭 클릭 피드백 ── */
.trDashMetric,
.trDashMiniCard,
.menuCard {
  transition: transform .15s cubic-bezier(.4,0,.2,1),
              box-shadow .15s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
}
.trDashMetric:hover  { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(15,23,42,.10) !important; }
.trDashMiniCard:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 12px 28px rgba(37,99,235,.12); }
.menuCard:hover      { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(15,23,42,.09) !important; }
.trDashMetric:active,
.trDashMiniCard:active,
.menuCard:active     { transform: scale(.97); transition-duration: .08s; }

/* 화면 전환 페이드 */
main:not(.hidden) { animation: tkdFadeIn .2s ease both; }
@keyframes tkdFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════
   명령 팔레트 (Ctrl+K)
   document.body에 직접 추가 — 레이아웃 영향 없음
   ════════════════════════════════════════════ */
#tkdCpOverlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(9,15,30,.55);
  backdrop-filter: blur(8px);
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: clamp(48px, 10vh, 120px);
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
}
#tkdCpOverlay.open { opacity: 1; pointer-events: auto; }

#tkdCpBox {
  width: min(600px, 92vw);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(9,15,30,.22), 0 0 0 1px rgba(226,232,240,.9);
  overflow: hidden;
  transform: translateY(-10px) scale(.98);
  transition: transform .18s cubic-bezier(.22,.68,0,1.2);
}
#tkdCpOverlay.open #tkdCpBox { transform: translateY(0) scale(1); }

#tkdCpSearchRow {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #eef2f7;
}
#tkdCpSearchRow span { font-size: 20px; color: #94a3b8; flex-shrink: 0; }
#tkdCpInput {
  flex: 1 !important; width: auto !important;
  border: none !important; outline: none !important;
  box-shadow: none !important; padding: 0 !important;
  border-radius: 0 !important; background: transparent !important;
  font-size: 17px !important; font-weight: 800 !important;
  color: #0f172a !important;
}
#tkdCpInput::placeholder { color: #94a3b8; font-weight: 700; }
#tkdCpEsc {
  font-size: 11px; font-weight: 900; color: #94a3b8;
  background: #f1f5f9; border: 1px solid #e2e8f0;
  border-radius: 6px; padding: 3px 8px; flex-shrink: 0;
  cursor: pointer;
}

#tkdCpList { max-height: 420px; overflow-y: auto; padding: 6px; }
#tkdCpList::-webkit-scrollbar { width: 5px; }
#tkdCpList::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

.tkdCpGroup {
  padding: 8px 12px 4px;
  font-size: 10px; font-weight: 900;
  color: #94a3b8; letter-spacing: .1em; text-transform: uppercase;
}
.tkdCpItem {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  transition: background .08s;
}
.tkdCpItem:hover, .tkdCpItem.on { background: #eff6ff; }
.tkdCpItemIcon {
  width: 36px; height: 36px; border-radius: 10px;
  background: #f8fafc; display: grid;
  place-items: center; font-size: 18px; flex-shrink: 0;
}
.tkdCpItem.on .tkdCpItemIcon { background: #dbeafe; }
.tkdCpItemLabel  { font-size: 14px; font-weight: 900; color: #0f172a; }
.tkdCpItemSub    { font-size: 12px; font-weight: 800; color: #64748b; margin-top: 1px; }
.tkdCpEmpty      { padding: 36px; text-align: center; color: #94a3b8; font-weight: 800; }

#tkdCpFooter {
  padding: 9px 16px;
  border-top: 1px solid #eef2f7;
  background: #f8fafc;
  display: flex; gap: 14px;
  font-size: 11px; font-weight: 800; color: #94a3b8;
}
#tkdCpFooter span { display: flex; align-items: center; gap: 4px; }
#tkdCpFooter kbd {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 4px; padding: 1px 5px;
  font-size: 10px; font-weight: 900; color: #475569;
}

/* ════════════════════════════════════════════
   알림 패널 (Notification)
   ════════════════════════════════════════════ */
#tkdNotiPanel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(380px, 96vw);
  background: #fff;
  box-shadow: -12px 0 48px rgba(9,15,30,.14);
  display: flex; flex-direction: column;
  z-index: 9998;
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.4,0,.2,1);
}
#tkdNotiPanel.open { transform: translateX(0); }

#tkdNotiBackdrop {
  position: fixed; inset: 0; z-index: 9997;
  background: rgba(9,15,30,.22);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
#tkdNotiBackdrop.open { opacity: 1; pointer-events: auto; }

.tkdNotiHead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #eef2f7;
}
.tkdNotiHead h3 { margin: 0; font-size: 17px; font-weight: 1000; color: #0f172a; }
.tkdNotiClose {
  width: 30px; height: 30px; border-radius: 8px;
  background: #f1f5f9; border: none; cursor: pointer;
  font-size: 15px; display: grid; place-items: center;
}
.tkdNotiClose:hover { background: #e2e8f0; }
.tkdNotiScroll { flex: 1; overflow-y: auto; padding: 8px 10px; }

.tkdNotiGroup {
  font-size: 10px; font-weight: 900; color: #94a3b8;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 8px 10px 4px;
}
.tkdNotiRow {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 10px; border-radius: 12px; cursor: pointer;
  transition: background .08s; position: relative;
}
.tkdNotiRow:hover { background: #f8fafc; }
.tkdNotiRow.unread::before {
  content: '';
  position: absolute; left: 10px; top: 19px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #2563eb;
}
.tkdNotiRow.unread { padding-left: 24px; }
.tkdNotiIcon {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 18px; flex-shrink: 0;
}
.tkdNotiIcon.a { background: #dcfce7; }
.tkdNotiIcon.p { background: #fef9c3; }
.tkdNotiIcon.c { background: #dbeafe; }
.tkdNotiIcon.n { background: #f3e8ff; }
.tkdNotiIcon.x { background: #fee2e2; }
.tkdNotiTitle { font-size: 13px; font-weight: 900; color: #0f172a; line-height: 1.35; }
.tkdNotiSub   { font-size: 12px; font-weight: 800; color: #64748b; margin-top: 2px; }
.tkdNotiEmpty { padding: 48px 20px; text-align: center; color: #94a3b8; font-weight: 800; }
.tkdNotiEmpty div { font-size: 40px; margin-bottom: 10px; }

/* ════════════════════════════════════════════
   헤더 벨 + 명령 버튼
   .trTopUserBox 안에 올바르게 삽입
   ════════════════════════════════════════════ */
.tkdHeaderBtns {
  display: flex; align-items: center; gap: 6px;
  margin-right: 6px;
}
.tkdHBtn {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.85);
  cursor: pointer; font-size: 16px;
  display: grid; place-items: center;
  transition: background .12s;
  position: relative;
}
.tkdHBtn:hover { background: rgba(255,255,255,.24); color: #fff; }
.tkdCmdBtn {
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px; width: auto;
  font-size: 12px; font-weight: 900; white-space: nowrap;
}
.tkdCmdKbd {
  font-size: 10px; background: rgba(255,255,255,.16);
  border-radius: 4px; padding: 2px 5px;
  color: rgba(255,255,255,.6);
}
.tkdNotiBadge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; border-radius: 999px;
  background: #ef4444; color: #fff;
  font-size: 9px; font-weight: 900; line-height: 16px;
  text-align: center; padding: 0 3px;
  border: 2px solid transparent;
  display: none;
}
.tkdNotiBadge.on { display: block; }

/* ── 헤더가 다크 배경일 때는 위 스타일 유지,
       일반 배경일 때는 톤 조정 ── */
.header:not([style*="background"]) .tkdHBtn,
body:not(.trBrandSystem) .header .tkdHBtn {
  background: rgba(15,23,42,.06);
  border-color: rgba(15,23,42,.1);
  color: #475569;
}
body:not(.trBrandSystem) .header .tkdHBtn:hover {
  background: rgba(15,23,42,.1);
  color: #0f172a;
}
body:not(.trBrandSystem) .tkdCmdKbd {
  background: rgba(15,23,42,.08);
  color: #64748b;
}

/* ════════════════════════════════════════════
   반응형
   ════════════════════════════════════════════ */
@media (max-width: 640px) {
  #tkdCpOverlay { padding-top: 0; align-items: flex-end; }
  #tkdCpBox     { border-radius: 20px 20px 0 0; width: 100%; }
  #tkdCpList    { max-height: 54vh; }
  .tkdCmdBtn .tkdCmdLabel,
  .tkdCmdBtn .tkdCmdKbd { display: none; }
  .tkdCmdBtn    { width: 36px; justify-content: center; }
}

