/* Hilltop: one hand-written stylesheet. Calm paper tones, one green accent. */

:root {
	--bg: #f6f3ee;
	--surface: #ffffff;
	--surface-muted: #faf8f4;
	--ink: #23211e;
	--ink-soft: #5d5850;
	--ink-faint: #8c867c;
	--line: #e4ded3;
	--line-strong: #cfc7b9;
	--accent: #2f6b4f;
	--accent-ink: #ffffff;
	--accent-soft: #e5f0ea;
	--danger: #b3402f;
	--danger-soft: #fbeae7;
	--focus: #5b9bd5;
	--radius: 10px;
	--radius-small: 6px;
	--shadow: 0 1px 2px rgb(35 33 30 / 6%), 0 2px 8px rgb(35 33 30 / 4%);
	--font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	color-scheme: light;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font: 16px/1.55 var(--font);
}

h1,
h2,
h3 {
	line-height: 1.25;
	margin: 0 0 0.5rem;
	font-weight: 650;
	letter-spacing: -0.01em;
}

h1 {
	font-size: 1.75rem;
}

h2 {
	font-size: 1.2rem;
}

p {
	margin: 0 0 0.75rem;
}

a {
	color: var(--accent);
	text-underline-offset: 2px;
}

:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.muted {
	color: var(--ink-soft);
}

.small {
	font-size: 0.875rem;
}

.inline {
	display: inline;
	margin: 0;
}

/* Top bar */

.topbar {
	background: var(--surface);
	border-bottom: 1px solid var(--line);
}

.topbar-inner {
	max-width: 1080px;
	margin: 0 auto;
	padding: 0.75rem 1rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 56px;
}

.brand {
	font-weight: 700;
	color: var(--ink);
	text-decoration: none;
	white-space: nowrap;
}

.brand-mark {
	color: var(--accent);
}

.crumbs {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
}

.crumbs a {
	color: var(--ink-soft);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.crumbs a:hover {
	color: var(--ink);
}

.crumb-sep {
	color: var(--line-strong);
}

.account {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.9rem;
	white-space: nowrap;
}

.account-name {
	color: var(--ink-soft);
	text-decoration: none;
	max-width: 12rem;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Page */

.page {
	max-width: 1080px;
	margin: 0 auto;
	padding: 2rem 1rem 4rem;
}

.page-narrow {
	max-width: 560px;
}

.page-actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.page-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.5rem;
}

.subtitle {
	color: var(--ink-soft);
	margin: 0.25rem 0 0;
}

.card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 1.5rem;
}

.auth-card {
	margin-top: 2rem;
}

.empty {
	text-align: center;
	color: var(--ink-soft);
	background: var(--surface-muted);
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius);
	padding: 2.5rem 1rem;
}

/* Buttons */

.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	padding: 0.55rem 1rem;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-weight: 550;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}

.button:hover {
	background: var(--surface-muted);
}

.button-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-ink);
}

.button-primary:hover {
	background: #275a42;
}

.button-small {
	padding: 0.3rem 0.8rem;
	font-size: 0.875rem;
}

.link-button {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: var(--ink-soft);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.link-button:hover {
	color: var(--ink);
}

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

/* Forms */

.stack > * + * {
	margin-top: 1rem;
}

.field label {
	display: block;
	font-weight: 600;
	margin-bottom: 0.35rem;
}

.field input,
.field textarea {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-small);
	background: var(--surface);
	color: var(--ink);
	font: inherit;
}

.field textarea {
	resize: vertical;
	min-height: 6rem;
}

.field input:focus,
.field textarea:focus {
	border-color: var(--accent);
	outline: 2px solid var(--accent-soft);
	outline-offset: 0;
}

.field-hint {
	color: var(--ink-faint);
	font-size: 0.875rem;
	margin: 0.35rem 0 0;
}

.field-error {
	color: var(--danger);
	font-size: 0.9rem;
	margin: 0.35rem 0 0;
}

