/* ============================================================
   LANDING DESK — components.css
   재사용 컴포넌트: 사이드바 · 탑바 · 버튼 · 카드 · 인풋 · 셀렉트
   · 토글 · 탭 · 테이블 · 뱃지 · 칩 · 모달 · 드롭존 · 코드영역
   · SERP 프리뷰 · 토스트
   ============================================================ */

/* =========================================================
   SIDEBAR
   ========================================================= */
.sb {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--sp-5) var(--sp-4);
  overflow-y: auto;
}

/* brand */
.sb-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-2) var(--sp-4);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h3);
  color: var(--text-strong);
  letter-spacing: -.2px;
}
.sb-brand .sb-logo {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: var(--color-primary-grad);
  display: grid; place-items: center;
  color: var(--color-white);
}
.sb-brand .sb-logo svg { width: 18px; height: 18px; }
.sb-brand .sb-logo-img {
  width: 34px; height: 34px;
  flex: none;
  object-fit: contain;
  transition: transform var(--dur) var(--ease-spring);
}
.sb-brand:hover .sb-logo-img { transform: rotate(-6deg) scale(1.06); }

/* profile block */
.sb-profile {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--bg-muted);
  margin-bottom: var(--sp-4);
}
.sb-profile .avatar { flex: none; }
.sb-profile .sb-profile-name { font-weight: var(--fw-semibold); color: var(--text-strong); font-size: var(--fs-sm); }
.sb-profile .sb-profile-role { font-size: var(--fs-xs); color: var(--text-muted); }

/* mini stats */
.sb-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.sb-stat {
  text-align: center;
  padding: var(--sp-3) var(--sp-1);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.sb-stat .sb-stat-num { display:block; font-weight: var(--fw-bold); color: var(--text-strong); font-size: var(--fs-h3); }
.sb-stat .sb-stat-label { font-size: 11px; color: var(--text-muted); }
.sb-stat svg { width: 15px; height: 15px; margin: 0 auto var(--sp-1); color: var(--color-primary); }

/* nav groups */
.sb-nav { flex: 1; }
.sb-group { margin-bottom: var(--sp-5); }
.sb-group-label {
  font-size: 11px;
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-faint);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
}
.sb-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-bottom: 2px;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur) var(--ease-spring);
}
.sb-link svg { width: 18px; height: 18px; flex: none; transition: transform var(--dur) var(--ease-spring); }
.sb-link:hover { background: var(--bg-muted); color: var(--text-body); transform: translateX(3px); }
.sb-link:hover svg { transform: scale(1.1); }
.sb-link:active { transform: translateX(3px) scale(.98); }
.sb-link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary-strong);
  font-weight: var(--fw-semibold);
}
.sb-link.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: var(--r-pill);
  background: var(--color-primary);
}
.sb-link.is-active .sb-dot {
  margin-left: auto;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
}
.sb-link.is-inert { cursor: default; opacity: .85; }
.sb-link.is-inert:hover { background: none; color: var(--text-muted); }

/* sidebar footer */
.sb-footer { border-top: 1px solid var(--border); padding-top: var(--sp-4); margin-top: var(--sp-2); }
.sb-footer-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}
.sb-footer-row svg { width: 18px; height: 18px; }
.sb-footer-row.is-inert { cursor: default; }
a.sb-footer-row:hover { background: var(--bg-muted); color: var(--text-body); }
#themeRow { cursor: default; }
.sb-theme-ico { display: inline-flex; transition: transform var(--dur) var(--ease-spring); }
#themeRow:hover .sb-theme-ico { transform: rotate(-15deg); }

/* =========================================================
   TOPBAR
   ========================================================= */
.tb {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: 100%;
  padding: 0 var(--content-pad);
}
.tb-burger {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-body);
  align-items: center; justify-content: center;
}
.tb-burger svg { width: 20px; height: 20px; }
.tb-title { font-size: var(--fs-h1); font-weight: var(--fw-bold); color: var(--text-strong); white-space: nowrap; }

.tb-search {
  flex: 1;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-pill);
  background: var(--gradient-top);
  background-size: 220% 100%;
  background-position: 0% 50%;
  animation: gradient-pan 16s ease-in-out infinite;
}
@keyframes gradient-pan {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .tb-search { animation: none; }
}
.tb-search .tb-search-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
  height: 32px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(4px);
}
.tb-search svg { width: 16px; height: 16px; color: var(--text-body); }
.tb-search input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: var(--fs-sm);
  color: var(--text-body);
}
.tb-search input::placeholder { color: var(--text-muted); }

