/* 키다리 업무 포털 — 시스템 카드는 서가에 꽂힌 책처럼, 분류 색 책등을 단다. */
:root {
  --paper: #F3F4EF;
  --sheet: #FFFFFF;
  --ink: #1C2330;
  --muted: #5E6675;
  --line: #D9DCD3;
  --warn: #A63D2F;
  --good: #2F6B3E;
  --focus: #2A5BD7;
  --radius-sheet: 3px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- 상단 ---------- */
.bar {
  display: flex; align-items: center; gap: 16px;
  max-width: 1120px; margin: 0 auto; padding: 18px 24px;
}
.bar .brand { font-weight: 700; letter-spacing: -0.01em; text-decoration: none; display: flex; align-items: center; gap: 10px; }
.brand img { width: 28px; height: 28px; }
.bar .spacer { flex: 1; }
.bar nav { display: flex; gap: 6px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--sheet); cursor: pointer; text-decoration: none; font-size: 15px; white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #2E3A4F; }
.btn.danger { color: var(--warn); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { border-color: var(--line); }
.btn[disabled] { opacity: .5; cursor: default; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--sheet); }
.seg button { border: 0; background: transparent; padding: 7px 12px; cursor: pointer; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* ---------- 머리말 ---------- */
.head { max-width: 1120px; margin: 0 auto; padding: 28px 24px 8px; }
.head .date { font-size: clamp(34px, 6vw, 56px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; margin: 0; }
.head .hello { margin: 10px 0 0; color: var(--muted); font-size: 17px; }
.head .where { color: var(--ink); font-weight: 600; }

/* ---------- 서가 ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 8px 24px 64px; }
.shelf { margin-top: 36px; }
.shelf h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.01em;
}
.shelf h2 .chip { width: 12px; height: 22px; border-radius: 2px; background: var(--c); }
.shelf .row {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  padding-bottom: 16px;
  border-bottom: 6px solid #E3E5DD; /* 선반 */
}

.book {
  --c: #3B5B7A;
  position: relative; display: grid; grid-template-columns: 22px 1fr;
  background: var(--sheet); border: 1px solid var(--line); border-radius: var(--radius-sheet);
  min-height: 168px;
}
.book .spine {
  background: var(--c);
  border-radius: 2px 0 0 2px;
  background-image:
    linear-gradient(to bottom, transparent 14px, rgba(255,255,255,.35) 14px, rgba(255,255,255,.35) 16px, transparent 16px),
    linear-gradient(to top, transparent 14px, rgba(255,255,255,.35) 14px, rgba(255,255,255,.35) 16px, transparent 16px);
}
.book .body { padding: 16px 18px 16px 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.book h3 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.book .desc { margin: -6px 0 0; color: var(--muted); font-size: 14px; }
.book .stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 2px 0 0; padding: 0; list-style: none; flex: 1; align-content: flex-start; }
.book .stats li { display: flex; flex-direction: column; }
.book .stats .v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.book .stats .v small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.book .stats .l { font-size: 13px; color: var(--muted); }
.book .stats .warn .v { color: var(--warn); }
.book .stats .good .v { color: var(--good); }
.book .note { font-size: 13px; color: var(--muted); flex: 1; }
.book .note.err { color: var(--warn); }
.book .foot { display: flex; align-items: center; gap: 10px; }
.book .foot .via { font-size: 12px; color: var(--muted); }
.book .foot .btn { margin-left: auto; }

.empty { margin-top: 48px; padding: 28px; background: var(--sheet); border: 1px dashed var(--line); border-radius: 6px; max-width: 560px; }

/* ---------- 로그인 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: 100%; max-width: 380px; background: var(--sheet); border: 1px solid var(--line); border-radius: 6px;
  display: grid; grid-template-columns: 22px 1fr; overflow: hidden;
}
.login .spine { background: var(--ink); }
.login form { padding: 28px 28px 24px; display: grid; gap: 14px; }
.login h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.02em; }

/* ---------- 입력 ---------- */
label.field { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
label.field input, label.field select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); font-size: 16px;
}
label.check { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.msg { font-size: 14px; min-height: 1.4em; margin: 0; color: var(--warn); }
.msg.ok { color: var(--good); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }

/* ---------- 관리 화면 ---------- */
.admin { max-width: 1120px; margin: 0 auto; padding: 8px 24px 64px; }
.admin h1 { font-size: 30px; letter-spacing: -0.03em; margin: 18px 0 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 20px 0 18px; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-size: 16px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 700; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
table.list { width: 100%; border-collapse: collapse; background: var(--sheet); border: 1px solid var(--line); }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 15px; }
table.list th { font-size: 13px; color: var(--muted); font-weight: 600; background: #FAFAF7; }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list .sw { display: inline-block; width: 10px; height: 18px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.tag.off { color: var(--warn); border-color: #E7C2BC; }
.tag.on { color: var(--good); border-color: #BFD8C5; }
.small { font-size: 13px; color: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 8px; padding: 0; width: min(560px, 94vw); color: var(--ink); }
dialog::backdrop { background: rgba(28,35,48,.35); }
dialog form { padding: 22px 24px; display: grid; gap: 12px; }
dialog h2 { margin: 0 0 4px; font-size: 20px; }
dialog .buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
dialog .buttons .left { margin-right: auto; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 0; display: grid; gap: 6px; }
legend { font-size: 14px; color: var(--muted); padding: 0 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 640px) {
  .bar { padding: 14px 16px; flex-wrap: wrap; }
  .head, main, .admin { padding-left: 16px; padding-right: 16px; }
  .shelf .row { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  table.list .hide-sm { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .book { transition: transform .12s ease; }
  .book:has(.btn:hover) { transform: translateY(-2px); }
}
