/* ========================================================
   DAYONE ADMIN — Dashboard shell (sidebar + topbar)
   ======================================================== */
:root {
  --c-bg: #f5f6fa;
  --c-surface: #ffffff;
  --c-border: #e5e7eb;
  --c-border-soft: #eef0f3;
  --c-text: #111827;
  --c-text-sub: #6b7280;
  --c-text-muted: #9ca3af;
  --c-brand: #5a5448;
  --c-brand-hover: #3f3a31;
  --c-brand-soft: #f4efe4;
  --c-sidebar: #1f2937;
  --c-sidebar-hover: #374151;
  --c-sidebar-active: #5a5448;
  --c-sidebar-text: #cbd5e1;
  --c-sidebar-dim: #6b7280;
  --c-danger: #dc2626;
  --c-danger-soft: #fef2f2;
  --c-success: #16a34a;
  --c-warn: #f59e0b;
  --c-info: #2563eb;
  --sb-w: 240px;
  --tb-h: 60px;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-pop: 0 8px 24px rgba(16, 24, 40, 0.12);
}

* {
  box-sizing: border-box;
}
.admin-body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
.admin-body:not(.auth-ready) .admin-sidebar,
.admin-body:not(.auth-ready) .admin-backdrop,
.admin-body:not(.auth-ready) .admin-layout,
.admin-body:not(.auth-ready) .toast {
  visibility: hidden;
}

/* ========== SIDEBAR ========== */
.admin-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sb-w);
  height: 100vh;
  background: var(--c-sidebar);
  color: var(--c-sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform 0.2s ease;
}
.sidebar-brand {
  padding: 20px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: var(--c-brand);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-brand-text {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #fff;
}
.sidebar-brand-text small {
  display: block;
  font-size: 10px;
  letter-spacing: 3px;
  font-weight: 400;
  color: var(--c-sidebar-dim);
  margin-top: 2px;
}

.sidebar-nav {
  padding: 14px 12px;
  flex: 1;
  overflow-y: auto;
}
.sidebar-section {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--c-sidebar-dim);
  padding: 14px 12px 6px;
  text-transform: uppercase;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--c-sidebar-text);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 140ms;
  margin-bottom: 2px;
}
.sidebar-link:hover {
  background: var(--c-sidebar-hover);
  color: #fff;
}
.sidebar-link.active {
  background: var(--c-sidebar-active);
  color: #fff;
}
.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}
.sidebar-link.active svg {
  opacity: 1;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-user {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 12px;
  color: #fff;
  font-weight: 500;
}
.sidebar-user-email {
  font-size: 11px;
  color: var(--c-sidebar-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-logout {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--c-sidebar-text);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  cursor: pointer;
  transition: all 140ms;
}
.sidebar-logout:hover {
  background: var(--c-danger);
  border-color: var(--c-danger);
  color: #fff;
}

/* ========== LAYOUT ========== */
.admin-layout {
  margin-left: var(--sb-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.admin-topbar {
  position: sticky;
  top: 0;
  height: var(--tb-h);
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: 20;
}
.admin-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.admin-topbar h1 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-topbar-sub {
  font-size: 12px;
  color: var(--c-text-sub);
}
.admin-topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-toggle {
  display: none;
  border: none;
  background: none;
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
}
.sidebar-toggle svg {
  width: 22px;
  height: 22px;
  color: var(--c-text);
}
/* nav 라벨: 데스크탑=긴 라벨, 모바일=축약 */
.nav-label-short {
  display: none;
}
/* topbar 로그아웃: 기본 숨김 (사이드바의 로그아웃 사용), 모바일에서만 표시 */
.topbar-logout {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--c-text-sub);
  cursor: pointer;
  min-width: 32px;
  min-height: 32px;
}
.topbar-logout:hover {
  background: #f3f4f6;
  color: var(--c-text);
}

/* API Status */
.admin-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--c-text-sub);
  letter-spacing: 0.3px;
}
.admin-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-text-muted);
}
.admin-status[data-state="online"] .dot {
  background: var(--c-success);
}
.admin-status[data-state="offline"] .dot {
  background: var(--c-danger);
}
.admin-status[data-state="offline"] .txt::before {
  content: "Fallback · ";
}

/* Content */
.admin-content {
  padding: 28px 28px 200px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
}
.admin-main {
  padding: 0;
  margin: 0;
  max-width: none;
}

/* Page header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}
.page-header p {
  font-size: 13px;
  color: var(--c-text-sub);
  margin: 0;
  line-height: 1.6;
}

/* Section / Card */
.admin-section,
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
}
.card-tight {
  padding: 16px 18px;
}
.admin-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.admin-section-head h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}
.admin-sub {
  font-size: 13px;
  color: var(--c-text-sub);
  margin: 0;
  line-height: 1.6;
}
.admin-sub strong {
  color: var(--c-text);
}

/* ========== DASHBOARD GRID ========== */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.dash-card {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  color: inherit;
  text-decoration: none;
  transition: all 160ms;
  box-shadow: var(--shadow-card);
}
.dash-card:hover {
  border-color: var(--c-brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow-pop);
}
.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.dash-card-head h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.2px;
  color: var(--c-text);
}
.dash-card-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-brand);
  line-height: 1;
}
.dash-card p {
  font-size: 11px;
  color: var(--c-text-sub);
  line-height: 1.6;
  margin: 0;
}
@media (max-width: 1200px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== DASHBOARD SUMMARY BLOCKS ========== */
.dash-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.dash-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.dash-block-head h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--c-text);
  letter-spacing: -0.2px;
}
.dash-block-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--c-text-muted);
  margin-left: 4px;
}
.dash-block-link {
  font-size: 12px;
  color: var(--c-brand);
  text-decoration: none;
  font-weight: 500;
}
.dash-block-link:hover {
  text-decoration: underline;
}
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 860px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.dash-kpi {
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 0;
}
.dash-kpi-label {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.dash-kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.dash-kpi-foot {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 6px;
}
/* 관리 바로가기 블록 안의 dash-grid는 margin-bottom 제거 */
.dash-block .dash-grid {
  margin-bottom: 0;
}
/* 대시보드 내 top-table 여백 조정 */
.dash-block .top-table {
  margin-top: 2px;
}
.dash-block .top-table tbody td {
  padding: 10px 10px;
}
.src-chip,
.status-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.6;
}
.src-chip.src-home {
  background: #eef4ff;
  color: #1e40af;
}
.src-chip.src-meta {
  background: #fef4e6;
  color: #b45309;
}
.status-chip {
  background: #f3f4f6;
  color: var(--c-text-sub);
}

/* ========== TOOLBAR ========== */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-row label {
  font-size: 12px;
  color: var(--c-text-sub);
}
.filter-row select,
.filter-row input[type="search"],
.filter-row input[type="date"] {
  padding: 7px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--c-surface);
  min-width: 180px;
  color: var(--c-text);
}
.filter-row input[type="date"] {
  min-width: 140px;
}
.filter-row .filter-tilde {
  font-size: 12px;
  color: var(--c-text-sub);
  margin: 0 -4px;
}
/* 검색은 우측으로 밀어 정렬 */
.filter-row .filter-search {
  margin-left: auto;
}
.filter-row select:focus,
.filter-row input:focus {
  outline: none;
  border-color: var(--c-brand);
}

/* ========== DATA TABLE ========== */
.data-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  background: #fafbfc;
  color: var(--c-text-sub);
  font-weight: 500;
  letter-spacing: 0.3px;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--c-border);
  font-size: 11px;
  text-transform: uppercase;
}
.data-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border-soft);
  vertical-align: middle;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table tbody tr:hover {
  background: #fafbfc;
  cursor: pointer;
}
.data-table tbody tr.is-selected {
  background: var(--c-brand-soft);
}
.data-table code {
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--c-brand);
  font-family: "Courier New", monospace;
}
.cell-thumb {
  width: 44px;
  height: 44px;
  background: #f3f4f6 no-repeat center/cover;
  border-radius: 4px;
  border: 1px solid var(--c-border-soft);
}
.cell-title {
  font-weight: 500;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text);
}
.cell-sub {
  font-size: 11px;
  color: var(--c-text-muted);
}
.td-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ========== BUTTONS ========== */
.btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 140ms;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary {
  background: var(--c-brand);
  color: #fff;
  border-color: var(--c-brand);
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-brand-hover);
  border-color: var(--c-brand-hover);
}
.btn-ghost {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--c-text-sub);
  background: var(--c-bg);
}
.btn-danger {
  background: var(--c-danger);
  color: #fff;
  border-color: var(--c-danger);
}
.btn-danger:hover:not(:disabled) {
  opacity: 0.9;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: var(--c-surface);
  color: var(--c-text-sub);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: all 140ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover:not(:disabled) {
  color: var(--c-text);
  border-color: var(--c-text-sub);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.icon-btn.danger:hover:not(:disabled) {
  color: var(--c-danger);
  border-color: var(--c-danger);
}

/* ========== FORM FIELDS ========== */
.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--c-text-sub);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input[type="url"],
.field input[type="text"],
.field input[type="number"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field input[type="date"],
.field input[type="datetime-local"],
.field select,
.field textarea,
.meta-form textarea,
.admin-panel input,
.admin-panel select,
.admin-panel textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-brand);
}
.field input[type="file"] {
  padding: 6px 0;
  font-size: 12px;
  color: var(--c-text-sub);
  border: none;
  background: transparent;
}
.field .hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--c-text-muted);
  line-height: 1.6;
}
.field .hint code {
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
}
.field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.field-row .or {
  font-size: 11px;
  color: var(--c-text-muted);
}
.field-row input {
  flex: 1;
  min-width: 200px;
}
.field-inline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 640px) {
  .field-inline {
    grid-template-columns: 1fr;
  }
}
.req {
  color: var(--c-danger);
}

