/* Dialtone web app. No external fonts or assets (CSP: 'self' only). */
:root {
	--brand: #00795f;
	--brand-strong: #006a66;
	--brand-soft: #d3f8e2;
	--bg: #f4f6f8;
	--surface: #ffffff;
	--surface-2: #f8fafb;
	--line: #e3e8ee;
	--text: #10202d;
	--muted: #5f6f7d;
	--active: #16a34a;
	--ringing: #d97706;
	--hold: #7c3aed;
	--parked: #2563eb;
	--danger: #dc2626;
	--offline: #94a3b8;
	--shadow: 0 1px 2px rgb(16 32 45 / 6%), 0 4px 16px rgb(16 32 45 / 6%);
	--shadow-lg: 0 12px 40px rgb(16 32 45 / 18%);
	--radius: 14px;
	--radius-sm: 9px;
	--nav-w: 232px;
	--top-h: 60px;
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--brand: #38ed6a;
		--brand-strong: #7ff59a;
		--brand-soft: #0d3b2e;
		--bg: #0b1220;
		--surface: #121b2d;
		--surface-2: #0f1828;
		--line: #22304a;
		--text: #e6edf5;
		--muted: #93a3b8;
		--active: #4ade80;
		--ringing: #fbbf24;
		--hold: #a78bfa;
		--parked: #60a5fa;
		--danger: #f87171;
		--offline: #64748b;
		--shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 6px 18px rgb(0 0 0 / 25%);
		--shadow-lg: 0 16px 48px rgb(0 0 0 / 50%);
	}
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
	font: 15px/1.45 var(--font);
	color: var(--text);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

.icon.dots { stroke-width: 3.6; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ brand */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.12rem; letter-spacing: -0.01em; }
.brand-mark {
	width: 30px; height: 30px; border-radius: 9px; flex: none;
	/* The Dialtone app icon (branding/dialtone-app-icon.svg). */
	background: #00c278 url(/icons/icon.svg) center / cover no-repeat;
	box-shadow: inset 0 0 0 1px rgb(255 255 255 / 15%);
}
.brand.big .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
.brand.big { font-size: 1.6rem; }

/* ------------------------------------------------------------- boot */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.boot-mark { width: 44px; height: 44px; border-radius: 13px; background: #00c278 url(/icons/icon.svg) center / cover no-repeat; animation: pulse 1.4s ease-in-out infinite; }

/* ------------------------------------------------------------ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
	radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 60%),
	radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, #006a66 22%, transparent), transparent 60%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 32px 28px; box-shadow: var(--shadow-lg); display: grid; gap: 10px; }
.login-card h1 { margin-top: 18px; }
.login-form { display: grid; gap: 8px; margin-top: 12px; }
.login-form label { font-weight: 600; font-size: 0.9rem; margin-top: 6px; }
.login-form input { height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; font: inherit; color: var(--text); background: var(--surface-2); }
.login-form input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
.login-foot { margin-top: 18px; font-size: 0.85rem; }
.form-msg { min-height: 1.3em; font-size: 0.92rem; display: flex; gap: 8px; align-items: center; }
.form-msg.error { color: var(--danger); }
.form-msg.info { color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; }

/* ----------------------------------------------------------- buttons */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 14px;
	border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
	font: 600 0.92rem var(--font); cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #062a1c; } }
.btn.block { width: 100%; min-height: 46px; margin-top: 10px; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent; }
.btn.busy::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2.5px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn.small { width: 30px; height: 30px; }

/* ------------------------------------------------------------- shell */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--nav-w) 1fr; grid-template-rows: var(--top-h) 1fr; grid-template-areas: "top top" "nav content"; }
.topbar { grid-area: top; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 0 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.spacer { flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 650; padding: 5px 11px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--offline); }
.status-pill.live { color: var(--active); }
.status-pill.live .dot { background: var(--active); box-shadow: 0 0 0 0 color-mix(in srgb, var(--active) 60%, transparent); animation: ping 2s infinite; }
.status-pill.stale { color: var(--ringing); }
.status-pill.stale .dot { background: var(--ringing); }
.status-pill.down { color: var(--danger); }
.status-pill.down .dot { background: var(--danger); }
.user-btn { display: inline-flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 0.9rem var(--font); cursor: pointer; min-height: 40px; }
.user-btn:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