.tb-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }
.tb-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: grid; place-items: center;
  transition: color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease-out);
}
.tb-icon-btn:hover { color: var(--text-body); border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tb-icon-btn:active { transform: translateY(0) scale(.94); transition-duration: .05s; }
.tb-icon-btn svg { width: 18px; height: 18px; }
.tb-icon-btn .tb-badge { animation: ld-pop var(--dur) var(--ease-spring) both; }
@keyframes ld-pop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
.tb-icon-btn .tb-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--color-primary);
  color: var(--color-white);
  font-size: 10px;
  font-weight: var(--fw-bold);
  display: grid; place-items: center;
}

/* =========================================================
   AVATAR (이니셜 원형)
   ========================================================= */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--color-primary-grad);
  color: var(--color-white);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  display: grid; place-items: center;
  letter-spacing: .3px;
}
.avatar.sm { width: 32px; height: 32px; font-size: var(--fs-xs); }
.avatar.alt-1 { background: var(--avatar-1); }
.avatar.alt-2 { background: var(--avatar-2); }
.avatar.alt-3 { background: var(--avatar-3); }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: 38px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: filter var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring),
              box-shadow var(--dur-fast) var(--ease-out);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.97); transition-duration: .05s; }
.btn-primary { background: var(--color-primary-grad); color: var(--color-white); box-shadow: var(--shadow-sm); }
.btn-primary:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg-card); border-color: var(--border-strong); color: var(--text-body); }
.btn-secondary:hover { background: var(--bg-muted); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-body); }
.btn-danger { background: var(--danger); color: var(--color-white); }
.btn-danger:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); }
.btn-sm { height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn-block { width: 100%; }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring);
}
.icon-btn:hover { background: var(--bg-muted); color: var(--color-primary); transform: scale(1.12); }
.icon-btn:active { transform: scale(.92); transition-duration: .05s; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn svg { width: 17px; height: 17px; }

/* =========================================================
   CARD
   ========================================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-6);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}
.card-head .card-title { font-size: var(--fs-h2); font-weight: var(--fw-semibold); color: var(--text-strong); }
.card-head .card-sub { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
.card-actions { display: flex; align-items: center; gap: var(--sp-2); }
.card-tight { padding: var(--sp-4); }

/* stat card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  transition: transform var(--dur) var(--ease-spring),
              box-shadow var(--dur) var(--ease-out),
              border-color var(--dur) var(--ease-out);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }
.stat-card .stat-icon { transition: transform var(--dur) var(--ease-spring); }
.stat-card .stat-label { font-size: var(--fs-sm); color: var(--text-muted); }
.stat-card .stat-num { font-size: var(--fs-display); font-weight: var(--fw-bold); color: var(--text-strong); line-height: 1.1; margin-top: var(--sp-2); }
.stat-card .stat-trend { font-size: var(--fs-xs); font-weight: var(--fw-semibold); margin-top: var(--sp-2); }
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  background: var(--color-primary-tint);
  color: var(--color-primary);
  display: grid; place-items: center;
  flex: none;
}
.stat-card .stat-icon svg { width: 20px; height: 20px; }

/* =========================================================
   FORM: input / textarea / select / checkbox / toggle
   ========================================================= */
.field { display: block; }
.field + .field { margin-top: var(--sp-4); }
.field-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-strong);
  margin-bottom: var(--sp-2);
}
.field-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-2); }
.field-help { font-size: var(--fs-xs); color: var(--text-muted); margin-top: var(--sp-2); }
.char-count { font-size: var(--fs-xs); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.char-count.over { color: var(--danger); }

.input, .textarea, .select-native {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 var(--sp-3);
  height: 40px;
  font-size: var(--fs-sm);
  color: var(--text-strong);
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
}
.textarea { height: auto; padding: var(--sp-3); resize: vertical; min-height: 88px; line-height: var(--lh-base); }
.input:focus, .textarea:focus, .select-native:focus {
  border-color: var(--color-primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:disabled { color: var(--text-muted); background: var(--bg-muted); }

/* input with prefix (slug) */
.input-group {
  display: flex;
  align-items: stretch;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.input-group:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.input-group .input-prefix {
  display: flex; align-items: center;
  padding: 0 var(--sp-3);
  background: var(--bg-muted);
  border-right: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  white-space: nowrap;
}
.input-group .input { border: none; background: transparent; box-shadow: none; }
.input-group .input:focus { box-shadow: none; }

/* custom select (네이티브 화살표 대체) */
.select-native {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239AA0AC' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-8);
  cursor: pointer;
}

/* checkbox */
.checkbox { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-body); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--color-primary); cursor: pointer; }

/* toggle switch */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-pill);
  transition: background var(--dur) var(--ease-out);
}
.toggle .track::before {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  background: var(--color-white);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease-spring);
}
.toggle input:checked + .track { background: var(--color-primary); }
.toggle input:checked + .track::before { transform: translateX(18px); }
.toggle input:disabled + .track { opacity: .7; cursor: default; }

