:root {
  --admin-accent: #3d7d78;
  --admin-accent-strong: #2f6864;
  --admin-accent-soft: #eaf3f1;
  --admin-bg: #f3f6f8;
  --admin-border: #dce4e9;
  --admin-border-strong: #c9d4db;
  --admin-danger: #ad4545;
  --admin-nav: #172630;
  --admin-nav-hover: #213742;
  --admin-surface: #fff;
  --admin-text: #1f2d38;
  --admin-text-muted: #6c7a84;
  --admin-shadow: 0 16px 40px rgba(23, 38, 48, .08);
  --admin-board-frame-height: 1336px;
}

[hidden] { display: none !important; }

html {
  background: var(--admin-bg);
  color: var(--admin-text);
  overflow-y: scroll;
}

body {
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: "Pretendard Variable", Pretendard, "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

button,
input,
select,
textarea { font: inherit; }

button,
a,
input,
select,
textarea { -webkit-tap-highlight-color: transparent; }

a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[contenteditable="true"]:focus {
  box-shadow: none;
  outline: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[contenteditable="true"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(61, 125, 120, .24);
  outline: 2px solid var(--admin-accent);
  outline-offset: 2px;
}

.sr-only {
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/* Header and navigation */
#header {
  align-items: center;
  background: var(--admin-nav);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08);
  color: #fff;
  display: flex;
  height: 72px;
  justify-content: space-between;
  padding: 0 clamp(24px, 5vw, 72px);
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 50;
}

#header .logo { margin: 0; }

#header .logo a {
  align-items: center;
  border-radius: 6px;
  display: flex;
  min-height: 44px;
}

#header .logo a img {
  display: block;
  max-width: 126px;
  width: 126px;
}

#header nav {
  display: block;
  float: none;
  height: 100%;
}

#header nav > .main-nav {
  align-items: stretch;
  display: flex;
  float: none;
  height: 100%;
  position: relative;
}

#header nav li { float: none; }

#header nav > .main-nav > li { position: relative; }

#header nav > .main-nav > li > a,
#header nav > .main-nav > li > .nav-logout {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: #d8e1e6;
  cursor: pointer;
  display: flex;
  float: none;
  font-size: 14px;
  font-weight: 600;
  height: 72px;
  letter-spacing: -.01em;
  padding: 0 21px;
  position: relative;
  transition: background-color .16s ease, color .16s ease;
  white-space: nowrap;
}

#header nav > .main-nav > li > a::after {
  background: var(--admin-accent);
  bottom: 0;
  content: "";
  height: 3px;
  left: 21px;
  opacity: 0;
  position: absolute;
  right: 21px;
  transform: scaleX(.45);
  transition: opacity .16s ease, transform .16s ease;
}

#header nav > .main-nav > li > a:hover,
#header nav > .main-nav > li > a:focus-visible,
#header nav > .main-nav > li > a.active,
#header nav > .main-nav > li > .nav-logout:hover,
#header nav > .main-nav > li > .nav-logout:focus-visible {
  background: var(--admin-nav-hover);
  color: #fff;
}

#header nav > .main-nav > li > a.active::after {
  opacity: 1;
  transform: scaleX(1);
}

#header nav .dropdown > ul {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  box-shadow: var(--admin-shadow);
  display: block;
  left: 50%;
  min-width: 190px;
  opacity: 0;
  padding: 8px;
  pointer-events: none;
  position: absolute;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  transition: opacity .16s ease, visibility .16s ease;
  visibility: hidden;
}

#header nav .dropdown > ul::before {
  content: "";
  height: 10px;
  left: 0;
  position: absolute;
  right: 0;
  top: -9px;
}

#header nav .dropdown:hover > ul,
#header nav .dropdown:focus-within > ul {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

#header nav .dropdown > ul > li { white-space: nowrap; }

#header nav .dropdown > ul a {
  border-radius: 8px;
  color: #40505c;
  display: block;
  float: none;
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
  padding: 10px 12px;
  transition: background-color .16s ease, color .16s ease;
}

#header nav .dropdown > ul a:hover,
#header nav .dropdown > ul a:focus-visible {
  background: #f3f6f7;
  color: var(--admin-text);
}

#header nav .dropdown > ul a.active {
  background: var(--admin-accent-soft);
  color: var(--admin-accent-strong);
  font-weight: 700;
}

#menu-icon {
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: none;
  height: 44px;
  margin: 0;
  padding: 10px;
  position: static;
  width: 44px;
}

#menu-icon span {
  border: 0;
  border-top: 2px solid #fff;
  display: block;
  margin: 0 0 6px;
  transition: transform .16s ease, opacity .16s ease;
  width: 24px;
}

#menu-icon span:last-child { margin-bottom: 0; }
#menu-icon.active .first { margin-top: 7px; transform: rotate(45deg); }
#menu-icon.active .second { position: static; transform: translateY(-8px) rotate(-45deg); }
#menu-icon.active .third { display: block; opacity: 0; }

/* Working surface */
main { display: block; }

.view {
  min-height: calc(100svh - 72px);
}

.view[hidden] { display: none; }