.nav { grid-area: nav; position: sticky; top: var(--top-h); align-self: start; height: calc(100vh - var(--top-h)); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); background: var(--surface); }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 11px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current="page"], .nav-more.current { background: var(--brand-soft); color: var(--brand-strong); }
.nav-sep { margin: 14px 14px 4px; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.nav-more { display: none; border: 0; background: none; font-family: inherit; cursor: pointer; }
@media (prefers-color-scheme: dark) { .nav-item[aria-current="page"] { color: var(--brand); } }

.content { grid-area: content; min-width: 0; padding: 22px clamp(14px, 3vw, 34px) 40px; }
.view:focus { outline: none; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head p { margin-top: 4px; }
.app.degraded .view { opacity: 0.72; transition: opacity 0.3s; }

.banner { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; margin-bottom: 16px; font-weight: 550; border: 1px solid; }
.banner.stale { background: color-mix(in srgb, var(--ringing) 12%, var(--surface)); border-color: color-mix(in srgb, var(--ringing) 35%, transparent); }
.banner.down { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.banner span { flex: 1; }

/* -------------------------------------------------------- segmented */
.segmented { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.segmented.wrap { flex-wrap: wrap; margin-bottom: 16px; }
.segmented button { min-height: 36px; padding: 0 14px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font: 600 0.88rem var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button[aria-pressed="true"] { background: var(--brand); color: #fff; }
@media (prefers-color-scheme: dark) { .segmented button[aria-pressed="true"] { color: #062a1c; } }
.segmented .count { font-size: 0.78rem; opacity: 0.8; }

/* ------------------------------------------------------------ search */
.search { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); min-width: min(320px, 100%); }
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.search-input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); min-height: 40px; min-width: 0; }

/* ------------------------------------------------------------- calls */
.calls-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1280px) { .calls-layout { grid-template-columns: 1fr 300px; } }
.call-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.call-card {
	position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
	padding: 14px 16px 12px 20px; display: grid; gap: 10px; outline-offset: 3px; transition: transform 0.12s, box-shadow 0.12s;
}
.call-card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--tone, var(--offline)); }
.call-card.tone-active { --tone: var(--active); }
.call-card.tone-ringing { --tone: var(--ringing); }
.call-card.tone-hold { --tone: var(--hold); }
.call-card.tone-parked { --tone: var(--parked); }
.call-card.mine { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.call-card.dragging { opacity: 0.5; transform: scale(0.98); }
.call-card[draggable="true"] { cursor: grab; }
.call-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--muted); }
.held-by { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.held-by .icon { width: 16px; height: 16px; }
.parties { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.parties .link { color: var(--muted); display: inline-grid; }
.party { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1 1 160px; }
.party-text { display: grid; min-width: 0; }
.party-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-num { color: var(--muted); font-size: 0.87rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.call-meta { font-size: 0.87rem; }
.call-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 2px; border-top: 1px dashed var(--line); padding-top: 10px; }
.call-actions .icon-btn { margin-left: auto; }

.chip { display: inline-flex; align-items: center; gap: 7px; font-size: 0.8rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: var(--c, var(--muted)); background: color-mix(in srgb, var(--c, var(--muted)) 13%, transparent); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.active { --c: var(--active); }
.chip.ringing { --c: var(--ringing); }
.chip.ringing .chip-dot { animation: blink 1s steps(2) infinite; }
.chip.hold { --c: var(--hold); }
.chip.parked { --c: var(--parked); }
.badge { font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.badge.you { color: var(--brand-strong); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.badge.hold { color: var(--hold); }
.badge.ringing { color: var(--ringing); }
.badge.rec { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 0.85rem; color: #fff; background: linear-gradient(135deg, #00795f, #00514e); letter-spacing: 0.02em; }
.avatar.ext { background: linear-gradient(135deg, #64748b, #334155); }
.avatar.sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar.xs { width: 24px; height: 24px; font-size: 0.62rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.05rem; }
.presence-ring { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--pc, var(--offline)); }
.presence-ring.available { --pc: var(--active); }
.presence-ring.busy { --pc: var(--danger); }
.presence-ring.ringing { --pc: var(--ringing); animation: ring 1.2s ease-in-out infinite; }
.presence-ring.hold { --pc: var(--hold); }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; font-weight: 650; color: var(--pc, var(--muted)); }
.presence .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.presence.available { --pc: var(--active); }
.presence.busy { --pc: var(--danger); }
.presence.ringing { --pc: var(--ringing); }
.presence.hold { --pc: var(--hold); }
.presence.offline, .presence.unknown { --pc: var(--offline); }

/* rail (wide screens) */
.rail { display: none; }
@media (min-width: 1280px) {
	.rail { display: block; position: sticky; top: calc(var(--top-h) + 22px); align-self: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; max-height: calc(100vh - var(--top-h) - 44px); overflow: auto; }
}
.rail-title { font-size: 0.95rem; }
.rail p { margin: 4px 0 10px; }
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rail-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; border: 1px dashed transparent; }
.rail-item.drop { border-color: var(--brand); background: var(--brand-soft); }
.rail-text { display: grid; font-size: 0.9rem; min-width: 0; }
.rail-text span:first-child { font-weight: 650; }

/* -------------------------------------------------------- directory */
.dir-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.dir-tile { position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 20px 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.dir-tile.own { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.dir-tile .avatar { margin-bottom: 6px; }
.dir-name { font-weight: 700; }
.dir-call { font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.tile-more { position: absolute; top: 6px; right: 6px; }

/* ----------------------------------------------------------- parking */
.meter { display: flex; gap: 4px; }
.meter span { width: 16px; height: 22px; border-radius: 5px; background: var(--line); }
.meter span.on { background: var(--parked); }
.slot-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.slot { border-radius: var(--radius); padding: 14px 16px; min-height: 148px; display: grid; align-content: start; gap: 10px; }
.slot.free { border: 2px dashed var(--line); color: var(--muted); place-content: center; justify-items: center; }
.slot.busy { background: var(--surface); border: 1px solid color-mix(in srgb, var(--parked) 45%, var(--line)); box-shadow: var(--shadow); }
.slot-num { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.slot.free .slot-num { opacity: 0.7; }
.slot-state { font-weight: 600; }
.slot-top { display: flex; align-items: center; justify-content: space-between; }
.slot-actions { display: flex; gap: 8px; }
.slot-actions .btn { flex: 1; }
.timeout { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.timeout span { display: block; height: 100%; background: var(--parked); transition: width 1s linear; }
.timeout.low span { background: var(--ringing); }

/* ---------------------------------------------------------- overview */
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow); border-top: 4px solid var(--c, var(--brand)); }
.kpi.active { --c: var(--active); } .kpi.ringing { --c: var(--ringing); } .kpi.hold { --c: var(--hold); } .kpi.parked { --c: var(--parked); }
.kpi-value { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi-label { font-weight: 650; }
.kpi-sub { font-size: 0.82rem; }
.board { margin-bottom: 22px; }
.board h2 { margin-bottom: 10px; }
.board-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.board-cell { display: grid; gap: 2px; padding: 10px 12px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--pc, var(--offline)); }
.board-cell.available { --pc: var(--active); } .board-cell.busy { --pc: var(--danger); } .board-cell.ringing { --pc: var(--ringing); } .board-cell.hold { --pc: var(--hold); }
.board-ext { font-weight: 800; font-variant-numeric: tabular-nums; }
.board-name { font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-time { font-size: 0.82rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.calls-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.calls-table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); }
.calls-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.calls-table tr:last-child td { border-bottom: 0; }
.who { display: inline-flex; align-items: center; gap: 8px; }

/* ----------------------------------------------------- empty states */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 56px 20px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.empty-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); margin-bottom: 6px; }
.empty-icon .icon { width: 28px; height: 28px; }
.empty.denied .empty-icon { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.empty p { max-width: 46ch; }
.skeletons { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.skeleton-card { height: 140px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); padding: 16px; display: grid; gap: 12px; align-content: start; }
.sk { display: block; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--line), var(--surface-2), var(--line)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sk-chip { width: 90px; height: 22px; } .sk-line { width: 80%; } .sk-line.short { width: 45%; }

/* ----------------------------------------------------- menus/dialogs */
.menu { position: fixed; z-index: 60; min-width: 220px; max-width: min(320px, 92vw); padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: pop 0.12s ease-out; }
.menu-item { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border: 0; background: transparent; color: var(--text); font: 550 0.92rem var(--font); border-radius: 8px; cursor: pointer; text-align: left; }
.menu-item:hover, .menu-item:focus { background: var(--brand-soft); outline: none; }
.backdrop { position: fixed; inset: 0; z-index: 50; background: rgb(8 15 26 / 45%); display: grid; place-items: center; padding: 16px; animation: fade 0.15s ease-out; }
.dialog { width: min(520px, 100%); max-height: min(720px, 90vh); display: flex; flex-direction: column; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: pop 0.15s ease-out; }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; padding: 18px 18px 12px 20px; border-bottom: 1px solid var(--line); }
.dialog-head p { margin-top: 4px; font-size: 0.9rem; }
.dialog-body { padding: 16px 20px 20px; overflow: auto; display: grid; gap: 12px; }
.moving { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 11px; }
.picker { display: grid; gap: 10px; }
.dest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 46vh; overflow: auto; }
.dest { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.dest.active { background: var(--brand-soft); }
.dest.disabled { opacity: 0.45; cursor: not-allowed; }
.dest-main { display: grid; flex: 1; min-width: 0; }
.empty-row { padding: 14px; color: var(--muted); }
.choice-list { display: grid; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.choice:hover, .choice:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.choice-main { display: grid; flex: 1; }
.quick { display: grid; gap: 8px; }

/* ------------------------------------------------------------ toasts */
.toasts { position: fixed; z-index: 70; right: 16px; bottom: 16px; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-weight: 550; animation: pop 0.15s ease-out; }
.toast-text { flex: 1; }
.toast-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.toast-actions:empty { display: none; }
.toast-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); flex: none; }
.toast.info .toast-dot { animation: pulse 1.2s infinite; }
.toast.success .toast-dot { background: var(--active); }
.toast.warn .toast-dot { background: var(--ringing); }
.toast.error .toast-dot { background: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: 0.2s; }

/* -------------------------------------------------- small screens */
@media (max-width: 900px) {
	.app { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr auto; grid-template-areas: "top" "content" "nav"; }
	.nav { position: sticky; bottom: 0; top: auto; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 20; }
	.nav-item { flex-direction: column; gap: 2px; min-height: 52px; padding: 4px 1px; font-size: 0.7rem; letter-spacing: -0.01em; flex: 1; justify-content: center; border-radius: 10px; min-width: 0; }
	.nav-item > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
	.nav-sep, .nav-extra { display: none; }
	.nav-more { display: flex; position: relative; }
	.user-name { display: none; }
	.user-btn { padding: 4px; }
	.toasts { bottom: calc(76px + env(safe-area-inset-bottom)); left: 16px; right: 16px; width: auto; }
	.backdrop { place-items: end stretch; padding: 0; }
	.dialog { width: 100%; max-height: 88vh; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); animation: sheet 0.2s ease-out; }
	.call-actions .btn { flex: 1; min-height: 44px; }
	h1 { font-size: 1.35rem; }
}
@media (max-width: 560px) {
	.parties { flex-direction: column; align-items: stretch; gap: 4px; }
	.parties .link { transform: rotate(90deg); width: 40px; justify-items: center; }
	.party { flex: none; }
}
@media (max-width: 480px) {
	.content { padding: 16px 12px 28px; }
	.dir-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.status-pill { font-size: 0.75rem; padding: 4px 9px; }
	.brand-name { display: none; }
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes blink { 50% { opacity: 0.25; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet { from { transform: translateY(30%); opacity: 0.5; } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--active) 55%, transparent); } 80%, 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes ring { 50% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 7px var(--pc); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------- voicemail (P3) */
.vm-layout { display: grid; gap: 16px; max-width: 860px; }
.vm-list, .greeting-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.vm-msg { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.vm-msg.new { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.vm-main { display: grid; gap: 6px; min-width: 0; }
.vm-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vm-caller { overflow-wrap: anywhere; }
.vm-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.88rem; }
.vm-msg audio, .greeting audio { width: 100%; max-width: 420px; height: 36px; }
.vm-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.vm-greetings h2 { font-size: 1.05rem; margin: 8px 0 10px; }
.greeting { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.greeting audio { grid-column: 1 / -1; }
.greeting-main { display: grid; gap: 2px; }
.greeting-rec { display: grid; gap: 12px; }
.chip.info { --c: var(--brand); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-item .badge { margin-left: auto; background: var(--brand); color: #fff; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .nav-item .badge { color: #042f2e; } }
@media (max-width: 640px) {
	.vm-msg { grid-template-columns: auto 1fr; }
	.vm-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------------------------------------------------------- history (P4) */
.hist-view { max-width: 860px; }
.hist-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.hist-tools .search { flex: 1; min-width: 200px; }
.hist-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.hist-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.hist-row.missed .hist-name, .hist-row.missed .hist-status { color: var(--danger); }
.hist-main { display: grid; gap: 4px; min-width: 0; }
.hist-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.hist-name { overflow-wrap: anywhere; }
.hist-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.86rem; align-items: center; }
.hist-dir { display: inline-flex; gap: 4px; align-items: center; }
.hist-dir .icon { width: 14px; height: 14px; }
.hist-dir.incoming .icon { transform: scaleX(-1); }
.hist-marks { display: flex; gap: 6px; flex-wrap: wrap; }
.hist-when { font-size: 0.86rem; white-space: nowrap; }
@media (max-width: 640px) { .hist-row { grid-template-columns: auto 1fr; } .hist-when { grid-column: 2; } }

/* --------------------------------------------------------- contacts (P5) */
.pb-view { max-width: 860px; }
.pb-view .view-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.pb-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.pb-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.pb-main { display: grid; gap: 3px; min-width: 0; }
.pb-name { overflow-wrap: anywhere; }
.pb-nums { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.9rem; }
.pb-mail { font-size: 0.9rem; overflow-wrap: anywhere; }
.pb-form { display: grid; gap: 14px; }
.pb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.field { display: grid; gap: 4px; font-weight: 600; font-size: 0.9rem; }
.field input:not([type=checkbox]):not([type=radio]), .pb-number input, .pb-number select { min-height: 40px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 400; }
.pb-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.pb-numbers { display: grid; gap: 8px; }
.pb-number { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; }
@media (max-width: 640px) { .pb-row { grid-template-columns: auto 1fr; } .pb-row .vm-actions { grid-column: 1 / -1; justify-content: flex-start; } }

/* ------------------------------------------- administration › features (A4) */
.feat-sections, .fc-groups { display: grid; gap: 22px; margin-top: 14px; }
.feat-section { display: grid; gap: 10px; }
.feat-section h2 { margin: 0; font-size: 1rem; }
.feat-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.feat-section .pb-list { margin: 0; }
.feat-section .pb-row { grid-template-columns: 1fr auto; }
.fc-edit { display: flex; gap: 10px; align-items: center; }
.fc-edit input[type=text] { width: 7.5em; min-height: 36px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.fc-edit input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: var(--brand); }
.feat-save { display: flex; gap: 10px; align-items: center; }
.feat-narrow { max-width: 480px; }
.feat-section > .pb-grid + .chat-start, .feat-section > .chat-start { margin-top: 4px; }
.field input[type=number] { min-height: 40px; }
@media (max-width: 640px) { .feat-section .pb-row { grid-template-columns: 1fr; } }

/* ----------------------------------------- administration › connectivity (A3) */
.feat-section .rt-list .pb-row { grid-template-columns: auto 1fr auto; }
.rt-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--line); font-weight: 700; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.rt-wide { grid-column: 1 / -1; min-width: 0; }
.rt-patterns { display: grid; gap: 6px; }
.rt-pattern { display: grid; grid-template-columns: 0.7fr 0.8fr 1.4fr 1fr auto; gap: 6px; align-items: center; }
.rt-pattern-head { font-weight: 400; }
.rt-wide .linkbtn { justify-self: start; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: 0.9rem; }
.check input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.cid-groups { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 4px 0; }
.cid-edit, .spam-edit { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: flex-end; }
.cid-edit select, .spam-edit select, .spam-edit input[type=number] { min-height: 36px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; max-width: 100%; }
.spam-edit input[type=number] { width: 4.5em; }
@media (max-width: 640px) { .cid-edit, .spam-edit { justify-content: flex-start; } }
.rt-pattern input { min-width: 0; min-height: 36px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 400; font-variant-numeric: tabular-nums; }
.rt-trunks { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; counter-reset: rt; }
.rt-trunk { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-weight: 400; }
.rt-trunk::before { counter-increment: rt; content: counter(rt) "."; color: var(--muted, inherit); margin-right: 4px; }
.rt-trunk > span:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 640px) {
	.feat-section .rt-list .pb-row { grid-template-columns: auto 1fr; }
	.rt-list .vm-actions { grid-column: 1 / -1; justify-content: flex-start; }
	.rt-pattern { grid-template-columns: 1fr 1fr; }
	.rt-pattern-head { display: none; }
}

/* ------------------------------------------------- dialling and settings (P2b) */
.dial-btn { min-height: 38px; }
@media (max-width: 640px) { .dial-label { display: none; } }
.dial-pad { display: grid; gap: 14px; }
.dial-pad .quick { display: flex; gap: 8px; }
.dial-pad .search { flex: 1; }
.hist-side { display: grid; gap: 6px; justify-items: end; }
.linkish { border: 0; background: none; padding: 2px 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.linkish:hover { color: var(--brand); text-decoration: underline; }
.linkish .icon { width: 15px; height: 15px; }
.me-view { max-width: 760px; }
.me-grid { display: grid; gap: 16px; }
.me-card { padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 12px; }
.me-card h2 { margin: 0; font-size: 1.05rem; }
.me-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.me-row > span:first-child { display: grid; gap: 2px; }
.me-row input[type=tel] { min-height: 38px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; width: 12em; }
.me-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--brand); }

/* -------------------------------------------------------- browser phone (P6) */
.phonebar { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: 16px; width: min(760px, calc(100vw - 24px));
	display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px;
	background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.phonebar.incoming { border-color: var(--brand); animation: pop 0.15s ease-out; }
.phonebar-main { display: grid; gap: 2px; min-width: 0; }
.phonebar-main strong { overflow-wrap: anywhere; }
.phonebar-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.phonebar-timer { font-variant-numeric: tabular-nums; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad .btn { min-height: 52px; font-size: 1.2rem; justify-content: center; }
.phone-state.live { color: var(--active); }
.phone-state.down { color: var(--danger); }
@media (max-width: 640px) {
	.phonebar { bottom: 76px; grid-template-columns: auto 1fr; }
	.phonebar-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* --------------------------------------------------------- messages (P8) */
.chat-view { max-width: 1100px; }
.chat-layout { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 14px; min-height: 60vh; }
.chat-convs, .chat-msgs, .chat-pick { list-style: none; margin: 0; padding: 0; }
.chat-convs { display: grid; gap: 6px; }
.chat-conv { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.chat-conv.active { border-color: var(--brand); }
.chat-conv.unread strong { color: var(--brand-strong); }
.chat-conv-main { display: grid; gap: 2px; min-width: 0; }
.chat-conv-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-conv-top time { font-size: 0.8rem; white-space: nowrap; }
.chat-preview { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-pane { display: grid; min-width: 0; }
.chat-thread { display: grid; grid-template-rows: auto 1fr auto; gap: 10px; min-height: 60vh; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.chat-thread-head { display: flex; gap: 10px; align-items: center; }
.chat-thread-head h2 { margin: 0; font-size: 1.05rem; }
.chat-thread-head p { margin: 2px 0 0; font-size: 0.85rem; }
.chat-back { display: none; transform: scaleX(-1); }
.chat-msgs { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: 62vh; padding: 4px; }
.chat-msg { display: grid; justify-items: start; max-width: 80%; }
.chat-msg.mine { align-self: flex-end; justify-items: end; }
.chat-sender { font-size: 0.8rem; color: var(--muted); margin: 4px 0 2px 4px; }
.chat-bubble { padding: 8px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 6px; }
.chat-msg.mine .chat-bubble { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, var(--line)); }
.chat-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-meta { display: flex; gap: 6px; align-items: center; justify-content: flex-end; font-size: 0.75rem; }
.chat-atts { display: grid; gap: 6px; }
.chat-img img { display: block; max-width: min(280px, 100%); max-height: 240px; border-radius: 10px; }
.chat-file { display: inline-flex; gap: 6px; align-items: center; color: var(--text); overflow-wrap: anywhere; }
.chat-file .icon { transform: rotate(180deg); }
.chat-compose { display: grid; gap: 6px; }
.chat-compose-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input { flex: 1; min-height: 44px; max-height: 160px; resize: vertical; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.chat-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chat-chips .badge { display: inline-flex; align-items: center; gap: 4px; }
.chat-pick { display: grid; gap: 4px; max-height: 50vh; overflow-y: auto; margin: 10px 0; }
.chat-pick label { display: flex; gap: 10px; align-items: center; padding: 6px 4px; cursor: pointer; }
.chat-start { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
@media (max-width: 760px) {
	.chat-layout { grid-template-columns: 1fr; }
	.chat-view.has-active .chat-list { display: none; }
	.chat-view:not(.has-active) .chat-pane { display: none; }
	.chat-back { display: inline-grid; }
	.chat-msg { max-width: 92%; }
}

/* ------------------------------------------------ recordings (P7) */
.rec-item { display: grid; gap: 8px; margin-bottom: 12px; }
.rec-item audio { width: 100%; }

/* ------------------------------------------------ devices (P9) */
.dev-enrol { display: grid; gap: 12px; }
.dev-qr { display: grid; place-items: center; padding: 8px; }
.qr { width: min(280px, 80vw); height: auto; background: #fff; border-radius: 8px; }
.qr.expired { opacity: 0.15; }
.dp-url { width: 100%; min-height: 40px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-family: ui-monospace, monospace; }
.field select { min-height: 40px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }

/* Administration (decision 0022) */
.apply-banner { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius, 12px); background: color-mix(in srgb, var(--warn, #b7791f) 14%, transparent); color: var(--text); }
.apply-banner .icon { flex: none; }
.apply-banner span { flex: 1; }
/* On/off settings in forms: the same switch row as My phone. */
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.toggle-row .muted { display: block; font-weight: 400; font-size: 0.8rem; }
.toggle-row input[type=checkbox] { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.more-fields { grid-column: 1 / -1; }
.more-fields > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; color: var(--brand); font-weight: 600; font-size: 0.9rem; padding: 4px 0; }
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; margin: 0 2px; }
.more-fields[open] > summary::before { transform: rotate(45deg); }
.more-fields > .pb-grid { margin-top: 10px; }
.field.wide { grid-column: 1 / -1; }
.field .small { font-size: 0.8rem; }

/* Call flow editor (decision 0023) */
.cf-editor { display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; height: calc(100vh - var(--top-h) - 56px); min-height: 420px; }
.cf-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cf-bar h1 { margin: 0; }
.cf-find { min-width: min(320px, 100%); }
.chip.warn-chip { --c: var(--ringing); }
.cf-stage { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background-color: var(--bg); background-image: radial-gradient(color-mix(in srgb, var(--text) 11%, transparent) 1.2px, transparent 1.3px); background-size: 22px 22px; cursor: grab; touch-action: none; }
.cf-stage.panning { cursor: grabbing; }
.cf-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cf-wires { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cf-wire { fill: none; stroke: color-mix(in srgb, var(--muted) 75%, transparent); stroke-width: 2; }
.cf-wire.hl { stroke: var(--brand); stroke-width: 2.6; }
.cf-wire.loop { stroke-dasharray: 6 4; }
.cf-wire.member { stroke-dasharray: 2 4; stroke-linecap: round; }
.cf-head { position: relative; }
.cf-note-ind { margin-left: auto; flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--ringing); background: color-mix(in srgb, var(--ringing) 14%, transparent); }
.cf-note-ind .icon { width: 14px; height: 14px; }
.cf-all-list { display: grid; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.cf-all-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 220px); gap: 12px; align-items: center; padding: 6px 12px; }
.cf-all-row + .cf-all-row { border-top: 1px solid var(--line); }
.cf-all-row code { font: 0.78rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.cf-all-row input { min-height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; width: 100%; box-sizing: border-box; }
.cf-all-row input:disabled { opacity: 0.6; }
.cf-all-row.changed code::after { content: " · changed"; color: var(--brand); font-family: var(--font); font-weight: 600; }
.cf-all-row[hidden], .cf-detail[hidden] { display: none; }
@media (max-width: 560px) { .cf-all-row { grid-template-columns: 1fr; } }
.cf-card.removed { opacity: 0.55; border-style: dashed; }
.cf-card.removed .cf-name { text-decoration: line-through; }
.cf-badge.removed { background: var(--danger); }
.cf-remove { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; justify-items: start; }
.btn.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
button.chip { border: 0; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 700; }
.cf-notes { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.cf-notes textarea { width: 100%; box-sizing: border-box; min-height: 96px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; resize: vertical; }
.cf-note-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); }
.cf-card { --k: var(--brand); position: absolute; width: 250px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); cursor: pointer; user-select: none; }
.cf-card:hover { border-color: color-mix(in srgb, var(--k) 45%, var(--line)); }
.cf-card.sel { border-color: var(--k); box-shadow: 0 0 0 3px color-mix(in srgb, var(--k) 22%, transparent), var(--shadow); }
.cf-card.cf-unresolved { border-style: dashed; border-color: var(--danger); }
.cf-card.g-start { --k: #0f766e; } .cf-card.g-route { --k: #2563eb; } .cf-card.g-answer { --k: #7c3aed; } .cf-card.g-ring { --k: var(--brand); } .cf-card.g-finish { --k: #64748b; }
@media (prefers-color-scheme: dark) { .cf-card.g-start { --k: #2dd4bf; } .cf-card.g-route { --k: #60a5fa; } .cf-card.g-answer { --k: #a78bfa; } .cf-card.g-finish { --k: #94a3b8; } }
.cf-head { display: flex; align-items: center; gap: 10px; padding: 11px 12px 8px; }
.cf-ic { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--k); background: color-mix(in srgb, var(--k) 13%, transparent); }
.cf-titles { display: flex; flex-direction: column; min-width: 0; }
.cf-kind { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.cf-name { font-size: 0.95rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-sum { margin: 0; padding: 0 12px 10px; color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.cf-in { position: absolute; left: -7px; top: 26px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid color-mix(in srgb, var(--muted) 75%, transparent); }
.cf-outs { border-top: 1px solid var(--line); }
.cf-out { position: relative; display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 6px 14px 6px 12px; font-size: 0.82rem; }
.cf-out + .cf-out { border-top: 1px dashed var(--line); }
.cf-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-loose { color: var(--ringing); font-weight: 600; font-size: 0.76rem; white-space: nowrap; }
.cf-loop { color: var(--muted); }
.cf-port { position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--k); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--k); }
.cf-port.open { background: var(--surface); box-shadow: 0 0 0 2px var(--ringing); }
.cf-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.cf-zoom button { min-width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 0.85rem var(--font); }
.cf-zoom button:hover { background: var(--surface-2); }
.cf-zoom .cf-tidy { padding: 0 10px; }
.cf-detail { display: grid; gap: 14px; }
.cf-detail p { margin: 0; }
.cf-detail h3 { margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.cf-dlist { list-style: none; margin: 0; padding: 0; display: grid; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.cf-dlist li { display: flex; gap: 12px; justify-content: space-between; padding: 8px 12px; }
.cf-dlist li + li { border-top: 1px solid var(--line); }
.cf-dlbl { color: var(--muted); }
.cf-note { color: var(--muted); font-size: 0.85rem; border-left: 3px solid var(--line); padding-left: 8px; }
.cf-warn { color: var(--danger); font-size: 0.85rem; }
@media (max-width: 760px) { .cf-editor { height: calc(100vh - var(--top-h) - 120px); } }
/* Call flow editing (E2): draft bar, edited steps, wiring, next-step picker, opening hours. */
.cf-draft { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip.draft-chip { --c: var(--ringing); }
.cf-card.changed { border-color: color-mix(in srgb, var(--ringing) 60%, var(--line)); }
.cf-badge { position: absolute; right: 10px; top: -9px; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 8px; border-radius: 999px; background: var(--ringing); color: #fff; }
.cf-card.drop { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 30%, transparent), var(--shadow); }
.cf-out.editable { cursor: pointer; }
.cf-out.editable:hover { background: color-mix(in srgb, var(--k) 8%, transparent); }
.cf-out.editable .cf-port { cursor: crosshair; width: 16px; height: 16px; margin-top: -8px; right: -8px; }
.cf-out.changed .cf-lbl { font-weight: 700; }
.cf-wire.changed { stroke: var(--ringing); stroke-width: 2.4; }
.cf-wire.draft { stroke: var(--brand); stroke-width: 2.4; stroke-dasharray: 5 4; }
.cf-stage.wiring { cursor: crosshair; }
.cf-goes { display: inline-flex; align-items: center; gap: 10px; }
.cf-next { display: grid; gap: 10px; }
.cf-picks { display: grid; gap: 2px; max-height: min(60vh, 460px); overflow: auto; }
.cf-pick { --k: var(--brand); display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 7px 8px; border-radius: 10px; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.cf-pick:hover, .cf-pick:focus-visible { background: var(--surface-2); }
.cf-pick .cf-ic { width: 30px; height: 30px; }
.cf-pick-t { display: flex; flex-direction: column; min-width: 0; }
.cf-pick-t strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn { border: 0; background: none; color: var(--brand); font: 600 0.85rem var(--font); cursor: pointer; padding: 4px 0; }
.cf-hours { display: grid; gap: 10px; }
.cf-rec { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cf-rec select { flex: 1 1 180px; min-width: 0; }
.pb-grid > .cf-full { grid-column: 1 / -1; }
.cf-opts { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; font-weight: 400; }
.cf-opt { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.cf-opt strong { font-variant-numeric: tabular-nums; min-width: 1ch; }
.cf-opt.fixed { padding-right: 10px; gap: 6px; color: var(--muted); border-style: dashed; }
.cf-opt.fixed .icon { width: 14px; height: 14px; }
.cf-opt-add { display: flex; gap: 6px; align-items: center; }
.cf-opt-add .btn { white-space: nowrap; flex: none; }
.cf-opt-add input.wide { width: auto; flex: 1 1 14em; min-width: 0; }
.cf-rec .btn { white-space: nowrap; }
.cf-opt-add input { width: 7em; min-height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 400; }
.cf-week { display: grid; grid-template-columns: 38px repeat(24, minmax(0, 1fr)); gap: 2px; user-select: none; touch-action: none; }
.cf-week .h { font-size: 0.66rem; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.cf-week .d { font-size: 0.78rem; font-weight: 700; color: var(--muted); align-self: center; }
.cf-week .c { position: relative; overflow: hidden; height: 22px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; }
.cf-week .c.on { background: var(--brand); border-color: var(--brand); }
.cf-week .c i { position: absolute; top: 0; bottom: 0; background: var(--brand); }
.cf-legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 0.8rem; align-items: center; }
.cf-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; background: var(--brand); }
.cf-legend i.off { background: var(--surface-2); border: 1px solid var(--line); }
.cf-exact { display: grid; gap: 6px; }
.cf-exact[hidden] { display: none; }
.cf-day { display: grid; grid-template-columns: 36px 92px minmax(0, 1fr); gap: 8px; align-items: start; padding: 6px 10px; border: 1px solid var(--line); border-radius: 11px; }
.cf-day.closed { background: var(--surface-2); }
.cf-day .dn { font-weight: 700; padding-top: 8px; }
.cf-day .toggle-row.compact { min-height: 36px; padding: 0; border: 0; background: none; justify-content: flex-start; gap: 8px; font-size: 0.85rem; }
.cf-ranges { display: grid; gap: 6px; justify-items: start; }
.cf-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cf-range { flex-wrap: nowrap; }
.cf-range input[type=time] { width: 8.2em; min-width: 0; min-height: 36px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .cf-day { grid-template-columns: 44px minmax(0, 1fr); } .cf-day .cf-ranges { grid-column: 1 / -1; } .cf-week { grid-template-columns: 30px repeat(24, minmax(0, 1fr)); gap: 1px; } }

/* Form fields keep their natural height; hints are regular weight. */
.field { align-content: start; }
.field > input, .field > select { align-self: start; width: 100%; box-sizing: border-box; }
.field select, .field .muted { font-weight: 400; }
