/* KKKLLL 기본 스타일 */
:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #6b7280;
    --line: #e2e5ea;
    --primary: #2457d6;
    --primary-dark: #1b44ab;
    --danger: #c62828;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 560px; }
main.container { padding-top: 24px; padding-bottom: 48px; }

h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 32px 0 12px; }
.muted { color: var(--muted); }

/* header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; min-height: 60px; flex-wrap: wrap; }
.logo { font-weight: 800; font-size: 18px; color: var(--text); letter-spacing: .04em; }
.nav { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--text); }
.auth { display: flex; align-items: center; gap: 10px; }
.user { color: var(--muted); }
.site-footer { border-top: 1px solid var(--line); padding: 16px 0; font-size: 13px; }
.site-footer .container { display: flex; justify-content: space-between; }

/* buttons */
.btn {
    display: inline-block; padding: 8px 16px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--text); font: inherit; cursor: pointer; line-height: 1.4;
}
.btn:hover { text-decoration: none; border-color: #c5cad3; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-small { padding: 4px 10px; font-size: 13px; }
form.inline { display: inline; margin: 0; }

/* messages */
.flash, .alert {
    margin-top: 16px; padding: 10px 14px; border-radius: var(--radius);
    background: #e8f0fe; border: 1px solid #c6d6fb;
}
.alert-error { background: #fdecec; border-color: #f5c2c2; color: var(--danger); }

/* cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin: 24px 0; }
.card {
    display: flex; flex-direction: column; gap: 6px; padding: 20px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
}
.card:hover { border-color: var(--primary); text-decoration: none; }
.card span { color: var(--muted); font-size: 14px; }

/* table */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #fafbfc; font-weight: 600; font-size: 14px; }
.table.kv th { width: 180px; }
.col-no { width: 70px; text-align: center !important; }
.col-date { width: 150px; }
.col-action { width: 80px; text-align: right !important; }
.empty { text-align: center !important; color: var(--muted); padding: 40px 0 !important; }

.page-head { display: flex; justify-content: space-between; align-items: center; }
.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 0 1 280px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.pagination a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* forms */
input[type=text], input[type=email], input[type=password], textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius);
    font: inherit; background: var(--surface);
}
input:focus, textarea:focus { outline: 2px solid #bcd0fb; border-color: var(--primary); }
.form { display: flex; flex-direction: column; gap: 6px; background: var(--surface);
        padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); }
.form label { font-weight: 600; margin-top: 10px; }
.form .btn-primary { margin-top: 16px; }
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.form-inline input { flex: 1 1 200px; width: auto; }
.field-error { color: var(--danger); font-size: 13px; margin: 0; }
.checkbox { font-weight: normal !important; margin-top: 0 !important; }
.current-photo { display: flex; align-items: center; gap: 16px; }
.current-photo img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius); }

/* detail */
.detail { display: flex; gap: 24px; background: var(--surface); padding: 24px;
          border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap; }
.photo img, .no-photo { width: 160px; height: 160px; object-fit: cover; border-radius: var(--radius); }
.no-photo { display: flex; align-items: center; justify-content: center; background: #eef0f3; color: var(--muted); }
.detail dl { display: grid; grid-template-columns: 100px 1fr; gap: 8px 16px; margin: 0; flex: 1; min-width: 260px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; }
.memo { white-space: pre-wrap; }
.actions { display: flex; gap: 8px; margin-top: 20px; }

code { background: #eef0f3; padding: 2px 6px; border-radius: 4px; font-size: 13px; word-break: break-all; }

@media (max-width: 640px) {
    .table.kv th { width: 120px; }
    .col-date { display: none; }
}

/* 공지사항 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; background: var(--primary);
         color: #fff; font-size: 12px; font-weight: 600; vertical-align: middle; }
.row-pinned { background: #f3f6fd; }
.col-writer { width: 110px; }
.col-views { width: 70px; text-align: center !important; }
.file-mark { margin-left: 6px; font-size: 12px; color: var(--muted); }

.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.post-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 20px; }
.post-head h1 { margin-bottom: 6px; }
.post-meta { display: flex; gap: 16px; font-size: 14px; flex-wrap: wrap; }
.post-body { white-space: pre-wrap; word-break: break-word; min-height: 120px; }

.gallery { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.gallery img { max-width: 100%; max-height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }

.attachments { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 12px; }
.attachments h2 { margin: 0 0 8px; font-size: 16px; }
.attachments ul, .file-edit-list { list-style: none; padding: 0; margin: 0; }
.attachments li { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.file-edit-list li { padding: 2px 0; }

@media (max-width: 640px) {
    .col-writer, .col-views { display: none; }
}
