/* 팔레트: 마이코칭스테이션 로고(민트/털)에서 추출 - 민트 #20B4B6, 배경톤 #E6F2F3
   레이아웃: 좌측 다크 사이드바 + 상단 브레드크럼 바 (snowui.byewind.com 대시보드 구성 참고) */
:root {
  --sidebar-bg: #0F1C1C;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active: rgba(32,180,182,.18);
  --sidebar-text: #90A9A8;
  --sidebar-text-active: #6BE7E3;
  --accent: #1FA9AB;
  --accent-dark: #178E90;
  --mint-pale: #E6F2F3;
  --bg: #F3F8F8;
  --border: #E1EDEC;
  --text: #1E2E2E;
  --muted: #6E8888;
  --danger: #d3455b;
  --ok: #1f9d63;
  --warn: #c98a1f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration: none; }

.app { display: flex; min-height: 100vh; }

/* ── 사이드바 ────────────────────────────────── */
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 18px 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  padding: 0 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 14px;
}
.brand-logo { width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0; }
.sidebar nav { display: flex; flex-direction: column; flex: 1; }
.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #4E6A69;
  padding: 0 22px;
  margin-bottom: 6px;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sidebar-text);
  margin: 2px 12px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
}
.nav-icon { display: flex; opacity: .85; flex-shrink: 0; }
.sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar nav a.active { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.sidebar nav a.active .nav-icon { opacity: 1; }
.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 0;
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
  color: #6E8887;
}
.sidebar-logout button {
  background: none;
  border: 1px solid rgba(255,255,255,.2);
  color: var(--sidebar-text);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}