.contents,
.app {
  color: var(--admin-text);
  display: block;
  margin: 0 auto;
  max-width: 1280px;
  min-height: 0;
  padding: 40px 0 72px;
  width: calc(100% - 48px);
}

.contents .wrap {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(23, 38, 48, .045);
  margin: 0;
  padding: clamp(24px, 3vw, 36px);
}

.contents h2 {
  color: var(--admin-text);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.35;
  margin: 0 0 24px;
}

.top {
  display: flex;
  justify-content: flex-end;
  overflow: visible;
}

.top .right {
  align-items: center;
  color: var(--admin-text-muted);
  float: none;
  font-size: 12px;
  font-weight: 400;
  gap: 5px;
  margin-left: auto;
}

.top .right img { width: 20px; }

.admin_table { overflow: visible; }

#view-board .board-table-frame {
  min-height: var(--admin-board-frame-height);
  position: relative;
  width: 100%;
}

#view-board .admin_table table { table-layout: fixed; }

#view-board .admin_table thead tr { height: 48px; }

#view-board #post-rows tr { height: 64px; }

#view-board #post-rows td {
  max-width: 0;
  overflow: hidden;
  padding-bottom: 12px;
  padding-top: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-board .board-empty {
  left: 0;
  position: absolute;
  right: 0;
  top: 48px;
}

#view-board .board-controls {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  min-height: 40px;
}

#view-board .board-controls .board_page,
#view-board .board-controls .right_box {
  float: none;
  margin: 0;
}

.mobile_wrap {
  overflow-x: auto;
  padding: 0;
  scrollbar-color: #c5d0d6 transparent;
  scrollbar-width: thin;
}