.field-preview {
  margin-bottom: 12px;
}
.field-preview.hidden {
  display: none;
}
.preview {
  width: 100%;
  height: 180px;
  background-color: #f3f4f6;
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.pair-fold {
  margin: 14px 0;
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}
.pair-fold summary {
  font-size: 12px;
  color: var(--c-text-sub);
  cursor: pointer;
  padding: 4px 0;
}
.pair-fold[open] summary {
  margin-bottom: 12px;
  color: var(--c-text);
}

/* ========== BADGES ========== */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  background: #f3f4f6;
  color: #4b5563;
  font-weight: 500;
}
.status-pending {
  background: #fef3c7;
  color: #92400e;
}
.status-contact {
  background: #dbeafe;
  color: #1e40af;
}
.status-estimate {
  background: #d1fae5;
  color: #065f46;
}
.status-done {
  background: #dcfce7;
  color: #14532d;
}
.status-cancel {
  background: #fee2e2;
  color: #991b1b;
}
.status-muted {
  background: #e5e7eb;
  color: #4b5563;
}
.src-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
  line-height: 1.5;
}
.src-homepage {
  background: #eef2ff;
  color: #4338ca;
}
.src-meta {
  background: #dbeafe;
  color: #1d4ed8;
}
.src-google {
  background: #dbeafe;
  color: #1e40af;
}
.src-naver {
  background: #dcfce7;
  color: #166534;
}
.src-youtube {
  background: #fee2e2;
  color: #b91c1c;
}
.src-kakao {
  background: #fef3c7;
  color: #854d0e;
}
.src-referral,
.src-other {
  background: #f1f5f9;
  color: #475569;
}

/* 입력/실제 출처 뱃지 구분 (라벨 prefix 표시) */
.src-input {
  background: #f1f5f9;
  color: #475569;
  border: 1px dashed #cbd5e1;
}
.src-actual {
  /* src-meta/src-google 등 색상 위에 굵은 prefix만 추가 */
  border: 1px solid transparent;
}

/* 유입 출처 탭 (전체/Meta/홈페이지) */
.source-tabs {
  display: inline-flex;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.source-tab {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.source-tab:hover {
  color: var(--c-text);
}
.source-tab.active {
  background: #fff;
  color: var(--c-text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* 탭 별도 줄 + 의미 안내 (출처 뱃지 범례) */
.source-tab-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.source-tab-bar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.source-tabs-large {
  background: #f3f4f6;
  padding: 4px;
}
.source-tabs-large .source-tab {
  padding: 7px 18px;
  font-size: 13px;
}
.source-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding-left: 14px;
  border-left: 1px solid var(--c-border);
  margin-left: auto;
}
.source-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--c-text-muted);
}
.source-legend .legend-text {
  color: var(--c-text);
}
@media (max-width: 980px) {
  .source-legend {
    margin-left: 0;
    border-left: 0;
    padding-left: 0;
    padding-top: 8px;
    border-top: 1px dashed var(--c-border);
    width: 100%;
  }
}
.session-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #fef3c7;
  color: #92400e;
  margin-left: 6px;
}
.session-pill.is-new {
  background: #d1fae5;
  color: #065f46;
}
.session-pill.is-repeat {
  background: #fef3c7;
  color: #92400e;
}

/* ========== MEMO THREAD ========== */
.memo-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.memo-item {
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 10px 12px;
}
.memo-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--c-text-sub);
  margin-bottom: 6px;
}
.memo-head strong {
  color: var(--c-text);
  font-weight: 600;
}
.memo-actions {
  display: flex;
  gap: 4px;
}
.memo-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--c-text-sub);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}
.memo-actions button:hover {
  background: #f3f4f6;
  color: var(--c-text);
}
.memo-body {
  font-size: 13px;
  color: var(--c-text);
  white-space: pre-wrap;
  line-height: 1.5;
}
.memo-editor textarea {
  width: 100%;
  min-height: 70px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 8px 10px;
  box-sizing: border-box;
  resize: vertical;
}
.memo-editor-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}
.memo-empty {
  font-size: 12px;
  color: var(--c-text-sub);
  padding: 10px 0;
}

/* ========== HISTORY (prev submissions) ========== */
.history-box {
  border: 1px dashed var(--c-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafbfc;
  margin-bottom: 10px;
}
.history-box h4 {
  margin: 0 0 6px 0;
  font-size: 12px;
  color: var(--c-text-sub);
  font-weight: 600;
}
.history-item {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
}
.history-item .h-date {
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.history-item .h-meta {
  color: var(--c-text-sub);
}

/* ========== SLIDE LIST (hero) ========== */
.slides-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.slide-item {
  display: grid;
  grid-template-columns: 40px 160px 1fr auto;
  gap: 16px;
  align-items: center;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: border-color 140ms;
}
.slide-item:hover {
  border-color: var(--c-text-sub);
}
.slide-index {
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-muted);
  text-align: center;
}
.slide-thumb {
  width: 100%;
  height: 90px;
  background: #f3f4f6 no-repeat center/cover;
  border-radius: 4px;
  border: 1px solid var(--c-border-soft);
}
.slide-meta {
  min-width: 0;
}
.slide-alt {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slide-url {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slide-href {
  font-size: 11px;
  color: var(--c-text-muted);
}
.slide-href.has-link {
  color: var(--c-brand);
}
.slide-actions {
  display: flex;
  gap: 4px;
}

.empty-state {
  text-align: center;
  padding: 44px 0;
  color: var(--c-text-muted);
  font-size: 13px;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
}

/* ADD form */
.slide-add {
  border-top: 1px solid var(--c-border-soft);
  padding-top: 18px;
}
.btn-add {
  width: 100%;
  padding: 12px;
  background: transparent;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-sm);
  color: var(--c-text-sub);
  font-size: 13px;
  cursor: pointer;
  transition: all 140ms;
}
.btn-add:hover:not(:disabled) {
  color: var(--c-text);
  border-color: var(--c-text-sub);
  background: #fafbfc;
}
.btn-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.add-form {
  margin-top: 14px;
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 18px;
}
.add-form.hidden {
  display: none;
}

/* ========== SAVE BAR ========== */
.save-bar {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--c-border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.save-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.count-label {
  color: var(--c-text-sub);
}
.count-label strong {
  color: var(--c-text);
}
.dirty-label {
  display: inline-block;
  padding: 2px 10px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 999px;
  font-size: 11px;
}
.dirty-label.hidden {
  display: none;
}
.save-actions {
  display: flex;
  gap: 8px;
}

/* ========== MODAL ========== */
.modal[hidden] {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
}
.modal-panel {
  position: relative;
  background: var(--c-surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--c-border-soft);
}
.modal-head h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}
.modal-body {
  padding: 20px 22px;
}

/* ========== BLOCK EDITOR (community) ========== */
.meta-form {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.block-editor {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px;
}
.be-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 4px;
}
.block-guide {
  background: #f8fafc;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--c-text-sub);
}
.block-guide summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--c-text);
  padding: 2px 0;
  user-select: none;
}
.block-guide[open] summary {
  margin-bottom: 8px;
}
.block-guide ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}
.block-guide strong {
  color: var(--c-text);
}
.blocks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}
.block-item {
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.block-tag {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--c-text-sub);
  font-weight: 600;
  text-transform: uppercase;
}
.block-actions {
  display: flex;
  gap: 4px;
}
.block-text {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  background: var(--c-surface);
}
.block-text:focus {
  outline: none;
  border-color: var(--c-brand);
}
.block-image-body {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 640px) {
  .block-image-body {
    grid-template-columns: 1fr;
  }
}
.block-image-preview {
  width: 100%;
  height: 120px;
  background: #f3f4f6;
  border: 1px solid var(--c-border-soft);
  border-radius: 4px;
  overflow: hidden;
}
.block-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.block-image-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.block-image-fields input[type="url"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  font-size: 12px;
}
.blocks-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== COMMUNITY EDIT (WYSIWYG) ========== */
.cm-edit {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.cm-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  border-top: 1px solid var(--c-border-soft);
}
.cm-row:first-of-type {
  border-top: none;
}
.cm-row-top .cm-lbl {
  align-items: flex-start;
  padding-top: 18px;
}
.cm-lbl {
  display: flex;
  align-items: center;
  background: #f7f8fa;
  border-right: 1px solid var(--c-border-soft);
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
}
.cm-val {
  padding: 14px 16px;
  min-width: 0;
}
.cm-val input[type="text"],
.cm-val input[type="date"],
.cm-val textarea,
.cm-select {
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--c-surface);
  color: var(--c-text);
}
.cm-val input[type="text"],
.cm-val textarea {
  width: 100%;
}
.cm-val textarea {
  resize: vertical;
  line-height: 1.6;
}
.cm-val input:focus,
.cm-val textarea:focus,
.cm-select:focus {
  outline: none;
  border-color: var(--c-brand);
}
.cm-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.cm-select {
  cursor: pointer;
}
.cm-custom {
  max-width: 320px;
}
.cm-date {
  max-width: 200px;
}
.cm-hint {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 8px;
}
.cm-edit .hidden {
  display: none;
}
.cm-notice {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--c-text-sub);
  background: #f9fafb;
  border: 1px solid var(--c-border-soft);
  border-radius: 6px;
  padding: 11px 13px;
  margin-bottom: 12px;
}
.cm-notice-warn {
  color: var(--c-danger);
}

