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

.sidebar {
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	padding: 16px 12px;
	border-right: 1px solid var(--border);
}

.brand {
	display: block;
	padding: 4px 10px 14px;
	font-size: 17px;
	font-weight: 800;
	text-decoration: none;
}

.nav-heading {
	margin: 16px 10px 6px;
	color: var(--muted);
	font-size: 12px;
	font-weight: 700;
}

.nav-item {
	display: flex;
	justify-content: space-between;
	width: 100%;
	padding: 7px 10px;
	border: 0;
	border-radius: 8px;
	background: none;
	font-weight: 600;
	text-align: left;
}

.nav-item:hover { background: var(--surface); }

.nav-item[aria-current="true"] {
	background: var(--surface-2);
	color: var(--accent);
}

.nav-count {
	color: var(--muted);
	font-size: 13px;
	font-weight: 400;
}

.field-toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 10px;
	font-size: 14px;
	cursor: pointer;
}

.field-toggle input { accent-color: var(--accent); }

.main { padding: 16px 24px 48px; min-width: 0; }

.topbar {
	display: flex;
	gap: 10px;
	max-width: 760px;
	margin: 0 auto 16px;
}

.search { flex: 1; min-width: 0; }

#status .notice { margin-bottom: 14px; }

.feed-title {
	margin: 0 0 12px;
	font-size: 20px;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
	gap: 16px;
}

.card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
	padding: 14px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: var(--surface);
}

.card:hover { border-color: var(--muted); }

.card-head {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	font-size: 13.5px;
	color: var(--muted);
}

.org-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.head-extra {
	flex: none;
	white-space: nowrap;
}

.avatar {
	display: grid;
	flex: none;
	width: 28px;
	height: 28px;
	place-items: center;
	border-radius: 8px;
	background: var(--surface-2);
	color: var(--text);
	font-size: 13px;
	font-weight: 700;
}

.card-title {
	padding: 0;
	border: 0;
	background: none;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	text-align: left;
	overflow-wrap: anywhere;
}

.card-title:hover { text-decoration: underline; }

