/* Brand colour custom properties */
:root {
	--color-primary: #0b3c2d;
	--color-primary-dark: #072a1f;
	--color-primary-light: #e8f2ec;
	--color-secondary: #2d6a4f;
	--color-accent: #f2e8d5;
	--color-danger: #dc2626;
	--color-success: #16a34a;
	--color-warning: #d97706;
	--color-text: #1f2937;
	--color-text-muted: #6b7280;
	--color-border: #e5e7eb;
	--color-bg: #f9fafb;
	--color-surface: #ffffff;
	--radius: 0.5rem;
	--shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

/* Base reset / typography */
*, *::before, *::after {
	box-sizing: border-box;
}

html {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
	font-size: 16px;
	color: var(--color-text);
	background: var(--color-bg);
	-webkit-font-smoothing: antialiased;
}

body {
	margin: 0;
	min-height: 100vh;
}

a {
	color: var(--color-secondary);
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}

h1, h2, h3, h4 {
	margin: 0 0 0.5rem;
	line-height: 1.25;
	color: var(--color-text);
}

p {
	margin: 0 0 1rem;
	line-height: 1.6;
}

/* Utility layout helpers */
.container {
	width: 100%;
	max-width: 960px;
	margin: 0 auto;
	padding: 0 1rem;
}

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

/* Form elements */
label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	margin-bottom: 0.375rem;
	color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
textarea,
select {
	display: block;
	width: 100%;
	padding: 0.5rem 0.75rem;
	font-size: 1rem;
	line-height: 1.5;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-surface);
	color: var(--color-text);
	transition: border-color 0.15s;
}
input:focus,
textarea:focus,
select:focus {
	outline: none;
	border-color: var(--color-secondary);
	box-shadow: 0 0 0 3px rgb(45 106 79 / 0.15);
}

select {
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.5rem center;
	background-size: 1rem;
	padding-right: 2rem;
}

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

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1.25rem;
	font-size: 0.95rem;
	font-weight: 500;
	border-radius: var(--radius);
	border: 1px solid transparent;
	cursor: pointer;
	touch-action: manipulation;
	text-decoration: none;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	white-space: nowrap;
}
.btn-primary {
	background: var(--color-primary);
	color: var(--color-accent);
	border-color: var(--color-primary-dark);
}
.btn-primary:hover {
	background: var(--color-primary-dark);
	border-color: var(--color-primary-dark);
	text-decoration: none;
}
.btn-secondary {
	background: var(--color-surface);
	color: var(--color-text);
	border-color: var(--color-border);
}
.btn-secondary:hover {
	background: var(--color-bg);
	text-decoration: none;
}
.btn-danger {
	background: var(--color-danger);
	color: #fff;
	border-color: var(--color-danger);
}
.btn-danger:hover {
	background: #b91c1c;
	text-decoration: none;
}
.btn-sm {
	padding: 0.25rem 0.75rem;
	font-size: 0.825rem;
}

/* Alert / flash messages */
.alert {
	padding: 0.75rem 1rem;
	border-radius: var(--radius);
	margin-bottom: 1rem;
	font-size: 0.9rem;
}
.alert-error {
	background: #fee2e2;
	color: #991b1b;
	border: 1px solid #fca5a5;
}
.alert-success {
	background: #dcfce7;
	color: #166534;
	border: 1px solid #86efac;
}
.alert-info {
	background: var(--color-primary-light);
	color: var(--color-primary);
	border: 1px solid var(--color-secondary);
}

/* Nav */
.nav {
	background: var(--color-surface);
	border-bottom: 1px solid var(--color-border);
	padding: 0.75rem 0;
}
.nav-inner {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}
.nav-brand {
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--color-primary);
}
.nav-links {
	display: flex;
	gap: 1rem;
	flex: 1;
}
.nav-link {
	color: var(--color-text-muted);
	font-size: 0.9rem;
}
.nav-link:hover,
.nav-link.active {
	color: var(--color-secondary);
}

/* Table */
table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}
th {
	text-align: left;
	padding: 0.5rem 0.75rem;
	border-bottom: 2px solid var(--color-border);
	font-weight: 600;
	color: var(--color-text-muted);
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
td {
	padding: 0.625rem 0.75rem;
	border-bottom: 1px solid var(--color-border);
	vertical-align: middle;
}
tr:last-child td {
	border-bottom: none;
}
tr:hover td {
	background: var(--color-bg);
}

/* Spacing helpers */
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.gap-2 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--color-text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: 'SF Mono', 'Fira Code', monospace; }

/* Badge */
.badge {
	display: inline-block;
	padding: 0.2rem 0.5rem;
	font-size: 0.75rem;
	font-weight: 600;
	border-radius: 9999px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}
.badge-blue { background: var(--color-primary); color: var(--color-accent); }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-gray { background: #f3f4f6; color: #6b7280; }

/* Form group */
.form-group {
	margin-bottom: 1rem;
}

/* Responsive table wrapper — stacks on mobile, scrolls on desktop */
.table-wrap {
	overflow-x: auto;
}

@media (max-width: 639px) {
	.table-wrap.card {
		border: none;
		background: transparent;
		border-radius: 0;
		box-shadow: none;
		padding: 0;
	}

	.table-wrap table,
	.table-wrap thead,
	.table-wrap tbody,
	.table-wrap th,
	.table-wrap td,
	.table-wrap tr { display: block; }

	.table-wrap thead tr { display: none; }

	.table-wrap tr {
		border: 1px solid var(--color-border);
		border-radius: 0.5rem;
		margin-bottom: 0.75rem;
		padding: 0.25rem 0;
		overflow: hidden;
	}

	.table-wrap tr:last-child { margin-bottom: 0; }

	.table-wrap td {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 0.5rem 0.75rem;
		border-bottom: 1px solid var(--color-border);
		text-align: right;
	}

	.table-wrap tr td:last-child { border-bottom: none; }

	.table-wrap td::before {
		content: attr(data-label);
		font-weight: 600;
		font-size: 0.75rem;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		color: var(--color-text-muted);
		text-align: left;
		flex-shrink: 0;
		margin-right: 1rem;
	}

	.table-wrap td[data-label=""]::before { display: none; }
	.table-wrap td[data-label=""] { justify-content: flex-end; }

	.table-wrap tr:hover td { background: transparent; }
}

/* Mobile nav */
@media (max-width: 639px) {
	.nav-inner {
		flex-wrap: wrap;
	}
	.nav-brand {
		margin-right: auto;
	}
	.nav-email {
		display: none;
	}
	.nav-links {
		order: 3;
		width: 100%;
		flex-wrap: wrap;
		gap: 0.75rem;
		padding-top: 0.5rem;
		border-top: 1px solid var(--color-border);
	}
}
