/* Shared Stitch workspace theme — sidebar, shell, common UI tokens */
:root {
	--font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
	--gutter: 24px;
	--bg: #f9fafb;
	--surface: #ffffff;
	--surface-2: #f8fafc;
	--border: #e5e7eb;
	--text: #111827;
	--text-muted: #6b7280;
	--primary: #2563eb;
	--primary-hover: #1d4ed8;
	--sidebar-bg: #111827;
	--sidebar-text: #d1d5db;
	--sidebar-active: #2563eb;
	--info-bg: #eff6ff;
	--info-border: #dbeafe;
}

* { box-sizing: border-box; }

body.ws-stitch-page,
body.ais-stitch-page {
	font-family: var(--font-sans);
	font-size: 14px;
	line-height: 1.5;
	background: var(--bg) !important;
	color: var(--text) !important;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	margin: 0;
}

html, body { height: 100%; }

body.ws-stitch-page .app-shell,
body.ais-stitch-page .app-shell { display: flex; min-height: 100vh; height: 100%; overflow: hidden; }

body.ws-stitch-page .app-sidebar,
body.ais-stitch-page .app-sidebar {
	position: fixed; left: 0; top: 0; bottom: 0; width: 240px; z-index: 100;
	flex-shrink: 0; background: var(--sidebar-bg) !important; color: var(--sidebar-text) !important;
	border-right: none !important; padding: 20px 14px 16px;
	display: flex; flex-direction: column; overflow-y: auto;
}

body.ws-stitch-page .app-sidebar-brand,
body.ais-stitch-page .app-sidebar-brand {
	padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,0.08) !important; margin-bottom: 12px;
}

body.ws-stitch-page .ws-brand-row,
body.ais-stitch-page .ws-brand-row { display: flex; align-items: center; gap: 12px; }

body.ws-stitch-page .ws-brand-logo,
body.ais-stitch-page .ws-brand-logo {
	width: 40px; height: 40px; object-fit: contain; border-radius: 10px;
	background: #fff !important; border: none !important; flex-shrink: 0;
}

body.ws-stitch-page .ws-brand-logo:not([src]),
body.ais-stitch-page .ws-brand-logo:not([src]),
body.ws-stitch-page .ws-brand-logo[src=""],
body.ais-stitch-page .ws-brand-logo[src=""] { display: none; }

body.ws-stitch-page .ws-brand-fallback,
body.ais-stitch-page .ws-brand-fallback {
	width: 40px; height: 40px; border-radius: 10px; background: #fff;
	color: #111827; font-weight: 700; font-size: 18px; display: inline-flex;
	align-items: center; justify-content: center; flex-shrink: 0;
}

body.ws-stitch-page .ws-brand-text .mark,
body.ais-stitch-page .ws-brand-text .mark {
	display: none !important;
}

body.ws-stitch-page .ws-brand-text .name,
body.ais-stitch-page .ws-brand-text .name {
	font-size: 15px; font-weight: 600; color: #f9fafb !important; margin-top: 0; letter-spacing: -0.01em;
}

body.ws-stitch-page .app-nav,
body.ais-stitch-page .app-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; flex: 1; }

body.ws-stitch-page .app-nav a.nav-item,
body.ws-stitch-page .app-nav button.nav-item,
body.ais-stitch-page .app-nav a.nav-item {
	display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px;
	text-decoration: none; font-weight: 500; font-size: 14px; color: var(--sidebar-text);
	box-sizing: border-box;
}

body.ws-stitch-page .app-nav button.nav-item,
body.ws-stitch-page .app-nav button[data-view] {
	display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px;
	border: none; background: transparent; font-family: inherit; font-weight: 500; font-size: 14px;
	color: var(--sidebar-text); cursor: pointer; text-align: left; box-sizing: border-box;
}

body.ws-stitch-page .app-nav a.nav-item .nav-ic,
body.ws-stitch-page .app-nav button.nav-item .nav-ic,
body.ws-stitch-page .app-nav button[data-view] .nav-ic,
body.ais-stitch-page .app-nav a.nav-item .nav-ic {
	width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85;
}