.has-error input,
.has-error textarea {
	border-color: var(--danger);
}

.form-actions {
	display: flex;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.notice {
	border-radius: var(--radius-small);
	padding: 0.75rem 1rem;
	margin: 1rem 0;
	background: var(--accent-soft);
	border: 1px solid #c9dfd2;
}

.notice p:last-child {
	margin-bottom: 0;
}

.notice-error {
	background: var(--danger-soft);
	border-color: #f0c8c1;
}

.notice-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
}

/* Home: project cards */

.project-grid,
.tool-grid,
.plain-list,
.people-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

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

.project-card {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	height: 100%;
	min-height: 140px;
	padding: 1.25rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	color: var(--ink);
	text-decoration: none;
	transition: border-color 120ms, transform 120ms;
}

.project-card:hover {
	border-color: var(--accent);
	transform: translateY(-1px);
}

.project-card-name {
	font-weight: 650;
	font-size: 1.1rem;
	overflow-wrap: anywhere;
}

.project-card-description {
	color: var(--ink-soft);
	font-size: 0.925rem;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.project-card-meta {
	margin-top: auto;
	color: var(--ink-faint);
	font-size: 0.85rem;
}

.archived {
	margin-top: 3rem;
}

.archived h2 {
	color: var(--ink-soft);
	font-size: 1rem;
}

.plain-list li + li {
	margin-top: 0.35rem;
}

/* Project page */

.project-header {
	text-align: center;
	margin: 0.5rem 0 2rem;
}

.project-header h1 {
	font-size: 2rem;
	overflow-wrap: anywhere;
}

.project-header-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	flex-wrap: wrap;
	margin-top: 1rem;
}

.owner-actions {
	display: inline-flex;
	gap: 0.5rem;
}

.avatars {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: var(--ink-soft);
	font-size: 0.9rem;
}

.avatars .avatar + .avatar {
	margin-left: -8px;
}

.avatars-label {
	margin-left: 0.5rem;
}

.avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--accent-soft);
	color: var(--accent);
	border: 2px solid var(--surface);
	font-size: 0.75rem;
	font-weight: 700;
}

.tool-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1rem;
}

.tool-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.4rem;
	min-height: 200px;
	padding: 1.75rem 1.25rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	color: var(--ink);
	text-decoration: none;
}

.tool-tile:hover {
	border-color: var(--accent);
}

.tool-icon {
	font-size: 1.75rem;
	color: var(--accent);
}

.tool-name {
	font-weight: 650;
	font-size: 1.15rem;
}

/* Unread counts, filled in live by the user's hub. Empty means nothing unread. */
.badge {
	display: inline-block;
	min-width: 1.4em;
	margin-left: 0.4rem;
	padding: 0.05em 0.45em;
	border-radius: 999px;
	background: var(--danger);
	color: #ffffff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.5;
	text-align: center;
	vertical-align: 0.15em;
}

.badge:empty {
	display: none;
}

.tool-blurb {
	color: var(--ink-soft);
	font-size: 0.925rem;
	max-width: 28ch;
}

/* People */

.add-person {
	display: flex;
	align-items: flex-end;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-bottom: 1.5rem;
}

.add-person .field {
	flex: 1 1 260px;
}