/* =========================================================
   TABS (underline)
   ========================================================= */
.tabs {
  display: flex;
  gap: var(--sp-1);
  border-bottom: 1px solid var(--border);
}
.tab {
  position: relative;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}
.tab:hover { color: var(--text-body); }
.tab.is-active { color: var(--color-primary-strong); font-weight: var(--fw-semibold); }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: var(--sp-3); right: var(--sp-3); bottom: -1px;
  height: 2px;
  border-radius: var(--r-pill);
  background: var(--color-primary);
  animation: tab-underline var(--dur) var(--ease-spring) both;
  transform-origin: center;
}
@keyframes tab-underline { from { transform: scaleX(0); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

/* pill filter tabs */
.pill-tabs { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pill-tab {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  background: var(--bg-muted);
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-spring);
}
.pill-tab:hover { transform: translateY(-1px); color: var(--text-body); }
.pill-tab:active { transform: scale(.95); transition-duration: .05s; }
.pill-tab.is-active { background: var(--color-primary-soft); color: var(--color-primary-strong); font-weight: var(--fw-semibold); }

/* =========================================================
   TABLE
   ========================================================= */
.table-wrap { overflow-x: auto; }
.table { min-width: 680px; }
.table thead th {
  background: var(--bg-muted);
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  padding: var(--sp-3) var(--sp-4);
  white-space: nowrap;
}
.table thead th:first-child { border-top-left-radius: var(--r-sm); border-bottom-left-radius: var(--r-sm); }
.table thead th:last-child { border-top-right-radius: var(--r-sm); border-bottom-right-radius: var(--r-sm); text-align: right; }
.table tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--text-body);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--dur-fast) var(--ease-out); }
.table tbody tr:hover { background: var(--color-primary-tint); }
.table tbody td { transition: transform var(--dur-fast) var(--ease-out); }
.table tbody tr:hover .cell-name { transform: translateX(3px); }
.table tbody td:last-child { text-align: right; }
.table .cell-name { font-weight: var(--fw-semibold); color: var(--text-strong); white-space: nowrap; }
.table .cell-slug { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.table .cell-date { white-space: nowrap; }
.table .cell-actions { display: inline-flex; gap: var(--sp-1); justify-content: flex-end; }
.table tr.is-pending td { color: var(--text-muted); }
.link-pending {
  font: inherit;
  color: var(--text-body);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease-out);
}
.link-pending:hover { color: var(--color-primary); }

/* =========================================================
   BADGES & CHIPS
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px var(--sp-2);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--bg-muted); color: var(--text-muted); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-3);
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}
.chip-pink { background: var(--chip-pink); color: var(--chip-pink-ink); }
.chip-green { background: var(--chip-green); color: var(--chip-green-ink); }
.chip-blue { background: var(--chip-blue); color: var(--chip-blue-ink); }
.chip-purple { background: var(--chip-purple); color: var(--chip-purple-ink); }
.chip-orange { background: var(--chip-orange); color: var(--chip-orange-ink); }
.chip-teal { background: var(--chip-teal); color: var(--chip-teal-ink); }

/* =========================================================
   MODAL
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,23,40,.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  z-index: 60;
}
.modal-backdrop.is-open { display: flex; animation: ld-fade var(--dur) var(--ease-out) both; }
.modal {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-in var(--dur) var(--ease-spring) both;
}
.modal.modal-wide { max-width: 640px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.modal-head .modal-title { font-size: var(--fs-h2); font-weight: var(--fw-semibold); color: var(--text-strong); }
.modal-body { padding: var(--sp-6); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
}

/* template picker grid (used inside modal) */
.tpl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.tpl-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              transform var(--dur) var(--ease-spring),
              box-shadow var(--dur) var(--ease-out);
}
.tpl-card:hover { border-color: var(--color-primary); background: var(--color-primary-tint); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tpl-card:active { transform: translateY(0) scale(.98); transition-duration: .06s; }
.tpl-card .tpl-thumb {
  height: 64px;
  border-radius: var(--r-sm);
  background: var(--gradient-top);
  margin-bottom: var(--sp-3);
}
.tpl-card .tpl-name { font-weight: var(--fw-semibold); color: var(--text-strong); font-size: var(--fs-sm); }
.tpl-card .tpl-meta { font-size: var(--fs-xs); color: var(--text-muted); }

/* =========================================================
   DROPZONE (image upload mock)
   ========================================================= */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg-input);
  padding: var(--sp-6);
  text-align: center;
  color: var(--text-muted);
  transition: border-color var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              transform var(--dur) var(--ease-spring);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--color-primary); background: var(--color-primary-tint); transform: translateY(-2px); }