.admin_table table:not(.sun-editor *, .detail-body *) {
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.admin_table table th:not(.sun-editor *, .detail-body *) {
  background: #f6f8fa;
  border-bottom: 1px solid var(--admin-border);
  border-top: 1px solid var(--admin-border);
  color: #51616d;
  font-size: 13px;
  font-weight: 650;
  padding: 13px 10px;
}

.admin_table table th:first-child:not(.sun-editor *, .detail-body *) { border-left: 1px solid var(--admin-border); }
.admin_table table th:last-child:not(.sun-editor *, .detail-body *) { border-right: 1px solid var(--admin-border); }
.admin_table table thead th:first-child:not(.sun-editor *, .detail-body *) { border-radius: 9px 0 0 0; }
.admin_table table thead th:last-child:not(.sun-editor *, .detail-body *) { border-radius: 0 9px 0 0; }

.admin_table table td:not(.sun-editor *, .detail-body *) {
  background: #fff;
  border-bottom: 1px solid #e8edf0;
  color: #3a4a55;
  font-size: 13px;
  padding: 13px 10px;
  text-align: center;
  transition: background-color .14s ease;
}

.admin_table table tbody tr:hover td:not(.sun-editor *, .detail-body *) { background: #fafcfc; }

.admin_table input[type="checkbox"] {
  accent-color: var(--admin-accent);
  height: 16px;
  width: 16px;
}

.board-empty {
  color: var(--admin-text-muted);
  padding: 52px 0;
  text-align: center;
}

.board_page {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 24px;
}

.board_page .pg_btn {
  background: #fff;
  background-image: none !important;
  border: 1px solid var(--admin-border-strong);
  border-radius: 7px;
  color: #51616d;
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  text-indent: 0;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
  width: auto;
}

.board_page .pg_btn.first,
.board_page .pg_btn.prev,
.board_page .pg_btn.next,
.board_page .pg_btn.end {
  background-image: none;
  text-indent: 0;
  width: auto;
}

.board_page .pg_btn:hover:not(:disabled) {
  background: var(--admin-accent-soft);
  border-color: #a9c5c1;
  color: var(--admin-accent-strong);
}

.board_page button:disabled {
  cursor: default;
  opacity: .38;
}

.page-count {
  color: #52616b;
  display: inline-block;
  font-size: 13px;
  min-width: 66px;
  text-align: center;
}

.admin_table .right_box {
  display: flex;
  float: right;
  gap: 7px;
  margin-top: 16px;
}

.admin_table .right_box button,
.write_btn,
.admin_table .contents_btn button,
.post-actions button,
.account-actions button,
.situ_detail {
  align-items: center;
  background: #fff;
  border: 1px solid var(--admin-border-strong);
  border-radius: 8px;
  color: #52616b;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 650;
  justify-content: center;
  margin: 0;
  min-height: 38px;
  padding: 8px 14px;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.admin_table .right_box button:hover,
.admin_table .contents_btn button:hover,
.post-actions button:hover,
.account-actions button:hover,
.situ_detail:hover {
  background: #f7f9fa;
  border-color: #aebcc5;
  color: var(--admin-text);
}

.admin_table .right_box .write_btn,
.admin_table .contents_btn button:last-child,
.post-actions button.primary,
.account-actions button:not(.secondary),
.situ_detail {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

.admin_table .right_box .write_btn:hover,
.admin_table .contents_btn button:last-child:hover,
.post-actions button.primary:hover,
.account-actions button:not(.secondary):hover,
.situ_detail:hover {
  background: var(--admin-accent-strong);
  border-color: var(--admin-accent-strong);
  color: #fff;
}

#delete-selected,
#archive-post { color: var(--admin-danger); }

#archive-post:last-child {
  background: var(--admin-danger);
  border-color: var(--admin-danger);
  color: #fff;
}

#archive-post:last-child:hover {
  background: #923838;
  border-color: #923838;
}

.admin_table .contents_btn {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 28px;
}

.admin_table .contents_tb tr:not(.sun-editor *, .detail-body *) { border: 0; }

.admin_table .contents_tb tr th:not(.sun-editor *, .detail-body *) {
  border-left: 1px solid var(--admin-border);
  border-radius: 0;
  border-top: 0;
  width: 24%;
}

.admin_table .contents_tb tr:first-child th:not(.sun-editor *, .detail-body *),
.admin_table .contents_tb tr:first-child td:not(.sun-editor *, .detail-body *) { border-top: 1px solid var(--admin-border); }

.admin_table .contents_tb tr:first-child th:not(.sun-editor *, .detail-body *) { border-radius: 9px 0 0 0; }
.admin_table .contents_tb tr:first-child td:not(.sun-editor *, .detail-body *) { border-radius: 0 9px 0 0; }

.admin_table .contents_tb tr td:not(.sun-editor *, .detail-body *) {
  border-right: 1px solid var(--admin-border);
  padding: 13px;
  text-align: left;
}

.admin_table .write_tb input[type="text"]:not(.sun-editor *),
.admin_table .write_tb input[type="email"]:not(.sun-editor *),
.admin_table .write_tb input[type="password"]:not(.sun-editor *),
.admin_table .write_tb input[type="date"]:not(.sun-editor *),
.admin_table .write_tb select:not(.sun-editor *),
.account-inline-control,
.admin_table .write_tb textarea:not(.sun-editor *) {
  background: #fff;
  border: 1px solid var(--admin-border-strong);
  border-radius: 7px;
  box-sizing: border-box;
  color: var(--admin-text);
  min-height: 40px;
  padding: 8px 11px;
  width: 100%;
}

.admin_table .write_tb input[readonly] {
  background: #f4f6f7;
  color: var(--admin-text-muted);
}

.detail-body img {
  display: block;
  height: auto;
  margin: 12px auto;
  max-width: 100%;
}

.review-fields { display: flex; gap: 8px; }
.review-fields input { flex: 1; }

.form-note {
  color: var(--admin-text-muted);
  display: block;
  font-size: 12px;
  margin: 7px 0 0;
}

.img_notice {
  color: var(--admin-text-muted);
  font-size: 12px;
  font-weight: 400;
  margin-top: 7px;
}

.logo-preview img {
  height: auto;
  max-height: 160px;
  max-width: 420px;
}

.password-section,
.account-section {
  border-top: 1px solid var(--admin-border);
  margin-top: 36px;
  padding-top: 30px;
}

.password-section h2,
.account-section h2 { margin-bottom: 20px; }

#managed-account-section[hidden] + .account-section {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

#account-list-table { min-width: 760px; }
#account-list-table td { vertical-align: middle; }
.account-actions { white-space: nowrap; }

.account-actions button {
  font-size: 12px;
  margin: 2px;
  min-height: 32px;
  padding: 5px 9px;
}

.account-actions button.secondary {
  background: #fff;
  color: #65737d;
}

.account-status { white-space: nowrap; }

/* Main popup editor: fixed working surface during load, upload and save. */
html.popup-editor-open { overflow: hidden; }
#view-popups { height: calc(100dvh - 72px); min-height: 0; }
#view-popups .contents { height: 100%; max-width: 1600px; padding: 24px 0; }
#view-popups .wrap { display: flex; height: 100%; min-height: 0; padding: 24px; }
#popup-form { display: flex; flex: 1; min-height: 0; min-width: 0; }
#popup-fields { border: 0; display: flex; flex: 1; flex-direction: column; margin: 0; min-height: 0; min-width: 0; padding: 0; }
.popup-toolbar { align-items: center; display: flex; flex: 0 0 auto; gap: 16px; justify-content: space-between; margin-bottom: 16px; }
#view-popups .popup-toolbar h2 { margin: 0; white-space: nowrap; }
.popup-table-frame { border: 1px solid var(--admin-border); border-radius: 9px; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; position: relative; scrollbar-gutter: stable; scrollbar-width: thin; scrollbar-color: var(--admin-border-strong) transparent; }
#popup-list-table { min-width: 760px; table-layout: fixed; width: 100%; }
#popup-list-table th { position: sticky; top: 0; z-index: 1; }
#popup-list-table th:nth-child(1) { width: 55px; }
#popup-list-table th:nth-child(2) { width: 152px; }
#popup-list-table th:nth-child(4) { width: 65px; }
#popup-list-table th:nth-child(5) { width: 160px; }
#popup-list-table td { height: 156px; padding: 12px; vertical-align: middle; }
.popup-thumbnail { align-items: center; background: var(--admin-bg); border: 1px dashed var(--admin-border-strong); border-radius: 8px; cursor: pointer; display: flex; height: 128px; justify-content: center; margin: auto; overflow: hidden; padding: 0; position: relative; width: 108px; }
.popup-thumbnail img { display: block; height: 100%; object-fit: contain; width: 100%; }
.popup-image-placeholder { color: var(--admin-text-muted); font-size: 11px; }
.popup-image-hint { background: rgba(23, 38, 48, .8); bottom: 0; color: #fff; font-size: 10px; left: 0; line-height: 24px; opacity: 0; pointer-events: none; position: absolute; right: 0; }
.popup-thumbnail:hover, .popup-thumbnail.is-dragover { border-color: var(--admin-accent); }
.popup-thumbnail.is-dragover { box-shadow: inset 0 0 0 2px var(--admin-accent); }
.popup-thumbnail:hover .popup-image-hint, .popup-thumbnail:focus-visible .popup-image-hint, .popup-thumbnail.is-dragover .popup-image-hint { opacity: 1; }
.popup-thumbnail[aria-busy="true"]::after { align-items: center; background: rgba(255, 255, 255, .9); color: var(--admin-text); content: "이미지 준비 중"; display: flex; font-size: 11px; inset: 0; justify-content: center; position: absolute; }
.popup-link-row { align-items: center; display: flex; gap: 8px; margin-top: 10px; }
.popup-link-row input { flex: 1; min-width: 0; }
.popup-open-link { align-items: center; border: 1px solid var(--admin-border); border-radius: 7px; color: var(--admin-accent-strong); display: inline-flex; flex: 0 0 64px; font-size: 12px; justify-content: center; min-height: 40px; text-decoration: none; white-space: nowrap; }
.popup-open-link[aria-disabled="true"] { color: var(--admin-text-muted); opacity: .5; pointer-events: none; }
.popup-controls button, .popup-actions button { background: #fff; border: 1px solid var(--admin-border-strong); border-radius: 7px; color: var(--admin-text); cursor: pointer; font-size: 13px; min-height: 38px; padding: 8px 12px; }
.popup-controls button:hover, .popup-actions button:hover { border-color: var(--admin-accent); }
.popup-controls button:disabled, .popup-actions button:disabled { cursor: default; opacity: .45; }
.popup-action-toolbar, .popup-delete-confirm { align-items: center; display: flex; gap: 6px; height: 36px; justify-content: center; white-space: nowrap; }
.popup-actions button { align-items: center; display: inline-flex; flex: 0 0 36px; font-size: 20px; justify-content: center; line-height: 1; margin: 0; min-height: 36px; padding: 0; width: 36px; }
.popup-delete-confirm button { flex-basis: auto; font-size: 11px; padding: 0 9px; width: auto; }
.popup-actions button[data-popup-action="delete"],
.popup-actions button[data-popup-action="confirm-delete"] { color: var(--admin-danger); }
.popup-empty { color: var(--admin-text-muted); font-size: 13px; left: 20px; position: absolute; right: 20px; text-align: center; top: 50%; transform: translateY(-50%); }
.popup-controls { align-items: center; display: flex; flex: 0 0 auto; gap: 8px; white-space: nowrap; }
.popup-controls button { min-width: 64px; }
#save-popups { background: var(--admin-accent); color: #fff; }
.popup-history-dialog { background: var(--admin-surface); border: 1px solid var(--admin-border); border-radius: 12px; box-shadow: var(--admin-shadow); box-sizing: border-box; color: var(--admin-text); height: min(760px, calc(100dvh - 32px)); margin: auto; max-height: none; max-width: none; overflow: hidden; padding: 24px; width: min(1080px, calc(100vw - 32px)); }
.popup-history-dialog[open] { display: flex; flex-direction: column; gap: 16px; }
.popup-history-dialog::backdrop { background: rgba(23, 38, 48, .55); }
.popup-history-header { align-items: center; display: flex; flex: 0 0 auto; gap: 16px; justify-content: space-between; }
#view-popups .popup-history-header h2 { font-size: 20px; margin: 0; }
#popup-history-note { color: var(--admin-text-muted); flex: 0 0 auto; font-size: 13px; margin: 0; }
.popup-history-picker { align-items: center; display: flex; flex: 0 0 auto; gap: 12px; }
.popup-history-picker label { flex: 0 0 auto; font-size: 13px; }
.popup-history-picker > .popup-controls { justify-content: flex-end; width: 88px; }
.popup-history-picker select { background: var(--admin-surface); border: 1px solid var(--admin-border-strong); border-radius: 7px; color: var(--admin-text); flex: 1; font-size: 13px; min-height: 40px; min-width: 0; padding: 8px; }
.popup-history-frame { border: 1px solid var(--admin-border); border-radius: 9px; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; position: relative; scrollbar-gutter: stable; }
.popup-history-status { align-items: center; background: var(--admin-surface); color: var(--admin-text-muted); display: flex; inset: 0; justify-content: center; margin: 0; padding: 24px; position: absolute; text-align: center; z-index: 1; }
.popup-history-items { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; margin: 0; padding: 16px; }
.popup-history-item { min-width: 0; }
.popup-history-image { align-items: center; background: var(--admin-bg); border: 1px solid var(--admin-border); border-radius: 7px; display: flex; height: 240px; justify-content: center; overflow: hidden; }
.popup-history-image img { display: block; height: 100%; object-fit: contain; width: 100%; }
.popup-history-item h3 { font-size: 14px; margin: 8px 0 4px; overflow-wrap: anywhere; }
.popup-history-item p { color: var(--admin-text-muted); font-size: 12px; margin: 4px 0 0; overflow-wrap: anywhere; }
.popup-history-footer { align-items: flex-end; display: flex; flex: 0 0 auto; gap: 16px; justify-content: space-between; }
.popup-history-warning { flex: 1; font-size: 13px; min-height: 42px; }
.popup-history-warning input { accent-color: var(--admin-accent); margin: 0 4px 0 0; vertical-align: middle; }
#apply-popup-history { background: var(--admin-accent); color: #fff; }
@media screen and (max-width: 799px) {
  .popup-history-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .popup-history-image { height: 220px; }
}
@media screen and (max-width: 959px) {
  #view-popups { height: calc(100dvh - 64px); }
}
@media screen and (max-width: 500px) {
  #view-popups .contents { padding: 12px 0; }
  #view-popups .wrap { padding: 16px; }
  .popup-toolbar { gap: 8px; margin-bottom: 12px; }
  .popup-controls { gap: 6px; }
  .popup-controls button { font-size: 12px; min-width: 52px; padding: 8px; }
  .popup-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .popup-history-dialog { padding: 16px; }
  .popup-history-dialog[open] { gap: 12px; }
  .popup-history-picker { flex-wrap: wrap; gap: 8px; }
  .popup-history-items { gap: 12px; padding: 12px; }
  .popup-history-image { height: 180px; }
  .popup-history-footer { align-items: stretch; flex-direction: column; gap: 8px; }
  .popup-history-warning { min-height: 63px; }
  .popup-history-footer .popup-controls { justify-content: flex-end; }
}

/* Dashboard */
.app-body { padding: 0; }

.tiles {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 370px);
  margin: 0;
}

.tile {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  box-shadow: 0 8px 26px rgba(23, 38, 48, .045);
  color: var(--admin-text);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 178px;
  padding: 28px;
  position: relative;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.tile:hover {
  border-color: #b8cacb;
  box-shadow: 0 14px 32px rgba(23, 38, 48, .09);
}

.tile-header { align-items: center; display: flex; }

.tile-header h3 {
  display: flex;
  flex-direction: column;
  line-height: 1.45;
  margin: 0;
}

.tile-header h3 span:first-child {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.03em;
}

.tile-header h3 span:last-child {
  color: var(--admin-text-muted);
  font-size: 13px;
  font-weight: 400;
  margin-top: 4px;
}

.tile .count {
  color: var(--admin-accent-strong);
  font-style: normal;
  font-weight: 750;
}

.tile a {
  align-items: center;
  color: var(--admin-accent-strong);
  display: flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: flex-start;
  text-decoration: none;
}

.tile a::after {
  bottom: 0;
  content: "";
  display: block;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

/* Feedback */
.toast-region {
  bottom: 20px;
  display: grid;
  gap: 7px;
  position: fixed;
  right: 20px;
  z-index: 100;
}

.toast {
  background: var(--admin-nav);
  border-radius: 9px;
  box-shadow: var(--admin-shadow);
  color: #fff;
  font-size: 13px;
  max-width: 360px;
  padding: 11px 15px;
}

.toast.error { background: #943f3f; }

.busy {
  background: var(--admin-nav);
  border-radius: 8px;
  bottom: 20px;
  color: #fff;
  font-size: 12px;
  left: 50%;
  padding: 9px 14px;
  position: fixed;
  transform: translateX(-50%);
  z-index: 90;
}

/* Login */
body.login-page {
  background: var(--admin-bg);
  color: var(--admin-text);
  min-height: 100svh;
  padding: 24px 0;
}

.login-page .grid {
  max-inline-size: 420px;
  width: min(92%, 420px);
}

.login-page .login {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
  box-shadow: var(--admin-shadow);
  overflow: hidden;
}

.login-page .login__header {
  background: var(--admin-nav);
  border-radius: 0;
  color: #fff;
  padding: 27px 24px;
  text-align: center;
}

.login-page .login__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.025em;
}

.login-page .login__body {
  background: #fff;
  display: grid;
  gap: 12px;
  padding: 28px 28px 18px;
}

.login-page .login__body::before { display: none; }

.login-page .login #login-id,
.login-page .login #login-password {
  background: #fff;
  border: 1px solid var(--admin-border-strong);
  border-radius: 8px;
  color: var(--admin-text);
  display: block;
  min-height: 48px;
  padding: 12px 14px;
  width: 100%;
}

.login-page .login__footer {
  align-items: stretch;
  background: #fff;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 28px 28px;
}

.login-page .login input[type="submit"] {
  background: var(--admin-accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  min-height: 46px;
  order: 1;
  padding: 11px 16px;
  transition: background-color .16s ease, transform .16s ease;
}

.login-page .login input[type="submit"]:hover,
.login-page .login input[type="submit"]:focus-visible {
  background: var(--admin-accent-strong);
}

.login-message {
  color: var(--admin-text-muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  min-height: 18px;
  order: 2;
  text-align: center;
}

.login-message.error { color: var(--admin-danger); }

@media only screen and (max-width: 959px) {
  #header {
    height: 64px;
    padding: 0 18px;
  }

  #header .logo a img {
    max-width: 116px;
    width: 116px;
  }

  #menu-icon { display: block; }

  #header nav {
    background: var(--admin-nav);
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 12px;
    box-shadow: 0 18px 36px rgba(9, 18, 23, .25);
    display: none;
    height: auto;
    left: 12px;
    max-height: calc(100svh - 82px);
    overflow-y: auto;
    padding: 8px;
    position: absolute;
    right: 12px;
    top: calc(100% + 8px);
    width: auto;
  }

  body.menu-open #header nav { display: block !important; }

  #header nav > .main-nav {
    align-items: stretch;
    display: flex;
    flex-direction: column;
    height: auto;
  }

  #header nav > .main-nav > li > a,
  #header nav > .main-nav > li > .nav-logout {
    border-radius: 8px;
    height: auto;
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
  }

  #header nav > .main-nav > li > a::after { display: none; }

  #header nav .dropdown > ul {
    background: transparent;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, .15);
    border-radius: 0;
    box-shadow: none;
    display: block;
    left: auto;
    margin: 3px 0 7px 16px;
    min-width: 0;
    opacity: 1;
    padding: 2px 0 2px 8px;
    pointer-events: auto;
    position: static;
    transform: none;
    visibility: visible;
  }

  #header nav .dropdown > ul::before { display: none; }

  #header nav .dropdown > ul a {
    color: #b9c6cd;
    padding: 8px 12px;
  }

  #header nav .dropdown > ul a::before { content: none; }

  #header nav .dropdown > ul a:hover,
  #header nav .dropdown > ul a:focus-visible,
  #header nav .dropdown > ul a.active {
    background: rgba(255, 255, 255, .08);
    color: #fff;
  }

  .view { min-height: calc(100svh - 64px); }
}