.people-list {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.person {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
}

.person + .person {
	border-top: 1px solid var(--line);
}

.person-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.person-name {
	font-weight: 600;
	overflow-wrap: anywhere;
}

.person-email {
	color: var(--ink-faint);
	font-size: 0.875rem;
	overflow-wrap: anywhere;
}

.person-role {
	color: var(--ink-soft);
	font-size: 0.875rem;
}

.error-card {
	margin-top: 2rem;
	text-align: center;
}

@media (max-width: 640px) {
	h1,
	.project-header h1 {
		font-size: 1.5rem;
	}

	.page {
		padding-top: 1.25rem;
	}

	.card {
		padding: 1.25rem;
	}

	.tool-grid {
		grid-template-columns: 1fr;
	}

	.tool-tile {
		min-height: 0;
		padding: 1.25rem;
	}

	.account-name {
		display: none;
	}

	.person {
		flex-wrap: wrap;
	}
}

/* === todos-messages === */

.back-link {
	margin-bottom: 1rem;
	font-size: 0.9rem;
}

.back-link a {
	color: var(--ink-soft);
	text-decoration: none;
}

/* Plain-text bodies: escaped, line breaks kept, nothing auto-linked. */
.text-body {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.field select {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-small);
	background: var(--surface);
	color: var(--ink);
	font: inherit;
}

.has-error select {
	border-color: var(--danger);
}

.field-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 1rem;
}

/* To-dos */

.todo-lists {
	display: grid;
	gap: 1rem;
}

.todo-list-card h2 a {
	color: var(--ink);
	text-decoration: none;
}

.todo-rows {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
}

.todo {
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
	padding: 0.45rem 0;
}

.todo + .todo {
	border-top: 1px solid var(--line);
}

.todo-check input {
	width: 1.1rem;
	height: 1.1rem;
	margin: 0.25rem 0 0;
	accent-color: var(--accent);
	cursor: pointer;
}

.todo-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.todo-title {
	color: var(--ink);
	text-decoration: none;
	overflow-wrap: anywhere;
}

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

.todo-done .todo-title {
	color: var(--ink-faint);
	text-decoration: line-through;
}

.todo-meta {
	color: var(--ink-faint);
	font-size: 0.85rem;
}

.todo-new {
	margin: 1.5rem 0;
}

.todo-completed summary {
	cursor: pointer;
	color: var(--ink-soft);
	font-weight: 600;
	margin-bottom: 0.5rem;
}

.todo-detail .todo-meta {
	display: block;
	margin-bottom: 1rem;
}

/* Discussions (messages) */

.message-list {
	list-style: none;
	margin: 0;
	padding: 0;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.message-list li + li {
	border-top: 1px solid var(--line);
}

.message-item {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 1rem 1.25rem;
	color: var(--ink);
	text-decoration: none;
}

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

.message-item-title {
	font-weight: 650;
	overflow-wrap: anywhere;
}

.message-item-meta {
	color: var(--ink-faint);
	font-size: 0.85rem;
}

.message-item-excerpt {
	color: var(--ink-soft);
	font-size: 0.925rem;
	overflow-wrap: anywhere;
}

.message h1 {
	overflow-wrap: anywhere;
}

/* Comments */

.comments {
	margin-top: 2rem;
}

.comment-list {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
}

.comment {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 0.85rem 1rem;
}

.comment + .comment {
	margin-top: 0.75rem;
}

.comment-meta {
	display: flex;
	align-items: baseline;
	gap: 0.6rem;
	margin-bottom: 0.35rem;
	font-size: 0.875rem;
	color: var(--ink-faint);
}

.comment-author {
	font-weight: 600;
	color: var(--ink);
}

.comment-delete {
	margin-left: auto;
}

.comment-empty {
	color: var(--ink-faint);
}

.comment-list:not(:empty) + .comment-empty {
	display: none;
}

.comment-form .form-actions {
	margin-top: 0.75rem;
}

/* === end todos-messages === */

/* === cards-schedule === */

.icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: var(--radius-small);
	background: var(--surface);
	color: var(--ink-soft);
	font: inherit;
	line-height: 1;
	cursor: pointer;
}

.icon-button:hover:not(:disabled) {
	background: var(--surface-muted);
	color: var(--ink);
}

.icon-button:disabled {
	opacity: 0.35;
	cursor: default;
}

.detail h1 {
	overflow-wrap: anywhere;
}

.detail-meta {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 0.35rem 1rem;
	margin: 0 0 1.25rem;
}

