/*
 * idoai – arbetsytan. Samma språk som applicerad.ai i homelab: mjuk och mänsklig,
 * varm neutral grund (havre, sand, kol), en enda starkare färg (--org), stora
 * rubriker med tät spärrning, pilar, hårfina linjer och mycket luft. Inga cirklar –
 * rundade rektanglar och pillerformer.
 * Typsnitt: Hanken Grotesk (SIL Open Font License 1.1), självhostat.
 * CSP: inga style-attribut i HTML. Ikoner är Lucide (ISC) som CSS-masker.
 */

@font-face {
	font-family: "Hanken Grotesk";
	src: url("/hanken-grotesk.woff2") format("woff2");
	font-weight: 100 900;
	font-style: normal;
	font-display: swap;
}

:root {
	--bg: #f3eee7;
	--surface: #fbf8f4;
	--surface-2: #ece5db;
	--ink: #26221e;
	--ink-2: #6b6259;
	--ink-3: #8f857b;
	--line: rgb(38 34 30 / 0.1);
	--line-strong: rgb(38 34 30 / 0.2);
	--danger: #a8432c;
	--ok: #3d7550;
	--warn: #8a5a1c;
	--shadow: 0 1px 2px rgb(38 34 30 / 0.04), 0 8px 24px -12px rgb(38 34 30 / 0.14);
	--panel: #26221e;
	--panel-ink: #f3eee7;
	--panel-ink-2: #d9d0c5;
	--panel-line: rgb(243 238 231 / 0.14);

	--org: #3b3530;
	--org-ink: #fbf8f4;
	--org-soft: color-mix(in oklab, var(--org) 10%, var(--surface));
	--org-text: color-mix(in oklab, var(--org) 78%, var(--ink));
	--motor: #8a5a1c;
	--motor-soft: color-mix(in oklab, var(--motor) 12%, var(--surface));

	--font: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	--mono: ui-monospace, "SF Mono", Menlo, monospace;
	--radius: 22px;
	--radius-sm: 14px;
	--rail: 300px;

	--i-arrow-right: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E");
	--i-chevron-right: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
	--i-folder: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z'/%3E%3C/svg%3E");
	--i-file: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M14 2v4a2 2 0 0 0 2 2h4'/%3E%3C/svg%3E");
	--i-lock: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='11' x='3' y='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
	--i-cog: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z'/%3E%3Cpath d='M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z'/%3E%3Cpath d='M12 2v2'/%3E%3Cpath d='M12 22v-2'/%3E%3Cpath d='m17 20.66-1-1.73'/%3E%3Cpath d='M11 10.27 7 3.34'/%3E%3Cpath d='m20.66 17-1.73-1'/%3E%3Cpath d='m3.34 7 1.73 1'/%3E%3Cpath d='M14 12h8'/%3E%3Cpath d='M2 12h2'/%3E%3Cpath d='m20.66 7-1.73 1'/%3E%3Cpath d='m3.34 17 1.73-1'/%3E%3Cpath d='m17 3.34-1 1.73'/%3E%3Cpath d='m11 13.73-4 6.93'/%3E%3C/svg%3E");
	--i-users: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2'/%3E%3Cpath d='M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z'/%3E%3Cpath d='M22 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
	--i-history: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3Cpath d='M12 7v5l4 2'/%3E%3C/svg%3E");
	--i-plug: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22v-5'/%3E%3Cpath d='M9 8V2'/%3E%3Cpath d='M15 8V2'/%3E%3Cpath d='M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z'/%3E%3C/svg%3E");
	--i-trash: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6'/%3E%3Cpath d='M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2'/%3E%3C/svg%3E");
	--i-plus: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='M12 5v14'/%3E%3C/svg%3E");
	--i-upload: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M12 3v12'/%3E%3C/svg%3E");
	--i-search: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 21-4.34-4.34'/%3E%3Cpath d='M11 3a8 8 0 1 0 0 16 8 8 0 0 0 0-16'/%3E%3C/svg%3E");
	--i-sparkles: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z'/%3E%3C/svg%3E");
	--i-log-out: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m16 17 5-5-5-5'/%3E%3Cpath d='M21 12H9'/%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3C/svg%3E");
	--i-layout: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M9 21V9'/%3E%3C/svg%3E");
	--i-menu: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h16'/%3E%3Cpath d='M4 12h16'/%3E%3Cpath d='M4 18h16'/%3E%3C/svg%3E");
	--i-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2' ry='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/%3E%3C/svg%3E");
	--i-media: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E");
	--i-sheet: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='3' rx='2'/%3E%3Cpath d='M3 9h18'/%3E%3Cpath d='M3 15h18'/%3E%3Cpath d='M9 3v18'/%3E%3C/svg%3E");
	--i-slides: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 3h20'/%3E%3Cpath d='M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3'/%3E%3Cpath d='m7 21 5-5 5 5'/%3E%3C/svg%3E");
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #1b1816;
		--surface: #24211e;
		--surface-2: #2e2a26;
		--ink: #efe8df;
		--ink-2: #b8aea3;
		--ink-3: #8f857b;
		--line: rgb(239 232 223 / 0.1);
		--line-strong: rgb(239 232 223 / 0.2);
		--danger: #e98a72;
		--ok: #8fc79c;
		--warn: #e7b46b;
		--shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 12px 28px -14px rgb(0 0 0 / 0.5);
		--panel: #0f0d0c;
		--org: #d9cfc3;
		--org-ink: #1b1816;
		--org-soft: color-mix(in oklab, var(--org) 14%, var(--surface));
		--org-text: color-mix(in oklab, var(--org) 70%, var(--ink));
		--motor: #e7b46b;
		--motor-soft: color-mix(in oklab, var(--motor) 14%, var(--surface));
		color-scheme: dark;
	}
}