@media screen and (max-width: 800px) {
  .top .right { display: flex; }
  .admin_table table:not(.sun-editor *, .detail-body *) { min-width: 860px; width: 100%; }
  .admin_table .contents_tb { min-width: 720px; }
  .detail-body { min-width: 480px; }
}

@media screen and (max-width: 500px) {
  .contents,
  .app {
    padding: 20px 0 48px;
    width: calc(100% - 24px);
  }

  .contents .wrap { padding: 20px 16px; }
  .contents h2 { font-size: 19px; margin-bottom: 18px; }

  .tile {
    min-height: 158px;
    padding: 22px;
  }

  #view-board .board-controls {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    min-height: 92px;
  }

  #view-board .board-controls .right_box { align-self: flex-end; }

  .review-fields { display: block; }
  .review-fields input { margin-bottom: 6px; width: 100%; }
  .toast-region { bottom: 12px; left: 12px; right: 12px; }
  .toast { max-width: none; }
  .login-page .login__body { padding: 24px 20px 16px; }
  .login-page .login__footer { padding: 0 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

/* Semantic article formatting is scoped to the editing and reading surfaces. */
#post-status,
#health-status {
  background: #fff;
  border: 1px solid var(--admin-border-strong);
  border-radius: 6px;
  color: var(--admin-text);
  font: inherit;
  min-height: 36px;
  max-width: 100%;
  padding: 4px 9px;
}
.detail-body { line-height: 1.8; text-align: left; }
.contents .detail-body h1 { font-size: 30px; font-weight: 700; line-height: 1.4; margin: 1em 0 .6em; }
.contents .detail-body h2 { font-size: 24px; font-weight: 700; line-height: 1.45; margin: 1.1em 0 .6em; }
.contents .detail-body h3 { font-size: 20px; font-weight: 700; line-height: 1.5; margin: 1em 0 .5em; }
.contents .detail-body p { font-size: 16px; line-height: 1.8; margin: 0 0 1em; }
.detail-body > :first-child { margin-top: 0; }
.detail-body a { color: var(--admin-accent-strong); text-decoration: underline; }
.detail-body ul { list-style: disc; padding-left: 1.5em; }
.detail-body ol { list-style: decimal; padding-left: 1.5em; }
.detail-body li { list-style: inherit; }
.detail-body { overflow-wrap: anywhere; }
.detail-body figure { margin: 0; max-width: 100%; overflow-x: auto; }
.detail-body table { border-collapse: collapse; max-width: 100%; }
.detail-body :is(th, td) { border: 1px solid var(--admin-border-strong); padding: 6px 8px; text-align: left; }
.detail-body table p { margin: 0; }