.detail-meta dt {
	color: var(--ink-faint);
}

.detail-meta dd {
	margin: 0;
}

/* Board (cards): it scrolls sideways inside itself, never the page. */

.board {
	display: flex;
	align-items: flex-start;
	gap: 1rem;
	overflow-x: auto;
	padding-bottom: 0.75rem;
	margin-bottom: 1.5rem;
	overscroll-behavior-x: contain;
}

.board-column {
	flex: 0 0 17rem;
	min-width: 0;
	background: var(--surface-muted);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 0.75rem;
}

.board-column-header {
	margin-bottom: 0.6rem;
}

.board-column-header h2 {
	font-size: 1rem;
	margin: 0 0 0.4rem;
	overflow-wrap: anywhere;
}

.board-count {
	color: var(--ink-faint);
	font-weight: 500;
	font-size: 0.85rem;
}

.board-column-actions,
.board-card-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.4rem;
	font-size: 0.85rem;
}

.board-cards {
	list-style: none;
	margin: 0;
	padding: 0;
}

.board-card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-small);
	box-shadow: var(--shadow);
	padding: 0.65rem 0.75rem;
	margin-bottom: 0.6rem;
}

.board-card-title {
	display: block;
	color: var(--ink);
	font-weight: 600;
	text-decoration: none;
	overflow-wrap: anywhere;
}

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

.board-card-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.75rem;
	margin: 0.3rem 0 0;
	color: var(--ink-faint);
	font-size: 0.8rem;
}

.board-card-actions {
	margin-top: 0.5rem;
}

.board-move {
	display: flex;
	gap: 0.3rem;
	min-width: 0;
}

.board-move select {
	min-width: 0;
	max-width: 8.5rem;
	padding: 0.2rem 0.3rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-small);
	background: var(--surface);
	color: var(--ink);
	font: inherit;
}

.board-add-card {
	display: block;
	padding: 0.4rem 0.25rem 0;
	color: var(--ink-soft);
	font-size: 0.9rem;
	text-decoration: none;
}

.board-add-card:hover {
	color: var(--accent);
}

.add-column {
	display: flex;
	align-items: flex-end;
	flex-wrap: wrap;
	gap: 0.75rem;
	max-width: 32rem;
}

.add-column .field {
	flex: 1 1 14rem;
}

/* Schedule */

.tabs {
	display: flex;
	gap: 0.25rem;
	border-bottom: 1px solid var(--line);
	margin-bottom: 1.25rem;
}

.tab {
	padding: 0.5rem 0.9rem;
	color: var(--ink-soft);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.tab:hover {
	color: var(--ink);
}

.tab-current {
	color: var(--ink);
	font-weight: 600;
	border-bottom-color: var(--accent);
}

.agenda,
.agenda-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.agenda-day + .agenda-day {
	margin-top: 1.25rem;
}

.agenda-date {
	font-size: 0.95rem;
	color: var(--ink-soft);
	margin: 0 0 0.4rem;
}

.agenda-items {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.agenda-item {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.25rem 1rem;
	padding: 0.7rem 1rem;
}

.agenda-item + .agenda-item {
	border-top: 1px solid var(--line);
}

.agenda-item a {
	font-weight: 600;
	overflow-wrap: anywhere;
	min-width: 0;
}

.agenda-when {
	color: var(--ink-faint);
	font-size: 0.875rem;
}

.is-done a {
	color: var(--ink-faint);
	text-decoration: line-through;
}

.month-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.75rem;
}

.month-nav h2 {
	margin: 0;
	font-size: 1.15rem;
}

.month-weekdays,
.month-grid {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
}

.month-weekdays {
	color: var(--ink-faint);
	font-size: 0.8rem;
	text-align: center;
	padding-bottom: 0.3rem;
}

.month-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	background: var(--line);
	gap: 1px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
}

.month-day {
	min-width: 0;
	min-height: 6rem;
	padding: 0.3rem;
	background: var(--surface);
}