/* ---------- grund ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
	background: var(--bg);
	color: var(--ink);
	font: 400 16px/1.55 var(--font);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
::selection { background: var(--org-soft); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
p { margin: 0 0 12px; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
strong, b { font-weight: 600; }
code { font-family: var(--mono); font-size: .84rem; }

.ico { display: inline-block; flex: none; width: 1em; height: 1em; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.eyebrow { margin: 0; font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-2); }
.small { font-size: .85rem; }
.error { color: var(--danger); }
.ok { color: var(--ok); }
.warn { background: var(--motor-soft); color: var(--warn); padding: 12px 14px; border-radius: var(--radius-sm); }
.loading { padding: 40vh 0 0; text-align: center; color: var(--ink-3); }

/* ---------- kontroller ---------- */

label { display: block; margin: 0 0 6px; font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
input, select, textarea {
	width: 100%;
	min-height: 46px;
	padding: 10px 14px;
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	background: var(--surface-2);
	color: var(--ink);
	font: inherit;
	transition: border-color .15s, background .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: var(--org); box-shadow: 0 0 0 4px var(--org-soft); }
select { appearance: none; padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	min-height: 44px;
	padding: 10px 22px;
	border: 1px solid var(--org);
	border-radius: 999px;
	background: var(--org);
	color: var(--org-ink);
	font: 600 .95rem/1 var(--font);
	letter-spacing: -0.005em;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
	transition: transform .15s, background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn:focus-visible, a:focus-visible, .node:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--org-soft); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.go::after { content: ""; display: inline-block; width: 1em; height: 1em; background: currentColor; -webkit-mask: var(--i-arrow-right) center / contain no-repeat; mask: var(--i-arrow-right) center / contain no-repeat; transition: transform .15s; }
.btn.go:hover::after { transform: translateX(3px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.small { min-height: 36px; padding: 6px 15px; font-size: .86rem; }
.btn.danger { background: transparent; border-color: transparent; color: var(--ink-3); font-weight: 500; }
.btn.danger:hover { color: var(--danger); background: color-mix(in oklab, var(--danger) 10%, transparent); transform: none; }
.btn .ico { width: 1.05em; height: 1.05em; }

.tag, .lock {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	margin-left: 8px;
	padding: 2px 9px;
	border-radius: 999px;
	font-size: .72rem;
	font-weight: 600;
	white-space: nowrap;
	vertical-align: middle;
}
.tag { border: 1px solid var(--line); color: var(--ink-3); font-weight: 500; }
.lock { background: var(--motor-soft); color: var(--warn); }
.lock::before { content: ""; width: .95em; height: .95em; background: currentColor; -webkit-mask: var(--i-lock) center / contain no-repeat; mask: var(--i-lock) center / contain no-repeat; }

/* ---------- inloggning och godkännande ---------- */

.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-side {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	gap: 40px;
	padding: clamp(40px, 5vw, 64px) clamp(28px, 5vw, 72px);
	background: var(--panel);
	color: var(--panel-ink);
}
.auth-side .eyebrow { color: var(--panel-ink-2); opacity: .7; }
.auth-claim { margin: 0; max-width: 12ch; font-size: clamp(2.6rem, 4.6vw, 4rem); font-weight: 600; letter-spacing: -0.045em; line-height: .98; }
.arrow-list { margin: 0; padding: 0; list-style: none; }
.arrow-list li { display: flex; gap: 14px; padding: 15px 0; border-top: 1px solid var(--panel-line); color: var(--panel-ink-2); }
.arrow-list li:last-child { border-bottom: 1px solid var(--panel-line); }
.arrow-list li::before { content: ""; flex: none; width: 1em; height: 1em; margin-top: .3em; background: currentColor; opacity: .6; -webkit-mask: var(--i-arrow-right) center / contain no-repeat; mask: var(--i-arrow-right) center / contain no-repeat; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 560px; width: 100%; padding: 64px clamp(24px, 6vw, 96px); }
.wordmark { margin: 0 0 14px; font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; }
.auth-panel h1 { font-size: clamp(2rem, 3.2vw, 2.6rem); letter-spacing: -0.04em; }
.auth-panel .lead { font-size: 1.05rem; color: var(--ink-2); max-width: 38ch; }
.auth-form { display: grid; gap: 14px; max-width: 420px; }
.auth-form .btn { min-height: 52px; font-size: 1rem; }
.auth-form .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.otp-input { font-size: 1.6rem; letter-spacing: .4em; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.fine { font-size: .82rem; color: var(--ink-3); max-width: 42ch; }

/* enkel kortsida: godkännandet i OAuth (pages.js) */
.center { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 2.6vw, 30px); }
.center > .card { width: 100%; max-width: 460px; }
.card h1 { font-size: 1.6rem; letter-spacing: -0.035em; margin: 0 0 14px; }
.brand { margin: 0 0 22px; font-weight: 700; letter-spacing: -0.03em; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.center .row > * { flex: 1; }

@media (max-width: 860px) {
	.auth { grid-template-columns: 1fr; }
	.auth-side { order: 2; gap: 24px; padding: 32px 20px 40px; }
	.auth-claim { font-size: 2.2rem; }
	.auth-panel { padding: 40px 20px 48px; }
}

/* ---------- arbetsytan ---------- */

.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }

.side {
	position: sticky;
	top: 0;
	height: 100vh;
	display: flex;
	flex-direction: column;
	gap: 18px;
	padding: 24px 16px 18px;
	border-right: 1px solid var(--line);
	background: var(--bg);
	min-height: 0;
}
.org-id { display: flex; align-items: center; gap: 12px; padding: 0 6px; min-width: 0; }
.org-mark { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--org); color: var(--org-ink); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; }
.org-id > div { min-width: 0; }
.org-id strong { display: block; font-size: 1.05rem; letter-spacing: -0.02em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-id span { font-size: .82rem; color: var(--ink-3); }

.search { position: relative; }
.search::before { content: ""; position: absolute; left: 14px; top: 50%; width: 1em; height: 1em; transform: translateY(-50%); background: var(--ink-3); -webkit-mask: var(--i-search) center / contain no-repeat; mask: var(--i-search) center / contain no-repeat; pointer-events: none; }
.search input { min-height: 42px; padding-left: 40px; border-radius: 999px; font-size: .95rem; }

.tree { flex: 1; min-height: 0; overflow: auto; margin: 0 -4px; padding: 0 4px 12px; }
.tree-group { padding: 14px 10px 6px; }
.node {
	display: flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 6px 10px;
	border-radius: 12px;
	color: var(--ink-2);
	font-size: .94rem;
	font-weight: 500;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	transition: background .15s, color .15s;
}
.node > .name { overflow: hidden; text-overflow: ellipsis; }
.node:hover { background: var(--surface); color: var(--ink); }
.node.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.node .caret { width: .85em; height: .85em; flex: none; background: var(--ink-3); -webkit-mask: var(--i-chevron-right) center / contain no-repeat; mask: var(--i-chevron-right) center / contain no-repeat; transition: transform .15s; }
.node .caret.open { transform: rotate(90deg); }
.node .caret.none { visibility: hidden; }
.node .ico { color: var(--ink-3); --i: var(--i-folder); }
.node.file .ico { --i: var(--i-file); }
.node .count { margin-left: auto; padding-left: 8px; color: var(--ink-3); font-size: .76rem; font-variant-numeric: tabular-nums; }
.node .lock { margin-left: auto; padding: 1px 7px; }
.node .lock::before { display: none; }
.node .lock + .count { margin-left: 6px; }
.node.motor { color: var(--ink); font-weight: 650; background: var(--motor-soft); }
.node.motor .ico { color: var(--warn); --i: var(--i-cog); }
.node.motor:hover, .node.motor.active { background: color-mix(in oklab, var(--motor) 18%, var(--surface)); }
.children { margin-left: 15px; padding-left: 6px; border-left: 1px solid var(--line); }

.side footer { display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.side footer button {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 36px;
	padding: 6px 10px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: var(--ink-2);
	font: 500 .9rem/1.2 var(--font);
	text-align: left;
	cursor: pointer;
}
.side footer button:hover { background: var(--surface); color: var(--ink); }
.side footer button .ico { color: var(--ink-3); }

.main { min-width: 0; }
.bar {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	padding: 14px clamp(20px, 4vw, 56px);
	background: color-mix(in oklab, var(--bg) 88%, transparent);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.crumbs { flex: 1; min-width: 180px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; font-size: .9rem; color: var(--ink-3); }
.crumbs a { cursor: pointer; text-decoration: none; padding: 2px 4px; border-radius: 6px; }
.crumbs a:hover { color: var(--ink); background: var(--surface); }
.crumbs a:last-child { color: var(--ink); font-weight: 600; }
.crumbs .sep { width: .8em; height: .8em; background: var(--ink-3); opacity: .6; -webkit-mask: var(--i-chevron-right) center / contain no-repeat; mask: var(--i-chevron-right) center / contain no-repeat; }

.content { padding: clamp(28px, 4vw, 48px) clamp(20px, 4vw, 56px) 96px; max-width: 1180px; }
.content > h2 { font-size: clamp(2rem, 3.6vw, 3rem); font-weight: 600; letter-spacing: -0.045em; line-height: 1; margin: 6px 0 12px; }
.content > h2.spaced { font-size: 1.5rem; margin-top: 40px; }
.desc { color: var(--ink-2); font-size: 1.02rem; max-width: 62ch; margin: 0 0 22px; }
.meta { color: var(--ink-3); font-size: .9rem; margin: 0 0 20px; }

/* mapplistan: luftiga rader i ett mjukt kort */
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table.list th { padding: 16px 16px 10px; text-align: left; font-size: .68rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line); }
table.list td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list td:first-child { font-weight: 500; }
table.list td.num, table.list th.num { text-align: right; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: .88rem; }
table.list tr.click { cursor: pointer; transition: background .12s; }
table.list tr.click:hover td { background: var(--org-soft); }
table.list .rowname { display: inline-flex; align-items: center; gap: 10px; }
table.list .rowname .ico { color: var(--ink-3); --i: var(--i-folder); }
table.list .rowname.file .ico { --i: var(--i-file); }
table.list tr.motor td:first-child { font-weight: 650; }
table.list tr.motor .rowname .ico { color: var(--warn); --i: var(--i-cog); }

.empty { padding: 48px 24px; text-align: center; color: var(--ink-3); background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }

/* filvisning */
pre.text { font: 13px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 26px; margin: 0; }
.md { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(22px, 3vw, 40px) clamp(22px, 4vw, 56px); line-height: 1.7; }
.md > * { max-width: 70ch; }
.md h1 { font-size: 1.9rem; letter-spacing: -0.035em; margin: 0 0 16px; }
.md h2 { font-size: 1.35rem; letter-spacing: -0.025em; margin: 28px 0 10px; }
.md h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.md ul, .md ol { padding-left: 1.3em; }
.md li { margin: 4px 0; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 6px; }
.md pre { background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-sm); overflow: auto; }
.md blockquote { margin: 12px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }
.md table { border-collapse: collapse; margin: 12px 0; }
.md td, .md th { border-bottom: 1px solid var(--line); padding: 6px 12px 6px 0; text-align: left; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
iframe.view, video.view { width: 100%; height: calc(100vh - 220px); min-height: 420px; border: 0; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
img.view { max-width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
audio { width: 100%; }

.summary { position: relative; margin: 0 0 22px; padding: 18px 22px 18px 52px; border-radius: var(--radius); background: var(--org-soft); }
.summary::before { content: ""; position: absolute; left: 22px; top: 21px; width: 1.05em; height: 1.05em; background: var(--org-text); -webkit-mask: var(--i-sparkles) center / contain no-repeat; mask: var(--i-sparkles) center / contain no-repeat; }
.summary strong { font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.summary p { margin: 6px 0 0; font-size: 1.02rem; color: var(--ink); max-width: 70ch; }

.tabs { display: inline-flex; gap: 4px; margin: 0 0 16px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.tabs button { min-height: 32px; padding: 4px 16px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); font: 600 .85rem/1 var(--font); cursor: pointer; }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* sök */
.hitfile { display: inline-flex; align-items: center; gap: 8px; margin: 26px 0 8px; font-weight: 600; cursor: pointer; }
.hitfile::before { content: ""; width: 1em; height: 1em; background: var(--ink-3); -webkit-mask: var(--i-file) center / contain no-repeat; mask: var(--i-file) center / contain no-repeat; }
.hitfile:hover { text-decoration: underline; text-underline-offset: 3px; }
.hits { background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 10px 0; }
.hit { font: 13px/1.6 var(--mono); padding: 1px 18px; white-space: pre-wrap; word-break: break-word; }
.hit .ln { color: var(--ink-3); display: inline-block; min-width: 48px; }
.hit.ctx { color: var(--ink-3); }
.hit:not(.ctx) { background: var(--org-soft); }

/* formulär och sidor */
textarea.edit { min-height: 60vh; font: 13px/1.6 var(--mono); padding: 18px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.form { display: grid; gap: 12px; max-width: 520px; }
.form .btn { justify-self: start; }
code.copy { display: inline-block; font-family: var(--mono); font-size: .9rem; background: var(--surface); box-shadow: var(--shadow); padding: 12px 16px; border-radius: var(--radius-sm); user-select: all; word-break: break-all; }
.drop { margin: 18px 0 0; padding: 26px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); text-align: center; color: var(--ink-3); transition: border-color .15s, background .15s, color .15s; }
.drop.over { border-color: var(--org); background: var(--org-soft); color: var(--ink); }
.progress { font-size: .9rem; color: var(--ink-2); margin-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.notice { position: fixed; bottom: 22px; right: 22px; z-index: 10; max-width: 420px; padding: 12px 18px; border-radius: var(--radius-sm); background: var(--panel); color: var(--panel-ink); box-shadow: var(--shadow); font-size: .95rem; }
.notice.bad { background: var(--danger); color: #fff; }

.menu-btn { display: none; }
@media (max-width: 860px) {
	.shell { grid-template-columns: 1fr; }
	.side { position: fixed; inset: 0 18% 0 0; z-index: 5; transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 60px rgb(0 0 0 / .25); }
	.side.open { transform: none; }
	.menu-btn { display: inline-flex; }
	.content > h2 { font-size: 2rem; }
	table.list td.num.hide-sm, table.list th.num.hide-sm { display: none; }
}

/* ---------- tillägg efter designerns råd (homelab-designer 2026-10-09) ---------- */

[hidden] { display: none !important; }
.spaced-top { margin-top: 36px !important; }

/* ikonklasser: .ico.i-namn */
.i-folder { --i: var(--i-folder); } .i-file { --i: var(--i-file); } .i-image { --i: var(--i-image); }
.i-media { --i: var(--i-media); } .i-sheet { --i: var(--i-sheet); } .i-slides { --i: var(--i-slides); }
.i-cog { --i: var(--i-cog); } .i-plus { --i: var(--i-plus); } .i-users { --i: var(--i-users); }
.i-layout { --i: var(--i-layout); } .i-history { --i: var(--i-history); } .i-trash { --i: var(--i-trash); }
.i-plug { --i: var(--i-plug); } .i-log-out { --i: var(--i-log-out); } .i-upload { --i: var(--i-upload); }
.i-menu { --i: var(--i-menu); }

/* vänsterspalten: mörk panel, trädet som tysta länkar */
.side { background: var(--panel); color: var(--panel-ink); border-right: 0; }
.org-mark { background: var(--panel-ink); color: var(--panel); }
.org-id span { color: var(--panel-ink-2); opacity: .75; }
.search::before { background: var(--panel-ink-2); opacity: .7; }
.search input { background: rgb(243 238 231 / .08); color: var(--panel-ink); }
.search input::placeholder { color: var(--panel-ink-2); opacity: .7; }
.search input:hover { border-color: var(--panel-line); }
.search input:focus { background: rgb(243 238 231 / .12); border-color: var(--panel-ink-2); box-shadow: none; }
.tree { scrollbar-color: var(--panel-line) transparent; }
.node { min-height: 32px; padding: 5px 10px; border-radius: 10px; color: var(--panel-ink-2); font-size: .9rem; }
.node:hover { background: rgb(243 238 231 / .07); color: var(--panel-ink); }
.node.active { background: rgb(243 238 231 / .12); color: var(--panel-ink); box-shadow: none; }
.node.open > .name { color: var(--panel-ink); font-weight: 600; }
.node .caret { background: var(--panel-ink-2); opacity: .6; }
.node .count { color: var(--panel-ink-2); opacity: .6; }
.node.motor { background: transparent; color: var(--panel-ink); font-weight: 600; }
.node.motor:hover, .node.motor.active { background: rgb(243 238 231 / .1); }
.children { border-left-color: var(--panel-line); }
.side footer { border-top-color: var(--panel-line); }
.side footer button { color: var(--panel-ink-2); }
.side footer button:hover { background: rgb(243 238 231 / .07); color: var(--panel-ink); }
.side footer button .ico { color: var(--panel-ink-2); opacity: .7; }
.side .me { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 10px 10px 0; border-top: 1px solid var(--panel-line); font-size: .82rem; color: var(--panel-ink-2); }
.side .me > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.side .me .link { min-height: 0; padding: 4px 6px; flex: none; }

/* rader i stället för tabell: namn överst, grå meta under */
.items { display: flex; flex-direction: column; }
.item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px 6px;
	border-bottom: 1px solid var(--line);
	cursor: pointer;
	border-radius: 0;
	transition: background .12s;
}
.item:first-child { border-top: 1px solid var(--line); }
.item:hover, .item:focus-visible { background: color-mix(in oklab, var(--surface) 70%, transparent); outline: none; }
.item > .ico { width: 1.15em; height: 1.15em; color: var(--ink-3); }
.item.motor > .ico { color: var(--org-text); }
.item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.item .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item.motor .title { font-weight: 600; }
.item .meta { margin: 2px 0 0; font-size: .82rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.go-arrow { flex: none; width: 1em; height: 1em; background: var(--ink-3); -webkit-mask: var(--i-arrow-right) center / contain no-repeat; mask: var(--i-arrow-right) center / contain no-repeat; opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
.item:hover .go-arrow { opacity: .7; transform: none; }
.empty-line { color: var(--ink-3); margin: 8px 0 0; }

/* kontroller: hover färgar, lyfter inte */
.btn:hover { transform: none; filter: brightness(1.08); }
.btn.ghost:hover { filter: none; }
.btn.armed { color: var(--danger); background: color-mix(in oklab, var(--danger) 12%, transparent); border-color: transparent; }
.link { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 0; }
.link:hover { color: var(--panel-ink); }

/* formulär direkt på sidan */
.inline-form { margin: 0 0 22px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); max-width: 640px; }
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row input { flex: 1; }
.inline-form .error:empty { display: none; }
.inline-form .error { margin: 8px 0 0; }

/* brödsmulor och rubriker */
.copy-link { margin-left: auto; }
.content > .eyebrow { margin: 0 0 4px; }
.content > h2.file-title { font-size: clamp(1.6rem, 2.6vw, 2.2rem); letter-spacing: -0.035em; word-break: break-word; }
.summary .by { display: block; margin-top: 8px; font-size: .8rem; color: var(--ink-3); }
.hitfile { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 22px 0 8px; }
.hitfile .meta { margin: 0; font-size: .8rem; font-weight: 400; color: var(--ink-3); }

/* bekräftelser: ett piller nere i mitten */
.notice { left: 50%; right: auto; bottom: 26px; transform: translateX(-50%); border-radius: 999px; padding: 11px 22px; max-width: min(560px, calc(100vw - 32px)); text-align: center; }

@media (max-width: 860px) {
	.bar { gap: 8px; padding: 10px 16px; }
	.crumbs { flex-basis: 100%; order: -1; }
	.drop { display: none; }
	.copy-link { display: none; }
	.item { padding: 13px 2px; }
	.inline-row { flex-wrap: wrap; }
	.inline-row input { flex-basis: 100%; }
}