.health-site-options { border: 0; margin: 0; min-width: 0; padding: 0; }
.health-site-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.health-site-option {
  align-items: center;
  background: var(--admin-surface);
  border: 1px solid var(--admin-border-strong);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--admin-text);
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  min-height: 34px;
  padding: 5px 8px;
}
.health-site-option:has(input:checked) {
  background: var(--admin-accent-soft);
  border-color: var(--admin-accent);
  color: var(--admin-accent-strong);
}
.health-site-option:focus-within { outline: 2px solid var(--admin-accent); outline-offset: 2px; }
.admin_table .health-site-option input[type="checkbox"] { flex: 0 0 16px; margin: 0; }
.health-site-options:disabled .health-site-option { cursor: default; }

/* Post controls stay beside the heading; editing uses a compact full-width canvas. */
#view-board .contents,
#view-detail .contents,
#view-editor .contents { padding-top: 24px; padding-bottom: 32px; }
#view-board .wrap,
#view-detail .wrap,
#view-editor .wrap { padding: 24px; }
.post-heading { align-items: center; display: flex; gap: 12px; justify-content: space-between; min-height: 36px; margin-bottom: 16px; }
.contents .post-heading h2 { margin: 0; min-width: 0; }
.post-actions { align-items: center; display: flex; flex: none; gap: 6px; margin-left: auto; }
.post-actions button { min-height: 36px; padding: 6px 12px; white-space: nowrap; }
#view-board .board-controls { justify-content: center; min-height: 56px; }
#view-editor .contents_tb,
#view-detail .contents_tb { min-width: 0; table-layout: fixed; width: 100%; }
#view-editor .contents_tb tr th:not(.sun-editor *),
#view-detail .contents_tb tr th:not(.detail-body *) { padding: 8px; width: 104px; }
#view-editor .contents_tb tr td:not(.sun-editor *),
#view-detail .contents_tb tr td:not(.detail-body *) { padding: 8px 10px; }
#view-editor .contents_tb tr.editor-content-row > td { border-left: 1px solid var(--admin-border); }
#view-editor .write_tb #health-status,
#view-editor .write_tb #post-status { min-height: 34px; padding: 4px 8px; width: 160px; }
#view-editor input[type="file"] { box-sizing: border-box; max-width: 100%; min-width: 0; width: 100%; }
#view-editor .top,
#view-detail .top { display: none; }
#view-detail .detail-body { min-width: 0; }

