/* Lokitron portal — public site + admin. */
:root {
  --bg: #f6f8fa; --surface: #ffffff; --text: #17202a; --muted: #5f6b76; --line: #dde3e8;
  --accent: #00a3c4; --accent-ink: #ffffff; --danger: #c43d2b; --ok: #1f9d63; --warn: #b7791f;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 4px 16px rgba(16, 24, 32, .05);
  font-family: -apple-system, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1419; --surface: #161d24; --text: #e6edf3; --muted: #95a1ad; --line: #26313b; --shadow: none; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono, .code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9rem; }
.right { text-align: right; }

/* ---- brand / buttons ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; color: var(--text); font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, #36c5e0, #0083a3); color: #fff; font-weight: 900; font-size: .95rem; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px;
  padding: 10px 20px; font-weight: 700; font-size: .95rem; cursor: pointer; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn.small { padding: 6px 14px; font-size: .85rem; }
.btn.wide { width: 100%; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; }
.danger { color: var(--danger) !important; }

/* ---- public ---- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.topbar nav a { margin-left: 22px; color: var(--muted); font-weight: 600; }
.hero { padding: 72px 0 40px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 8px; }
.lead { font-size: 1.15rem; color: var(--muted); margin: 0 0 20px; }
.section-title { font-size: 1.2rem; margin: 24px 0 14px; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 48px; }
.app-card { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); color: var(--text); border-top: 3px solid var(--accent); }
.app-card:hover { text-decoration: none; transform: translateY(-1px); }
.app-card-text { display: flex; flex-direction: column; }
.app-card-text span { color: var(--muted); font-size: .92rem; }
.app-icon { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: none; }
.app-icon.big { width: 96px; height: 96px; border-radius: 22px; }
.app-icon.placeholder { display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 1.5rem; }
.app-hero { padding: 56px 0 32px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent); }
.app-hero-inner { display: flex; gap: 24px; align-items: center; }
.app-hero h1 { margin: 0; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.app-body { display: grid; grid-template-columns: 1fr 320px; gap: 40px; padding-top: 32px; padding-bottom: 56px; }
.policy-list { display: flex; flex-direction: column; gap: 10px; }
.policy-list h2 { font-size: 1rem; margin: 0 0 4px; }
.policy-list a { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; color: var(--text); }
.policy-list a span { display: block; color: var(--muted); font-size: .88rem; }
.site-links a { margin-right: 18px; }
.doc { padding-top: 28px; padding-bottom: 64px; }
.crumbs { color: var(--muted); font-size: .9rem; display: flex; gap: 8px; }
.doc-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 12px 0 4px; }
.doc-grid { display: grid; grid-template-columns: 1fr 240px; gap: 40px; margin-top: 24px; }
.doc-side { position: sticky; top: 88px; align-self: start; display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
.doc-side a { color: var(--muted); padding: 4px 10px; border-left: 2px solid var(--line); }
.doc-side a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 2em; padding-top: .4em; border-top: 1px solid var(--line); font-size: 1.3rem; }
.prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin: .3em 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose code { background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 1px 6px; border-radius: 6px; }
.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-between; }
.footer-inner a { color: var(--muted); margin-left: 16px; }
.error-page { text-align: center; padding: 96px 20px; }
.error-code { font-size: 4rem; font-weight: 900; color: var(--accent); margin: 0; }
@media (max-width: 820px) {
  .app-body, .doc-grid { grid-template-columns: 1fr; }
  .doc-side { position: static; }
  .app-hero-inner { flex-direction: column; align-items: flex-start; }
}

/* ---- admin ---- */
body.admin { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex: none; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 14px;
  display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--muted); padding: 9px 12px; border-radius: 10px; font-weight: 600; }
.sidebar nav a.active, .sidebar nav a:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); text-decoration: none; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; }
.admin-main { flex: 1; padding: 28px clamp(16px, 4vw, 40px); max-width: 1100px; }
.admin-main h1 { margin-top: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card h2 { margin-top: 0; font-size: 1.1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat { color: var(--muted); }
.stat strong { display: block; font-size: 2rem; color: var(--text); }
.stat.alert strong { color: var(--danger); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.row-line { display: flex; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row-line:last-of-type { border-bottom: 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; font-weight: 400; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 4px; height: 44px; }
textarea.mono { font-size: .88rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
.actions { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; padding: 0; overflow: hidden; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr.group td { background: var(--bg); font-weight: 700; color: var(--muted); font-size: .85rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill.on, .pill.reviewed { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.pill.off { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.pill.new { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.flash { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600; }
.error { color: var(--danger); font-weight: 600; }
.code { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; }
.code.wrap { white-space: pre-wrap; word-break: break-word; }
.login-box { max-width: 380px; margin: 12vh auto; }
.login-box h1 { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; }
.narrow { max-width: 480px; }
.inline { display: inline; margin-left: 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg a { padding: 6px 14px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.seg a.active { background: var(--accent); color: #fff; }
.editor .tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.tab { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.preview { border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; min-height: 300px; max-width: none; margin-bottom: 14px; }
@media (max-width: 820px) {
  body.admin { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
