:root {
    --ink: #1c1c1e;
    --muted: #6b6b70;
    --border: #e2e2e5;
    --accent: #2a5bd7;
    --bg: #fafafa;
    --surface: #ffffff;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.6;
}

.wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.site-header .brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--ink);
    text-decoration: none;
}

main.wrap { padding: 40px 20px 80px; }

h1 { font-size: 1.9rem; margin-bottom: 24px; }

.guide-list { list-style: none; padding: 0; }
.guide-list li {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.guide-list a { color: var(--accent); text-decoration: none; font-weight: 600; }
.guide-list .meta { color: var(--muted); font-size: 0.85rem; }

.guide-content { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 30px; }
.guide-content h2 { margin-top: 1.6em; }
.original-pdf { margin-top: 20px; }

.pdf-viewer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}
.pdf-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: #f6f6f8;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
.pdf-viewer-filename {
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pdf-viewer-open {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.pdf-viewer-open:hover { text-decoration: underline; }
.pdf-viewer-frame {
    display: block;
    width: 100%;
    height: 82vh;
    min-height: 480px;
    max-height: 900px;
    border: 0;
    background: #525659;
}

@media (max-width: 640px) {
    .pdf-viewer-frame { height: 70vh; }
}

.site-footer {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Admin */
.admin-header {
    background: #1c1c1e;
    color: #fff;
    padding: 14px 0;
}
.admin-header .wrap { display: flex; justify-content: space-between; align-items: center; }
.admin-header a { color: #fff; text-decoration: none; }
.admin-header nav a { margin-right: 16px; opacity: 0.85; }
.admin-header .logout { opacity: 0.7; font-size: 0.9rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 24px; }

table.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
table.admin-table th, table.admin-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
table.admin-table th { background: #f2f2f4; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
table.admin-table tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge.published { background: #e3f6e8; color: #1b7a3a; }
.badge.draft { background: #f0f0f2; color: var(--muted); }

.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.95rem;
}
.btn.secondary { background: #eceef2; color: var(--ink); }
.btn.danger { background: #d64545; }

form.stacked label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 0.9rem; }
form.stacked input[type=text], form.stacked input[type=password], form.stacked input[type=file] {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 18px; font-size: 1rem;
}

.login-wrap { max-width: 360px; margin: 80px auto; }

.actions form { display: inline; }
.actions .btn { padding: 6px 12px; font-size: 0.85rem; }

.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; }
.flash.error { background: #fdecec; color: #a11; }
.flash.success { background: #e3f6e8; color: #1b7a3a; }

#editor { background: #fff; min-height: 400px; border: 1px solid var(--border); }
.ql-toolbar { border-radius: 8px 8px 0 0; }
.ql-container { border-radius: 0 0 8px 8px; font-size: 1rem; }

#editorWrap { transition: opacity 0.15s ease; }
#editorWrap.is-superseded { opacity: 0.45; }

.option-row { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-weight: normal; }
.option-hint { margin: -4px 0 0 26px; color: var(--muted); font-size: 0.85rem; }