@media (max-width: 500px) {
  #view-board .wrap,
  #view-detail .wrap,
  #view-editor .wrap { padding: 16px 12px; }
  .post-heading { gap: 8px; margin-bottom: 12px; }
  .contents .post-heading h2 { font-size: 18px; }
  .post-actions button { min-height: 36px; padding: 6px 10px; }
  #view-editor .contents_tb tr th:not(.sun-editor *),
  #view-detail .contents_tb tr th:not(.detail-body *) { padding: 6px; width: 72px; }
  #view-editor .contents_tb tr td:not(.sun-editor *),
  #view-detail .contents_tb tr td:not(.detail-body *) { padding: 7px 8px; }
  .health-site-option { min-height: 36px; padding: 5px 6px; }
  #view-board .board-controls { min-height: 56px; }
}

/* Native SunEditor controls share the existing administrator palette. */
#view-editor .post-editor { min-width: 0; width: 100%; }
#view-editor .sun-editor {
  --se-main-out-color: var(--admin-border-strong);
  --se-main-color: var(--admin-text);
  --se-main-border-color: var(--admin-border);
  --se-active-dark3-color: var(--admin-accent);
  --se-active-light-color: var(--admin-accent-soft);
  --se-active-light2-color: var(--admin-accent-soft);
  --se-edit-inner-padding: 12px;
  --se-border-radius: 3px;
  --se-input-btn-size: 32px;
  border-radius: 3px;
  max-width: 100%;
  min-width: 0;
  text-align: left;
}
#view-editor .sun-editor .se-toolbar { background: #f6f7f8; outline: 0; }
#view-editor .sun-editor .se-btn-tray { display: flex; flex-wrap: wrap; align-items: center; padding: 3px; }
#view-editor .sun-editor .se-btn-module { flex: none; }
#view-editor .sun-editor .se-btn { min-height: 32px; }
#view-editor .sun-editor .se-wrapper { min-width: 0; }
#view-editor .sun-editor .sun-editor-editable { overflow-wrap: anywhere; font-size: 16px; line-height: 1.8; }
#view-editor .sun-editor .sun-editor-editable h1 { font-size: 30px; font-weight: 700; line-height: 1.4; margin: 1em 0 .6em; }
#view-editor .sun-editor .sun-editor-editable h2 { font-size: 24px; font-weight: 700; line-height: 1.45; margin: 1.1em 0 .6em; }
#view-editor .sun-editor .sun-editor-editable h3 { font-size: 20px; font-weight: 700; line-height: 1.5; margin: 1em 0 .5em; }
#view-editor .sun-editor .sun-editor-editable p { margin: 0 0 1em; }
#view-editor .sun-editor .sun-editor-editable li { list-style: inherit; }
#view-editor .sun-editor .sun-editor-editable img { max-width: 100%; }
#view-editor .sun-editor .sun-editor-editable > :first-child { margin-top: 0; }
#view-editor .sun-editor :is(button, input, select, textarea):focus-visible { outline: 2px solid var(--admin-accent); outline-offset: -2px; box-shadow: none; }
#view-editor .sun-editor .se-wrapper-code { border: 0; border-radius: 0; min-height: 300px; padding: 12px; width: 100%; }