.dropzone:hover svg { transform: translateY(-2px); color: var(--color-primary); }
.dropzone svg { width: 28px; height: 28px; margin: 0 auto var(--sp-2); color: var(--text-faint); transition: transform var(--dur) var(--ease-spring), color var(--dur-fast) var(--ease-out); }
.dropzone .dz-text { font-size: var(--fs-sm); }
.dropzone .dz-hint { font-size: var(--fs-xs); color: var(--text-faint); margin-top: var(--sp-1); }
.dropzone.has-file { border-style: solid; border-color: var(--color-primary-soft); background: var(--color-primary-tint); }
.dz-thumb {
  width: 100%;
  height: 96px;
  border-radius: var(--r-sm);
  background: var(--bg-muted);
  display: grid; place-items: center;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}
.dz-thumb svg { width: 26px; height: 26px; }
.dz-filename { font-size: var(--fs-xs); color: var(--text-body); }

/* =========================================================
   CODE AREA (mono)
   ========================================================= */
.code-area {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.6;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  color: var(--text-body);
  white-space: pre;
  overflow-x: auto;
  width: 100%;
  resize: vertical;
}
textarea.code-area { min-height: 140px; white-space: pre; outline: none; }
textarea.code-area:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
pre.code-area { margin: 0; min-height: 120px; }

/* =========================================================
   SERP PREVIEW CARD
   ========================================================= */
.serp {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  background: var(--bg-card);
}
.serp .serp-url { font-size: var(--fs-xs); color: var(--serp-url-tone); margin-bottom: 2px; word-break: break-all; }
.serp .serp-title {
  font-size: 18px;
  line-height: 1.3;
  color: var(--serp-title);
  font-weight: var(--fw-medium);
  margin-bottom: var(--sp-1);
}
.serp .serp-desc { font-size: var(--fs-sm); color: var(--text-body); line-height: var(--lh-base); }


/* =========================================================
   TOAST
   ========================================================= */
.toast-stack {
  position: fixed;
  right: var(--sp-6);
  bottom: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 80;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--text-strong);
  color: var(--color-white);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  animation: toast-in var(--dur) var(--ease-spring);
}
.toast svg { width: 16px; height: 16px; color: var(--success); flex: none; }
.toast.is-leaving { animation: toast-out var(--dur-fast) var(--ease-out) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* =========================================================
   PERMISSION MATRIX (RBAC)
   ========================================================= */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix .mx-yes { color: var(--success); display: inline-flex; }
.matrix .mx-yes svg { width: 18px; height: 18px; }
.matrix .mx-no { color: var(--text-faint); font-weight: var(--fw-bold); }

/* =========================================================
   MISC
   ========================================================= */
.divider { height: 1px; background: var(--border); border: none; margin: var(--sp-4) 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.flex-center { display: flex; align-items: center; gap: var(--sp-2); }
.gap-2 { gap: var(--sp-2); } .gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.list-activity { display: flex; flex-direction: column; gap: var(--sp-3); }
.act-item { display: flex; align-items: center; gap: var(--sp-3); }
.act-item .act-text { font-size: var(--fs-sm); color: var(--text-body); }
.act-item .act-time { font-size: var(--fs-xs); color: var(--text-muted); }

@media (max-width: 1024px) {
  .tb-burger { display: inline-flex; }
}
@media (max-width: 768px) {
  .toast-stack { right: var(--sp-4); left: var(--sp-4); bottom: var(--sp-4); }
  .tb-search { display: none; }
}
