:root {
  color-scheme: light;
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
  color: #172033;
  background: #eef2f7;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; }
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #76a9ff; outline-offset: 2px; }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 1rem; }
.auth-card { width: min(100%, 28rem); padding: 2rem; border: 1px solid #d7dee8; border-radius: 14px; background: white; box-shadow: 0 12px 30px #26364a20; }
.auth-card h1 { margin: .2rem 0 1.5rem; font-size: 1.7rem; }
.auth-note { margin: -.75rem 0 1.25rem; color: #1e4f8f; font-weight: 600; }
.eyebrow { margin: 0; color: #1e63bd; font-size: .76rem; font-weight: 800; letter-spacing: .12em; }
form { display: grid; gap: 1rem; }
label { display: grid; gap: .35rem; color: #49566a; font-size: .86rem; font-weight: 750; }
input, select { min-height: 44px; padding: .6rem .75rem; border: 1px solid #aeb9c7; border-radius: 7px; background: white; }
button { min-height: 44px; padding: .6rem .9rem; border: 1px solid #1e63bd; border-radius: 7px; color: white; background: #1e63bd; cursor: pointer; font-weight: 800; }
button:disabled { cursor: wait; opacity: .55; }
.status { max-width: none; min-height: 1.5rem; margin: 1rem 0 0; color: #8c2525; text-align: left; white-space: pre-wrap; }

.admin-layout { display: grid; grid-template-columns: 16rem minmax(0, 1fr); min-height: 100vh; background: #f4f7fb; }
.admin-sidebar { position: sticky; top: 0; height: 100vh; padding: 2rem 1.25rem; color: white; background: linear-gradient(165deg, #142540, #1d426d); }
.admin-brand { padding: 0 .5rem 1.5rem; border-bottom: 1px solid #ffffff24; }
.admin-sidebar h1 { margin: .35rem 0 .6rem; font-size: 1.45rem; }
.admin-brand > p:last-child { margin: 0; color: #c4d2e5; font-size: .82rem; line-height: 1.6; }
.admin-sidebar .eyebrow { color: #9fc8ff; }
.admin-tabs { display: grid; gap: .35rem; margin-top: 1.25rem; }
.admin-tab { position: relative; width: 100%; padding: .75rem 1rem; border-color: transparent; color: #dce8f7; text-align: left; background: transparent; }
.admin-tab::before { position: absolute; inset: .65rem auto .65rem 0; width: 3px; border-radius: 99px; background: transparent; content: ""; }
.admin-tab:hover { background: #ffffff12; }
.admin-tab.active { color: white; background: #ffffff1c; }
.admin-tab.active::before { background: #82b7ff; }
.admin-main { min-width: 0; max-width: 90rem; width: 100%; padding: clamp(1.25rem, 3vw, 2.5rem); }
.admin-header, .section-heading, .toolbar, .dialog-actions, .pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.admin-header { padding-bottom: 1.25rem; border-bottom: 1px solid #dce3ec; }
.admin-header h2 { margin: .2rem 0 0; font-size: clamp(1.55rem, 3vw, 2rem); }
.admin-session { display: flex; align-items: center; gap: .65rem; padding: .45rem .45rem .45rem .8rem; border: 1px solid #d7dee8; border-radius: 10px; background: white; box-shadow: 0 4px 14px #26364a0d; }
.admin-session > span { color: #6b7688; font-size: .76rem; font-weight: 750; }
.admin-session > strong { color: #24344e; font-size: .9rem; }
.admin-main > .status { margin: 1rem 0; padding: .75rem 1rem; border: 1px solid #9bc7a8; border-radius: 9px; color: #245b36; background: #effaf2; }
.admin-main > .status.error { border-color: #e2abab; color: #8c2525; background: #fff2f2; }
.admin-main > .status:empty { display: none; }
.section-kicker { margin: 0; color: #3973bd; font-size: .72rem; font-weight: 850; letter-spacing: .08em; }
.admin-tab-panel[hidden] { display: none; }
.panel { margin-top: 1.25rem; padding: clamp(1rem, 2vw, 1.5rem); border: 1px solid #e0e6ef; border-radius: 14px; background: white; box-shadow: 0 10px 30px #26364a0b; }
.section-heading { align-items: end; margin-bottom: 1.1rem; }
.section-heading h3 { margin: .15rem 0 0; font-size: 1.25rem; }
.toolbar { justify-content: start; align-items: end; margin-bottom: 1rem; padding: .9rem; border: 1px solid #e1e7ef; border-radius: 10px; background: #f8fafc; }
.toolbar label { flex: 1 1 15rem; }
.toolbar .search-field { max-width: 34rem; }
.toolbar button, .admin-header button, .user-actions button, .dialog-actions button { min-height: 38px; }
.secondary { border-color: #aeb9c7; color: #24344e; background: white; }
.secondary:hover:not(:disabled) { background: #edf3fa; }
.danger { border-color: #b83838; background: #b83838; }
.table-wrap { overflow-x: auto; border: 1px solid #e1e7ef; border-radius: 10px; }
table { width: 100%; min-width: 44rem; border-collapse: collapse; }
th, td { padding: .8rem .9rem; border-bottom: 1px solid #e6ebf2; text-align: left; vertical-align: middle; }
th { color: #526176; background: #f8fafc; font-size: .78rem; letter-spacing: .02em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbff; }
.user-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.user-actions button, td > .danger { border-color: #c6d1df; color: #34445b; background: white; }
.user-actions .danger, td > .danger { border-color: #e1b2b2; color: #9b3030; background: #fff7f7; }
.user-actions button:hover, td > .danger:hover { background: #f0f5fb; }
.user-actions .danger:hover, td > .danger:hover { background: #ffeded; }
.muted { margin: .35rem 0 0; color: #5f6c80; }
.mode-note { margin: 0 0 1rem; padding: .7rem .85rem; border-left: 3px solid #6d9ed8; border-radius: 6px; color: #41536c; background: #eef5fd; font-size: .85rem; }
.empty { margin: 1rem 0 0; padding: 1.5rem; border: 1px dashed #cbd5e1; border-radius: 9px; color: #5f6c80; background: #fafcff; text-align: center; }
.statistics-filter { margin-bottom: 1rem; padding: .9rem; border: 1px solid #e1e7ef; border-radius: 10px; background: #f8fafc; }
.statistics-filter label { max-width: 28rem; }
.statistics-list .question-card { cursor: default; }
.statistics-list .statistics-count { background: #dcecff; color: #164d92; }
.statistics-list .statistics-date { flex-basis: 100%; color: #5f6c80; }
.pagination { justify-content: center; margin-top: 1rem; }
dialog { width: min(30rem, calc(100vw - 2rem)); padding: 1.5rem; border: 1px solid #cbd5e1; border-radius: 14px; box-shadow: 0 24px 70px #14213d38; }
dialog::backdrop { background: #14213d88; }
dialog h2 { margin: .2rem 0 .5rem; }
dialog p { color: #5b6678; line-height: 1.6; }
dialog .dialog-copy { margin-top: 0; }
.dialog-actions { justify-content: end; }
.dialog-actions .danger { border-color: #b83838; color: white; background: #b83838; }
.processing-log-dialog { width: min(48rem, calc(100vw - 2rem)); }
.processing-log-dialog table { min-width: 38rem; }
.processing-log-dialog tfoot { font-weight: 800; background: #f3f7fc; }
.processing-log-dialog tfoot th, .processing-log-dialog tfoot td { border-top: 2px solid #cbd5e1; }
.processing-log-warning { margin-bottom: 0; color: #8c2525; }
.processing-log-note { margin-bottom: 1rem; font-size: .82rem; }
.processing-log-dialog [hidden] { display: none; }
#answer-extraction-dialog { max-width: none; width: min(48rem, calc(100vw - 2rem)); }
#answer-extraction-dialog .answer-extraction-retry { display: flex; align-items: start; gap: .6rem; margin-top: 1rem; }
#answer-extraction-unknown { width: 1.25rem; height: 1.25rem; min-height: 0; flex: 0 0 auto; margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 600px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { position: static; height: auto; padding: 1rem; }
  .admin-brand { padding: 0 0 1rem; }
  .admin-brand > p:last-child { display: none; }
  .admin-sidebar h1 { margin-bottom: 0; font-size: 1.25rem; }
  .admin-tabs { grid-template-columns: repeat(3, 1fr); margin-top: .8rem; }
  .admin-tab { padding-inline: .35rem; text-align: center; }
  .admin-tab::before { inset: auto .75rem 0; width: auto; height: 3px; }
  .admin-main { padding: 1rem; }
  .admin-header { align-items: start; }
  .admin-session { width: 100%; justify-content: space-between; }
  .section-heading { align-items: stretch; }
  .section-heading > button { width: 100%; }
  .toolbar { align-items: stretch; }
  .toolbar label, .toolbar button { width: 100%; max-width: none; }
}

/* Admin and my-page UX fixes (2026-10). login.html also loads this file, so every rule names an admin/my-page element. */
/* main's shared margin:auto centres a short admin tab vertically inside the grid; keep the header at the top. */
.admin-layout > .admin-main { margin-block: 0; }
/* A flex <td> leaves the table grid, so the 작업 column lost its width and the row background ended early. */
#books td.user-actions, #users td.user-actions { display: table-cell; }
#books td.user-actions > button, #books td.user-actions .card-book-actions > button, #users td.user-actions > button {
  display: inline-flex; align-items: center; min-height: 34px; margin: 0 .35rem .35rem 0; padding: .35rem .65rem; font-size: .82rem; white-space: nowrap;
}
#books td.user-actions { color: #5f6c80; font-size: .82rem; }
#books th, #books td { padding-inline: .6rem; }
/* 삭제 sits on its own line, apart from routine actions, in an outlined red style. */
#books td.user-actions > .danger { display: flex; width: fit-content; margin-top: .65rem; }
#users td.user-actions > .danger { margin-left: .9rem; }
#books td.user-actions > .danger, #users td.user-actions > .danger { border-color: #b83838; color: #a12a2a; background: white; }
#books td.user-actions > .danger:hover, #users td.user-actions > .danger:hover { color: white; background: #b83838; }
.admin-layout ~ dialog .field-hint { margin-top: -.6rem; color: #5f6c80; font-size: .8rem; line-height: 1.5; }
.admin-layout ~ dialog .dialog-error { margin: 0; padding: .6rem .75rem; border: 1px solid #e2abab; border-radius: 8px; color: #8c2525; background: #fff2f2; }
.admin-layout ~ dialog .dialog-error[hidden] { display: none; }
.admin-layout ~ dialog label strong { color: #172033; }
#operations-status { margin: 0 0 1rem; padding: .75rem 1rem; border: 1px solid #d7dee8; border-radius: 9px; font-weight: 750; }
#operations-status:empty { display: none; }
#operations-status[data-state="ok"] { border-color: #9bc7a8; color: #245b36; background: #effaf2; }
#operations-status[data-state="warning"] { border-color: #e7c27a; color: #7a4b00; background: #fff8e8; }
#operations-status[data-state="error"] { border-color: #e2abab; color: #8c2525; background: #fff2f2; }
#operations-summary { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1.5rem; margin: 0 0 1rem; }
#operations-summary dt { color: #526176; font-weight: 750; }
#operations-summary dd { margin: 0; }
.admin-layout ~ dialog .dialog-consequences { margin: 0; padding-left: 1.2rem; color: #5b6678; font-size: .9rem; line-height: 1.6; }
/* My page: section tabs and empty template slots. */
.mypage-tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: .4rem; margin: 1rem 0 0; padding: .5rem; border: 1px solid #d7dee8; border-radius: 10px; background: white; box-shadow: 0 4px 14px #26364a0d; }
.mypage-tabs button { min-height: 40px; border-color: transparent; color: #34445b; background: transparent; }
.mypage-tabs button:hover { background: #edf3fa; }
.mypage-tabs button[aria-pressed="true"] { color: white; background: #1e63bd; }
.mypage-main .template-add { width: 100%; min-height: 96px; margin-top: .5rem; border: 1px dashed #aeb9c7; color: #1e63bd; background: #f8fafc; }
.mypage-main .template-add:hover { background: #edf3fa; }
.mypage-main .private-source-thumbnail:disabled { cursor: default; opacity: 1; }