.month-day.is-other-month {
	background: var(--surface-muted);
}

.month-day.is-other-month .month-day-number {
	color: var(--ink-faint);
}

.month-day-number {
	display: inline-block;
	min-width: 1.6rem;
	padding: 0.1rem 0.25rem;
	border-radius: 999px;
	color: var(--ink-soft);
	font-size: 0.8rem;
	text-align: center;
	text-decoration: none;
}

.month-day-number:hover {
	background: var(--accent-soft);
}

.month-day.is-today .month-day-number {
	background: var(--accent);
	color: var(--accent-ink);
}

.month-items {
	list-style: none;
	margin: 0.2rem 0 0;
	padding: 0;
	font-size: 0.78rem;
}

.month-items li + li {
	margin-top: 0.15rem;
}

.month-items a {
	display: block;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	padding: 0.05rem 0.3rem;
	border-radius: 4px;
	background: var(--accent-soft);
	color: var(--ink);
	text-decoration: none;
}

.month-items .month-todo a {
	background: none;
	color: var(--ink-soft);
}

.month-time {
	color: var(--ink-soft);
}

.checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 600;
}

.checkbox input {
	width: 1.1rem;
	height: 1.1rem;
	accent-color: var(--accent);
}

.when {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.when legend {
	padding: 0;
	margin-bottom: 0.5rem;
	font-weight: 650;
}

@media (max-width: 640px) {
	.board-column {
		flex-basis: 15rem;
	}

	.month-day {
		min-height: 4.5rem;
		padding: 0.2rem;
	}

	.month-items {
		font-size: 0.68rem;
	}

	.month-items a {
		padding: 0 0.15rem;
	}

	.month-time {
		display: none;
	}
}

/* === end cards-schedule === */

/* htmx's own indicator styles, moved here because the CSP blocks the <style> tag it would inject. */
.htmx-indicator {
	opacity: 0;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
	opacity: 1;
	transition: opacity 200ms ease-in;
}

/* Archived projects */

.archived-banner {
	margin: 0 0 1.25rem;
	padding: 0.6rem 1rem;
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius-small);
	background: var(--surface-muted);
	color: var(--ink-soft);
	text-align: center;
	font-size: 0.925rem;
}

/* Invitations */

.invitations {
	margin-bottom: 2rem;
}

.invitation-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.invitation {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 0.6rem 0;
}

.invitation + .invitation {
	border-top: 1px solid var(--line);
}

