/* 1n4D portal — shared base styles. Every module links this with a RELATIVE path. */
:root {
  --bg: #0e0f13; --panel: #171922; --panel-2: #1f2230; --line: #2c3040;
  --text: #e8e9ee; --muted: #9aa0b4; --accent: #7c9cff; --accent-2: #ffb86b;
  --ok: #5ad48a; --warn: #ffd166; --err: #ff6b6b;
  --radius: 10px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); min-height: 100%; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar .brand img { width: 28px; height: 28px; border-radius: 6px; }
.topbar nav a { margin-left: 14px; color: var(--muted); text-decoration: none; }
.topbar nav a:hover { color: var(--text); }
.userbadge { display: flex; align-items: center; gap: 10px; }
.badge { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.badge.guest { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=datetime-local], input[type=url], textarea, select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
button, .btn { background: var(--accent); color: #0b0c10; border: 0; border-radius: 8px; padding: 9px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button.secondary, .btn.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--err); color: #fff; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.err { color: var(--err); border-color: var(--err); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.readonly-banner { background: #2a2411; border: 1px solid #5a4a1a; color: var(--warn); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.meter { height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
#n4d-toast { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
#n4d-toast .toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 8px 12px; border-radius: 8px; }
#n4d-toast .toast.err { border-left-color: var(--err); } #n4d-toast .toast.ok { border-left-color: var(--ok); }
.spec-ref { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; }
footer.modfoot { margin-top: 24px; padding: 12px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
/* A1 adaptive: compact mode hides everything except elements marked .compact-keep */
html.compact .compact-hide { display: none !important; }