.sidebar-logout button:hover { background: rgba(255,255,255,.08); color: #fff; }

/* ── 상단 바 + 콘텐츠 ───────────────────── */
.content { flex: 1; max-width: 1240px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 34px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar-crumb { font-size: 13px; color: var(--muted); }
.topbar-crumb .sep { margin: 0 6px; color: #c3d3d2; }
.topbar-crumb .current { color: var(--text); font-weight: 600; }
.topbar-date { font-size: 12.5px; color: var(--muted); }

.content > .page-header,
.content > form,
.content > .card,
.content > .stat-grid,
.content > .error-box,
.content > .success-box,
.content > .notice-box {
  margin-left: 34px;
  margin-right: 34px;
}
.content > .page-header { margin-top: 26px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 20px; margin: 0; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(20,40,40,.03);
}

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { border-radius: 12px; padding: 18px; border: 1px solid transparent; }
.stat-card .icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; background: rgba(255,255,255,.6); }
.stat-card .label { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.stat-card .value { font-size: 25px; font-weight: 700; }
.stat-card.tint-mint { background: #E1F4F3; }
.stat-card.tint-mint .value { color: #147C79; }
.stat-card.tint-blue { background: #E6EEFC; }
.stat-card.tint-blue .value { color: #2E52A8; }
.stat-card.tint-amber { background: #FCF1DE; }
.stat-card.tint-amber .value { color: #A6740F; }
.stat-card.tint-rose { background: #FBE9EE; }
.stat-card.tint-rose .value { color: #B03A56; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: var(--mint-pale); }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--mint-pale); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31,169,171,.15);
}
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge.active { background: var(--mint-pale); color: var(--accent-dark); }
.badge.expired, .badge.revoked, .badge.closed { background: #f4e4e7; color: var(--danger); }
.badge.inactive { background: #eee; color: var(--muted); }
.badge.open { background: #fdf1dc; color: var(--warn); }
.badge.answered { background: var(--mint-pale); color: var(--accent-dark); }
.badge.trial { background: #E6EEFC; color: #2E52A8; }

.error-box { background: #fdeef0; border: 1px solid #f3c4cc; color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.success-box { background: var(--mint-pale); border: 1px solid #b6ddda; color: var(--accent-dark); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.notice-box { background: var(--mint-pale); border: 1px solid #b6ddda; color: var(--accent-dark); padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.search-bar input { flex: 1; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; }

.key-reveal {
  font-family: "SFMono-Regular", Consolas, monospace;
  background: var(--sidebar-bg);
  color: #9df0ea;
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 15px;
  letter-spacing: .04em;
  word-break: break-all;
}

.muted { color: var(--muted); font-size: 13px; }

/* 로그인/최초설정 화면 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--mint-pale); }
.auth-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 36px; width: 360px; }
.auth-card h1 { font-size: 18px; margin: 0 0 20px; }
.auth-logo { text-align: center; margin-bottom: 18px; }
.auth-logo img { width: 56px; height: 56px; border-radius: 14px; }

/* 무료 체험 라이선스 신청 페이지 */
.trial-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #E6F2F3 0%, #F3F8F8 60%);
  padding: 32px 16px;
}
.trial-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 28px rgba(20, 60, 60, .08);
}
.trial-logo { text-align: center; margin-bottom: 10px; }
.trial-logo img { width: 52px; height: 52px; border-radius: 13px; }
.trial-brand {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 24px;
  letter-spacing: .01em;
}
.trial-plan {
  background: var(--mint-pale);
  border: 1px solid #cfe6e4;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 22px;
}
.trial-plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.trial-plan-name { font-size: 15px; font-weight: 700; color: var(--text); }
.trial-price { font-size: 22px; font-weight: 800; color: var(--accent-dark); }
.trial-plan-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 0;
}
.trial-plan-row span:last-child { color: var(--text); font-weight: 500; }
.trial-key-label { font-size: 13px; color: var(--muted); margin: 4px 0 6px; }
.trial-fine {
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
  margin: 18px 0 0;
}

/* ── 이미지 관리(/admin/media) ─────────────────── */
.media-breadcrumb {
  margin: 0 34px 16px;
  font-size: 13px;
  color: var(--muted);
}
.media-breadcrumb a { color: var(--muted); }
.media-breadcrumb a:hover { color: var(--accent-dark); }
.media-breadcrumb a.current { color: var(--text); font-weight: 600; }
.media-breadcrumb .sep { margin: 0 6px; color: #c3d3d2; }

.media-toolbar { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.media-inline-form { display: flex; align-items: center; gap: 8px; }
.media-inline-form input[type="text"] {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  width: 180px;
}
.media-upload-form { flex: 1; min-width: 280px; }

.dropzone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 220px;
  padding: 14px 16px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: var(--mint-pale);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); background: #DDF0EF; color: var(--accent-dark); }
.dropzone input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}

.media-folder-link { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; }
.media-folder-link:hover { color: var(--accent-dark); }
.media-folder-icon { font-size: 16px; }

.media-actions { display: flex; gap: 8px; justify-content: flex-end; }
.media-action-form { display: inline-block; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.media-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.media-thumb-link { display: block; }
.media-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: var(--mint-pale);
  display: block;
  border: 1px solid var(--border);
}
.media-thumb-generic {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}
.media-item-name {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.media-item-meta { font-size: 11.5px; }
.media-item-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.media-item-actions .btn.small { padding: 3px 8px; font-size: 11px; }

/* ── 앱 전환 탭 (공지사항 / FAQ / 고객문의: 코칭앱 · 상담앱) ─────────────────── */
.app-tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border); }
.content > .app-tabs { margin-left: 34px; margin-right: 34px; } /* .content 직계 요소의 좌우 여백(위 .page-header/.card 규칙)과 맞춘다 */
.app-tab {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 10px 18px 11px; margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0;
  color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.app-tab:hover { background: var(--mint-pale); color: var(--text); }
.app-tab.active { background: #fff; border-color: var(--border); color: var(--accent-dark); box-shadow: inset 0 2px 0 var(--accent); }
.app-tab-product { font-size: 12px; font-weight: 500; color: var(--muted); }
.app-tab.active .app-tab-product { color: var(--accent); }
.app-tab-count {
  align-self: center; min-width: 18px; padding: 0 6px; border-radius: 999px;
  background: #fdf1dc; color: var(--warn); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
@media (max-width: 640px) { .app-tab-product { display: none; } }
/* ── 백업/복원 화면 ─────────────────────────────────── */
[hidden] { display: none !important; }
.section-title { font-size: 16px; margin: 0 0 10px; }
.table-box { overflow-x: auto; }
.plain-list { margin: 6px 0 0; padding-left: 20px; font-size: 13.5px; }
.plain-list li { margin: 3px 0; }
.mode-options { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 18px; }
.mode-option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; }
.mode-option:hover { background: var(--mint-pale); }
.mode-option input { width: auto; margin-top: 4px; }
.mode-option:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.confirm-line { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; font-size: 14px; }
/* ── 마지막 백업 알림 배너 (대시보드, 백업/복원) ─────────── */
.content > .backup-banner { margin-left: 34px; margin-right: 34px; }
.backup-banner { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 20px; border-radius: 12px; border: 1px solid #b6ddda; background: var(--mint-pale); color: var(--text); }
.backup-banner-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.backup-banner-text b { font-size: 14.5px; }
.backup-banner-text span { font-size: 13px; color: var(--muted); }
.backup-banner.stale, .backup-banner.never { background: #fdf1dc; border-color: #ecd4a4; }
.backup-banner.stale .backup-banner-text b, .backup-banner.never .backup-banner-text b { color: var(--warn); }