:root {
	--bg: #f2ead9;
	--surface: #faf5eb;
	--ink: #1a1a2e;
	--muted: #5a6474;
	--border: #d8dce2;
	--accent: #1a3a5c;
	--accent-soft: #e4eaf1;
	--brand-amber: #d4821a;
	--brand-steel: #2c6eab;

	--status-new: #5b6b74;
	--status-new-soft: #eceff0;
	--status-approved: #2b6cb0;
	--status-approved-soft: #e4eef8;
	--status-assigned: #0f6e66;
	--status-assigned-soft: #e3f2ef;
	--status-in-progress: #c2410c;
	--status-in-progress-soft: #fbe8de;
	--status-ready-for-release: #7c3aed;
	--status-ready-for-release-soft: #f0e9fc;
	--status-on-hold: #be185d;
	--status-on-hold-soft: #fbe4ee;
	--status-blocked: #b45309;
	--status-blocked-soft: #fbeadb;
	--status-closed: #3f7d4f;
	--status-closed-soft: #e5f1e7;

	--font-ui: "IBM Plex Sans", -apple-system, "Segoe UI", sans-serif;
	--font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
	--font-display: "Playfair Display", Georgia, serif;
}

body {
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-ui);
}

.navbar-brand {
	font-weight: 600;
	letter-spacing: 0.01em;
}

.brand-logo {
	height: 28px;
	width: auto;
}

.brand-suffix {
	font-family: var(--font-ui);
	font-weight: 600;
	color: var(--muted);
	font-size: 0.95rem;
}

.btn-teal {
	background: var(--accent);
	border-color: var(--accent);
	color: #fff;
}

.btn-teal:hover, .btn-teal:focus, .btn-teal:active {
	background: #12283f;
	border-color: #12283f;
	color: #fff;
}

.btn-outline-teal {
	background: transparent;
	border-color: var(--accent);
	color: var(--accent);
}

.btn-outline-teal:hover, .btn-outline-teal:focus {
	background: var(--accent-soft);
	border-color: var(--accent);
	color: var(--accent);
}

.page-container {
	max-width: 1200px;
}

h1, h2, h3 {
	font-family: var(--font-display);
	font-weight: 700;
	color: var(--ink);
}

.ticket-id {
	font-family: var(--font-mono);
	font-weight: 600;
	color: var(--accent);
	text-decoration: none;
}

.ticket-id:hover {
	text-decoration: underline;
}

.source-ref, .body-markdown {
	font-family: var(--font-mono);
	font-size: 0.85rem;
}

.body-markdown {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 0.375rem;
	padding: 1rem;
	white-space: pre-wrap;
	word-break: break-word;
}

.rendered-markdown {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 0.375rem;
	padding: 1.25rem 1.5rem;
	line-height: 1.6;
}

.rendered-markdown h1, .rendered-markdown h2, .rendered-markdown h3 {
	margin-top: 1.25rem;
	margin-bottom: 0.5rem;
}

.rendered-markdown h1:first-child, .rendered-markdown h2:first-child, .rendered-markdown h3:first-child {
	margin-top: 0;
}

.rendered-markdown p, .rendered-markdown ul, .rendered-markdown ol {
	margin-bottom: 0.75rem;
}

.rendered-markdown code {
	font-family: var(--font-mono);
	font-size: 0.85em;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 0.25rem;
	padding: 0.1em 0.35em;
}

.rendered-markdown pre {
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 0.375rem;
	padding: 0.75rem 1rem;
	overflow-x: auto;
}

.rendered-markdown pre code {
	background: none;
	border: none;
	padding: 0;
}

.rendered-markdown blockquote {
	border-left: 3px solid var(--accent);
	margin-left: 0;
	padding-left: 1rem;
	color: var(--muted);
}

.rendered-markdown table {
	border-collapse: collapse;
	width: 100%;
	margin-bottom: 1rem;
}

.rendered-markdown th, .rendered-markdown td {
	border: 1px solid var(--border);
	padding: 0.4rem 0.6rem;
	text-align: left;
}

.rendered-markdown th {
	background: var(--bg);
}

/* Ticket type tabs */

.nav-tabs .nav-link {
	color: var(--muted);
	border: none;
	border-bottom: 2px solid transparent;
	font-weight: 500;
}

.nav-tabs .nav-link:hover {
	border-color: var(--accent-soft);
	color: var(--ink);
}

.nav-tabs .nav-link.active {
	color: var(--accent);
	background: transparent;
	border-color: var(--accent);
}

/* Board */

.board {
	display: flex;
	flex-wrap: nowrap;
	gap: 1rem;
	align-items: stretch;
	overflow-x: auto;
}

.board-column {
	flex: 1 1 0;
	min-width: 170px;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 0.5rem;
	padding: 0.75rem;
	display: flex;
	flex-direction: column;
}

