/* Vikunja-inspired light theme */

:root {
	--bg:          #f2f4f8;
	--surface:     #ffffff;
	--border:      #e4e8ee;
	--text:        #33373e;
	--text-muted:  #8a919c;
	--primary:     #1973ff;
	--primary-dim: #1260d6;
	--danger:      #eb5757;
	--radius:      8px;
	--shadow:      0 1px 3px rgba(20, 30, 60, .08), 0 1px 2px rgba(20, 30, 60, .04);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Top bar ---------- */

.topbar {
	display: flex;
	align-items: center;
	gap: 24px;
	height: 56px;
	padding: 0 24px;
	background: var(--surface);
	box-shadow: var(--shadow);
	position: sticky;
	top: 0;
	z-index: 10;
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 700;
	font-size: 17px;
	color: var(--text);
	text-decoration: none;
}

.topbar nav {
	display: flex;
	gap: 4px;
}

.topbar nav a {
	padding: 6px 14px;
	border-radius: 6px;
	color: var(--text-muted);
	text-decoration: none;
	font-weight: 600;
}

.topbar nav a:hover  { background: #eef2f8; color: var(--text); }
.topbar nav a.active { background: #e8f0ff; color: var(--primary); }

.spacer { flex: 1; }

/* ---------- Buttons, inputs ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 16px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: #eef1f6;
	color: var(--text);
	font-weight: 600;
	font-size: 14px;
	text-decoration: none;
	cursor: pointer;
}

.btn:hover        { background: #e4e9f1; }
.btn.primary      { background: var(--primary); color: #fff; }
.btn.primary:hover{ background: var(--primary-dim); }
.btn.subtle       { background: transparent; border-color: var(--border); }
.btn.subtle:hover { background: #f2f5fa; }
.btn.danger       { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: #fdeeee; }

input[type="text"], input[type="search"], select, textarea {
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--surface);
	color: var(--text);
	font: inherit;
}

input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(25, 115, 255, .15);
}

textarea { width: 100%; resize: vertical; }

/* ---------- Layout ---------- */

main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.page-head {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 16px;
}

.page-head h1 { margin: 0; font-size: 24px; }

.card {
	background: var(--surface);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

.muted  { color: var(--text-muted); font-size: 13px; }
.hidden { display: none !important; }

.error-banner {
	margin-bottom: 16px;
	padding: 10px 16px;
	border-radius: 6px;
	background: #fdeeee;
	border: 1px solid var(--danger);
	color: #b03434;
}

/* ---------- List view ---------- */

.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 12px 16px;
	margin-bottom: 16px;
}

.toolbar .grow { flex: 1; min-width: 220px; }

.table-wrap { overflow-x: auto; }

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

th, td {
	padding: 10px 14px;
	text-align: left;
	border-bottom: 1px solid var(--border);
	white-space: nowrap;
}

td.title-cell { white-space: normal; min-width: 240px; font-weight: 600; }

th {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--text-muted);
	user-select: none;
}

th[data-sort] { cursor: pointer; }
th[data-sort]:hover { color: var(--text); }
th .sort-arrow { margin-left: 4px; }

tbody tr { cursor: pointer; }
tbody tr:hover { background: #f6f9fd; }
tbody tr:last-child td { border-bottom: none; }

.empty { padding: 40px; text-align: center; color: var(--text-muted); }

/* ---------- Badges & chips ---------- */

.badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 700;
	color: #fff;
}

.chip {
	display: inline-block;
	padding: 2px 10px;
	margin: 1px 2px 1px 0;
	border-radius: 20px;
	background: #eef1f6;
	color: #5a6270;
	font-size: 12px;
	font-weight: 600;
}

.chip .chip-x {
	margin-left: 6px;
	cursor: pointer;
	color: var(--text-muted);
}

.chip .chip-x:hover { color: var(--danger); }

/* ---------- Kanban board ---------- */

.board {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	overflow-x: auto;
	padding-bottom: 24px;
}

.column {
	flex: 0 0 300px;
	background: #eaedf3;
	border-radius: var(--radius);
	padding: 10px;
	max-height: calc(100vh - 200px);
	display: flex;
	flex-direction: column;
}

.column-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 6px 10px;
	font-weight: 700;
}

.column-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
}