/* Reserve the viewport for the form and let only the article body scroll. */
#view-editor { --post-header-height: 72px; }
#view-editor .contents {
  display: flex;
  flex-direction: column;
  height: max(640px, calc(100dvh - var(--post-header-height)));
}
#view-editor :is(.wrap, .admin_table, #post-form, .mobile_wrap, .write_tb, .write_tb > tbody) {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
#view-editor .mobile_wrap { overflow: visible; }
#view-editor .write_tb > tbody > tr { display: flex; flex: none; }
#view-editor .write_tb > tbody > tr > th { flex: none; }
#view-editor .write_tb > tbody > tr > td { flex: 1; min-width: 0; }
#view-editor .write_tb > tbody > .editor-content-row { flex: 1; min-height: 0; }
#view-editor .editor-content-row > td { display: flex; }
#view-editor .post-editor { display: flex; min-height: 0; }
#view-editor .post-editor > .sun-editor { flex: 1; min-height: 0; }
#view-editor .post-editor > .sun-editor > .se-container { display: flex; flex-direction: column; height: 100%; }
#view-editor .sun-editor .se-toolbar,
#view-editor .sun-editor .se-status-bar { flex: none; }
#view-editor .sun-editor .se-wrapper { flex: 1; min-height: 0; }
#view-editor .sun-editor .se-wrapper-code { min-height: 0; }
@media (max-width: 959px) {
  #view-editor { --post-header-height: 64px; }
}

