/* Общие токены страниц /scheduler и /rooms. Тёмная тема по умолчанию, как у
   DSH; светлая включается системной настройкой. Цвета статусов проверены на
   контраст AA для текста 12–14 px на обоих фонах. */
:root {
	color-scheme: dark;
	--bg: #14171e;
	--bg-raised: #1b1f28;
	--bg-sunken: #11141a;
	--bg-hover: #232937;
	--bg-selected: #243350;
	--border: #2a3040;
	--border-strong: #3a4357;
	--text: #e7ebf2;
	--text-2: #aab3c3;
	--text-3: #8a93a6;
	--accent: #6ea8ff;
	--accent-strong: #3d7ce0;
	--accent-soft: rgba(110, 168, 255, .14);
	--ok: #5fd394;
	--ok-soft: rgba(95, 211, 148, .13);
	--warn: #e8a95b;
	--warn-soft: rgba(232, 169, 91, .14);
	--bad: #ff8a8a;
	--bad-soft: rgba(255, 138, 138, .13);
	--muted-soft: rgba(170, 179, 195, .12);
	--agent: #7fdcaa;
	--agent-soft: rgba(95, 211, 148, .10);
	--agent-border: rgba(95, 211, 148, .32);
	--mine-soft: rgba(110, 168, 255, .16);
	--mine-border: rgba(110, 168, 255, .38);
	--canvas: #181c24;
	--canvas-stroke: #c6cedc;
	--canvas-label: #dfe5ee;
	--shadow: 0 10px 30px rgba(0, 0, 0, .35);
	--radius: 10px;
	--radius-lg: 14px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: light) {
	:root {
		color-scheme: light;
		--bg: #f6f7f9;
		--bg-raised: #ffffff;
		--bg-sunken: #eef0f4;
		--bg-hover: #eef1f6;
		--bg-selected: #e3ecfb;
		--border: #e1e5ec;
		--border-strong: #cbd2dd;
		--text: #1a1f29;
		--text-2: #4a5263;
		--text-3: #6b7385;
		--accent: #2563c9;
		--accent-strong: #2563c9;
		--accent-soft: rgba(37, 99, 201, .10);
		--ok: #1d7f4b;
		--ok-soft: rgba(29, 127, 75, .10);
		--warn: #9a5a0c;
		--warn-soft: rgba(196, 124, 30, .13);
		--bad: #bf2f2f;
		--bad-soft: rgba(191, 47, 47, .09);
		--muted-soft: rgba(74, 82, 99, .09);
		--agent: #1d7f4b;
		--agent-soft: rgba(29, 127, 75, .07);
		--agent-border: rgba(29, 127, 75, .25);
		--mine-soft: rgba(37, 99, 201, .08);
		--mine-border: rgba(37, 99, 201, .25);
		--canvas: #ffffff;
		--canvas-stroke: #2c3442;
		--canvas-label: #1a1f29;
		--shadow: 0 10px 30px rgba(20, 30, 50, .12);
	}
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
	background: var(--bg-raised); border: 1px solid var(--border-strong); font-size: 13px;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent-strong); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.icon { width: 32px; padding: 0; }

.field { display: grid; gap: 4px; font-size: 12px; color: var(--text-3); }
.input, .select {
	height: 32px; padding: 0 10px; border-radius: 8px; min-width: 0;
	background: var(--bg-raised); border: 1px solid var(--border-strong); color: var(--text);
}
.input::placeholder, textarea::placeholder { color: var(--text-3); }

.chip {
	display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
	border-radius: 99px; font-size: 12px; line-height: 1; white-space: nowrap;
	background: var(--muted-soft); color: var(--text-2);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.agent { background: var(--agent-soft); color: var(--agent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.dim { color: var(--text-3); font-size: 12px; }
.mono { font-family: var(--mono); }

.toast {
	position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100;
	max-width: min(560px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 10px;
	background: var(--bg-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.toast.bad { border-color: var(--bad); color: var(--bad); }

/* Упрощённая разметка сообщений агентов (format.js). */
.md p { margin: 0 0 8px; white-space: pre-wrap; }
.md p:last-child, .md ul:last-child, .md ol:last-child, .md pre:last-child { margin-bottom: 0; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 20px; }
.md li { margin: 2px 0; }
.md code { font: 12.5px/1.4 var(--mono); background: var(--bg-sunken); border-radius: 5px; padding: 1px 5px; }
.md pre { margin: 0 0 8px; padding: 10px 12px; border-radius: 8px; background: var(--bg-sunken); overflow: auto; }
.md pre code { background: none; padding: 0; }
.md h4 { margin: 4px 0 6px; font-size: 14px; }