.column-count {
	color: var(--text-muted);
	font-weight: 600;
	font-size: 13px;
}

.column-cards {
	display: flex;
	flex-direction: column;
	gap: 8px;
	overflow-y: auto;
	min-height: 40px;
	flex: 1;
}

.column.drag-over { outline: 2px dashed var(--primary); outline-offset: -4px; }

.kanban-card {
	background: var(--surface);
	border-radius: 6px;
	box-shadow: var(--shadow);
	padding: 10px 12px;
	cursor: grab;
}

.kanban-card:hover { box-shadow: 0 3px 8px rgba(20, 30, 60, .14); }
.kanban-card.dragging { opacity: .5; }

.kanban-card .card-title { font-weight: 600; margin-bottom: 6px; }

.kanban-card .card-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	color: var(--text-muted);
	font-size: 12px;
}

/* ---------- Dialog ---------- */

dialog {
	border: none;
	border-radius: var(--radius);
	box-shadow: 0 10px 40px rgba(20, 30, 60, .25);
	padding: 24px;
	min-width: 440px;
}

dialog::backdrop { background: rgba(20, 30, 60, .35); }

dialog h2 { margin-top: 0; }

.status-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
}

.status-row input[type="text"] { flex: 1; }
.status-row input[type="color"] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }

.dialog-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 16px;
	padding-top: 16px;
	border-top: 1px solid var(--border);
}

/* ---------- Issue detail ---------- */

.issue-layout {
	display: flex;
	gap: 20px;
	align-items: flex-start;
}

.issue-main { flex: 1; min-width: 0; }

.issue-side {
	flex: 0 0 300px;
	position: sticky;
	top: 80px;
}

.section { padding: 20px; margin-bottom: 20px; }
.section h2 { margin: 0 0 12px; font-size: 17px; }

.field-label {
	display: block;
	margin: 14px 0 4px;
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--text-muted);
}

.field-label:first-child { margin-top: 0; }

.title-input { width: 100%; font-size: 18px; font-weight: 600; }

.issue-side select, .issue-side input[type="text"] { width: 100%; }

.chip-editor { margin-bottom: 6px; min-height: 10px; }

.meta-dates { margin-top: 18px; line-height: 1.8; }

.attachment-list {
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
}

.attachment-list li {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 0;
	border-bottom: 1px solid var(--border);
}

.attachment-list li:last-child { border-bottom: none; }
.attachment-list a { color: var(--primary); text-decoration: none; font-weight: 600; }
.attachment-list a:hover { text-decoration: underline; }

.attachment-x {
	cursor: pointer;
	border: none;
	background: none;
	color: var(--text-muted);
	font-size: 15px;
}

.attachment-x:hover { color: var(--danger); }

.file-btn { position: relative; overflow: hidden; }

.history-list { margin-bottom: 16px; }

.history-entry {
	padding: 12px 0;
	border-bottom: 1px solid var(--border);
}

.history-entry:last-child { border-bottom: none; }

.history-head {
	display: flex;
	gap: 10px;
	align-items: baseline;
	margin-bottom: 4px;
}

.history-author { font-weight: 700; }
.history-comment { white-space: pre-wrap; }

.history-attachments { margin-top: 6px; }
.history-attachments a { color: var(--primary); text-decoration: none; font-size: 13px; margin-right: 12px; }
.history-attachments a:hover { text-decoration: underline; }

.comment-form { border-top: 1px solid var(--border); padding-top: 16px; }
.comment-form input[type="text"] { width: 240px; margin-bottom: 8px; }
.comment-form textarea { margin-bottom: 8px; }

.comment-form-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

@media (max-width: 900px) {
	.issue-layout { flex-direction: column-reverse; }
	.issue-side { position: static; flex: none; width: 100%; }
}