/* Quill 오버라이드 */
#toolbar.ql-toolbar {
  border-color: var(--c-border);
  border-radius: 6px 6px 0 0;
  background: #fafbfc;
}
#editor.ql-container {
  border-color: var(--c-border);
  border-radius: 0 0 6px 6px;
  font-family: inherit;
  font-size: 15px;
}
#editor .ql-editor {
  min-height: 360px;
  line-height: 1.8;
}
#editor .ql-editor img {
  max-width: 100%;
  height: auto;
}
/* 폰트 picker 라벨 (커스텀 화이트리스트) */
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="malgun"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="malgun"]::before {
  content: "맑은 고딕";
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="notosans"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="notosans"]::before {
  content: "본고딕";
  font-family: "Noto Sans KR", sans-serif;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value="nanum"]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value="nanum"]::before {
  content: "나눔명조";
  font-family: "Nanum Myeongjo", serif;
}
.ql-font-malgun {
  font-family: "Malgun Gothic", "맑은 고딕", sans-serif;
}
.ql-font-notosans {
  font-family: "Noto Sans KR", sans-serif;
}
.ql-font-nanum {
  font-family: "Nanum Myeongjo", serif;
}
/* 사이즈 picker 라벨 px 표기 */
.ql-snow .ql-picker.ql-size .ql-picker-label::before,
.ql-snow .ql-picker.ql-size .ql-picker-item::before {
  content: attr(data-value) !important;
}
@media (max-width: 640px) {
  .cm-row {
    grid-template-columns: 1fr;
  }
  .cm-lbl {
    border-right: none;
    border-bottom: 1px solid var(--c-border-soft);
  }
}