#view-editor .sun-editor .se-tooltip-inner { transform: translateX(-50%); }
#view-editor .sun-editor .se-tooltip-inner .se-tooltip-text { left: 0; }

#view-doctors .contents { max-width: 960px; }
#view-doctors .wrap { min-width: 0; }
#view-doctors .post-heading { flex-wrap: wrap; }
#view-doctors .post-actions a { font-size: 13px; }
#doctor-back { color: var(--admin-text-muted); padding: 7px; }
#doctor-retire { color: var(--admin-danger); }
.doctor-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.doctor-tabs a, #doctor-clear-photo, #doctor-reload {
  background: var(--admin-surface); border: 1px solid var(--admin-border-strong); border-radius: 6px;
  color: var(--admin-text); cursor: pointer; font-size: 13px; padding: 7px 12px;
}
.doctor-tabs a[aria-current="page"] { background: var(--admin-accent-soft); border-color: var(--admin-accent); color: var(--admin-accent-strong); }
.doctor-list-frame { border: 1px solid var(--admin-border); border-radius: 8px; height: clamp(320px, 61dvh, 660px); overflow: auto; scrollbar-gutter: stable; }
.doctor-list-frame table { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; }
.doctor-list-frame :is(th, td) { border-bottom: 1px solid var(--admin-border); overflow-wrap: anywhere; padding: 10px 12px; text-align: left; }
.doctor-list-frame th { background: var(--admin-bg); font-size: 13px; position: sticky; top: 0; }
.doctor-list-frame th:first-child { width: 64px; }
.doctor-list-frame :is(td, th):first-child { text-align: center; }
.doctor-list-frame td a { color: var(--admin-accent-strong); display: inline-block; font-weight: 650; padding: 3px 0; text-decoration: underline; text-underline-offset: 3px; }
#doctor-fields {
  align-items: start; border: 0; border-top: 1px solid var(--admin-border); display: grid;
  gap: 12px 18px; grid-template-columns: 112px minmax(0, 1fr); margin: 0; min-width: 0; padding: 16px 0 0;
}
#doctor-fields > label { color: var(--admin-text); font-size: 14px; font-weight: 600; padding-top: 7px; }
#doctor-fields :is(input:not([type="file"]), select, textarea) {
  background: var(--admin-surface); border: 1px solid var(--admin-border-strong); border-radius: 6px; box-sizing: border-box;
  color: var(--admin-text); min-height: 38px; min-width: 0; padding: 6px 10px; width: 100%;
}
#doctor-fields textarea { height: 144px; resize: vertical; }
.doctor-photo-field { align-items: center; display: flex; gap: 12px; min-width: 0; }
.doctor-photo-preview {
  align-items: center; background: var(--admin-bg); border: 1px solid var(--admin-border); border-radius: 6px;
  color: var(--admin-text-muted); display: flex; flex: 0 0 76px; font-size: 12px; height: 92px; justify-content: center; overflow: hidden;
}
.doctor-photo-preview img { height: 100%; object-fit: contain; width: 100%; }
.doctor-photo-field > div:last-child { display: grid; gap: 8px; justify-items: start; min-width: 0; }
#doctor-photo { font-size: 13px; max-width: 100%; width: 100%; }
#view-doctors button:disabled { cursor: default; opacity: .5; }
.doctor-feedback { align-items: center; display: flex; gap: 8px; justify-content: space-between; min-height: 48px; }
#doctor-status { color: var(--admin-text-muted); font-size: 13px; }
#doctor-status[role="alert"] { color: var(--admin-danger); }
#doctor-reload { flex: none; }
@media (max-width: 500px) {
  #doctor-fields { gap: 12px 8px; grid-template-columns: 72px minmax(0, 1fr); }
  #doctor-fields > label { font-size: 13px; }
  .doctor-photo-field { align-items: flex-start; flex-direction: column; gap: 8px; }
  .doctor-photo-preview { flex: none; width: 76px; }
  .doctor-list-frame :is(th, td) { padding: 8px; }
}

@media (max-width: 500px) {
  #view-editor .contents { height: max(760px, calc(100dvh - var(--post-header-height))); }
}
