/* Reusable admin · Toss-inspired work UI
   DESIGN.md의 검증된 색상/간격/타이포그래피 토큰을 업무용 웹 화면에 맞게 적용한다. */

:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --sidebar: #ffffff;
  --sidebar-soft: #e8f3ff;
  --text: #191f28;
  --muted: #8b95a1;
  --line: #e5e8eb;
  --accent: #3182f6;
  --accent-strong: #2272eb;
  --accent-weak: #e8f3ff;
  --accent-weak-text: #1b64da;
  --body-text: #4e5968;
  --danger: #e42939;
  --danger-weak: #fff0f1;
  --success: #00a878;
  --success-weak: #e9f9f4;
  --shadow: none;
}

html.adm-theme-dark {
  --bg: #17191c;
  --surface: #202328;
  --sidebar: #202328;
  --sidebar-soft: #27384f;
  --text: #f2f4f6;
  --body-text: #c7cdd4;
  --muted: #8b95a1;
  --line: #343a40;
  --accent-weak: #223b5f;
  --accent-weak-text: #78b5ff;
}

html { background: var(--bg); }
body {
  color: var(--text);
  font-family: "Toss Product Sans", Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { transition: background-color .16s ease, border-color .16s ease, color .16s ease, opacity .16s ease; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(49, 130, 246, .24);
  outline-offset: 2px;
}

input, select, textarea {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
textarea { padding: 13px 14px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #aeb6bf; }
input:hover, select:hover, textarea:hover { background: color-mix(in srgb, var(--bg) 82%, var(--line)); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(49, 130, 246, .12);
}
input:disabled, select:disabled, textarea:disabled, button:disabled { cursor: not-allowed; opacity: .42; }

.adm-shell { grid-template-columns: 248px minmax(0, 1fr); }
.adm-sidebar {
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  color: var(--text);
}
.adm-brand { gap: 12px; padding: 6px 8px 24px; }
.adm-brand-mark {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
}
.adm-brand-copy { gap: 1px; }
.adm-brand-copy strong { color: var(--text); font-size: 19px; font-weight: 700; }
.adm-brand-copy small { color: var(--muted); font-size: 12px; }
.adm-sidebar-toggle {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: var(--bg);
  color: var(--body-text);
  font-weight: 700;
}
.adm-sidebar-toggle:hover { background: var(--accent-weak); color: var(--accent-weak-text); }
.adm-nav { gap: 4px; }
.adm-nav > a, .adm-nav-parent {
  min-height: 48px;
  gap: 11px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--body-text);
  font-size: 15px;
  font-weight: 600;
}
.adm-nav > a:hover, .adm-nav-parent:hover { background: var(--bg); color: var(--text); }
.adm-nav > a.active {
  background: var(--accent-weak);
  color: var(--accent-weak-text);
  font-weight: 700;
}
.adm-nav-icon {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
  border-radius: 9px;
  background: var(--bg);
  color: var(--body-text);
}
.adm-nav > a.active .adm-nav-icon { background: #d7eaff; color: var(--accent-weak-text); }
.adm-nav-section { margin: 16px 0 5px; color: var(--muted); font-size: 12px; }
.adm-nav-section::after { background: var(--line); }
.nav-caret { color: var(--muted); }
.adm-subnav { gap: 2px; padding: 3px 0 4px 52px; }
.adm-subnav a {
  padding: 9px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.adm-subnav a:hover, .adm-subnav a.active { background: var(--accent-weak); color: var(--accent-weak-text); }

html.adm-sidebar-collapsed .adm-shell { grid-template-columns: 86px minmax(0, 1fr); }
html.adm-sidebar-collapsed .adm-sidebar { padding-inline: 12px; }

.adm-main { padding: 24px 28px 56px; }
.adm-top-menu-bar {
  height: 58px;
  margin-bottom: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.adm-top-profile {
  height: 42px;
  padding: 0 14px 0 8px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
}
.adm-top-profile strong { font-size: 14px; font-weight: 700; }
.adm-top-profile small { color: var(--muted); font-size: 11px; }
.profile-dot { width: 30px; height: 30px; background: var(--accent-weak); color: var(--accent-weak-text); }
.adm-theme-toggle {
  width: 76px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
}
.adm-theme-toggle i { width: 32px; height: 32px; box-shadow: none; background: var(--bg); }
.adm-theme-dark .adm-theme-toggle i { transform: translateX(36px); }
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-weak);
  color: var(--accent-weak-text);
}
.icon-btn:hover { background: #d8eaff; }
.icon-btn.logout { background: var(--danger-weak); color: var(--danger); }

.adm-page-head { margin-bottom: 24px; }
.adm-eyebrow { margin-bottom: 4px; color: var(--accent); font-size: 13px; font-weight: 700; }
.adm-page-head h1 { font-size: 30px; line-height: 45px; font-weight: 700; letter-spacing: -.025em; }
.head-actions { gap: 8px; margin: -66px 0 24px; }

.primary-btn, .secondary-btn, .small-btn, .toolbar button, .distribution-trigger, .add-group-bottom {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}
.primary-btn, .toolbar button, .distribution-trigger, .add-group-bottom {
  background: var(--accent);
  color: #fff;
}
.primary-btn:hover, .toolbar button:hover, .distribution-trigger:hover, .add-group-bottom:hover { background: var(--accent-strong); }
.secondary-btn, .small-btn {
  border: 0;
  background: var(--accent-weak);
  color: var(--accent-weak-text);
}
.secondary-btn:hover, .small-btn:hover { background: #d8eaff; }

.adm-stats { gap: 16px; margin-bottom: 20px; }
.adm-stat-card, .adm-panel {
  padding: 24px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
}
.adm-stat-card { min-height: 126px; }
.adm-stat-card p { margin-bottom: 12px; color: var(--body-text); font-size: 14px; font-weight: 600; }
.adm-stat-card strong { font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -.03em; }
.dashboard-summary-grid { gap: 16px; }
.panel-head { margin-bottom: 16px; }
.panel-head h2, .memo-list h2 { font-size: 20px; line-height: 30px; font-weight: 700; }
.recent-list li { min-height: 66px; padding: 14px 2px; }
.recent-list strong { font-weight: 700; }
.recent-list span, .recent-list em { color: var(--muted); font-size: 13px; }

.toolbar {
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
}
.toolbar input[type=search] { min-width: 240px; }
.toolbar .page-size-control { padding-left: 4px; color: var(--muted); font-size: 13px; }
.page-size-control select { min-width: 104px; background-color: var(--bg); }

.table-area {
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  scrollbar-color: #c8d0d8 transparent;
  scrollbar-width: thin;
}
.table-area table { border-collapse: separate; border-spacing: 0; }
th, td { height: 58px; padding: 12px 14px; border-bottom-color: var(--line); }
th {
  background: var(--surface);
  color: var(--body-text);
  font-size: 13px;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -.01em;
}
td { color: var(--body-text); font-size: 14px; line-height: 1.45; }
td strong { color: var(--text); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8faff; }
.table-area input[type=checkbox], .menu-check-list input, .distribution-member-list input {
  width: 24px;
  height: 24px;
  min-height: 24px;
  accent-color: var(--accent);
}
.empty-cell { padding: 56px 24px !important; }
.badge {
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--accent-weak);
  color: var(--accent-weak-text);
  font-size: 12px;
  font-weight: 700;
}
.badge.duplicate-count { background: #fff4d6; color: #9a6700; }
.duplicate-row td { background: #fffdf5; }
.text-btn { min-height: 36px; padding: 0 10px; border-radius: 9px; color: var(--accent-weak-text); }
.text-btn:hover { background: var(--accent-weak); }
.danger-link { min-height: 36px; padding: 0 10px; border-radius: 9px; color: var(--danger); }
.danger-link:hover { background: var(--danger-weak); }
.pagination { gap: 8px; margin-top: 20px; }
.pagination a { min-height: 42px; padding: 0 16px; border: 0; border-radius: 11px; background: var(--surface); }
.pagination span { padding: 0 8px; font-size: 13px; }

.sheet-sync-status {
  min-height: 54px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--success-weak);
  color: #087f5b;
}
.sheet-sync-status span { color: #3d8e74; font-size: 13px; }
.sheet-sync-status.error { border: 0; background: var(--danger-weak); color: var(--danger); }

.flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--success-weak);
  color: #087f5b;
  font-weight: 600;
}
.flash.error { background: var(--danger-weak); color: var(--danger); }

.modal-backdrop { background: rgba(25, 31, 40, .48); backdrop-filter: none; }
.modal { padding: 24px; }
.modal-panel, .message-panel {
  padding: 32px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: none;
}
.modal-panel h2, .message-panel h2 { margin-bottom: 24px; font-size: 24px; line-height: 36px; font-weight: 700; }
.modal-close, .message-close {
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--body-text);
}
.form-grid { gap: 18px 16px; }
.form-grid label, .message-panel label { gap: 8px; color: var(--body-text); font-size: 13px; font-weight: 600; }
.modal-actions { gap: 8px; margin-top: 16px; }
.form-help, .menu-access-help, .distribution-empty { border-radius: 12px; background: var(--bg); color: var(--body-text); }

.menu-access-modal { padding: 32px; }
.menu-check-list { gap: 10px; }
.menu-check-list label, .distribution-member-list label {
  min-height: 60px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: var(--bg);
}
.menu-check-list label:has(input:checked), .distribution-member-list label:has(input:checked) {
  background: var(--accent-weak);
  box-shadow: none;
}
.menu-check-list input, .distribution-member-list input { accent-color: var(--accent); }

.member-table table { min-width: 1220px; }
.inline-form { gap: 7px; }
.inline-form select { min-height: 40px; border-radius: 9px; }
.menu-access-btn, .db-workspace-create, .edit-member-btn, .db-workspace-ready, .danger-small {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
}
.menu-access-btn, .db-workspace-create, .edit-member-btn { background: var(--accent-weak); color: var(--accent-weak-text); }
.db-workspace-ready { background: var(--success-weak); color: #087f5b; }
.danger-small { background: var(--danger-weak); color: var(--danger); }

.settings-grid, .guide-list-grid { gap: 16px; }
.settings-card, .guide-list-grid .guide-card, .memo-layout .adm-panel {
  border: 0;
  border-radius: 16px;
  background: var(--surface);
}
.settings-card { min-height: 140px; padding: 24px; }
.settings-card:hover { border-color: transparent; background: #f8faff; }
.settings-card strong { font-size: 20px; line-height: 30px; }
.settings-card span { color: var(--body-text); }
.guide-list-grid .guide-card { min-height: 170px; padding: 22px; }
.guide-card h3 { font-size: 17px; line-height: 1.5; }
.guide-card p { color: var(--body-text); font-size: 13px; }
.doc-icon { color: var(--accent); }
.memo-content { border-radius: 12px; }

.db-board-list { gap: 20px; }
.db-board-group {
  border: 0;
  border-radius: 16px;
  box-shadow: none;
}
.db-board-group-head {
  min-height: 78px;
  padding: 16px 20px;
  border-left-width: 5px;
  background: var(--surface);
}
.db-board-group-head h2 { font-size: 18px; font-weight: 700; }
.db-board-group-head p { font-size: 13px; }
.db-board-table { border-top-color: var(--line); border-radius: 0; }
.db-board-table td input:not([type=checkbox]) { min-height: 42px; background: var(--bg); }
.db-eye-btn { background: var(--accent-weak); color: var(--accent-weak-text); border: 0; border-radius: 10px; }
.db-save-btn, .db-delete-btn { width: 40px; height: 40px; border-radius: 10px; }
.db-save-btn { background: var(--accent); }
.db-delete-btn { background: var(--danger-weak); color: var(--danger); }
.db-original-fields label { border: 0; border-radius: 12px; background: var(--bg); }
.db-field-save { border-radius: 9px; background: var(--accent); color: #fff; }
.db-detail-modal { border-radius: 20px; }
.db-message-icon { border-radius: 12px; }
.db-message-icon.sms { border: 0; background: var(--accent-weak); color: var(--accent-weak-text); }
.db-note-panel .ql-toolbar, .db-note-panel .ql-container, .db-comments { border-color: var(--line); }
.db-note-panel .ql-toolbar { background: var(--bg); }
.message-recipient { border: 0; border-radius: 12px; background: var(--bg); }
.message-recipient strong { color: var(--accent-weak-text); }
.kakao-template-list button { border: 0; border-radius: 12px; background: var(--bg); }
.kakao-template-list button.active { background: var(--accent-weak); box-shadow: none; }

.law-lead-table th, .law-lead-table td { padding-top: 12px; padding-bottom: 12px; }
.law-lead-table .law-text-cell { line-height: 1.45; }
.received-at-cell span { line-height: 1.45; }

.login-page { background: var(--bg); }
.login-card {
  width: min(420px, 100%);
  padding: 40px;
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: none;
}
.login-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; }
.login-tit { color: var(--text); font-size: 30px; line-height: 45px; font-weight: 700; }
.login-sub { color: var(--muted); }
.login-card label { color: var(--body-text); font-size: 13px; }
.login-card input { height: 52px; border: 1px solid transparent; background: var(--bg); color: var(--text); }
.login-card .submit-btn { height: 54px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 700; }
.login-card .submit-btn:hover { background: var(--accent-strong); }
.login-error { border-radius: 12px; background: var(--danger-weak); color: var(--danger); }

@media (max-width: 1180px) {
  .adm-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .adm-main { padding-inline: 20px; }
  .adm-stats { gap: 12px; }
  .adm-stat-card { min-height: 116px; padding: 20px; }
}

@media (max-width: 900px) {
  .adm-shell, .adm-sidebar-collapsed .adm-shell { display: block; }
  .adm-sidebar {
    position: relative;
    height: auto;
    min-height: 0;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .adm-brand { padding: 0 4px 12px; }
  .adm-sidebar-toggle { display: none; }
  .adm-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .adm-nav > a, .adm-nav-parent { justify-content: center; min-width: 0; padding: 0 8px; }
  .adm-nav-section, .adm-nav-group { grid-column: 1 / -1; }
  .adm-nav-group .adm-nav-parent { justify-content: flex-start; }
  .adm-subnav { display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px 0 6px 40px; }
  .adm-main { padding: 20px 16px 48px; }
  .adm-top-menu-bar { margin-bottom: 24px; }
  .dashboard-summary-grid { grid-template-columns: 1fr; }
  .db-detail-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  body { font-size: 14px; }
  .adm-brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .adm-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-nav > a, .adm-nav-parent { justify-content: flex-start; min-height: 44px; }
  .adm-subnav { grid-template-columns: 1fr; padding-left: 42px; }
  .adm-main { padding: 16px 12px 40px; }
  .adm-top-menu-bar { height: 46px; margin-bottom: 20px; }
  .adm-theme-toggle { width: 70px; height: 40px; }
  .icon-btn { width: 40px; height: 40px; }
  .adm-page-head h1 { font-size: 26px; line-height: 39px; }
  .head-actions { margin: 0 0 16px; flex-wrap: wrap; }
  .adm-stats, .adm-stats.three { grid-template-columns: 1fr; }
  .adm-stat-card { min-height: 104px; }
  .toolbar { align-items: stretch; padding: 10px; }
  .toolbar input, .toolbar select, .toolbar button, .toolbar .distribution-trigger { width: 100% !important; }
  .page-size-control { justify-content: space-between; }
  .table-area { border-radius: 14px; }
  th, td { height: 54px; padding: 10px 12px; }
  .modal { padding: 10px; }
  .modal-panel, .message-panel { padding: 24px 16px; border-radius: 18px; }
  .modal-close, .message-close { top: 14px; right: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button, .modal-actions a { width: 100%; }
  .db-detail-title { padding-right: 36px; }
  .db-message-shortcuts { padding-right: 0; }
  .db-original-fields label { grid-template-columns: 76px minmax(0, 1fr); }
  .db-field-save { grid-column: 2; }
  .comment-form { display: flex; }
  .kakao-template-layout, .kakao-variables { grid-template-columns: 1fr; }
  .login-card { padding: 32px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
