/* hashtable 관리자 페이지. 색은 아래 변수만 쓴다 (밝은 화면, 어두운 화면) */
:root {
	color-scheme: light dark;
	--bg: #f7f6f3;
	--surface: #ffffff;
	--text: #1f1e1b;
	--muted: #6b6860;
	--line: #dedbd3;
	--accent: #2f5d50;
	--accent-text: #ffffff;
	--danger: #a33a2c;
	--focus: #2f5d50;
	--radius: 8px;
	font-family: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #191917;
		--surface: #232320;
		--text: #eceae4;
		--muted: #a09d94;
		--line: #3a3934;
		--accent: #7fc0aa;
		--accent-text: #10201b;
		--danger: #ef8a7a;
		--focus: #7fc0aa;
	}
}
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* 머리 줄 */
.top { display: flex; align-items: center; gap: 16px; padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right)); border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: -0.01em; }
.tabs { display: flex; gap: 4px; flex: 1; min-width: 0; }
.tabs a { white-space: nowrap; padding: 8px 12px; border-radius: var(--radius); color: var(--muted); text-decoration: none; min-height: 40px; display: inline-flex; align-items: center; }
.tabs a:hover { color: var(--text); background: var(--bg); }
.tabs a[aria-current='page'] { color: var(--text); background: var(--bg); font-weight: 600; }
main { padding: 20px max(16px, env(safe-area-inset-left)) 48px max(16px, env(safe-area-inset-right)); max-width: 1200px; margin: 0 auto; }

/* 버튼과 입력 */
.btn { min-height: 40px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 0.875rem; }
.field { min-height: 40px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.field:hover { border-color: var(--muted); }
label.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; white-space: nowrap; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.8125rem; white-space: nowrap; }
.badge.off { color: var(--muted); }
.error { color: var(--danger); }

/* 아이콘 찾기 */
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; }
.count { margin: 12px 0 8px; font-size: 0.875rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.cell { width: 100%; height: 100%; min-height: 96px; padding: 14px 6px 8px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cell:hover { border-color: var(--accent); }
.cell svg { width: 28px; height: 28px; flex: none; }
.cell span { font-size: 0.75rem; color: var(--muted); line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
.more { display: flex; justify-content: center; margin-top: 16px; }

/* 창 */
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 16px 0; }
.dialog-head h2 { font-size: 1.125rem; overflow-wrap: anywhere; }
.dialog-body { padding: 12px 16px 16px; display: grid; gap: 14px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; }
.preview { display: flex; align-items: center; gap: 16px; }
.preview svg { width: 72px; height: 72px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 0.8125rem; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.group-title { font-size: 0.8125rem; color: var(--muted); margin-bottom: 6px; }
.code { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.code code { display: block; padding: 9px 12px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.8125rem; overflow-x: auto; white-space: pre; }

/* 표 */
.form-row { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 16px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.8125rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 6px; }
td.right, th.right { text-align: right; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.875rem; overflow-wrap: anywhere; }
.stack { display: grid; gap: 16px; }
.section-title { font-size: 0.9375rem; font-weight: 600; margin-bottom: 8px; }

/* 로그인 */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); display: grid; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login h1 { font-size: 1.125rem; }

/* 표는 좁아지면 줄마다 카드로 */
@media (max-width: 960px) {
	table, tbody, tr, td { display: block; }
	thead { display: none; }
	tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
	tr:last-child { border-bottom: 0; }
	td { padding: 2px 0; border: 0; white-space: normal; }
	td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 0.8125rem; margin-right: 8px; }
	td.right { text-align: left; }
	td.actions { text-align: left; padding-top: 8px; }
}
@media (max-width: 720px) {
	.top { gap: 6px; }
	.tabs { gap: 0; }
	.tabs a { padding: 8px 10px; min-height: 44px; }
	.toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
	.toolbar input[type='search'] { grid-column: 1 / -1; }
	.form-row { grid-template-columns: minmax(0, 1fr); }
	.grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
	.btn, .field { min-height: 44px; }
	.btn.small { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