.snippet {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	color: var(--muted);
	font-size: 13.5px;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.chip {
	padding: 2px 8px;
	border-radius: 8px;
	background: var(--surface-2);
	font-size: 12.5px;
	overflow-wrap: anywhere;
}

.chip-pay { color: var(--accent); font-weight: 700; }
.chip-job { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.chip-preprint { color: var(--vote); font-weight: 700; }

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 2px;
	margin-top: auto;
	padding-top: 4px;
}

.action {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	min-height: 32px;
	padding: 4px 8px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

.action:hover { background: var(--surface-2); color: var(--text); }
.action[aria-pressed="true"] { color: var(--accent); }
.action-vote[aria-pressed="true"] { color: var(--vote); }

.empty {
	max-width: 480px;
	margin: 48px auto;
	text-align: center;
}

.toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 12px;
}

.toolbar .feed-title { margin: 0; }

.state-picker { width: auto; margin-left: auto; }
.state-picker + .layout-switch { margin-left: 0; }
.local-note { margin: 0 0 12px; font-size: 13.5px; }

.layout-switch { display: flex; gap: 6px; }
.layout-switch .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.event-when { color: var(--accent); font-size: 13.5px; font-weight: 700; }

.month-heading { margin: 20px 0 10px; font-size: 16px; }
.month-heading:first-child { margin-top: 0; }

.cal-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-title { min-width: 150px; margin: 0; font-size: 16px; text-align: center; }
.cal-nav .btn:disabled { opacity: 0.4; cursor: default; }

.cal {
	width: 100%;
	border-collapse: collapse;
	table-layout: fixed;
	background: var(--surface);
}

.cal th {
	padding: 6px;
	border: 1px solid var(--border);
	color: var(--muted);
	font-size: 12.5px;
	font-weight: 700;
}

.cal-day {
	height: 108px;
	padding: 4px;
	border: 1px solid var(--border);
	vertical-align: top;
}

.cal-other { background: var(--bg, transparent); }
.cal-other .cal-date { color: var(--muted); }

.cal-date { padding: 0 4px 4px; font-size: 12.5px; font-weight: 700; }
.cal-today .cal-date { color: var(--accent); }
.cal-today { box-shadow: inset 0 0 0 2px var(--accent); }

.cal-event,
.cal-more {
	display: block;
	width: 100%;
	margin-bottom: 3px;
	padding: 2px 6px;
	overflow: hidden;
	border: 0;
	border-radius: 6px;
	font-size: 12px;
	line-height: 1.35;
	text-align: left;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.cal-event { background: var(--surface-2); }
.cal-event:hover { outline: 1px solid var(--muted); }
.cal-more { background: none; color: var(--muted); font-weight: 700; }
.cal-more:hover { text-decoration: underline; }
.cal-count { display: none; }
.cal-empty { margin-top: 12px; }

.add-calendar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.add-calendar-note { flex-basis: 100%; margin: 0; font-size: 13px; }

.day-list { display: grid; gap: 8px; margin-top: 12px; }

.day-event {
	display: grid;
	gap: 2px;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--surface-2);
	font-size: 13px;
	text-align: left;
}

.day-event:hover { border-color: var(--muted); }
.day-event-title { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }

.more {
	display: flex;
	justify-content: center;
	margin-top: 20px;
}

.stage { font-size: 13px; padding: 4px 6px; width: auto; }

.post-text {
	margin: 0;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.attached {
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: 10px;
	font-size: 13.5px;
}

/* Job detail slides in from the right, like a post panel. */
.panel {
	position: fixed;
	inset: 0 0 0 auto;
	width: min(640px, 100vw);
	height: 100vh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 20px 24px 32px;
	overflow-y: auto;
	border: 0;
	border-left: 1px solid var(--border);
	background: var(--surface);
	color: var(--text);
}

.panel::backdrop { background: rgb(0 0 0 / 0.55); }

.panel-top {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-bottom: 8px;
}

.panel h2 { margin: 6px 0 10px; font-size: 22px; line-height: 1.25; overflow-wrap: anywhere; }
.panel h3 { margin: 22px 0 8px; font-size: 15px; }

.description {
	margin: 12px 0;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.panel-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 14px 0;
}

.composer {
	display: grid;
	gap: 8px;
	margin-top: 8px;
}

.composer textarea { min-height: 80px; resize: vertical; }
.composer .btn { justify-self: start; }

.comment {
	padding: 10px 0;
	border-bottom: 1px solid var(--border);
}

.comment p { margin: 0 0 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.when { color: var(--muted); font-size: 12.5px; }

.danger { color: var(--danger); }

.compact .card .snippet { display: none; }

.tour-card {
	position: fixed;
	z-index: 20;
	width: 268px;
	padding: 16px;
	border: 1px solid var(--border);
	border-radius: 14px;
	background: var(--surface-2);
	box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
	font-size: 14px;
}

.tour-pointer {
	position: absolute;
	width: 10px;
	height: 10px;
	margin: -5px;
	background: var(--surface-2);
	border: solid var(--border);
	border-width: 0 0 1px 1px;
	transform: rotate(45deg);
}

.tour-card[data-side="left"] .tour-pointer { left: 100%; transform: rotate(225deg); }
.tour-card[data-side="below"] .tour-pointer { top: 0; transform: rotate(135deg); }

.tour-body { display: grid; gap: 12px; }

.tour-message { margin: 0; }

.tour-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.tour-buttons { display: flex; align-items: center; gap: 6px; }

.tour-skip {
	padding: 6px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
}

.tour-skip:hover { color: var(--text); }

.tour-ring { flex: none; width: 18px; height: 18px; transform: rotate(-90deg); }
.tour-ring circle { fill: none; stroke-width: 2; }
.tour-ring-bg { stroke: var(--border); stroke-dashoffset: 0; }
.tour-ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.3s; }

.tour-target {
	outline: 2px dashed var(--accent);
	outline-offset: 3px;
	border-radius: 8px;
}

.tour-switch {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	cursor: pointer;
}

.tour-switch input {
	position: absolute;
	opacity: 0;
	width: 40px;
	height: 22px;
	margin: 0;
}

.tour-switch-track {
	position: relative;
	flex: none;
	width: 40px;
	height: 22px;
	border-radius: 11px;
	background: var(--border);
	transition: background 0.2s;
}

.tour-switch-track::after {
	content: "";
	position: absolute;
	inset: 3px auto 3px 3px;
	width: 16px;
	border-radius: 50%;
	background: #fff;
	transition: transform 0.2s;
}

.tour-switch input:checked + .tour-switch-track { background: var(--accent); }
.tour-switch input:checked + .tour-switch-track::after { transform: translateX(18px); }
.tour-switch input:focus-visible + .tour-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The save demo: a five second loop, square so the card doesn't resize. */
.tour-demo {
	position: relative;
	aspect-ratio: 1;
	overflow: hidden;
	border-radius: 10px;
	background: var(--accent);
	padding: 10px;
}

.tour-demo > * { --demo-paper: #f7faf9; --demo-ink: #9fb0aa; }

.demo-bar {
	display: flex;
	align-items: center;
	gap: 6px;
	height: 26px;
	padding: 0 6px;
	border-radius: 7px 7px 0 0;
	background: #dfe7e4;
}

.demo-url { flex: 1; height: 10px; border-radius: 5px; background: #fff; }

.demo-button {
	display: grid;
	place-items: center;
	width: 18px;
	height: 18px;
	border-radius: 5px;
	background: #0b6e4f;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
	animation: demo-press 5s infinite;
}

.demo-page {
	display: grid;
	align-content: start;
	gap: 9px;
	height: calc(100% - 26px);
	padding: 14px 12px;
	border-radius: 0 0 7px 7px;
	background: var(--demo-paper);
}

.demo-line { display: block; height: 7px; border-radius: 4px; background: var(--demo-ink); }
.demo-line-title { width: 70%; height: 10px; background: #55665f; }
.demo-line-short { width: 45%; }

.demo-popup {
	position: absolute;
	top: 40px;
	right: 14px;
	display: grid;
	gap: 8px;
	width: 62%;
	padding: 10px;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 6px 18px rgb(0 0 0 / 0.3);
	animation: demo-popup 5s infinite;
}

.demo-save {
	padding: 4px;
	border-radius: 6px;
	background: #0b6e4f;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-align: center;
	animation: demo-saved 5s infinite;
}

.demo-cursor {
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: 0;
	border-left: 8px solid #14201c;
	border-top: 4px solid transparent;
	border-bottom: 10px solid transparent;
	filter: drop-shadow(0 0 1px #fff);
	animation: demo-cursor 5s infinite;
}

@keyframes demo-cursor {
	0%, 10% { transform: translate(60px, 150px); }
	28%, 34% { transform: translate(214px, 22px); }
	55%, 64% { transform: translate(150px, 112px); }
	100% { transform: translate(60px, 150px); }
}

@keyframes demo-press {
	0%, 29%, 35%, 100% { transform: none; }
	32% { transform: scale(0.8); }
}

@keyframes demo-popup {
	0%, 32% { opacity: 0; transform: translateY(-6px); }
	38%, 90% { opacity: 1; transform: none; }
	100% { opacity: 0; transform: translateY(-6px); }
}

@keyframes demo-saved {
	0%, 60% { filter: none; }
	64%, 100% { filter: brightness(1.5); }
}

@media (prefers-reduced-motion: reduce) {
	.demo-cursor, .demo-button, .demo-save { animation: none; }
	.demo-cursor { transform: translate(150px, 112px); }
	.demo-popup { animation: none; }
	.tour-ring-fill, .tour-switch-track, .tour-switch-track::after { transition: none; }
}

@media (max-width: 760px) {
	.shell { grid-template-columns: minmax(0, 1fr); }
	.sidebar {
		position: static;
		height: auto;
		border-right: 0;
		border-bottom: 1px solid var(--border);
	}
	.main { padding: 12px 16px 40px; }
	.grid { grid-template-columns: minmax(0, 1fr); }
	.topbar { flex-wrap: wrap; }
	.search { flex-basis: 100%; }
	.cal-day { height: 58px; padding: 2px; }
	.cal-date { padding: 0 2px 2px; text-align: center; }
	.cal-event, .cal-more { display: none; }
	.cal-count {
		display: block;
		width: 100%;
		min-height: 28px;
		border: 0;
		border-radius: 8px;
		background: var(--accent);
		color: var(--on-accent);
		font-size: 12.5px;
		font-weight: 700;
	}
}
