:root {
	--bg: #f4f5f8;
	--panel: #ffffff;
	--text: #1c2330;
	--muted: #6a7385;
	--line: #d9dde6;
	--accent: #3a6bd8;
	--accent-dark: #2b54b0;
	--ok: #1f7a3d;
	--err: #b3261e;
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0.4em 0; }
h2 { font-size: 1.15rem; margin: 1.4em 0 0.5em; }
code { background: #e8ebf2; padding: 1px 5px; border-radius: 3px; }
.muted { color: var(--muted); }

/* --- Layout --- */
.topbar {
	display: flex;
	align-items: center;
	gap: 28px;
	padding: 10px 24px;
	background: #1c2330;
	color: #fff;
}
.topbar a { color: #cfd6e6; text-decoration: none; }
.topbar .brand { color: #fff; font-weight: 700; }
.topbar nav { display: flex; gap: 6px; flex: 1; }
.topbar nav a { padding: 6px 12px; border-radius: 4px; }
.topbar nav a:hover { background: #2d3750; }
.topbar nav a.active { background: var(--accent); color: #fff; }
.logout { display: flex; align-items: center; gap: 12px; margin: 0; }
.whoami { color: #cfd6e6; }

main { max-width: 1280px; margin: 0 auto; padding: 16px 24px 48px; }

/* --- Forms / buttons --- */
label { display: block; font-weight: 600; font-size: 0.9rem; }
label.check { font-weight: 400; align-self: end; }
input[type=text], input[type=url], input[type=password], input[type=date],
input[type=time], input[type=number], select, textarea {
	display: block;
	width: 100%;
	margin-top: 4px;
	padding: 7px 9px;
	font: inherit;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: #fff;
}
input[type=color] { display: block; margin-top: 4px; height: 36px; width: 80px; padding: 2px; }
input.short { width: 80px; }
textarea { resize: vertical; }
button, .btn {
	display: inline-block;
	padding: 7px 14px;
	font: inherit;
	color: var(--text);
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 4px;
	cursor: pointer;
	text-decoration: none;
}
button:hover, .btn:hover { background: #eef1f7; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); }
button.link { background: none; border: 0; color: #cfd6e6; padding: 0; }
button.copy { margin: 6px 0 14px; }
button.copied { background: var(--ok); border-color: var(--ok); color: #fff; }

.card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 6px;
	padding: 16px 20px;
	margin: 12px 0;
}
.card.narrow { max-width: 380px; margin: 64px auto; }
.card.narrow label { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px 18px; }
.form-grid .wide, fieldset.wide { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 6px; }
fieldset label { margin-bottom: 10px; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 6px; }

.flash { padding: 9px 14px; border-radius: 4px; margin: 10px 0; }
.flash-ok { background: #e3f4e8; color: var(--ok); }
.flash-err { background: #fbe4e2; color: var(--err); }

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); }
.table th, .table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: #eef1f7; font-size: 0.85rem; }
.table td.url { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tr.ended { color: var(--muted); }
.table form { margin: 0; }
.facts { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }

/* --- Calendar --- */
.cal-head { display: flex; align-items: center; justify-content: space-between; }
.cal-nav { display: flex; gap: 8px; }
.calendar {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	border-top: 1px solid var(--line);
	border-left: 1px solid var(--line);
	background: var(--panel);
}
.calendar .dow {
	padding: 6px 8px;
	font-weight: 600;
	font-size: 0.85rem;
	background: #eef1f7;
	border-right: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}
.day {
	min-height: 118px;
	padding: 4px;
	border-right: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}
.day.other-month { background: #f7f8fb; color: var(--muted); }
.day.today { background: #fff8dc; }
.day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.daynum { font-size: 0.85rem; font-weight: 600; padding: 0 3px; }
.day .add { visibility: hidden; text-decoration: none; padding: 0 6px; color: var(--muted); }
.day:hover .add { visibility: visible; }

.chip {
	display: block;
	margin-bottom: 3px;
	padding: 3px 6px;
	border-radius: 4px;
	font-size: 0.78rem;
	line-height: 1.25;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.chip:hover { filter: brightness(0.92); }
.chip-time { font-weight: 700; }
.chip-sub { display: block; opacity: 0.85; font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; }

/* Status markers: used on chips and in the legend. */
.chip::before, .mark::before { display: inline-block; width: 1.1em; font-weight: 700; }
.status-planned::before { content: '○'; }
.status-ready::before { content: '◐'; }
.status-sent::before { content: '●'; }
.status-cancelled::before { content: '✕'; }
.chip.status-cancelled { opacity: 0.55; text-decoration: line-through; }
.mark { display: inline-block; }

.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 14px; font-size: 0.85rem; }
.legend-title { font-weight: 700; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-note { margin-left: auto; color: var(--muted); }

/* --- Phrases / composer --- */
.phrase-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 8px; }
.phrase-row textarea { flex: 1; margin-top: 0; }
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.picks legend, .notice legend { font-weight: 700; padding: 0 6px; }
.picks .actions { grid-column: 1 / -1; }
.notice textarea { font-family: ui-monospace, 'DejaVu Sans Mono', monospace; font-size: 0.9rem; }