/* ========== ESTIMATES DETAIL ========== */
.est-quick-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.est-stat-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}
.est-stat-label {
  display: inline-flex;
  align-items: center;
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}
.est-stat-card strong {
  display: block;
  color: var(--c-text);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.est-stat-card em {
  display: block;
  margin-top: 6px;
  color: var(--c-text-muted);
  font-size: 12px;
  font-style: normal;
}
@media (max-width: 760px) {
  .est-quick-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .est-stat-card {
    padding: 12px 10px;
  }
  .est-stat-card strong {
    font-size: 22px;
  }
}
.est-layout {
  display: block;
}
.est-list {
  display: grid;
  gap: 16px;
  align-items: start;
}
.est-date-group {
  min-width: 0;
  display: grid;
  gap: 8px;
}
.est-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}
.est-date-head strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.est-date-head span {
  font-size: 11px;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.est-date-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.est-card {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 10px;
  text-align: left;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  color: var(--c-text);
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition:
    border-color 140ms,
    background 140ms,
    box-shadow 140ms;
}
.est-card:hover {
  border-color: var(--c-text-muted);
  background: #fafbfc;
}
.est-card.is-selected {
  border-color: var(--c-brand);
  background: var(--c-brand-soft);
  box-shadow: 0 0 0 2px rgba(90, 84, 72, 0.12);
}
.est-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  min-width: 0;
}
.est-card-title {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.est-card-title strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 700;
}
.est-card-title small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text-sub);
  font-size: 12px;
  line-height: 1.4;
}
.est-card-tags {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}
.est-card-tags .badge,
.est-card-tags .src-badge,
.branch-chip,
.est-card-info .session-pill {
  white-space: nowrap;
}
.est-card-info .session-pill {
  margin-left: 0;
}
.branch-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  background: #f3f4f6;
  color: var(--c-text-sub);
}
.est-card-info {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 10px 0;
  border-top: 1px solid var(--c-border-soft);
  border-bottom: 1px solid var(--c-border-soft);
}
.est-card-info > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.est-card-info b,
.est-card-summary b {
  font-size: 10px;
  color: var(--c-text-muted);
  font-weight: 700;
  letter-spacing: 0.2px;
}
.est-card-info em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
  font-size: 12px;
  color: var(--c-text);
  line-height: 1.5;
}
.est-card-summary {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.est-card-summary em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: normal;
  font-size: 12px;
  color: var(--c-text);
  line-height: 1.5;
}
.est-card-action {
  justify-self: end;
  color: var(--c-brand);
  font-size: 12px;
  font-weight: 700;
}
@media (max-width: 760px) {
  .est-list {
    grid-template-columns: 1fr;
  }
  .est-date-cards {
    grid-template-columns: 1fr;
  }
  .est-card-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .est-card-info {
    grid-template-columns: 1fr;
  }
  .est-card-summary em {
    display: -webkit-box;
    overflow: hidden;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}
.est-modal {
  padding: 18px;
}
.est-edit-modal {
  z-index: 70;
}
.est-modal-panel {
  max-width: min(1040px, calc(100vw - 36px));
}
.est-edit-panel {
  max-width: min(760px, calc(100vw - 36px));
}
.est-modal-head {
  align-items: flex-start;
  gap: 14px;
}
.modal-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}
.est-detail-body {
  padding: 18px 20px 20px;
}
.est-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: 12px;
}
.est-info-panel {
  min-width: 0;
  background: #fafbfc;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.est-info-panel h3,
.est-info-panel .history-box h4 {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: 0.3px;
  color: var(--c-text-sub);
  text-transform: uppercase;
}
.est-info-main {
  grid-row: span 3;
}
.est-manage-panel .form-actions,
.est-memo-panel .form-actions {
  margin-top: 10px;
}
.est-manage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
.est-history-panel .history-box {
  border: 0;
  background: transparent;
  padding: 0;
}
.est-memo-panel .memo-thread {
  max-height: 240px;
  overflow: auto;
}

/* 방문 히스토리 패널 (첫 진입 → 폼 제출까지 page_view 흐름) */
.est-visit-history-panel h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.visit-history-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--c-text-muted);
}
.visit-history-thread {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: #fafafa;
}
.visit-history-empty {
  padding: 14px;
  text-align: center;
  color: var(--c-text-muted);
  font-size: 12px;
}
.visit-history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: visit;
}
.visit-history-item {
  display: grid;
  grid-template-columns: 120px 1fr 1fr auto;
  gap: 10px;
  padding: 8px 12px 8px 32px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  position: relative;
}
.visit-history-item:last-child {
  border-bottom: 0;
}
.visit-history-item::before {
  counter-increment: visit;
  content: counter(visit);
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: #e5e7eb;
  color: var(--c-text-muted);
  font-size: 10px;
  font-weight: 600;
}
.visit-history-item.is-first::before {
  background: #16a34a;
  color: #fff;
}
.visit-history-item.is-first {
  background: #f0fdf4;
}
.visit-time {
  font-family: ui-monospace, monospace;
  color: var(--c-text);
  white-space: nowrap;
}
.visit-page {
  color: var(--c-text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visit-from {
  color: var(--c-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visit-meta {
  color: var(--c-text-muted);
  font-size: 11px;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .visit-history-item {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* 첫/끝 출처 뱃지 미세 구분 */
.src-badge.src-first {
  outline: 1px solid #16a34a;
  outline-offset: -1px;
}
.src-badge.src-last {
  opacity: 0.9;
}
.customer-edit-form {
  display: block;
}
@media (max-width: 820px) {
  .est-modal {
    align-items: stretch;
    padding: 10px;
  }
  .est-modal-panel,
  .est-edit-panel {
    max-width: none;
    max-height: calc(100vh - 20px);
  }
  .est-modal-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .modal-head-actions {
    width: 100%;
  }
  .modal-head-actions .btn {
    flex: 1;
  }
  .est-detail-body {
    padding: 14px;
  }
  .est-detail-grid {
    grid-template-columns: 1fr;
  }
  .est-info-main {
    grid-row: auto;
  }
  .est-manage-grid {
    grid-template-columns: 1fr;
  }
}

/* 모바일 (≤640px): 하단 가로 네비게이션 + 테이블 → 카드 뷰 */
@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }
  /* 모바일: 사이드바 숨김 → 하단 GNB(핵심 5탭) + 전체 시트 사용 (방식 A) */
  .admin-sidebar {
    display: none !important;
  }
  .sidebar-brand,
  .sidebar-footer {
    display: none !important;
  }
  .sidebar-nav {
    /* 5x2 그리드 — 한 줄 5개, 2단 */
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    grid-auto-rows: 1fr;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    gap: 0;
    overflow: visible;
  }
  .sidebar-link {
    /* grid item: flex 속성 무효화. 셀 내부에서 가운데 정렬 */
    flex: initial;
    min-width: 0;
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    margin: 0;
    border-radius: 0;
    font-size: 10px;
    font-weight: 500;
    color: var(--c-text-sub, #64748b);
    background: transparent !important;
    position: relative;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
    border-right: 1px solid var(--c-border-soft, #eef0f3);
    border-bottom: 1px solid var(--c-border-soft, #eef0f3);
  }
  /* 5n번째: 우측 끝 → 오른쪽 보더 제거 */
  .sidebar-link:nth-child(5n) {
    border-right: none;
  }
  /* 마지막 줄(6~10번): 아래쪽 보더 제거 */
  .sidebar-link:nth-child(n + 6) {
    border-bottom: none;
  }
  .sidebar-link:hover {
    background: transparent !important;
    color: var(--c-text);
  }
  .sidebar-link svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
  }
  .sidebar-link.active {
    color: var(--c-brand, #1a2f4e) !important;
    background: transparent !important;
  }
  .sidebar-link.active svg {
    opacity: 1;
  }
  .sidebar-link.active::before {
    /* 활성 표시 라인: 하단 nav 이므로 카드 상단에 라인 */
    content: "";
    position: absolute;
    top: 0;
    left: 22%;
    right: 22%;
    height: 2.5px;
    background: var(--c-brand, #1a2f4e);
    border-radius: 0 0 3px 3px;
  }
  .nav-label-full {
    display: none;
  }
  .nav-label-short {
    display: inline;
    font-size: 10px;
  }

  /* 레이아웃: 상단 nav 만큼 본문 위쪽 여백 */
  .admin-layout {
    margin-left: 0 !important;
  }
  .admin-content {
    padding-top: 20px;
    padding-bottom: 76px !important; /* 하단 GNB 58px + 여유 */
  }

  /* iOS Safari: focus 시 자동확대 방지 — input/textarea/select font-size ≥ 16px */
  .admin-content
    input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  .admin-content textarea,
  .admin-content select,
  .modal input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  .modal textarea,
  .modal select {
    font-size: 16px;
  }

  /* 터치 타깃 최소 사이즈 (Apple HIG 44, 보수적으로 38px) */
  .icon-btn,
  .topbar-logout {
    min-width: 38px;
    min-height: 38px;
  }
  /* 카드/리스트의 인라인 액션 버튼 (수정/삭제) — admin.css 기본 .btn-sm 도 모바일에서 36px 이상 */
  .btn-sm,
  .mkt-actions button {
    min-height: 36px;
  }

  /* 햄버거/백드롭 숨김 */
  .sidebar-toggle {
    display: none !important;
  }
  .admin-backdrop {
    display: none !important;
  }

  /* 상단바 로그아웃 버튼 활성화 */
  .topbar-logout {
    display: inline-flex;
  }
  /* topbar 공간 확보: status 는 dot만 */
  .admin-topbar {
    padding: 0 12px;
  }
  .admin-status {
    padding: 4px 6px;
  }
  .admin-status .txt {
    display: none;
  }
  .admin-topbar-right {
    gap: 6px;
  }

  /* wrapper 박스 제거 — 카드별로 독립 테두리만 */
  .data-table-wrap.est-list {
    overflow: visible;
    border: none;
    background: transparent;
    border-radius: 0;
  }
  .est-list .data-table {
    display: block;
    width: 100%;
    min-width: 0;
    border: none;
    background: transparent;
    table-layout: auto;
  }
  .est-list .data-table thead {
    display: none;
  }
  .est-list .data-table tbody {
    display: block;
    width: 100%;
  }
  .est-list .data-table tbody tr {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
  }
  .est-list .data-table tbody td .badge,
  .est-list .data-table tbody td .src-badge {
    display: inline-block;
    max-width: 100%;
  }
  .est-list .data-table tbody tr.is-selected {
    border-color: var(--c-text-sub, #64748b);
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.12);
  }
  /* 기본 셀: grid 2컬럼 (라벨 고정폭, 값 1fr) — flex+anonymous text 이슈 회피 */
  .est-list .data-table tbody td {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 8px;
    align-items: baseline;
    padding: 5px 0;
    border: none;
    font-size: 13px;
    color: var(--c-text);
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .est-list .data-table tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    color: var(--c-text-sub, #64748b);
    font-weight: 500;
    white-space: nowrap;
  }
  .est-list .data-table tbody td > * {
    min-width: 0;
    max-width: 100%;
  }
  /* 이름 셀은 상단 강조 블록 — 라벨 숨기고 큰 제목 + 부제 */
  .est-list .data-table tbody td[data-label="이름"] {
    display: block;
    padding: 0 0 8px;
    border-bottom: 1px dashed var(--c-border);
    margin: 0 0 8px;
  }
  .est-list .data-table tbody td[data-label="이름"]::before {
    display: none;
  }
  .est-list .data-table tbody td[data-label="이름"] .cell-title {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--c-text);
    word-break: break-word;
  }
  .est-list .data-table tbody td[data-label="이름"] .cell-sub {
    display: block;
    margin-top: 2px;
    color: var(--c-text-sub, #64748b);
    font-size: 11px;
    word-break: break-all;
    overflow-wrap: break-word;
    line-height: 1.4;
  }
  /* 비어있는 값은 셀 자체 숨김 (라벨만 덩그러니 남는 문제 방지) */
  .est-list .data-table tbody td:empty {
    display: none;
  }

  /* 필터 바: 라벨 숨기고 입력요소 전폭 */
  .filter-row {
    gap: 8px;
  }
  .filter-row label {
    display: none;
  }
  .filter-row select {
    min-width: 0;
    flex: 1 1 45%;
    font-size: 16px; /* iOS 자동확대 방지 */
  }
  .filter-row input[type="search"] {
    min-width: 0;
    flex: 1 1 100%;
    font-size: 16px; /* iOS 자동확대 방지 */
  }

  /* 상세 영역 - 여백 축소, overflow 방지, 헤더 줄바꿈, dl 블록 레이아웃 */
  .est-detail {
    padding: 14px;
    min-height: auto;
    box-sizing: border-box;
    overflow-wrap: anywhere;
  }
  .est-detail * {
    max-width: 100%;
  }
  .est-detail .btn {
    max-width: 100%;
    white-space: normal;
  }
  .form-actions {
    flex-wrap: wrap;
  }
  .form-actions .btn {
    flex: 1 1 auto;
  }
  .detail-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }
  .detail-head h2 {
    font-size: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    word-break: break-word;
    overflow-wrap: anywhere;
  }
  .detail-dl {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .detail-dl dt {
    font-size: 11px;
    margin-top: 10px;
  }
  .detail-dl dt:first-child {
    margin-top: 0;
  }
  .detail-dl dd {
    font-size: 13px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--c-border-soft, #e5e7eb);
    overflow-wrap: anywhere;
  }
  .detail-dl dd:last-of-type {
    border-bottom: none;
  }

  /* admin-panel 여백 축소 */
  .admin-panel {
    padding: 12px 14px;
  }

  /* 쓰레드 메모 */
  .memo-item {
    padding: 10px;
    overflow: hidden;
  }
  .memo-head {
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: 11px;
    align-items: center;
  }
  .memo-head > span:first-child {
    flex: 1 1 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .memo-actions {
    flex: 0 0 auto;
    display: inline-flex;
    gap: 2px;
  }
  .memo-actions button {
    padding: 6px 10px;
    font-size: 12px;
  }
  .memo-body {
    font-size: 13px;
    overflow-wrap: anywhere;
  }
  .memo-editor-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .memo-editor-row input {
    flex: 1 1 100%;
    width: 100%;
  }

  /* 회차/히스토리 박스 */
  .history-box {
    padding: 10px 12px;
  }
  .history-item {
    flex-wrap: wrap;
    row-gap: 2px;
  }
  .history-item .h-meta {
    width: 100%;
    padding-left: 0;
  }
  .session-pill {
    font-size: 12px;
    padding: 3px 10px;
  }

  /* 출처뱃지 한 줄 유지 */
  .src-badge {
    white-space: nowrap;
  }
}
.est-detail {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px;
  min-height: 400px;
  box-shadow: var(--shadow-card);
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--c-border-soft);
}
.detail-head h2 {
  font-size: 16px;
  margin: 0 0 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.detail-name {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-sub {
  font-size: 11px;
  color: var(--c-text-muted);
}
.detail-title-note {
  min-width: 0;
  flex: 1 1 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.detail-dl {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px 14px;
  font-size: 12px;
  margin-bottom: 18px;
}
.detail-dl dt {
  color: var(--c-text-sub);
}
.detail-dl dd {
  margin: 0;
  color: var(--c-text);
  word-break: break-word;
}
.detail-note {
  background: #fafbfc;
  border: 1px solid var(--c-border-soft);
  border-radius: 4px;
  padding: 8px 10px;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.6;
}
.file-chip {
  display: inline-block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--c-brand);
  margin: 2px 4px 2px 0;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  text-decoration: none;
}
.file-chip:hover {
  border-color: var(--c-brand);
}
.admin-panel {
  background: #fafbfc;
  border: 1px solid var(--c-border-soft);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-top: 16px;
}
.admin-panel h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 12px;
  letter-spacing: 0.3px;
  color: var(--c-text-sub);
  text-transform: uppercase;
}
.panel-hint {
  font-size: 12px;
  color: var(--c-text-sub);
  line-height: 1.6;
  margin: -4px 0 12px;
}
.field-row-2,
.field-row-3 {
  display: flex;
  gap: 12px;
}
.field-row-2 > .field,
.field-row-3 > .field {
  flex: 1;
  margin-bottom: 14px;
  min-width: 0;
}
@media (max-width: 640px) {
  .field-row-2,
  .field-row-3 {
    flex-direction: column;
    gap: 0;
  }
  .field-row-3 > .field[style*="flex"] {
    flex: 1 !important;
  }
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--c-text);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 240ms,
    transform 240ms;
  z-index: 100;
  pointer-events: none;
  box-shadow: var(--shadow-pop);
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.error {
  background: var(--c-danger);
}

/* ========== GUIDE ========== */
.admin-guide {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-top: 16px;
}
.admin-guide summary {
  padding: 14px 22px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
}
.admin-guide summary:hover {
  background: #fafbfc;
}
.guide-body {
  padding: 0 22px 22px;
  font-size: 13px;
  color: var(--c-text-sub);
  line-height: 1.7;
}
.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.spec-table th,
.spec-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--c-border-soft);
  font-size: 12px;
}
.spec-table th {
  background: #fafbfc;
  color: var(--c-text-sub);
  font-weight: 500;
}
.spec-table code {
  background: #f3f4f6;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--c-brand);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-pop);
  }
  .admin-layout {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: inline-flex;
  }
  .admin-content {
    padding: 20px 16px 24px;
  }
  .admin-topbar {
    padding: 0 16px;
  }
  .slide-item {
    grid-template-columns: 30px 100px 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
  }
  .slide-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
  .save-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .save-actions {
    justify-content: stretch;
  }
  .save-actions .btn {
    flex: 1;
  }
}

/* ========== MOBILE BACKDROP ========== */
.admin-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  z-index: 35;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}
@media (max-width: 900px) {
  .admin-backdrop {
    display: block;
  }
  .admin-backdrop.show {
    opacity: 1;
    pointer-events: auto;
  }
  body.drawer-open {
    overflow: hidden;
  }
}

/* ========== 모바일 하단 GNB (방식 A: 핵심 5탭 + 전체 시트) ========== */
.admin-botnav,
.admin-sheet,
.admin-sheet-mask {
  display: none;
}
@media (max-width: 640px) {
  /* 하단 GNB 가 메뉴를 대체하므로 상단 햄버거(사이드바 토글) 숨김 */
  .sidebar-toggle {
    display: none !important;
  }
  .admin-botnav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 41;
    height: 58px;
    background: #fff;
    border-top: 1px solid var(--c-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-sizing: content-box;
  }
  .botnav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 10px;
    line-height: 1.1;
    color: var(--c-text-sub);
    text-decoration: none;
    background: none;
    border: 0;
    cursor: pointer;
    position: relative;
    font-family: inherit;
    white-space: nowrap;
  }
  .botnav-tab svg {
    width: 21px;
    height: 21px;
    opacity: 0.7;
  }
  .botnav-tab.active {
    color: var(--c-brand);
  }
  .botnav-tab.active svg {
    opacity: 1;
  }
  .botnav-tab.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 28%;
    right: 28%;
    height: 2.5px;
    background: var(--c-brand);
    border-radius: 0 0 3px 3px;
  }
  .botnav-more {
    color: var(--c-text);
    font-weight: 700;
  }

  .admin-sheet-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 48;
    background: rgba(17, 24, 39, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .admin-sheet-mask.show {
    opacity: 1;
    pointer-events: auto;
  }
  .admin-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 49;
    background: #fff;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    padding: 8px 14px calc(16px + env(safe-area-inset-bottom));
    max-height: 80%;
    overflow: auto;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.18);
  }
  .admin-sheet.show {
    transform: translateY(0);
  }
  .sheet-handle {
    width: 38px;
    height: 4px;
    background: #d1d5db;
    border-radius: 999px;
    margin: 4px auto 12px;
  }
  .admin-sheet h3 {
    font-size: 13px;
    font-weight: 800;
    margin: 0 0 10px;
    color: var(--c-text);
  }
  .sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 0;
  }
  .sheet-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11px;
    line-height: 1.15;
    color: var(--c-text);
    text-decoration: none;
    padding: 12px 2px;
    border-radius: 9px;
    text-align: center;
  }
  .sheet-cell svg {
    width: 22px;
    height: 22px;
    opacity: 0.82;
  }
  .sheet-cell.active {
    color: var(--c-brand);
    background: var(--c-brand-soft);
    font-weight: 700;
  }
  .sheet-cell.active svg {
    opacity: 1;
  }
  body.sheet-open {
    overflow: hidden;
  }
}

/* Page header (topbar 대신 main 내부에서 쓸 경우) */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}
.page-header p {
  font-size: 13px;
  color: var(--c-text-sub);
  margin: 0;
  line-height: 1.6;
}

