/* =========================================================
   법무법인 KNC — 관리자 페이지 스타일
   (style.css의 디자인 토큰을 함께 사용)
   ========================================================= */
body.admin { background: var(--ivory); word-break: keep-all; }

/* 로그인 */
.login-screen {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: radial-gradient(120% 90% at 80% -10%, rgba(184,144,78,0.18), transparent 55%), linear-gradient(160deg, var(--ink-900), var(--ink-700));
}
.login-card {
  width: min(420px, 100%); background: var(--paper); border-radius: var(--radius-lg);
  padding: 44px 40px; box-shadow: var(--shadow-lg); text-align: center;
}
.login-card .brand-mark { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 18px; font-size: 1.4rem; }
.login-card h1 { font-family: var(--serif); font-size: 1.6rem; color: var(--ink-800); }
.login-card p { color: var(--muted); font-size: 0.92rem; margin: 6px 0 26px; }
.login-card input { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; margin-bottom: 14px; }
.login-card input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(184,144,78,0.15); }
.login-card .login-err { color: #c0392b; font-size: 0.85rem; min-height: 20px; margin-bottom: 8px; }
.login-back { display: inline-block; margin-top: 18px; font-size: 0.85rem; color: var(--muted-2); }

/* 상단바 */
.admin-bar {
  position: sticky; top: 0; z-index: 20; background: var(--ink-900); color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px); box-shadow: var(--shadow);
}
.admin-bar .ab-left { display: flex; align-items: center; gap: 16px; }
.admin-bar .brand-logo { height: 26px; width: auto; display: block; }
.admin-bar .ab-title { font-family: var(--serif); font-size: 1.15rem; }
.admin-bar .ab-title span { display: block; font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.14em; color: rgba(255,255,255,0.55); }
.admin-bar .ab-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.abtn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 18px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; transition: transform 0.25s, background 0.25s, box-shadow 0.25s; cursor: pointer;
}
.abtn svg { width: 16px; height: 16px; }
.abtn-primary { background: var(--brass); color: #1a1204; }
.abtn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(184,144,78,0.4); }
.abtn-ghost { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2); }
.abtn-ghost:hover { background: rgba(255,255,255,0.18); }
.abtn-danger { background: rgba(208,91,74,0.15); color: #ffb4a6; border: 1px solid rgba(208,91,74,0.4); }
.abtn-danger:hover { background: rgba(208,91,74,0.28); }

/* 저장 알림 */
.save-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60;
  transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--ink-800); color: #fff; padding: 14px 26px; border-radius: 999px;
  box-shadow: var(--shadow-lg); font-weight: 600; font-size: 0.92rem; transition: opacity 0.3s, transform 0.3s;
}
.save-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.save-toast.err { background: #b23b2c; }

/* 레이아웃 */
.admin-main { max-width: 1000px; margin: 0 auto; padding: 30px clamp(16px, 4vw, 40px) 80px; }
.admin-intro { color: var(--muted); font-size: 0.95rem; margin-bottom: 22px; }
.admin-intro b { color: var(--ink-800); }

/* 탭 */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 26px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 12px 20px; font-size: 0.98rem; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--ink-800); }
.tab.active { color: var(--brass-600); border-bottom-color: var(--brass); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.3s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 카드/폼 */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
}
.card > h3 { font-family: var(--serif); font-size: 1.25rem; color: var(--ink-800); margin-bottom: 18px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.fld.col2 { grid-column: 1 / -1; }
.fld label { font-size: 0.85rem; font-weight: 600; color: var(--ink-700); }
.fld .hint { font-size: 0.76rem; color: var(--muted-2); font-weight: 400; }
.fld input, .fld textarea, .fld select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px;
  font-family: inherit; font-size: 0.95rem; color: var(--text); background: var(--paper);
}
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(184,144,78,0.13); background: #fff; }
.fld textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

/* 아코디언(변호사/업무) */
.acc-item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.acc-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; }
.acc-head:hover { background: var(--paper); }
.acc-thumb { flex: none; width: 46px; height: 46px; border-radius: 10px; background: linear-gradient(155deg, var(--ink-700), var(--ink-900)); color: var(--brass-300); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; overflow: hidden; }
.acc-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.acc-titles { flex: 1; min-width: 0; }
.acc-titles b { color: var(--ink-800); font-size: 1.02rem; }
.acc-titles span { display: block; font-size: 0.82rem; color: var(--muted); }
.acc-tools { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--ivory); color: var(--muted); transition: background 0.2s, color 0.2s; cursor: pointer; }
.icon-btn:hover { background: var(--brass-100); color: var(--brass-600); }
.icon-btn.del:hover { background: #f7dcd6; color: #b23b2c; }
.icon-btn svg { width: 16px; height: 16px; }
.acc-caret { transition: transform 0.3s; }
.acc-item.open .acc-caret { transform: rotate(180deg); }
.acc-body { display: none; padding: 6px 20px 24px; border-top: 1px solid var(--line); }
.acc-item.open .acc-body { display: block; }

/* 사진 업로더 */
.photo-uploader { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.photo-preview { width: 96px; height: 120px; border-radius: 12px; overflow: hidden; background: linear-gradient(155deg, var(--ink-700), var(--ink-900)); color: var(--brass-300); display: grid; place-items: center; font-family: var(--serif); font-size: 2rem; font-weight: 700; flex: none; border: 1px solid var(--line); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; }
.photo-actions { display: flex; flex-direction: column; gap: 8px; }
.photo-actions .hint { font-size: 0.78rem; color: var(--muted-2); }

/* 리치텍스트 편집기 */
.rte { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.rte:focus-within { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(184,144,78,0.13); }
.rte-toolbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--paper); border-bottom: 1px solid var(--line); }
.rte-btn { min-width: 30px; height: 28px; padding: 0 9px; border-radius: 6px; background: #fff; border: 1px solid var(--line); color: var(--ink-700); font-size: 0.85rem; cursor: pointer; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.rte-btn:hover { background: var(--brass-100); border-color: var(--brass); color: var(--brass-600); }
.rte-btn:active { background: var(--brass-300); }
.rte-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.rte-editor { min-height: 88px; padding: 12px 14px; font-family: inherit; font-size: 0.95rem; line-height: 1.7; color: var(--text); outline: none; }
.rte-editor:empty::before { content: attr(data-ph); color: var(--muted-2); }
.rte-editor b, .rte-editor strong { font-weight: 700; }

.add-row { display: flex; justify-content: center; margin-top: 8px; }
.list-actions { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

/* 백업 */
.backup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.backup-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.backup-card h3 { font-family: var(--serif); font-size: 1.15rem; color: var(--ink-800); margin-bottom: 8px; }
.backup-card p { font-size: 0.9rem; color: var(--muted); margin-bottom: 16px; line-height: 1.6; }

@media (max-width: 720px) {
  .field-grid, .backup-grid { grid-template-columns: 1fr; }
  .admin-bar .ab-title span { display: none; }
}
