/* 블로그랩 — 내부 도구라 화려함보다 읽기 쉬움이 먼저다 */

:root {
    --bg: #f3f5f8;
    --card: #ffffff;
    --line: #e3e7ee;
    --text: #1d2433;
    --muted: #6b7486;
    --primary: #1f6feb;
    --primary-ink: #ffffff;
    --good: #148a4b;
    --warn: #b7791f;
    --bad: #d33a3a;
    --commercial: #efe3ff;
    --commercial-ink: #6b21c8;
    --caution: #ffe7d1;
    --caution-ink: #b45309;
    --side: #151b28;
    --side-ink: #c8cfdc;
    --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: "Pretendard Variable", Pretendard, -apple-system, "Malgun Gothic", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}
a { color: inherit; }
.link { color: var(--primary); text-decoration: none; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.text-good { color: var(--good); }
.text-bad { color: var(--bad); }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; }

/* ── 틀 ───────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side {
    width: 220px; flex: none; background: var(--side); color: var(--side-ink);
    display: flex; flex-direction: column; padding: 20px 12px; position: sticky; top: 0; height: 100vh;
}
.brand { font-size: 20px; font-weight: 800; color: #fff; text-decoration: none; padding: 0 10px 18px; letter-spacing: -0.5px; }
.brand b { color: #5aa2ff; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 11px; color: #7d879b; margin: 14px 10px 4px; letter-spacing: 1px; }
.nav-link {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--side-ink);
}
.nav-link:hover { background: rgba(255, 255, 255, .06); }
.nav-link.is-active { background: var(--primary); color: #fff; }
.nav-link.is-pending { opacity: .55; }
.nav-tag { font-size: 10px; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; }
.side-foot { display: flex; justify-content: space-between; padding: 12px 10px 0; border-top: 1px solid #2a3244; font-size: 13px; }
.side-foot a { color: var(--side-ink); text-decoration: none; }

.main { flex: 1; min-width: 0; padding: 20px 28px 60px; }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.top h1 { font-size: 20px; margin: 0; }
.menu-btn { display: none; border: 0; background: var(--card); border-radius: 8px; padding: 6px 10px; font-size: 16px; }

/* ── 카드 ───────────────────────────── */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 16px;
}
.card.narrow { max-width: 520px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.card-title { font-size: 15px; margin: 0 0 10px; }
.card-head .card-title { margin: 0; }
.card.note { background: #f8fafc; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card, .grid-2 + .grid-2 { margin-top: 16px; }
.grid-2 { margin-bottom: 16px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.empty { color: var(--muted); margin: 6px 0; }
.plain { margin: 8px 0; padding-left: 18px; }
.plain li { margin: 4px 0; }

/* ── 폼 ───────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
    font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; width: 100%;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #b9d3ff; border-color: var(--primary); }
.search-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.search-row .field { margin-bottom: 0; }
.search-row .grow { flex: 1; min-width: 220px; }
.form-foot { display: flex; justify-content: space-between; align-items: center; }
.inline { display: inline; }

.btn {
    font: inherit; border: 1px solid var(--line); background: #fff; border-radius: 8px;
    padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap;
}
.btn:hover { border-color: #c5ccd8; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.btn-primary:hover { background: #195fd0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash-error { background: #fdecec; color: #a12424; }
.flash-ok { background: #e7f6ee; color: #136b3c; }
.flash-info { background: #eaf2ff; color: #1d4f9c; }

/* ── 표 ───────────────────────────── */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 520px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfd; position: sticky; top: 0; }
.table.compact th, .table.compact td { padding: 5px 8px; }
.table .cell-main a { text-decoration: none; }
.table .cell-main a:hover { text-decoration: underline; }
.table tbody tr:hover { background: #fafcff; }
.table.topics th { width: 130px; white-space: nowrap; color: var(--muted); font-weight: 600; }
.ext { color: var(--muted); text-decoration: none; font-size: 12px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab { padding: 6px 12px; border-radius: 20px; text-decoration: none; border: 1px solid var(--line); }
.tab.is-active { background: var(--text); color: #fff; border-color: var(--text); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }

.badge { font-size: 11px; padding: 1px 7px; border-radius: 10px; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.badge-blog { background: #e7f0ff; color: #1d4f9c; }
.badge-post { background: #e7f6ee; color: #136b3c; }
.badge-morph { background: #f4ecff; color: #5b21b6; }
.badge-keyword { background: #fff4e5; color: #9a5b00; }
.badge-cafe { background: #e9f8ef; color: #136b3c; }
.badge-influencer { background: #fdeef4; color: #a1245b; }
.badge-pending { background: #f3f4f6; color: #9aa1ad; font-weight: 400; }

/* ── 키워드 조회 ───────────────────────────── */
.section-order { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.section-order span { border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; font-size: 12px; background: #fff; }
.section-order span.is-popular { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips a { border: 1px solid var(--line); border-radius: 20px; padding: 4px 11px; text-decoration: none; font-size: 13px; }
.chips a:hover { border-color: var(--primary); color: var(--primary); }
tr.is-mine td { background: #eef5ff; }
.sub { font-size: 13px; color: var(--muted); margin: 14px 0 6px; font-weight: 600; }
details summary { cursor: pointer; margin-top: 10px; }

/* ── 대시보드 ───────────────────────────── */
.quick { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.quick-item { display: flex; gap: 8px; align-items: flex-end; }
.quick-item .field { flex: 1; margin-bottom: 0; }
.quick-link { flex-direction: column; align-items: flex-start; justify-content: center; text-decoration: none; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 14px; }

/* ── 결과 ───────────────────────────── */
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.profile h2 { margin: 0; font-size: 18px; }
.profile p { margin: 2px 0 0; }
.profile .btn { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { font-size: 16px; }
.stat small { color: var(--muted); font-weight: 400; }
.post-title { font-size: 18px; margin: 0 0 14px; }
.post-title a { text-decoration: none; }

.grade { font-size: 28px; font-weight: 800; margin: 4px 0 8px; }
.grade-normal { color: #222; }
.grade-index { color: var(--primary); }

.score { font-size: 13px; color: var(--muted); }
.score b { font-size: 22px; color: var(--text); margin: 0 2px 0 4px; }
.notes { list-style: none; margin: 0; padding: 0; }
.notes li { padding: 6px 0 6px 18px; position: relative; }
.notes li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 8px; height: 8px; border-radius: 50%; }
.note-good::before { background: var(--good); }
.note-warn::before { background: var(--warn); }
.note-bad::before { background: var(--bad); }

.content-box {
    white-space: pre-wrap; line-height: 1.8; max-height: 520px; overflow-y: auto;
    border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: #fcfcfd;
}
mark { border-radius: 3px; padding: 0 2px; }
.hl-commercial { background: var(--commercial); color: var(--commercial-ink); }
.hl-caution { background: var(--caution); color: var(--caution-ink); font-weight: 600; }
.legend { display: flex; gap: 6px; font-size: 12px; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 22px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.bar i { display: block; width: 100%; max-width: 46px; background: #5aa2ff; border-radius: 6px 6px 0 0; }
.bar em { font-style: normal; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bar span { font-size: 11px; color: var(--muted); margin-top: 4px; }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumbs figure { margin: 0; width: 96px; }
.thumbs img { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; border: 2px solid #f1b8b8; }
.thumbs figcaption { font-size: 11px; color: var(--bad); text-align: center; }

/* ── 로그인 ───────────────────────────── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--side); }
.login-card { background: var(--card); padding: 30px; border-radius: 14px; width: 100%; max-width: 360px; }
.login-card .brand { color: var(--text); padding: 0 0 4px; display: block; }
.login-card .brand b { color: var(--primary); }

/* ── 좁은 화면 ───────────────────────────── */
@media (max-width: 900px) {
    .grid-2, .quick { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .side { position: fixed; left: -240px; z-index: 20; transition: left .2s; }
    .side.is-open { left: 0; }
    .menu-btn { display: inline-block; }
    .main { padding: 14px 16px 40px; }
}