body.ws-stitch-page .app-nav a.nav-item:hover,
body.ws-stitch-page .app-nav button.nav-item:hover,
body.ws-stitch-page .app-nav button[data-view]:hover,
body.ais-stitch-page .app-nav a.nav-item:hover { background: rgba(255,255,255,0.06); color: #f3f4f6; }

body.ws-stitch-page .app-nav a.nav-item.active,
body.ws-stitch-page .app-nav button.nav-item.active,
body.ws-stitch-page .app-nav button[data-view].active,
body.ais-stitch-page .app-nav a.nav-item.active {
	background: var(--sidebar-active) !important; color: #fff !important; font-weight: 600;
	box-shadow: none !important;
}

body.ws-stitch-page .app-nav .nav-item-foot,
body.ais-stitch-page .app-nav .nav-item-foot {
	margin-top: auto;
}

body.ws-stitch-page .app-sidebar-foot,
body.ais-stitch-page .app-sidebar-foot { padding: 12px 8px 0; border-top: none !important; margin-top: auto; }

body.ws-stitch-page .sidebar-logout-btn,
body.ais-stitch-page .sidebar-logout-btn {
	width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 11px 14px; border-radius: 8px; border: none !important;
	background: #fff !important; color: #111827 !important; font-weight: 600; cursor: pointer;
	font-family: inherit; font-size: 14px;
}

body.ws-stitch-page .sidebar-logout-btn:hover,
body.ais-stitch-page .sidebar-logout-btn:hover { background: #f3f4f6 !important; }

body.ws-stitch-page .app-stage,
body.ais-stitch-page .app-stage {
	flex: 1; margin-left: 240px !important; min-width: 0; height: 100vh; overflow: hidden;
	display: flex; flex-direction: column; background: var(--bg);
}

body.ws-stitch-page .app-main,
body.ais-stitch-page .app-main {
	flex: 1; overflow: auto; padding: 20px var(--gutter) 48px; min-height: 0;
}

body.ws-stitch-page .app-topbar,
body.ais-stitch-page .app-topbar,
body.ws-stitch-page .ais-stitch-topbar,
body.ais-stitch-page .ais-stitch-topbar {
	flex-shrink: 0; background: var(--surface) !important; border-bottom: 1px solid var(--border);
	padding: 14px var(--gutter); display: flex; align-items: center; justify-content: space-between;
	gap: 16px; flex-wrap: wrap;
}

body.ws-stitch-page .app-topbar h1,
body.ais-stitch-page .app-topbar h1 {
	margin: 0; font-size: 1.125rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em;
}

body.ws-stitch-page .app-topbar-actions a,
body.ais-stitch-page .app-topbar-actions a {
	font-size: 13px; color: var(--primary); font-weight: 600; text-decoration: none;
}

body.ws-stitch-page .app-topbar-actions a:hover,
body.ais-stitch-page .app-topbar-actions a:hover { color: var(--primary-hover); text-decoration: underline; }

body.ws-stitch-page .ais-stitch-topbar,
body.ais-stitch-page .ais-stitch-topbar {
	display: grid; grid-template-columns: minmax(160px, 220px) minmax(200px, 1fr) auto;
	align-items: center; gap: 16px 20px; flex-wrap: unset;
}

body.ws-stitch-page .ais-stitch-topbar-left,
body.ais-stitch-page .ais-stitch-topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

body.ws-stitch-page .ais-stitch-crumb-label,
body.ais-stitch-page .ais-stitch-crumb-label {
	font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap;
}

body.ws-stitch-page .ais-stitch-topbar-left select,
body.ais-stitch-page .ais-stitch-topbar-left select {
	flex: 1; min-width: 0; padding: 8px 28px 8px 10px; border: 1px solid var(--border);
	border-radius: 8px; font-size: 14px; font-weight: 500; background: #fff; color: var(--text);
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 10px center;
}

body.ws-stitch-page .ais-stitch-url-wrap,
body.ais-stitch-page .ais-stitch-url-wrap {
	display: flex; align-items: center; gap: 10px; padding: 0 12px; height: 40px;
	border: 1px solid var(--border); border-radius: 8px; background: #fff; min-width: 0;
}

body.ws-stitch-page .ais-stitch-url-wrap svg,
body.ais-stitch-page .ais-stitch-url-wrap svg { flex-shrink: 0; color: #9ca3af; }

body.ws-stitch-page .ais-stitch-url-wrap input,
body.ais-stitch-page .ais-stitch-url-wrap input {
	border: none; background: transparent; width: 100%; min-width: 0;
	font-size: 13px; color: var(--text-muted); font-family: inherit;
}

body.ws-stitch-page .ais-stitch-topbar-right,
body.ais-stitch-page .ais-stitch-topbar-right {
	display: flex; align-items: center; gap: 10px; justify-content: flex-end;
}

body.ws-stitch-page .ais-stitch-icon-btn,
body.ais-stitch-page .ais-stitch-icon-btn {
	width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px;
	background: #fff; color: #6b7280; display: inline-flex; align-items: center; justify-content: center;
	cursor: default; padding: 0;
}

body.ws-stitch-page .ais-stitch-avatar,
body.ais-stitch-page .ais-stitch-avatar {
	width: 36px; height: 36px; border-radius: 999px; background: #e5e7eb;
	border: 1px solid var(--border);
}

body.ws-stitch-page a,
body.ais-stitch-page a { color: var(--primary); }

body.ws-stitch-page a:hover,
body.ais-stitch-page a:hover { color: var(--primary-hover); }

body.ws-stitch-page .btn,
body.ais-stitch-page .btn {
	padding: 9px 16px; border-radius: 8px; border: none; font-weight: 600; font-size: 14px;
	cursor: pointer; font-family: inherit; line-height: 1.2;
	box-shadow: none !important; transform: none !important; filter: none !important;
	background: var(--primary); color: #fff;
}

body.ws-stitch-page .btn:hover,
body.ais-stitch-page .btn:hover { transform: none !important; filter: none !important; box-shadow: none !important; }

body.ws-stitch-page .btn-primary,
body.ais-stitch-page .btn-primary {
	background: var(--primary) !important; color: #fff !important;
	text-decoration: none; display: inline-flex; align-items: center;
}

body.ws-stitch-page .btn-primary:hover,
body.ais-stitch-page .btn-primary:hover { background: var(--primary-hover) !important; color: #fff !important; }

body.ws-stitch-page .btn-secondary,
body.ws-stitch-page .btn.secondary,
body.ais-stitch-page .btn-secondary {
	background: #fff !important; color: #374151 !important; border: 1px solid var(--border) !important;
	text-decoration: none; display: inline-block;
}

body.ws-stitch-page .btn-secondary:hover,
body.ws-stitch-page .btn.secondary:hover,
body.ais-stitch-page .btn-secondary:hover { background: #f9fafb !important; color: #374151 !important; }

body.ws-stitch-page .data-panel,
body.ais-stitch-page .data-panel {
	background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
	margin-bottom: 16px; overflow: hidden; box-shadow: none !important;
}

body.ws-stitch-page .data-panel-head,
body.ais-stitch-page .data-panel-head {
	padding: 14px 20px; border-bottom: 1px solid var(--border);
	font-weight: 600; font-size: 14px; color: var(--text);
}

body.ws-stitch-page .data-panel-body,
body.ais-stitch-page .data-panel-body { padding: 16px 20px; }

body.ws-stitch-page .field label,
body.ais-stitch-page .field label {
	display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
	letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 6px;
}

body.ws-stitch-page input,
body.ws-stitch-page select,
body.ws-stitch-page textarea,
body.ais-stitch-page input,
body.ais-stitch-page select,
body.ais-stitch-page textarea {
	border-radius: 8px !important;
}

body.ws-stitch-page input:focus,
body.ws-stitch-page select:focus,
body.ws-stitch-page textarea:focus,
body.ais-stitch-page input:focus,
body.ais-stitch-page select:focus,
body.ais-stitch-page textarea:focus {
	outline: none; border-color: #93c5fd !important;
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

	body.ws-stitch-page .card,
	body.ais-stitch-page .card {
	border-radius: 8px !important; border-color: var(--border) !important; box-shadow: none !important;
}

/* Reports pages — Drip Report + Web Reports content */
body.ws-stitch-page .section-card {
	background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
	padding: 20px; margin-bottom: 16px; box-shadow: none !important; scroll-margin-top: 80px;
}
body.ws-stitch-page .section-header { margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
body.ws-stitch-page .section-header h3 {
	margin: 0; font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.01em;
}
body.ws-stitch-page .section-header .desc { font-size: 13px; color: var(--text-muted); margin-top: 6px; max-width: 52ch; line-height: 1.5; }
body.ws-stitch-page .view-btn {
	padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
	background: #fff; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
body.ws-stitch-page .view-btn:hover { background: var(--surface-2); color: var(--text); }
body.ws-stitch-page .view-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
body.ws-stitch-page .report-nav-btn {
	padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border);
	background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit; color: var(--text);
}
body.ws-stitch-page .report-nav-btn:hover { background: var(--surface-2); border-color: #93c5fd; color: var(--primary); }
body.ws-stitch-page .report-nav-btn.active {
	background: var(--info-bg); border-color: var(--info-border); color: var(--primary);
}
body.ws-stitch-page .hero-card {
	background: var(--info-bg); border: 1px solid var(--info-border); border-radius: 8px;
	padding: 20px; margin-bottom: 16px;
}
body.ws-stitch-page .hero-card h2 { margin: 0 0 8px; font-size: 1.125rem; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
body.ws-stitch-page .hero-card p { margin: 0; color: var(--text-muted); font-size: 14px; max-width: 720px; }
body.ws-stitch-page .data-panel-head .sub { display: block; font-weight: 500; font-size: 13px; color: var(--text-muted); margin-top: 4px; }
body.ws-stitch-page .preset-btns button:hover { border-color: #93c5fd; color: var(--primary); }
body.ws-stitch-page .btn-outline:hover,
body.ws-stitch-page .btn-ghost:hover { border-color: #93c5fd; color: var(--primary); background: var(--info-bg); }
body.ws-stitch-page .chat-session-break {
	background: var(--info-bg); border: 1px dashed var(--info-border); color: var(--primary);
}

@media (max-width: 900px) {
	body.ws-stitch-page .app-sidebar,
	body.ais-stitch-page .app-sidebar {
		position: static; width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; padding: 16px;
	}
	body.ws-stitch-page .app-stage,
	body.ais-stitch-page .app-stage { margin-left: 0 !important; height: auto; }
	body.ws-stitch-page .ais-stitch-topbar,
	body.ais-stitch-page .ais-stitch-topbar { grid-template-columns: 1fr; }
}
