:root {
  --bg: #f5f7fa; --panel: #ffffff; --ink: #1f2933; --muted: #6b7a8c;
  --accent: #2f6feb; --line: #e2e8f0; --ok: #1a7f37; --err: #c0392b; --chip: #eef3fb;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
.health-banner { background: #c0392b; color: #fff; text-align: center; padding: 6px 12px; font-size: 13px; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand small { color: var(--muted); font-weight: 400; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
main { max-width: 860px; margin: 24px auto; padding: 0 16px; }
.hero h1 { margin: 0 0 6px; } .hero p { margin: 0 0 18px; color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.panel h2 { margin-top: 0; font-size: 17px; }
.form label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 14px; }
.form label small { color: var(--muted); font-weight: 400; }
.form input[type=text], .form input[type=url], .form input[type=password], .form input[type=file], .form textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
.form textarea { resize: vertical; }
.button { display: inline-block; margin-top: 14px; padding: 9px 18px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.link-button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.tab { padding: 8px 16px; border: 0; background: none; font: inherit; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.item-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; background: #fff; }
.item-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-title { font-weight: 600; color: var(--ink); text-decoration: none; }
.item-title:hover { text-decoration: underline; }
.item-meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.badge { padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.badge-file { background: var(--chip); color: var(--accent); }
.badge-url { background: #e7f7ee; color: #1a7f37; }
.badge-text { background: #fdf3e3; color: #a05a00; }
.badge.status { background: #eef1f5; color: var(--muted); }
.error { background: #fdecea; border: 1px solid #f5b5ab; color: var(--err); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.success { background: #e7f7ee; border: 1px solid #a9ddc0; color: var(--ok); border-radius: 8px; padding: 10px 14px; margin: 10px 0; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0; }
.center { text-align: center; }
.back-link { color: var(--accent); text-decoration: none; }
.item-head h1 { margin: 8px 0 0; }
.detail { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; }
.detail dt { color: var(--muted); font-weight: 600; } .detail dd { margin: 0; word-break: break-word; }
.detail code { background: var(--chip); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.actions { margin-top: 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.text-view pre { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 14px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.login-body { background: linear-gradient(135deg, #2f6feb, #6f42c1); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 420px; padding: 16px; }
.login-card { background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.login-brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
.login-intro { color: var(--muted); font-size: 14px; }
.note { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* RAG switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; transition: background .2s, box-shadow .2s; cursor: pointer; }
.switch-slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + .switch-slider { background: #1a7f37; box-shadow: 0 0 10px rgba(26,127,55,.55); }
.switch input:checked + .switch-slider::before { transform: translateX(20px); }
.switch-label { font-size: 13px; }
.switch-on { color: #1a7f37; font-weight: 600; }
.switch-off { color: var(--muted); }

:focus-visible { outline: 3px solid #2f6feb; outline-offset: 2px; border-radius: 6px; }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.filter-bar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }

.pager { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
