:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --line: #e4e1d8;
  --text: #1d1c19;
  --muted: #6d6a61;
  --accent: #9a6b12;
  --accent-soft: #f5ead3;
  --focus: #2c5bd6;
  --ok: #217a45;
  --warn: #a15c00;
  --warn-soft: #fdf0dc;
  --err: #b3261e;
  --shadow: 0 1px 2px rgba(20, 18, 10, .06), 0 4px 16px rgba(20, 18, 10, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161512;
    --surface: #1f1e1a;
    --surface-2: #282722;
    --line: #36342d;
    --text: #efece4;
    --muted: #a39f94;
    --accent: #e0b35a;
    --accent-soft: #3a2f19;
    --focus: #7ea2ff;
    --ok: #5cc98a;
    --warn: #f0a847;
    --warn-soft: #3b2c14;
    --err: #ff8a80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.topbar {
  display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  padding: 14px 20px; font-size: 13px; color: var(--muted);
}
.topbar button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.topbar button:hover { color: var(--text); background: var(--surface-2); }

main { max-width: 920px; margin: 0 auto; padding: 0 16px 80px; }

/* ── 검색 ───────────────────────── */
.hero { text-align: center; padding: 7vh 0 18px; transition: padding .2s; }
body.searching .hero { padding-top: 8px; }
.brand { font-size: 44px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.brand span { color: var(--accent); }
.brand-sub { color: var(--muted); margin: 2px 0 26px; font-size: 14px; }
body.searching .brand { font-size: 28px; }
body.searching .brand-sub { display: none; }

.searchbox {
  display: flex; align-items: center; gap: 10px;
  max-width: 680px; margin: 0 auto; padding: 0 18px; height: 54px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.searchbox:focus-within { border-color: var(--focus); }
.searchbox svg { flex: none; color: var(--muted); }
.searchbox input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; }
.searchbox kbd { font: 12px ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px auto 0; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.index-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 10px; }

.results { margin: 18px 0 8px; }
.results-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; padding: 0 4px 8px; }
.result {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; border-radius: 10px;
}
.result:hover, .result.kbd { background: var(--surface); box-shadow: var(--shadow); }
.ext {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  font: 700 10px ui-monospace, monospace; text-transform: uppercase; background: var(--surface-2); color: var(--muted);
}
.ext.pdf { background: #fde6e4; color: #b3261e; }
.ext.img { background: #e3f0e6; color: #217a45; }
.ext.vid { background: #e6e7fb; color: #3c3fb0; }
.ext.doc { background: #e3ecfb; color: #2156b8; }
.ext.xls { background: #e1f3ea; color: #177245; }
.ext.ppt { background: #fbe9df; color: #b14a13; }
.ext.ai  { background: #fdf0dc; color: #a15c00; }
@media (prefers-color-scheme: dark) {
  .ext.pdf, .ext.img, .ext.vid, .ext.doc, .ext.xls, .ext.ppt, .ext.ai { background: var(--surface-2); }
  .ext.pdf { color: #ff8a80; } .ext.img { color: #7fd6a0; } .ext.vid { color: #a9abff; }
  .ext.doc { color: #8fb4ff; } .ext.xls { color: #7fd6a0; } .ext.ppt { color: #ffab7a; } .ext.ai { color: #f0a847; }
}
.r-main { min-width: 0; }
.r-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; display: block; }
.r-name:hover { text-decoration: underline; }
.r-name mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.r-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sum { font-size: 13px; color: var(--muted); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.r-actions { display: flex; gap: 6px; align-items: center; }
.badge { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px;
  padding: 5px 10px; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.empty { text-align: center; color: var(--muted); padding: 28px 0; }

/* ── 섹션 ───────────────────────── */
section.block { margin-top: 38px; }
.block h2 { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .02em; margin: 0 0 12px 4px; }

.drop {
  display: flex; align-items: center; gap: 16px; padding: 20px 22px;
  background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--radius); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.drop strong { display: block; }
.drop small { color: var(--muted); }
.drop input { display: none; }
.ai-off { margin-top: 8px; font-size: 12.5px; color: var(--warn); }

.jobs { margin-top: 10px; display: grid; gap: 6px; }
.job {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}
.job-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-info { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.job-info b { color: var(--text); font-weight: 600; }
.job.error .job-info { color: var(--err); }
.status { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.bar { width: 90px; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.spin { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.job select { font-size: 12.5px; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }

.tools { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; }
.tool {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 4px 12px;
  background: none; border: 0; border-radius: var(--radius); cursor: pointer; font-size: 13px;
}
.tool:hover { background: var(--surface); box-shadow: var(--shadow); }
.tool img { width: 52px; height: 52px; }
.tool.disabled { opacity: .45; cursor: not-allowed; }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.card {
  display: block; text-decoration: none; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
a.card:hover { border-color: var(--muted); }
.card-title { font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card.soon { border-style: dashed; background: none; }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.warn { color: var(--warn); background: var(--warn-soft); }
.pill.soon { color: var(--muted); background: var(--surface-2); }

.overlay {
  position: fixed; inset: 0; display: none; place-items: center; z-index: 10;
  background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(2px);
  font-size: 20px; font-weight: 700; color: var(--accent);
}
body.dragging .overlay { display: grid; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }

@media (max-width: 720px) {
  .tools { grid-template-columns: repeat(3, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .brand { font-size: 34px; }
  .result { grid-template-columns: 36px 1fr; }
  .r-actions { grid-column: 2; }
  .searchbox kbd { display: none; }
}

/* ── 사이트 · 연락처 · 금고 ───────── */
.edit-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 7px; padding: 2px 9px; font-size: 12px; cursor: pointer; font-weight: 500; margin-left: 6px;
}
.edit-btn:hover { color: var(--text); border-color: var(--muted); }

.tbl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td input {
  width: 100%; min-width: 90px; border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px; background: var(--bg);
}
td.tight { white-space: nowrap; width: 1%; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.tbl-foot { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: center; }
.tbl-foot .grow { flex: 1; color: var(--muted); font-size: 12.5px; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px 6px; border-radius: 6px; font-size: 12.5px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.vault-locked { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.vault-locked .lock { width: 40px; height: 40px; border-radius: 11px; background: var(--warn-soft); color: var(--warn); display: grid; place-items: center; flex: none; }
.vault-locked input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--bg); }
.vault-locked .msg { color: var(--err); font-size: 13px; }
.vault-note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
td:first-child, th:first-child { white-space: nowrap; }
.tbl table { min-width: 560px; }
.btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--line)); }
.btn.danger:hover { background: color-mix(in srgb, var(--err) 8%, transparent); border-color: var(--err); }