.invitation-actions,
.person-actions {
	display: inline-flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.person-invited .person-name {
	font-weight: 500;
	color: var(--ink-soft);
}

.avatar-invited {
	background: var(--surface-muted);
	color: var(--ink-faint);
	border: 1px dashed var(--line-strong);
}

/* Chat */

.chat-lines {
	list-style: none;
	margin: 0 0 1rem;
	padding: 0;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.chat-line {
	padding: 0.65rem 1rem;
}

.chat-line + .chat-line {
	border-top: 1px solid var(--line);
}

.chat-unread-divider {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.25rem 1rem;
	color: var(--danger);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.chat-unread-divider::after {
	content: '';
	flex: 1;
	border-top: 1px solid var(--danger);
}

.chat-lines:empty {
	display: none;
}

.chat-lines:not(:empty) + .chat-empty {
	display: none;
}

.chat-meta {
	display: flex;
	gap: 0.5rem;
	align-items: baseline;
	font-size: 0.875rem;
}

.chat-author {
	font-weight: 600;
}

.chat-meta time {
	color: var(--ink-faint);
}

.chat-line .text-body {
	margin-top: 0.15rem;
}

.chat-form {
	display: flex;
	align-items: flex-end;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.chat-form .field {
	flex: 1 1 280px;
}

.chat-form .field textarea {
	min-height: 0;
}

.chat-earlier {
	text-align: center;
}

#chat-error:empty {
	display: none;
}

/* Organizations */

.org-switcher {
	position: relative;
	font-size: 0.875rem;
}

.org-switcher summary {
	cursor: pointer;
	list-style: none;
	padding: 0.2rem 0.6rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	color: var(--ink-soft);
	white-space: nowrap;
}

.org-switcher summary::-webkit-details-marker {
	display: none;
}

.org-switcher summary::after {
	content: ' ▾';
}

.org-switcher ul {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 10;
	min-width: 220px;
	margin: 0;
	padding: 0.35rem 0;
	list-style: none;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-small);
	box-shadow: var(--shadow);
}

.org-switcher li a {
	display: block;
	padding: 0.4rem 0.9rem;
	color: var(--ink);
	text-decoration: none;
}

.org-switcher li a:hover,
.org-switcher li a[aria-current='true'] {
	background: var(--surface-muted);
}

.org-switcher-new {
	border-top: 1px solid var(--line);
	margin-top: 0.25rem;
	padding-top: 0.25rem;
}

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.org-role-form select {
	font: inherit;
	font-size: 0.875rem;
	padding: 0.15rem 0.3rem;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius-small);
	background: var(--surface);
}

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

.danger-zone {
	border-color: #f0c8c1;
}

.card + .card {
	margin-top: 1rem;
}

/* Live: top bar menus, toast, presence */

.live-menus {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	font-size: 0.9rem;
}

.live-menus + .account {
	margin-left: 0.75rem;
}

.topbar-link {
	color: var(--ink-soft);
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}

.topbar-link:hover {
	color: var(--ink);
}

.notifications {
	position: relative;
}

.notifications summary {
	list-style: none;
}

.notifications summary::-webkit-details-marker {
	display: none;
}

.notifications-list {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 10;
	width: min(340px, calc(100vw - 2rem));
	max-height: 60vh;
	overflow-y: auto;
	padding: 0.5rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-small);
	box-shadow: var(--shadow);
}

.notifications-list ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.notifications-list a {
	display: block;
	padding: 0.45rem 0.5rem;
	border-radius: var(--radius-small);
	color: var(--ink);
	text-decoration: none;
}

.notifications-list a:hover {
	background: var(--surface-muted);
}

.notifications-list p {
	margin: 0.25rem 0.5rem;
}

.notifications-text {
	display: block;
	color: var(--ink-soft);
	font-size: 0.85rem;
	overflow-wrap: anywhere;
}

.toast {
	position: fixed;
	right: 1rem;
	bottom: 1rem;
	z-index: 20;
	display: none;
	max-width: min(360px, calc(100vw - 2rem));
	padding: 0.75rem 1rem;
	background: var(--ink);
	border-radius: var(--radius-small);
	box-shadow: var(--shadow);
}

.toast.show {
	display: block;
}

.toast a {
	color: #ffffff;
	text-decoration: none;
}

.presence {
	display: inline-block;
	width: 0.55rem;
	height: 0.55rem;
	border-radius: 50%;
	background: var(--line-strong);
	vertical-align: 0.1em;
}

.presence.online {
	background: #2f9e5b;
}

.avatar-small {
	width: 26px;
	height: 26px;
	font-size: 0.65rem;
}

.avatar-with-presence {
	position: relative;
	display: inline-flex;
}

.avatar-with-presence .presence {
	position: absolute;
	right: -1px;
	bottom: -1px;
	border: 2px solid var(--surface);
	width: 0.7rem;
	height: 0.7rem;
}

/* Chat v2: line tools, reactions, typing, presence, mentions */

.chat-line.pending {
	opacity: 0.6;
}

.chat-line-deleted p {
	margin: 0.15rem 0 0;
	font-style: italic;
}

.chat-edited {
	color: var(--ink-faint);
	font-size: 0.8rem;
}

.chat-line-tools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.3rem;
	font-size: 0.8rem;
}

.chat-line-tools .link-button {
	color: var(--ink-faint);
}