/* ========== GRID + DRAG CARDS (공통) ========== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 1400px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.drag-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: grab;
  transition:
    border-color 140ms,
    transform 140ms,
    box-shadow 140ms;
  position: relative;
  user-select: none;
}
.drag-card:hover {
  border-color: var(--c-text-sub);
}
.drag-card.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.drag-card.drag-over {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 2px var(--c-brand-soft);
}
.drag-card.file-over {
  border-color: var(--c-info);
  box-shadow: 0 0 0 2px #dbeafe;
}
.drag-card.file-over::after {
  content: "📥 이미지 드롭";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.2);
  color: var(--c-info);
  font-weight: 600;
  pointer-events: none;
  border-radius: var(--radius-sm);
}

.drag-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #f3f4f6 no-repeat center/cover;
  position: relative;
  border-bottom: 1px solid var(--c-border-soft);
}
.drag-card-thumb.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  font-size: 11px;
}

.drag-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  min-width: 28px;
  height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.drag-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 140ms;
}
.drag-card:hover .drag-card-actions,
.drag-card:focus-within .drag-card-actions {
  opacity: 1;
}
.drag-card-action {
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms;
}
.drag-card-action:hover {
  background: rgba(17, 24, 39, 1);
}
.drag-card-action.danger:hover {
  background: var(--c-danger);
}

.drag-card-meta {
  padding: 10px 12px;
}
.drag-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin: 0 0 4px;
}
.drag-card-sub {
  font-size: 11px;
  color: var(--c-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drag-card-sub.accent {
  color: var(--c-brand);
}
.drag-card-tags {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.card-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 16px;
  color: var(--c-text-muted);
  font-size: 13px;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
}

/* ========== THUMB UPLOAD (single) ========== */
.thumb-upload {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.thumb-preview {
  width: 160px;
  height: 100px;
  background: #f3f4f6 no-repeat center/cover;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  font-size: 11px;
}
.thumb-preview.has-image::before {
  content: "";
}
.thumb-preview.empty::before {
  content: "미등록";
}
.thumb-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.thumb-actions .btn {
  justify-content: flex-start;
}

/* ========== GALLERY (multi-image upload) ========== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0;
}
@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.gallery-item {
  position: relative;
  aspect-ratio: 1;
  background: #f3f4f6 no-repeat center/cover;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  transition:
    border-color 140ms,
    box-shadow 140ms;
}
.gallery-item.dragging {
  opacity: 0.4;
  cursor: grabbing;
}
.gallery-item.drag-over {
  border-color: var(--c-brand);
  box-shadow: 0 0 0 2px var(--c-brand-soft);
}
.gallery-item-order {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.gallery-item-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(17, 24, 39, 0.85);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 140ms;
}
.gallery-item:hover .gallery-item-remove {
  opacity: 1;
}
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 16px;
  color: var(--c-text-muted);
  font-size: 12px;
  border: 1px dashed var(--c-border);
  border-radius: var(--radius-sm);
}

/* ========== ANALYTICS ========== */
.notice-banner {
  background: #fff8e6;
  border: 1px solid #f1d97a;
  color: #7a5d0a;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 18px;
}
.notice-banner strong {
  color: #5a4608;
}
.analytics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  background: #f3f5f8;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-text-sub);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.seg-btn:hover {
  color: var(--c-text);
}
.seg-btn.active {
  background: var(--c-brand);
  color: #fff;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.16);
}
.analytics-compare {
  font-size: 12px;
  color: var(--c-text-muted);
}
.analytics-range-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 4px 8px;
}
.analytics-range-picker[hidden] {
  display: none;
}
.analytics-range-picker label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--c-text-muted);
}
.analytics-range-picker input[type="date"] {
  border: 0;
  outline: none;
  font-size: 12px;
  padding: 2px 4px;
  color: var(--c-text);
  background: transparent;
  font-family: inherit;
}
.btn-apply-range {
  appearance: none;
  border: 0;
  background: var(--c-brand);
  color: #fff;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}
.btn-apply-range:hover {
  opacity: 0.9;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-grid-6 {
  grid-template-columns: repeat(6, 1fr);
}
@media (max-width: 1280px) {
  .kpi-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 860px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .kpi-grid-6 {
    grid-template-columns: repeat(2, 1fr);
  }
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.kpi-label {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}
.kpi-delta {
  font-size: 12px;
  color: var(--c-text-muted);
}
.kpi-split {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.kpi-split .kpi-divider {
  font-size: 18px;
  font-weight: 400;
  color: var(--c-text-muted);
}
.kpi-sub {
  font-size: 11px;
  color: var(--c-text-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
  margin-bottom: 4px;
}
.kpi-help {
  display: inline-block;
  margin-left: 4px;
  width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0;
  font-size: 11px;
  text-align: center;
  border-radius: 50%;
  background: var(--c-border);
  color: var(--c-text-muted);
  cursor: pointer;
  vertical-align: middle;
  border: 0;
  transition:
    background 0.15s,
    color 0.15s;
}
.kpi-help:hover,
.kpi-help:focus-visible,
.kpi-help.is-active {
  background: var(--c-text);
  color: #fff;
  outline: none;
}

/* 클릭 트리거 정보 팝오버 (단일 인스턴스) */
.info-popover {
  position: absolute;
  z-index: 9999;
  max-width: 320px;
  padding: 10px 14px;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  line-height: 1.55;
  pointer-events: auto;
}
.info-popover[hidden] {
  display: none;
}
.info-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: var(--arrow-left, 16px);
  width: 12px;
  height: 12px;
  background: #111827;
  transform: rotate(45deg);
}
.info-popover-content {
  position: relative;
  z-index: 1;
}

/* analytics 페이지 섹션 순서 (data-order 기반) */
.analytics-layout {
  display: flex;
  flex-direction: column;
}
.analytics-layout > .analytics-toolbar {
  order: 0;
}
.analytics-layout > [data-order="1"] {
  order: 1;
}
.analytics-layout > [data-order="2"] {
  order: 2;
}
.analytics-layout > [data-order="3"] {
  order: 3;
}
.analytics-layout > [data-order="4"] {
  order: 4;
}
.analytics-layout > [data-order="5"] {
  order: 5;
}
.analytics-layout > [data-order="6"] {
  order: 6;
}
.analytics-layout > [data-order="7"] {
  order: 7;
}

/* 퍼널 이동경로 (3단계 흐름 카드) */
.funnel-section .panel {
  padding: 16px 18px;
}
.funnel-section .badge-source {
  vertical-align: middle;
}
.funnel-stages {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 12px;
  align-items: stretch;
  margin-top: 12px;
}
.funnel-stage {
  background: #fafafa;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 12px 14px;
}
.funnel-stage-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--c-border);
}
.funnel-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.funnel-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px dashed #e5e7eb;
}
.funnel-list li:last-child {
  border-bottom: 0;
}
.funnel-list .page-path {
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.funnel-list .page-pct {
  font-weight: 600;
  color: var(--c-text);
  white-space: nowrap;
}
.funnel-list .page-cnt {
  color: var(--c-text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.funnel-list .empty-state {
  color: var(--c-text-muted);
  text-align: center;
  padding: 8px;
  border: 0;
}
.funnel-arrow {
  align-self: center;
  font-size: 20px;
  color: var(--c-text-muted);
}
.funnel-conversion {
  text-align: center;
  padding: 18px 0;
}
.funnel-conv-val {
  font-size: 28px;
  font-weight: 700;
  color: #16a34a;
  letter-spacing: -1px;
}
.funnel-conv-sub {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 4px;
}
@media (max-width: 980px) {
  .funnel-stages {
    grid-template-columns: 1fr;
  }
  .funnel-arrow {
    transform: rotate(90deg);
    margin: 0 auto;
  }
}

/* 데이터 소스 뱃지 */
.badge-source {
  display: inline-block;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  border-radius: 3px;
  letter-spacing: 0.5px;
  margin-right: 6px;
  vertical-align: middle;
  text-transform: none;
}
.badge-ga4 {
  background: #1a73e8;
  color: #fff;
}
.badge-self {
  background: #16a34a;
  color: #fff;
}
.badge-meta {
  background: #1877f2;
  color: #fff;
}

/* 신규/재방문 게이지 */
.gauge-bar {
  display: flex;
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}
.gauge-fill {
  height: 100%;
  transition: width 0.3s ease;
}
.gauge-fill-new {
  background: #16a34a;
}
.gauge-fill-returning {
  background: #fbbf24;
}

/* 자체측정 상세 패널 */
.self-panel {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.self-panel .panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.self-panel .panel-head h3 {
  font-size: 14px;
  margin: 0;
  font-weight: 600;
}
.self-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 980px) {
  .self-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 600px) {
  .self-grid {
    grid-template-columns: 1fr;
  }
}
.self-item {
  background: #fafafa;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 12px 14px;
}
.self-label {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.self-big {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -0.5px;
  margin-bottom: 2px;
}
.self-sub {
  font-size: 11px;
  color: var(--c-text-muted);
}
.self-locations {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: loc;
}
.self-locations li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.self-locations li:last-child {
  border-bottom: 0;
}
.self-locations li::before {
  counter-increment: loc;
  content: counter(loc);
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: #f3f4f6;
  color: var(--c-text-muted);
  font-size: 10px;
  font-weight: 600;
  margin-right: 8px;
  flex-shrink: 0;
}
.self-locations .loc-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.self-locations .loc-country {
  font-size: 10px;
  color: var(--c-text-muted);
  margin-left: 4px;
}
.self-locations .loc-cnt {
  font-weight: 600;
  color: var(--c-text);
}
.self-locations .empty-state {
  display: block;
  text-align: center;
  color: var(--c-text-muted);
  padding: 8px;
  border: 0 !important;
}
.self-locations .empty-state::before {
  display: none !important;
}

/* 디바이스 비중 바 */
.device-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.device-row {
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.device-name {
  color: var(--c-text-muted);
}
.device-bar-track {
  height: 6px;
  background: #f3f4f6;
  border-radius: 3px;
  overflow: hidden;
}
.device-bar-fill {
  display: block;
  height: 100%;
}
.device-pc {
  background: #6366f1;
}
.device-mo {
  background: #f97316;
}
.device-val {
  font-size: 11px;
  color: var(--c-text);
  font-weight: 500;
  white-space: nowrap;
}
.delta {
  font-weight: 600;
}
.delta.up {
  color: #15803d;
}
.delta.down {
  color: #b91c1c;
}
.delta.flat {
  color: var(--c-text-muted);
}
.analytics-row {
  margin-bottom: 18px;
}
.analytics-row.two-col {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .analytics-row.two-col {
    grid-template-columns: 1fr;
  }
}
.panel {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  min-width: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.panel-head h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: var(--c-text);
}
.panel-sub {
  font-size: 11px;
  color: var(--c-text-muted);
}
.ops-dashboard {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}
.ops-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.ops-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-brand);
}
.ops-head h2 {
  margin: 0;
  color: var(--c-text);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
}
.ops-period {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(54px, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: #f3f5f8;
  flex: 0 0 auto;
}
.ops-period-btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--c-text-sub);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  white-space: nowrap;
}
.ops-period-btn.active {
  background: var(--c-brand);
  color: #fff;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.16);
}
.ops-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.ops-kpi {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e7ebf0;
  border-radius: 10px;
  background: #fafbfc;
}
.ops-kpi.is-alert {
  background: #fff8ed;
  border-color: #f3d3a3;
}
.ops-kpi span,
.ops-kpi em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-kpi span {
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 5px;
}
.ops-kpi strong {
  display: block;
  color: var(--c-text);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ops-kpi em {
  color: var(--c-text-muted);
  font-size: 11px;
  font-style: normal;
  margin-top: 5px;
}
.ops-target-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #e7ebf0;
  border-radius: 10px;
  background: #fafbfc;
}
.ops-target-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.ops-target-copy strong {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 800;
}
.ops-target-copy span {
  color: var(--c-text-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-target-manual,
.ops-target-input {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--c-text-sub);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.ops-target-manual input {
  width: 16px;
  height: 16px;
  accent-color: var(--c-brand);
}
.ops-target-input {
  padding: 5px 8px;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: #fff;
}
.ops-target-input input {
  width: 74px;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--c-text);
  font: inherit;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ops-target-input input:disabled {
  color: var(--c-text-muted);
}
.ops-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.95fr);
  gap: 14px;
  align-items: start;
}
.ops-main-stack {
  grid-column: 1;
  display: grid;
  gap: 14px;
  min-width: 0;
}
.ops-panel {
  padding: 16px;
}
.ops-side {
  grid-column: 2;
  display: grid;
  gap: 12px;
  min-width: 0;
}
.ops-heatmap-mobile {
  display: none;
}
.ops-bars {
  display: grid;
  gap: 11px;
  min-width: 0;
}
.ops-bar-row {
  display: grid;
  grid-template-columns: minmax(78px, 0.25fr) minmax(0, 1fr) minmax(50px, auto);
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.ops-bar-label,
.ops-bar-value {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ops-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-bar-value {
  text-align: right;
}
.ops-bar-track {
  position: relative;
  min-width: 0;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f6;
}
.ops-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--c-brand), #c2a679);
}
.ops-bar-row.is-forecast .ops-bar-fill {
  background: linear-gradient(90deg, #0ea5e9, #c2a679);
}
.ops-target {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  background: #f7f8fa;
  color: var(--c-text-sub);
  font-size: 12px;
  line-height: 1.5;
}
.ops-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.ops-weekday {
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
  text-align: center;
}
.ops-weekday strong,
.ops-weekday span {
  display: block;
}
.ops-weekday strong {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 800;
}
.ops-weekday span {
  margin-top: 3px;
  color: var(--c-text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.ops-weekday.is-hot {
  background: #b91c1c;
  border-color: #991b1b;
}
.ops-weekday.is-hot strong,
.ops-weekday.is-hot span {
  color: #fff;
}
.ops-weekday.is-warm {
  background: #fee2e2;
  border-color: #fecaca;
}
.ops-weekday.is-warm strong,
.ops-weekday.is-warm span {
  color: #991b1b;
}
.ops-weekday.is-cool {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.ops-weekday.is-cool strong,
.ops-weekday.is-cool span {
  color: #1d4ed8;
}
.ops-weekday.is-cold {
  background: #dbeafe;
  border-color: #60a5fa;
}
.ops-weekday.is-cold strong,
.ops-weekday.is-cold span {
  color: #1e3a8a;
}
.ops-weekday-meter {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f4;
  margin-top: 7px;
}
.ops-weekday-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--c-brand);
}
.ops-weekday.is-hot .ops-weekday-meter,
.ops-weekday.is-warm .ops-weekday-meter {
  background: rgba(255, 255, 255, 0.42);
}
.ops-weekday.is-hot .ops-weekday-meter i {
  background: #fff;
}
.ops-weekday.is-warm .ops-weekday-meter i {
  background: #dc2626;
}
.ops-weekday.is-cool .ops-weekday-meter i,
.ops-weekday.is-cold .ops-weekday-meter i {
  background: #2563eb;
}
.ops-actions,
.ops-mini-ranks,
.ops-campaigns {
  display: grid;
  gap: 8px;
}
.ops-action,
.ops-rank {
  display: grid;
  grid-template-columns: minmax(76px, 0.28fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.ops-action span,
.ops-rank span {
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 700;
}
.ops-action strong,
.ops-rank strong {
  min-width: 0;
  overflow: hidden;
  color: var(--c-text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-rank strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ops-rank b {
  color: var(--c-brand);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ops-clarity-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: linear-gradient(135deg, #f7f8fb 0%, #eef2f8 100%);
  color: var(--c-text);
  text-decoration: none;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.ops-clarity-link:hover {
  border-color: var(--c-brand);
  background: #fff;
}
.ops-clarity-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ops-clarity-meta strong {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-text);
}
.ops-clarity-meta em {
  font-style: normal;
  font-size: 11px;
  color: var(--c-text-muted);
}
.ops-clarity-cta {
  font-size: 11px;
  font-weight: 700;
  color: var(--c-brand);
  white-space: nowrap;
}
.ops-campaign {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.ops-campaign-head {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ops-campaign-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--c-brand);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.ops-campaign-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--c-text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-campaign-head b {
  color: var(--c-brand);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ops-campaign-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f4;
  margin-top: 7px;
}
.ops-campaign-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--c-brand), #c2a679);
}
.ops-campaign em {
  display: block;
  margin-top: 4px;
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-style: normal;
}
.ops-heatmap {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}
.ops-heatmap-grid {
  display: grid;
  grid-template-columns: 58px repeat(var(--heatmap-days), 18px);
  gap: 5px;
  align-items: center;
  width: max-content;
  min-width: 100%;
}
.ops-heatmap-corner,
.ops-heatmap-date,
.ops-heatmap-label,
.ops-heatmap-cell {
  min-width: 0;
}
.ops-heatmap-date {
  color: var(--c-text-muted);
  font-size: 10px;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ops-heatmap-label {
  display: grid;
  gap: 2px;
}
.ops-heatmap-label strong,
.ops-heatmap-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-heatmap-label strong {
  color: var(--c-text);
  font-size: 11px;
  font-weight: 800;
}
.ops-heatmap-label span {
  color: var(--c-text-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.ops-heatmap-cell {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid #e4e8ee;
  border-radius: 4px;
  background: #f4f6f8;
  color: transparent;
  cursor: default;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ops-heatmap-cell:focus-visible {
  outline: 2px solid rgba(26, 47, 78, 0.28);
  outline-offset: 1px;
}
.ops-heatmap-cell span {
  display: block;
  transform: translateY(0.5px);
}
.ops-heatmap-cell.level-0 {
  color: transparent;
}
.ops-heatmap-cell.level-1 {
  color: rgba(26, 47, 78, 0.62);
}
.ops-heatmap-cell.level-2,
.ops-heatmap-cell.level-3 {
  color: rgba(26, 47, 78, 0.86);
}
.ops-heatmap-cell.level-4 {
  color: #fff;
}
.ops-heatmap-cell.is-visitors.level-1 {
  background: #dbeafe;
  border-color: #bfdbfe;
}
.ops-heatmap-cell.is-visitors.level-2 {
  background: #93c5fd;
  border-color: #60a5fa;
}
.ops-heatmap-cell.is-visitors.level-3 {
  background: #3b82f6;
  border-color: #2563eb;
}
.ops-heatmap-cell.is-visitors.level-4 {
  background: #1d4ed8;
  border-color: #1e40af;
}
.ops-heatmap-cell.is-pageviews.level-1 {
  background: #fef3c7;
  border-color: #fde68a;
}
.ops-heatmap-cell.is-pageviews.level-2 {
  background: #fcd34d;
  border-color: #fbbf24;
}
.ops-heatmap-cell.is-pageviews.level-3 {
  background: #d97706;
  border-color: #b45309;
}
.ops-heatmap-cell.is-pageviews.level-4 {
  background: #92400e;
  border-color: #78350f;
}
.ops-heatmap-cell.is-submissions.level-1 {
  background: #dcfce7;
  border-color: #bbf7d0;
}
.ops-heatmap-cell.is-submissions.level-2 {
  background: #86efac;
  border-color: #4ade80;
}
.ops-heatmap-cell.is-submissions.level-3 {
  background: #16a34a;
  border-color: #15803d;
}
.ops-heatmap-cell.is-submissions.level-4 {
  background: #166534;
  border-color: #14532d;
}
.ops-heatmap-summary {
  min-height: 18px;
  margin-top: 10px;
  color: var(--c-text-sub);
  font-size: 11px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.ops-empty {
  padding: 18px 10px;
  color: var(--c-text-muted);
  font-size: 12px;
  text-align: center;
  border: 1px dashed var(--c-border);
  border-radius: 8px;
  background: #fafbfc;
}
.ops-insights-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.ops-insight-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.82fr);
  gap: 12px;
  min-width: 0;
}
.ops-insight-panel {
  overflow: hidden;
}
.ops-funnel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ops-funnel-step {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.ops-funnel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.ops-funnel-head span,
.ops-funnel-step em {
  color: var(--c-text-muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.ops-funnel-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-funnel-head strong {
  flex: 0 0 auto;
  color: var(--c-text);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ops-funnel-track,
.ops-conversion-track,
.ops-hour-meter {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f4;
}
.ops-funnel-track {
  height: 10px;
  margin: 10px 0 7px;
}
.ops-funnel-track i,
.ops-conversion-track i,
.ops-hour-meter i {
  display: block;
  height: 100%;
  width: 0;
  min-width: 2px;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--c-brand), #c2a679);
}
.ops-funnel-summary {
  min-height: 18px;
  margin-top: 10px;
  color: var(--c-text-sub);
  font-size: 11px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
.ops-conversion-list {
  display: grid;
  gap: 9px;
}
.ops-conversion-list .ops-empty,
.ops-hour-grid .ops-empty,
.ops-location-list .ops-empty {
  grid-column: 1 / -1;
}
.ops-conversion-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 7px 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.ops-conversion-source {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 4px 7px;
  min-width: 0;
}
.ops-conversion-source .source-kpi-dot {
  margin-top: 5px;
}
.ops-conversion-source strong,
.ops-conversion-source em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-conversion-source strong {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 800;
}
.ops-conversion-source em {
  grid-column: 2;
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-style: normal;
}
.ops-conversion-rate {
  color: var(--c-brand);
  font-size: 15px;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ops-conversion-track {
  grid-column: 1 / -1;
  height: 6px;
}
.ops-hour-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.ops-hour-item {
  min-width: 0;
  padding: 10px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.ops-hour-item.is-hot {
  background: var(--c-brand);
  border-color: var(--c-brand);
}
.ops-hour-item.is-warm {
  background: #fff8ed;
  border-color: #f3d3a3;
}
.ops-hour-item.is-cool {
  background: #f8fafc;
  border-color: #dbe3ee;
}
.ops-hour-item.is-empty {
  background: #f7f8fa;
  border-color: #edf0f4;
}
.ops-hour-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.ops-hour-head span {
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-weight: 800;
}
.ops-hour-head strong {
  color: var(--c-text);
  font-size: 16px;
  line-height: 1.1;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ops-hour-item em {
  display: block;
  margin-top: 5px;
  color: var(--c-text);
  font-size: 13px;
  font-weight: 800;
  font-style: normal;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
.ops-hour-meter {
  height: 6px;
  margin-top: 8px;
}
.ops-hour-meter i {
  background: var(--c-brand);
}
.ops-hour-item.is-hot .ops-hour-head span,
.ops-hour-item.is-hot .ops-hour-head strong,
.ops-hour-item.is-hot em {
  color: #fff;
}
.ops-hour-item.is-hot .ops-hour-meter {
  background: rgba(255, 255, 255, 0.24);
}
.ops-hour-item.is-hot .ops-hour-meter i {
  background: #c2a679;
}
.ops-hour-item.is-warm .ops-hour-head strong,
.ops-hour-item.is-warm em {
  color: #8a5f18;
}
.ops-hour-item.is-warm .ops-hour-meter i {
  background: #c2a679;
}
.ops-hour-item.is-cool .ops-hour-meter i {
  background: #6b7f9b;
}
.ops-hour-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 10px;
}
.ops-hour-summary-item {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fff;
}
.ops-hour-summary-item span,
.ops-hour-summary-item strong,
.ops-hour-summary-item em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-hour-summary-item span {
  color: var(--c-text-muted);
  font-size: 10px;
  font-weight: 800;
}
.ops-hour-summary-item strong {
  margin-top: 3px;
  color: var(--c-text);
  font-size: 12.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ops-hour-summary-item em {
  margin-top: 2px;
  color: var(--c-text-muted);
  font-size: 10px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}
.ops-location-top {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf0f4;
}
.ops-location-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ops-location-head strong {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 800;
}
.ops-location-head span {
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.ops-location-list {
  display: grid;
  gap: 7px;
}
.ops-location-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.ops-location-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--c-brand);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}
.ops-location-main {
  min-width: 0;
}
.ops-location-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.ops-location-title strong {
  min-width: 0;
  overflow: hidden;
  color: var(--c-text);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-location-title b {
  flex: 0 0 auto;
  color: var(--c-brand);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.ops-location-main em {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ops-location-track {
  position: relative;
  width: 100%;
  height: 6px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f4;
}
.ops-location-track i {
  display: block;
  width: 0;
  min-width: 2px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
}
.ops-location-detail-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: var(--c-text);
  cursor: pointer;
  text-align: left;
}
.ops-location-detail-btn strong {
  font-size: 12px;
  font-weight: 800;
}
.ops-location-detail-btn span {
  flex: 0 0 auto;
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-weight: 700;
}
.ops-location-detail-btn:hover,
.ops-location-detail-btn:focus-visible {
  border-color: var(--c-brand);
  outline: none;
}
.visitor-detail-panel {
  max-width: 980px;
}
.visitor-detail-head {
  align-items: flex-start;
}
.visitor-detail-head h2 {
  margin-bottom: 3px;
}
.visitor-detail-head p {
  margin: 0;
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 700;
}
.visitor-detail-close {
  width: 32px;
  height: 32px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  background: #fff;
  color: var(--c-text);
  font-size: 20px;
  line-height: 1;
}
.visitor-detail-body {
  display: grid;
  gap: 14px;
}
.visitor-detail-filter {
  display: grid;
  gap: 10px;
}
.visitor-detail-seg {
  flex-wrap: wrap;
}
.visitor-detail-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}
.visitor-detail-picker[hidden] {
  display: none;
}
.visitor-detail-picker label {
  display: grid;
  gap: 4px;
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-weight: 800;
}
.visitor-detail-picker input {
  min-height: 34px;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--c-text);
  font: inherit;
}
.visitor-detail-content {
  display: grid;
  gap: 14px;
}
.visitor-detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.visitor-detail-metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.visitor-detail-metric span,
.visitor-detail-metric strong,
.visitor-detail-metric em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visitor-detail-metric span {
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-weight: 800;
}
.visitor-detail-metric strong {
  margin-top: 5px;
  color: var(--c-text);
  font-size: 18px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.visitor-detail-metric em {
  margin-top: 3px;
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-style: normal;
}
.visitor-detail-section {
  display: grid;
  gap: 9px;
}
.visitor-detail-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.visitor-detail-section-head h3 {
  margin: 0;
  color: var(--c-text);
  font-size: 13px;
  font-weight: 850;
}
.visitor-detail-section-head span {
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-weight: 800;
}
.visitor-detail-top-list {
  display: grid;
  gap: 7px;
}
.visitor-detail-top-row {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  padding: 10px 12px 14px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fff;
}
.visitor-detail-top-row > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #edf4ff;
  color: #2563eb;
  font-size: 10.5px;
  font-weight: 850;
}
.visitor-detail-top-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--c-text);
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visitor-detail-top-row em {
  color: var(--c-text-muted);
  font-size: 11px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.visitor-detail-top-row i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
}
.visitor-detail-month {
  overflow: hidden;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fff;
}
.visitor-detail-month summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
}
.visitor-detail-month summary::-webkit-details-marker {
  display: none;
}
.visitor-detail-month summary strong {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 850;
}
.visitor-detail-month summary span {
  color: var(--c-brand);
  font-size: 11px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.visitor-detail-day-list {
  display: grid;
  border-top: 1px solid #edf0f4;
}
.visitor-detail-day-row {
  display: grid;
  grid-template-columns: 62px 80px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 9px 12px;
}
.visitor-detail-day-row + .visitor-detail-day-row {
  border-top: 1px solid #f1f3f6;
}
.visitor-detail-day-row span {
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 800;
}
.visitor-detail-day-row strong {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.visitor-detail-day-row em {
  min-width: 0;
  overflow: hidden;
  color: var(--c-text-muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.visitor-detail-event-list {
  display: grid;
  gap: 7px;
}
.visitor-detail-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e7ebf0;
  border-radius: 8px;
  background: #fafbfc;
}
.visitor-detail-event-row div,
.visitor-detail-event-row p {
  min-width: 0;
}
.visitor-detail-event-row strong {
  color: var(--c-text);
  font-size: 12px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.visitor-detail-event-row span {
  margin-left: 7px;
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 700;
}
.visitor-detail-event-row em {
  color: var(--c-text-muted);
  font-size: 10.5px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.visitor-detail-event-row p {
  grid-column: 1 / -1;
  margin: 0;
  overflow: hidden;
  color: var(--c-text-muted);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 860px) {
  .ops-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-layout {
    grid-template-columns: 1fr;
  }
  .ops-main-stack,
  .ops-side,
  .ops-heatmap-mobile {
    grid-column: auto;
  }
  .ops-heatmap-desktop {
    display: none;
  }
  .ops-heatmap-mobile {
    display: block;
  }
  .ops-main-stack {
    display: contents;
  }
  .ops-main-panel {
    order: 1;
  }
  .ops-side {
    order: 2;
  }
  .ops-heatmap-mobile {
    order: 3;
  }
  .ops-insights-stack {
    order: 4;
  }
  .ops-funnel {
    grid-template-columns: 1fr;
  }
  .ops-insight-two {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .analytics-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .seg {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border-radius: 12px;
  }
  .seg-btn {
    min-width: 0;
    padding: 8px 6px;
    font-size: 12px;
  }
  .analytics-range-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    gap: 8px;
  }
  .analytics-range-picker label,
  .analytics-range-picker input[type="date"] {
    min-width: 0;
    width: 100%;
  }
  .btn-apply-range {
    grid-column: 1 / -1;
    min-height: 34px;
  }
  .ops-dashboard {
    padding: 12px;
    border-radius: 10px;
  }
  .ops-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .ops-head h2 {
    font-size: 18px;
  }
  .ops-period {
    width: 100%;
    border-radius: 12px;
  }
  .ops-period-btn {
    padding: 9px 6px;
  }
  .ops-kpi-grid {
    gap: 8px;
  }
  .ops-kpi {
    padding: 12px 10px;
    border-radius: 8px;
  }
  .ops-kpi strong {
    font-size: 24px;
  }
  .ops-kpi em {
    font-size: 10.5px;
  }
  .ops-target-control {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 11px 10px;
  }
  .ops-target-copy span {
    white-space: normal;
  }
  .ops-target-manual,
  .ops-target-input {
    width: 100%;
  }
  .ops-target-input {
    justify-content: space-between;
  }
  .ops-target-input input {
    flex: 1;
    width: auto;
  }
  .ops-panel {
    padding: 13px 12px;
  }
  .ops-panel .panel-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    margin-bottom: 12px;
  }
  .ops-bar-row {
    grid-template-columns: 64px minmax(0, 1fr) 42px;
    gap: 7px;
  }
  .ops-bar-label,
  .ops-bar-value {
    font-size: 11px;
  }
  .ops-bar-track {
    height: 11px;
  }
  .ops-target {
    font-size: 11px;
  }
  .ops-weekdays {
    grid-template-columns: repeat(7, minmax(34px, 1fr));
    gap: 4px;
  }
  .ops-weekday {
    padding: 7px 2px;
    border-radius: 7px;
  }
  .ops-weekday strong {
    font-size: 11px;
  }
  .ops-weekday span {
    font-size: 10px;
  }
  .ops-action,
  .ops-rank {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }
  .ops-heatmap-grid {
    grid-template-columns: 54px repeat(var(--heatmap-days), 17px);
    gap: 4px;
  }
  .ops-heatmap-cell {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    font-size: 8px;
  }
  .ops-funnel-step,
  .ops-conversion-row,
  .ops-hour-item,
  .ops-location-row {
    padding: 9px 10px;
  }
  .ops-funnel-head strong {
    font-size: 16px;
  }
  .ops-conversion-row {
    grid-template-columns: minmax(0, 1fr) 58px;
  }
  .ops-hour-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-location-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .ops-location-head span {
    white-space: normal;
  }
  .ops-location-detail-btn {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .ops-location-detail-btn span {
    white-space: normal;
  }
  .visitor-detail-modal {
    align-items: stretch;
    padding: 10px;
  }
  .visitor-detail-panel {
    max-height: calc(100vh - 20px);
  }
  .visitor-detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .visitor-detail-top-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .visitor-detail-top-row em {
    grid-column: 2;
    white-space: normal;
  }
  .visitor-detail-day-row {
    grid-template-columns: 54px 64px minmax(0, 1fr);
  }
  .visitor-detail-event-row {
    grid-template-columns: 1fr;
  }
  .visitor-detail-event-row span {
    display: block;
    margin: 3px 0 0;
  }
  .visitor-detail-event-row em {
    white-space: normal;
  }
}
@media (max-width: 380px) {
  .ops-dashboard {
    margin-inline: -2px;
    padding-inline: 10px;
  }
  .ops-kpi {
    padding-inline: 8px;
  }
  .ops-kpi strong {
    font-size: 22px;
  }
  .ops-weekdays {
    grid-template-columns: repeat(7, minmax(31px, 1fr));
  }
  .ops-bar-row {
    grid-template-columns: 58px minmax(0, 1fr) 38px;
  }
}
.sub-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
@media (max-width: 640px) {
  .sub-kpi {
    grid-template-columns: repeat(2, 1fr);
  }
}
.sub-kpi-item {
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 12px 14px;
}
.sub-kpi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--c-text-muted);
  margin-bottom: 4px;
}
.sub-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}
.source-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.source-kpi-item {
  background: #fafbfc;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 0;
}
.source-kpi-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--c-text-muted);
  font-size: 11px;
  margin-bottom: 4px;
}
.source-kpi-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.source-kpi-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-kpi-value {
  color: var(--c-text);
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.source-kpi-sub {
  color: var(--c-text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}
.chart-wrap canvas {
  max-width: 100% !important;
}
.chart-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-text-muted);
  font-size: 13px;
  background: #fafbfc;
  border: 1px dashed var(--c-border);
  border-radius: 6px;
}
@media (max-width: 640px) {
  .chart-wrap {
    height: 300px;
  }
}
.top-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.top-table thead th {
  text-align: left;
  padding: 8px 10px;
  color: var(--c-text-muted);
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--c-border);
  font-weight: 500;
}
.top-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid #f1f3f5;
  color: var(--c-text);
}
.top-table tbody tr:last-child td {
  border-bottom: 0;
}
.top-table td.num {
  color: var(--c-text-sub);
  font-variant-numeric: tabular-nums;
}
.top-table td.path {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--c-text);
}
.connect-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--c-text-sub);
}
.connect-steps li + li {
  margin-top: 2px;
}

/* ========== HEATMAP ADMIN ========== */
.admin-content--heatmap {
  padding: 0;
}
.heatmap-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 60px);
  background: #f7f8fb;
}
.heatmap-pages {
  background: #fff;
  border-right: 1px solid #e7ebf0;
  padding: 20px 16px;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
}
.heatmap-pages-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e7ebf0;
}
.heatmap-pages-head h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  margin: 0;
}
.heatmap-pages-count {
  font-size: 11px;
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}
.heatmap-pages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.heatmap-page-item {
  appearance: none;
  border: 1px solid #e7ebf0;
  background: #fafbfc;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.heatmap-page-item:hover {
  border-color: var(--c-brand);
  background: #fff;
}
.heatmap-page-item.active {
  border-color: var(--c-brand);
  background: #fff;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.06);
}
.hpi-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: 4px;
  word-break: break-all;
}
.hpi-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--c-text-muted);
  margin-bottom: 2px;
}
.hpi-total {
  font-size: 11px;
  color: var(--c-brand);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.heatmap-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--c-text-muted);
  font-size: 12px;
}

.heatmap-main {
  padding: 20px 24px 32px;
  overflow-x: auto;
}
.heatmap-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e7ebf0;
}
.heatmap-toolbar .seg {
  background: #fff;
}
.heatmap-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}
.btn-refresh {
  appearance: none;
  border: 1px solid #e7ebf0;
  background: #fff;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--c-text-sub);
  font-size: 14px;
  transition:
    border-color 0.15s,
    color 0.15s;
}
.btn-refresh:hover {
  border-color: var(--c-brand);
  color: var(--c-brand);
}

.heatmap-canvases {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.heatmap-device-col {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid #e7ebf0;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.04);
}
.heatmap-device-col[data-device="pc"] {
  width: 720px;
}
.heatmap-device-col[data-device="mobile"] {
  width: 280px;
}
.heatmap-device-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e7ebf0;
}
.heatmap-device-head strong {
  font-size: 13px;
  color: var(--c-text);
}
.heatmap-device-head span {
  font-size: 11px;
  color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}
.heatmap-device-head .hdh-events {
  margin-left: auto;
  color: var(--c-brand);
  font-weight: 600;
}
.heatmap-stage {
  position: relative;
  width: 100%;
  background: #f3f5f8;
  border-radius: 6px;
  overflow: hidden;
}
.heatmap-shot {
  display: block;
  width: 100%;
  height: auto;
}
.heatmap-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: normal;
}
.heatmap-scroll-bar {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  background: transparent;
  pointer-events: none;
}

@media (max-width: 960px) {
  .heatmap-layout {
    grid-template-columns: 1fr;
  }
  .heatmap-pages {
    max-height: 200px;
    border-right: 0;
    border-bottom: 1px solid #e7ebf0;
  }
  .heatmap-pages-list {
    flex-direction: row;
    overflow-x: auto;
  }
  .heatmap-page-item {
    flex: 0 0 200px;
  }
  .heatmap-canvases {
    flex-direction: column;
  }
  .heatmap-device-col[data-device="pc"],
  .heatmap-device-col[data-device="mobile"] {
    width: 100%;
  }
}
