﻿:root {
  --navy: #153b67;
  --blue: #1f67a8;
  --blue-soft: #eaf3fb;
  --green: #3d8d78;
  --ink: #1f2937;
  --muted: #667085;
  --line: #dfe5ec;
  --surface: #ffffff;
  --background: #f4f7fa;
  --danger: #b42318;
  --warning: #8a5a00;
  --shadow: 0 18px 45px rgba(21, 59, 103, .10);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--background); font-family: Pretendard, "Noto Sans KR", "Malgun Gothic", Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden, [hidden] { display: none !important; }

.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #e7f3ff 0, transparent 45%), linear-gradient(135deg, #f7fbff, #edf2f7); }
.login-shell { width: 100%; max-width: 460px; }
.login-card { background: rgba(255,255,255,.96); border: 1px solid rgba(21,59,103,.1); border-radius: 28px; padding: 38px; box-shadow: var(--shadow); }
.login-logo { display: block; max-width: 220px; max-height: 76px; object-fit: contain; object-position: left center; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.login-card h1 { margin: 0; font-size: clamp(28px, 6vw, 38px); line-height: 1.2; }
.login-help { margin: 14px 0 28px; color: var(--muted); line-height: 1.7; }
.login-form label, .field label { display: block; margin-bottom: 8px; font-weight: 700; }
.login-form input, .field input, .field textarea, .field select, .search-box input { width: 100%; border: 1px solid #cbd5e1; border-radius: 12px; background: #fff; padding: 13px 14px; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
.login-form input:focus, .field input:focus, .field textarea:focus, .field select:focus, .search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31,103,168,.12); }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: stretch; }
.security-note { margin: 20px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

.primary-button, .secondary-button, .ghost-button, .danger-button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; font-weight: 750; transition: transform .15s, box-shadow .15s, background .15s; }
.primary-button { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(31,103,168,.22); }
.primary-button:hover { background: #15568f; transform: translateY(-1px); }
.secondary-button { color: var(--navy); background: #fff; border-color: #cbd5e1; }
.secondary-button:hover { background: #f8fafc; border-color: #9fb2c7; }
.ghost-button { color: var(--muted); background: transparent; border-color: #d8e0e9; }
.ghost-button:hover { color: var(--ink); background: #f8fafc; }
.danger-button { color: #fff; background: var(--danger); }
.danger-button:hover { background: #8f1c13; }
.full { width: 100%; margin-top: 18px; }
.small { min-height: 34px; padding: 7px 11px; border-radius: 9px; font-size: 13px; }

.flash { margin: 0 0 18px; padding: 13px 15px; border-radius: 12px; border: 1px solid; line-height: 1.55; }
.flash.error { color: #8b1e16; background: #fff1f0; border-color: #ffc9c4; }
.flash.success { color: #176143; background: #edf9f3; border-color: #b7e4d0; }
.flash.warning { color: var(--warning); background: #fff8e6; border-color: #f1d49a; }

.site-header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); border-bottom: 1px solid rgba(21,59,103,.1); backdrop-filter: blur(14px); }
.header-inner { width: min(1240px, calc(100% - 32px)); margin: 0 auto; min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 13px; min-width: 0; }
.brand img { width: 54px; height: 54px; object-fit: contain; }
.brand span { display: grid; line-height: 1.2; }
.brand strong { color: var(--navy); font-size: 17px; }
.brand small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.page-shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 64px; }
.hero-section, .admin-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.hero-section h1, .admin-heading h1, .password-panel h1 { margin: 0; color: var(--navy); font-size: clamp(30px, 5vw, 46px); line-height: 1.18; }
.hero-section p:not(.eyebrow), .admin-heading p:not(.eyebrow) { margin: 11px 0 0; color: var(--muted); }
.search-box { width: min(360px, 100%); }
.search-box input { min-height: 48px; padding-left: 16px; }
.category-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 22px; }
.category-filter-button { min-height: 38px; padding: 8px 14px; color: var(--navy); background: #fff; border: 1px solid #cbd5e1; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 750; transition: color .16s, background .16s, border-color .16s, transform .16s; }
.category-filter-button:hover { transform: translateY(-1px); border-color: var(--blue); }
.category-filter-button.is-active { color: #fff; background: var(--blue); border-color: var(--blue); box-shadow: 0 6px 15px rgba(31,103,168,.18); }

.program-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.program-card { min-width: 0; }
.program-card-button { width: 100%; min-height: 188px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 17px; padding: 24px; text-align: left; color: inherit; background: var(--surface); border: 1px solid rgba(21,59,103,.11); border-radius: 20px; box-shadow: 0 10px 30px rgba(21,59,103,.07); cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.program-card-button:hover { transform: translateY(-4px); border-color: rgba(31,103,168,.35); box-shadow: 0 18px 40px rgba(21,59,103,.13); }
.program-icon { width: 78px; height: 78px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 19px; background: var(--blue-soft); font-size: 34px; }
.program-icon.small { width: 54px; height: 54px; border-radius: 14px; font-size: 25px; }
.program-icon.has-image { overflow: hidden; background: #fff; border: 1px solid var(--line); }
.program-icon img { width: 100%; height: 100%; display: block; padding: 1px; object-fit: contain; border-radius: inherit; }
.program-icon.small img { padding: 1px; }
.program-content { display: grid; min-width: 0; gap: 7px; }
.program-category { width: fit-content; padding: 4px 8px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 11px; font-weight: 800; }
.program-content strong { color: var(--navy); font-size: 20px; line-height: 1.35; }
.program-description { color: var(--muted); font-size: 14px; line-height: 1.55; }
.program-arrow { color: var(--blue); font-size: 24px; }
.empty-state { padding: 64px 24px; text-align: center; border: 1px dashed #b8c5d2; border-radius: 20px; background: rgba(255,255,255,.7); }
.empty-state.compact { padding: 32px 20px; }
.empty-state h2, .empty-state h3 { margin: 0 0 8px; color: var(--navy); }
.empty-state p { margin: 0 0 20px; color: var(--muted); }
.empty-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 16px; border-radius: 50%; color: var(--blue); background: var(--blue-soft); font-size: 34px; }

.viewer-modal { position: fixed; inset: 0; z-index: 100; }
.viewer-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.58); }
.viewer-panel { position: absolute; inset: 3vh 2vw; display: grid; grid-template-rows: auto auto 1fr; overflow: hidden; background: #fff; border-radius: 20px; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.viewer-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.viewer-header h2 { margin: 0; color: var(--navy); }
.viewer-actions { display: flex; gap: 8px; }
.viewer-notice { padding: 9px 22px; color: #63511b; background: #fff8df; border-bottom: 1px solid #f2dd9f; font-size: 13px; }
#programFrame { width: 100%; height: 100%; border: 0; background: #fff; }
.modal-open { overflow: hidden; }

.admin-layout { display: grid; grid-template-columns: minmax(330px, .8fr) minmax(0, 1.2fr); gap: 22px; align-items: start; }
.panel { background: #fff; border: 1px solid rgba(21,59,103,.1); border-radius: 20px; box-shadow: 0 12px 34px rgba(21,59,103,.07); }
.form-panel { position: sticky; top: 96px; padding: 24px; }
.list-panel { padding: 24px; }
.panel h2 { margin: 0 0 22px; color: var(--navy); }
.admin-form { display: grid; gap: 17px; }
.field-row { display: grid; gap: 14px; }
.field-row.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.field textarea { resize: vertical; min-height: 88px; }
.field small { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.field-label-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.field-label-actions label { margin: 0; }
.text-link { color: var(--blue); font-size: 12px; font-weight: 800; }
.text-link:hover { text-decoration: underline; }
.required { color: var(--danger); font-size: 12px; }
.checkbox-field { display: flex; align-items: center; min-height: 78px; padding-top: 24px; }
.checkbox-field label { display: flex; align-items: center; gap: 9px; margin: 0; }
.checkbox-field input { width: 18px; height: 18px; padding: 0; }
.form-actions { display: flex; gap: 9px; padding-top: 4px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; }
.count-badge { display: inline-grid; min-width: 28px; height: 28px; place-items: center; margin-left: 5px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 13px; }
.admin-program-list { display: grid; gap: 12px; }
.admin-program-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; }
.admin-program-main { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.admin-program-main > div { min-width: 0; }
.admin-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.admin-title-line strong { color: var(--navy); font-size: 16px; }
.admin-program-main p { margin: 6px 0; color: var(--muted); font-size: 13px; }
.admin-program-main code { display: block; max-width: 520px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #475467; font-size: 12px; }
.admin-item-actions { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.admin-item-actions form { margin: 0; }
.status-badge { padding: 3px 7px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-badge.on { color: #176143; background: #e9f8f1; }
.status-badge.off { color: #6b7280; background: #eef1f4; }
.category-admin-layout { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr); gap: 22px; align-items: start; }
.category-list { display: grid; gap: 11px; }
.category-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.category-order-number { width: 34px; height: 34px; display: grid; place-items: center; color: var(--blue); background: var(--blue-soft); border-radius: 50%; font-size: 13px; font-weight: 850; }
.category-item-main { min-width: 0; }
.category-item-main p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.inline-form { display: inline-flex; margin: 0; }
.compact-checkbox { display: grid; min-height: auto; padding-top: 0; }
.compact-checkbox small { margin-left: 27px; }

.order-panel-heading { align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.order-panel-heading h2 { margin: 0; }
.panel-help { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.program-order-form { display: grid; gap: 14px; }
.order-sortable-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; transition: opacity .16s, border-color .16s, box-shadow .16s, transform .16s; }
.order-leading { display: grid; justify-items: center; gap: 6px; }
.order-drag-handle { width: 34px; min-height: 34px; display: grid; place-items: center; padding: 0; color: #667085; background: #f8fafc; border: 1px solid #d8e0e8; border-radius: 9px; cursor: grab; font-size: 20px; font-weight: 900; line-height: 1; letter-spacing: -6px; text-indent: -4px; }
.order-drag-handle:active { cursor: grabbing; }
.order-position { min-width: 28px; height: 24px; display: grid; place-items: center; padding: 0 6px; color: var(--blue); background: var(--blue-soft); border-radius: 999px; font-size: 12px; font-weight: 850; }
.order-actions { flex-wrap: wrap; justify-content: flex-end; }
.order-move-buttons { display: flex; gap: 5px; }
.icon-only { width: 36px; padding-left: 0; padding-right: 0; font-size: 17px; }
.icon-only:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.order-sortable-item.is-dragging { opacity: .48; border-style: dashed; }
.order-sortable-item.is-drag-over { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,103,168,.12); transform: translateY(2px); }
.order-save-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; background: rgba(255,255,255,.96); border: 1px solid #cbd5e1; border-radius: 14px; box-shadow: 0 10px 28px rgba(21,59,103,.13); backdrop-filter: blur(10px); }
.order-status { color: var(--muted); font-size: 13px; }
.order-status.is-changed { color: var(--blue); font-weight: 750; }
.hidden-delete-form { display: none; }

.icon-current-field { align-self: end; }
.current-icon-display { min-height: 48px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; font-size: 27px; }
.default-icon-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; max-height: 330px; padding: 10px; overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.icon-choice { min-width: 0; min-height: 68px; display: grid; place-items: center; gap: 3px; padding: 7px 4px; color: var(--navy); background: #fff; border: 1px solid #d8e0e8; border-radius: 12px; cursor: pointer; transition: border-color .16s, box-shadow .16s, transform .16s, background .16s; }
.icon-choice:hover { transform: translateY(-1px); border-color: rgba(31,103,168,.45); box-shadow: 0 5px 14px rgba(21,59,103,.09); }
.icon-choice:focus-visible { outline: 3px solid rgba(31,103,168,.22); outline-offset: 2px; }
.icon-choice.is-selected { color: var(--blue); background: var(--blue-soft); border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.icon-choice-symbol { font-size: 25px; line-height: 1; }
.icon-choice-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 700; }
.custom-icon-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 10px; }
.custom-icon-row label { margin: 0; font-size: 13px; }
.custom-icon-row input { min-height: 42px; }

.icon-upload-box { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.icon-preview { width: 112px; height: 112px; display: grid; place-items: center; overflow: hidden; border: 1px solid #cbd5e1; border-radius: 18px; background: #fff; color: var(--navy); font-size: 36px; }
.icon-preview img { width: 100%; height: 100%; display: block; padding: 2px; object-fit: contain; }
.icon-upload-controls { min-width: 0; }
.icon-upload-controls input[type="file"] { padding: 9px; background: #fff; }
.icon-upload-actions { display: flex; gap: 8px; margin-top: 9px; }
.icon-upload-box.is-uploading { opacity: .72; }
.icon-upload-box.is-error { border-color: #f0aaa4; background: #fff5f4; }
.icon-upload-box.is-success { border-color: #a8d8c5; background: #f2fbf7; }

.narrow-shell { width: min(680px, calc(100% - 32px)); }
.password-panel { padding: 30px; }
.password-panel h1 { margin-bottom: 24px; }

@media (max-width: 980px) {
  .program-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout, .category-admin-layout { grid-template-columns: 1fr; }
  .form-panel { position: static; }
}
@media (max-width: 720px) {
  .header-inner { min-height: auto; padding: 12px 0; align-items: flex-start; }
  .brand img { width: 44px; height: 44px; }
  .brand strong { font-size: 15px; }
  .header-actions { gap: 5px; }
  .header-actions .secondary-button, .header-actions .ghost-button { min-height: 34px; padding: 7px 9px; font-size: 12px; }
  .page-shell { padding-top: 28px; }
  .hero-section, .admin-heading { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .category-filter { flex-wrap: nowrap; margin-top: -4px; padding-bottom: 5px; overflow-x: auto; }
  .category-filter-button { flex: 0 0 auto; }
  .program-grid { grid-template-columns: 1fr; }
  .program-card-button { min-height: 158px; }
  .field-row.two { grid-template-columns: 1fr; }
  .default-icon-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 360px; }
  .custom-icon-row { grid-template-columns: 1fr; gap: 6px; }
  .icon-upload-box { grid-template-columns: 90px 1fr; }
  .icon-preview { width: 90px; height: 90px; border-radius: 16px; }
  .checkbox-field { min-height: auto; padding-top: 0; }
  .admin-program-item { align-items: stretch; flex-direction: column; }
  .category-item { grid-template-columns: auto minmax(0, 1fr); }
  .category-item .admin-item-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .admin-item-actions { justify-content: flex-end; }
  .order-panel-heading { align-items: stretch; }
  .order-panel-heading > .primary-button { width: 100%; }
  .order-sortable-item { grid-template-columns: auto minmax(0, 1fr); }
  .order-actions { grid-column: 1 / -1; }
  .order-leading { align-content: start; }
  .order-save-bar { align-items: stretch; flex-direction: column; }
  .order-save-bar .primary-button { width: 100%; }
  .viewer-panel { inset: 0; border-radius: 0; }
  .viewer-header { align-items: flex-start; flex-direction: column; }
  .viewer-actions { width: 100%; }
  .viewer-actions > * { flex: 1; }
}
@media (max-width: 480px) {
  .login-card { padding: 28px 22px; border-radius: 22px; }
  .header-inner { width: min(100% - 20px, 1240px); }
  .brand small { display: none; }
  .page-shell, .narrow-shell { width: min(100% - 20px, 1240px); }
  .program-card-button { padding: 19px; grid-template-columns: auto 1fr; }
  .program-arrow { display: none; }
  .program-icon { width: 64px; height: 64px; border-radius: 16px; font-size: 29px; }
  .default-icon-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-actions { flex-direction: column; }
  .form-actions > * { width: 100%; }
}

.login-home-action { margin-top: 10px; }
.login-home-action .full { width: 100%; text-align: center; }

/* 비밀번호 찾기 */
.login-utility-links { display: flex; justify-content: flex-end; margin-top: 12px; }
.login-utility-links a { color: var(--blue); font-weight: 700; text-decoration: none; }
.login-utility-links a:hover { text-decoration: underline; }
.recovery-form { display: grid; gap: 10px; }
.recovery-form .primary-button { margin-top: 8px; }
.security-settings-shell { display: grid; gap: 22px; }
.recovery-panel h2 { margin: 0; color: var(--navy); font-size: clamp(23px, 4vw, 30px); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-description { color: var(--muted); line-height: 1.7; margin: 0 0 20px; }
.status-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 68px; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; }
.status-badge.active { background: #e8f7ef; color: #176143; border: 1px solid #b7e4d0; }
.status-badge.inactive { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
@media (max-width: 560px) {
  .section-title-row { align-items: flex-start; }
  .login-utility-links { justify-content: center; }
}