.board-column h2 {
	font-family: var(--font-ui);
	font-weight: 600;
	font-size: 0.95rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--muted);
	margin: 0 0 0.75rem;
}

.column-body {
	flex: 1;
	min-height: 60px;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.ticket-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-left: 4px solid var(--status-new);
	border-radius: 0.375rem;
	padding: 0.6rem 0.75rem;
	cursor: grab;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
	overflow-wrap: break-word;
	word-break: break-word;
}

.ticket-card:hover {
	box-shadow: 0 2px 8px rgba(30, 42, 50, 0.08);
}

.ticket-card:active {
	cursor: grabbing;
}

.ticket-card.status-new     { border-left-color: var(--status-new); }
.ticket-card.status-approved { border-left-color: var(--status-approved); }
.ticket-card.status-assigned { border-left-color: var(--status-assigned); }
.ticket-card.status-in_progress { border-left-color: var(--status-in-progress); }
.ticket-card.status-ready_for_release { border-left-color: var(--status-ready-for-release); }
.ticket-card.status-on_hold  { border-left-color: var(--status-on-hold); }
.ticket-card.status-blocked  { border-left-color: var(--status-blocked); }
.ticket-card.status-closed   { border-left-color: var(--status-closed); }

.ticket-card .ticket-title {
	display: block;
	margin-top: 0.25rem;
	color: var(--ink);
}

.btn-close-ticket {
	display: block;
	margin-top: 0.5rem;
	margin-left: auto;
	padding: 0.15rem 0.6rem;
	font-size: 0.75rem;
	background: var(--surface);
	color: var(--status-closed);
	border: 1px solid var(--status-closed);
	border-radius: 0.25rem;
	cursor: pointer;
}

.btn-close-ticket:hover {
	background: var(--status-closed);
	color: var(--surface);
}

.occurrence-badge {
	font-family: var(--font-mono);
}

/* Occurrence severity: a second signal, independent of the status border — how many
   times this exact bug has been reported, not what state the ticket is in. */
.occurrence-tier-low {
	background: #eaf7ee;
}

.occurrence-tier-medium {
	background: #fdf3d9;
}

.occurrence-tier-high {
	background: #fbe7e7;
}

.occurrence-badge-low {
	background: #d3ecda;
	color: #2a6b3d;
}

.occurrence-badge-medium {
	background: #f6e3ab;
	color: #7a5a05;
}

.occurrence-badge-high {
	background: #f3c6c6;
	color: #8a2222;
}

.badge-neutral        { background: var(--status-new-soft); color: var(--status-new); }
.status-badge-new     { background: var(--status-new-soft); color: var(--status-new); }
.status-badge-approved { background: var(--status-approved-soft); color: var(--status-approved); }
.status-badge-assigned { background: var(--status-assigned-soft); color: var(--status-assigned); }
.status-badge-in_progress { background: var(--status-in-progress-soft); color: var(--status-in-progress); }
.status-badge-ready_for_release { background: var(--status-ready-for-release-soft); color: var(--status-ready-for-release); }
.status-badge-on_hold  { background: var(--status-on-hold-soft); color: var(--status-on-hold); }
.status-badge-blocked  { background: var(--status-blocked-soft); color: var(--status-blocked); }
.status-badge-closed   { background: var(--status-closed-soft); color: var(--status-closed); }

@media ( prefers-reduced-motion: reduce ) {
	.ticket-card {
		transition: none;
	}
}

@media ( max-width: 640px ) {
	.board {
		flex-direction: column;
		overflow-x: visible;
	}
	.board-column {
		flex: 1 1 auto;
		width: 100%;
	}
}

/* ==========================================================================
   Admin dashboard (views/admin/*, includes/js/admin.js)
   ========================================================================== */

.admin-table .admin-nowrap {
	white-space: nowrap;
}

/* A disabled user or revoked token stays listed but reads as inactive. */
.admin-table tr.admin-row-inactive > td {
	color: var(--muted);
}

/* Inline edit panel rows sit under their record row on a cream band with an
   accent rule, so it is clear which record the open form belongs to. */
.admin-table > tbody > tr.admin-panel-row > td {
	--bs-table-bg: var(--surface);
	border-left: 3px solid var(--accent);
	padding: 0.75rem 1rem;
}

.table-hover > tbody > tr.admin-panel-row:hover > * {
	--bs-table-bg-state: transparent;
}

.admin-panel-row .form-label {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--muted);
	margin-bottom: 0.25rem;
}

.badge-role-superuser {
	background: var(--accent-soft);
	color: var(--accent);
}

.badge-self {
	background: transparent;
	border: 1px solid var(--border);
	color: var(--muted);
	font-weight: 500;
}

@media ( max-width: 575.98px ) {
	.admin-panel-row .admin-panel-field {
		flex: 1 1 100%;
	}
}
