:root {
  --brand: #1d4e89;
  --brand-dark: #153a66;
  --brand-soft: #eaf1fa;
  --accent: #e8590c;
  --danger: #d6336c;
  --ok: #2b8a3e;
  --ink: #1b1f24;
  --ink-2: #4a5360;
  --ink-3: #8a93a0;
  --line: #e3e7ec;
  --line-2: #f0f2f5;
  --bg: #f6f7f9;
  --card: #ffffff;
  --radius: 10px;
  font-family: 'Pretendard Variable', Pretendard, -apple-system, 'Malgun Gothic', sans-serif;
  font-size: 14px;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); }
.red { color: var(--danger); }
.blue { color: var(--brand); }
.orange { color: var(--accent); }
.green { color: var(--ok); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ── 머리 ── */
.top { background: #fff; border-bottom: 2px solid var(--brand); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1440px; margin: 0 auto; height: 60px; display: flex; align-items: center; gap: 28px; padding: 0 20px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -0.5px; color: var(--brand); }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 15px; }
.logo small { font-size: 11px; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 8px 14px; border-radius: 8px; font-weight: 700; color: var(--ink-2); }
.nav a.on, .nav a:hover { color: var(--brand); background: var(--brand-soft); }
.me { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 13px; }
.quick { display: flex; align-items: center; gap: 6px; }
.quick input { width: 170px; }

/* ── 바탕 틀 ── */
.wrap { max-width: 1440px; margin: 0 auto; padding: 20px; display: grid; grid-template-columns: 180px 1fr; gap: 20px; }
.side { position: sticky; top: 80px; align-self: start; }
.side a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; }
.side a.on { background: var(--brand); color: #fff; }
.side a:not(.on):hover { background: var(--line-2); }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 10px 0; }
.main { min-width: 0; }
.page-title { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 16px; }
.page-title h1 { font-size: 24px; margin: 0; letter-spacing: -0.6px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.card + .card { margin-top: 14px; }

/* ── 입력 ── */
.inp, select.inp { height: 34px; border: 1px solid #cfd6de; border-radius: 7px; padding: 0 10px; background: #fff; min-width: 0; }
.inp:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea.inp { height: auto; padding: 8px 10px; resize: vertical; }
.btn { height: 34px; padding: 0 14px; border-radius: 7px; border: 1px solid #cfd6de; background: #fff; font-weight: 700; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: var(--brand-dark); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.ghost { border-color: transparent; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 12.5px; cursor: pointer; user-select: none; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip small { opacity: 0.7; }

/* ── 검색 조건 ── */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 28px; }
.frow { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 10px; min-height: 34px; }
.frow > label { font-weight: 700; color: var(--ink-2); font-size: 13px; }
.fctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fctl .inp { flex: 1; }
.fctl .tilde { color: var(--ink-3); }
.fwide { grid-column: 1 / -1; }
.tags-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px 12px; }
.tags-grid label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.fbar { display: flex; justify-content: center; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.fold { text-align: center; margin-top: 10px; }

/* ── 목록 ── */
.list-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; flex-wrap: wrap; }
.list-head .count { font-size: 16px; font-weight: 800; }
.list-head .count b { color: var(--danger); }
.sorts { display: flex; gap: 2px; margin-left: auto; flex-wrap: wrap; }
.sorts button { border: 0; background: transparent; padding: 6px 8px; color: var(--ink-2); font-size: 13px; border-radius: 6px; }
.sorts button.on { color: var(--brand); font-weight: 800; background: var(--brand-soft); }
table.items { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.items th { background: #f3f5f8; color: var(--ink-2); font-size: 12.5px; font-weight: 700; padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.items td { padding: 12px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.items tr.row:hover td { background: #fafcff; cursor: pointer; }
.thumb { width: 116px; height: 82px; border-radius: 6px; background: #edf0f4 center/cover no-repeat; display: grid; place-items: center; color: var(--ink-3); font-size: 11px; }
.it-usage { font-weight: 800; color: var(--brand); font-size: 13px; }
.it-case { font-weight: 800; font-size: 15.5px; margin: 1px 0 3px; }
.it-addr { color: var(--ink); font-size: 13.5px; line-height: 1.45; }
.it-sub { color: var(--brand); font-size: 12.5px; margin-top: 3px; }
.tagline { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: #fff0f3; color: var(--danger); }
.tag.blue { background: var(--brand-soft); color: var(--brand); }
.tag.orange { background: #fff4e6; color: var(--accent); }
.tag.gray { background: var(--line-2); color: var(--ink-2); }
.price .a { color: var(--ink-2); }
.price .m { color: var(--brand); font-weight: 800; }
.price .unit { font-size: 11.5px; color: var(--ok); }
.star { color: #f59f00; }
.pager { display: flex; justify-content: center; gap: 4px; margin: 18px 0; }
.pager button { min-width: 34px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 6px; }
.pager button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.gcard { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: pointer; }
.gcard .thumb { width: 100%; height: 150px; border-radius: 0; }
.gcard .gbody { padding: 10px 12px; }
.empty { text-align: center; color: var(--ink-3); padding: 60px 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }

/* ── 첫 화면 ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .k { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -0.5px; }
.themes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 14px; }
.theme { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 8px; text-align: center; font-weight: 700; cursor: pointer; }
.theme:hover { border-color: var(--brand); color: var(--brand); }
.theme .ic { font-size: 22px; margin-bottom: 6px; }

/* ── 달력 ── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dh { text-align: center; font-weight: 700; color: var(--ink-2); padding: 4px; }
.cal .day { background: #fff; border: 1px solid var(--line); border-radius: 8px; min-height: 120px; padding: 8px; font-size: 12px; }
.cal .day .d { font-weight: 800; margin-bottom: 4px; }
.cal .day a { display: block; color: var(--ink-2); padding: 1px 0; }
.cal .day a:hover { color: var(--brand); }
.cal .day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

/* ── 로그인 ── */
.auth { max-width: 380px; margin: 10vh auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.auth h2 { margin: 0 0 18px; text-align: center; }
.auth .inp { width: 100%; margin-bottom: 10px; height: 42px; }
.auth .btn { width: 100%; height: 44px; }
.err { color: var(--danger); font-size: 13px; margin: 6px 0; min-height: 18px; }
.note { background: #fff9db; border: 1px solid #ffe066; color: #5c4a00; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
table.plain { width: 100%; border-collapse: collapse; }
table.plain th, table.plain td { padding: 8px; border-bottom: 1px solid var(--line-2); text-align: left; font-size: 13px; }
table.plain th { color: var(--ink-2); font-weight: 700; background: #f8f9fb; }

@media (max-width: 900px) {
  .wrap { grid-template-columns: 1fr; padding: 12px; }
  .side { position: static; display: flex; gap: 4px; overflow-x: auto; }
  .side hr { display: none; }
  .side a { white-space: nowrap; }
  .filters { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .themes { grid-template-columns: repeat(3, 1fr); }
  .nav { display: none; }
  .quick input { width: 120px; }
  table.items .hide-m { display: none; }
}