/* Edit, delete and the reaction picker show on hover or focus; a line without reactions takes no extra room. */
.chat-line:not(:hover):not(:focus-within) .chat-line-tools .link-button,
.chat-line:not(:hover):not(:focus-within) .reaction-picker {
	display: none;
}

.chat-line:not(:hover):not(:focus-within) .chat-line-tools:not(:has(.reaction)) {
	display: none;
}

.chat-reactions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.3rem;
}

.reaction,
.reaction-choice {
	padding: 0.05rem 0.45rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	font: inherit;
	cursor: pointer;
}

.reaction[aria-pressed='true'] {
	border-color: var(--accent);
	background: var(--accent-soft);
}

.reaction-picker {
	position: relative;
}

.reaction-picker summary {
	list-style: none;
	cursor: pointer;
	padding: 0 0.45rem;
	border: 1px dashed var(--line-strong);
	border-radius: 999px;
	color: var(--ink-faint);
}

.reaction-picker summary::-webkit-details-marker {
	display: none;
}

.reaction-picker[open] > summary + * {
	margin-top: 0.3rem;
}

.reaction-picker[open] {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
}

.mention {
	padding: 0 0.15rem;
	border-radius: 4px;
	background: var(--accent-soft);
	color: var(--accent);
	font-weight: 600;
}

.text-body a {
	overflow-wrap: anywhere;
}

.chat-typing {
	min-height: 1.4em;
	margin: 0 0 0.5rem;
	font-size: 0.85rem;
	font-style: italic;
}

.chat-presence {
	display: flex;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chat-presence .avatar + .avatar {
	margin-left: 0;
}

.chat-form {
	position: relative;
}

.mention-suggestions {
	position: absolute;
	bottom: calc(100% - 1.5rem);
	left: 0;
	z-index: 10;
	min-width: 240px;
	margin: 0;
	padding: 0.3rem;
	list-style: none;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-small);
	box-shadow: var(--shadow);
}

.mention-suggestions[hidden] {
	display: none;
}

.mention-choice {
	display: block;
	width: 100%;
	padding: 0.35rem 0.5rem;
	border: 0;
	border-radius: var(--radius-small);
	background: none;
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.mention-choice:hover,
.mention-choice:focus {
	background: var(--surface-muted);
}

.chat-edit .field {
	margin-bottom: 0.5rem;
}

/* Pings */

.ping-list {
	list-style: none;
	margin: 0;
	padding: 0;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.ping-item + .ping-item {
	border-top: 1px solid var(--line);
}

.ping-link {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 0.75rem 1rem;
	color: var(--ink);
	text-decoration: none;
}

.ping-link:hover {
	background: var(--surface-muted);
}

.ping-people {
	display: inline-flex;
	gap: 0.2rem;
	flex: none;
}

.ping-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1;
}

.ping-title {
	font-weight: 600;
}

.ping-item.unread .ping-title {
	font-weight: 750;
}

.ping-preview {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 0.875rem;
}

.ping-time {
	flex: none;
	font-size: 0.8rem;
}

.ping-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 1rem;
}

.people-inline {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
	color: var(--ink-soft);
}

.ping-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.75rem;
	font-size: 0.9rem;
}

.ping-control summary {
	cursor: pointer;
	color: var(--ink-soft);
}

.ping-control[open] .inline-form {
	margin-top: 0.5rem;
	padding: 0.75rem;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius-small);
}

.person-picker {
	margin: 0 0 1rem;
	padding: 0;
	border: 0;
}

.person-picker legend {
	margin-bottom: 0.5rem;
	font-weight: 600;
}

.checkbox {
	display: flex;
	align-items: baseline;
	gap: 0.5rem;
	padding: 0.25rem 0;
}

@media (max-width: 640px) {
	.live-menus {
		gap: 0.5rem;
	}

	.ping-time {
		display: none;
	}
}
