/* The Week In — Stylesheet */

/* ============================================================
   Reset & Base
   ============================================================ */

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

:root {
	--color-bg: #f7f8fa;
	--color-surface: #ffffff;
	--color-border: #e2e5ea;
	--color-text: #1a1d23;
	--color-text-muted: #6b7280;
	--color-primary: #2563eb;
	--color-primary-hover: #1d4ed8;
	--color-danger: #dc2626;
	--color-danger-hover: #b91c1c;
	--color-success: #059669;
	--color-warning: #d97706;
	--radius: 8px;
	--radius-sm: 4px;
	--shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
	--shadow-md: 0 4px 6px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
	--font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--font-mono: 'SF Mono', Monaco, 'Cascadia Code', Consolas, monospace;
}

body {
	font-family: var(--font-sans);
	font-size: 15px;
	line-height: 1.6;
	color: var(--color-text);
	background: var(--color-bg);
	-webkit-font-smoothing: antialiased;
}

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

img {
	max-width: 100%;
	height: auto;
}


/* ============================================================
   Layout
   ============================================================ */

.container {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 24px;
}


/* ============================================================
   Header
   ============================================================ */

.site-header {
	background: var(--color-surface);
	border-bottom: 1px solid var(--color-border);
	padding: 0;
	position: sticky;
	top: 0;
	z-index: 100;
}

.site-header .container {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 56px;
}

.logo {
	font-size: 18px;
	font-weight: 700;
	color: var(--color-text);
	letter-spacing: -0.02em;
}
.logo:hover {
	text-decoration: none;
	color: var(--color-primary);
}

.main-nav {
	display: flex;
	align-items: center;
	gap: 24px;
}

.main-nav a {
	color: var(--color-text-muted);
	font-size: 14px;
	font-weight: 500;
}
.main-nav a:hover {
	color: var(--color-text);
	text-decoration: none;
}

/* User dropdown */
.user-dropdown {
	position: relative;
}

.user-dropdown-trigger {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 4px 8px;
	border: none;
	background: transparent;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	color: var(--color-text);
	cursor: pointer;
	border-radius: var(--radius-sm);
	transition: background-color 0.15s;
}
.user-dropdown-trigger:hover {
	background: var(--color-bg);
}

.dropdown-chevron {
	color: var(--color-text-muted);
	transition: transform 0.15s;
}
.user-dropdown:hover .dropdown-chevron {
	transform: rotate(180deg);
}

.avatar {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	object-fit: cover;
}

.user-dropdown-menu {
	display: none;
	position: absolute;
	right: 0;
	top: 100%;
	padding-top: 4px;
	min-width: 200px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
	z-index: 200;
	overflow: hidden;
}
.user-dropdown:hover .user-dropdown-menu {
	display: block;
}

.user-dropdown-header {
	padding: 10px 14px;
	border-bottom: 1px solid var(--color-border);
}
.user-dropdown-email {
	font-size: 12px;
	color: var(--color-text-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.user-dropdown-item {
	display: block;
	padding: 10px 14px;
	font-size: 13px;
	color: var(--color-text);
	text-decoration: none;
	transition: background-color 0.1s;
}
.user-dropdown-item:hover {
	background: var(--color-bg);
	text-decoration: none;
}
.user-dropdown-logout {
	color: var(--color-danger);
}

/* Admin dropdown */
.admin-dropdown {
	position: relative;
}
.admin-dropdown-trigger {
	display: flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: 1px solid var(--color-border);
	border-radius: 6px;
	padding: 6px 10px;
	font-size: 13px;
	font-weight: 500;
	color: var(--color-text);
	cursor: pointer;
	transition: background-color 0.15s;
}
.admin-dropdown-trigger:hover {
	background: var(--color-bg);
}
.admin-dropdown:hover .dropdown-chevron {
	transform: rotate(180deg);
}
.admin-dropdown-menu {
	display: none;
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 4px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: 8px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
	min-width: 180px;
	z-index: 100;
	overflow: hidden;
}
.admin-dropdown:hover .admin-dropdown-menu {
	display: block;
}
.admin-dropdown-item {
	display: block;
	padding: 10px 14px;
	font-size: 13px;
	color: var(--color-text);
	text-decoration: none;
	transition: background-color 0.1s;
}
.admin-dropdown-item:hover {
	background: var(--color-bg);
	text-decoration: none;
}

.avatar-small {
	width: 20px;
	height: 20px;
}

.role-badge {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding: 2px 8px;
	border-radius: 10px;
	background: var(--color-border);
	color: var(--color-text-muted);
}
.role-editor {
	background: #dbeafe;
	color: #1e40af;
}
.role-admin {
	background: #fce7f3;
	color: #9d174d;
}


/* ============================================================
   Footer
   ============================================================ */

.site-footer {
	margin-top: 48px;
	padding: 24px 0;
	border-top: 1px solid var(--color-border);
	color: var(--color-text-muted);
	font-size: 13px;
	text-align: center;
}


/* ============================================================
   Page Header
   ============================================================ */

.page-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 32px 0 24px;
}

.page-header h1 {
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.page-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}


/* ============================================================
   Buttons
   ============================================================ */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.4;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text);
	cursor: pointer;
	transition: all 0.15s ease;
	text-decoration: none;
}
.btn:hover {
	text-decoration: none;
	background: var(--color-bg);
}

.btn-primary {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: #ffffff;
}
.btn-primary:hover {
	background: var(--color-primary-hover);
	border-color: var(--color-primary-hover);
}

.btn-secondary {
	background: var(--color-surface);
	border-color: var(--color-border);
	color: var(--color-text-muted);
}
.btn-secondary:hover {
	color: var(--color-text);
	border-color: var(--color-text-muted);
}

.btn-danger {
	background: var(--color-surface);
	border-color: var(--color-danger);
	color: var(--color-danger);
}
.btn-danger:hover {
	background: var(--color-danger);
	color: #ffffff;
}

.btn-success {
	background: var(--color-success);
	border-color: var(--color-success);
	color: #ffffff;
}
.btn-success:hover {
	background: #047857;
	border-color: #047857;
	color: #ffffff;
}

.inline-form {
	display: inline;
}

.api-key-section {
	margin-top: 24px;
	padding-top: 24px;
	border-top: 1px solid var(--color-border);
}

.api-key-display {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 8px 0;
}

.api-key-value {
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 8px 12px;
	font-family: var(--font-mono);
	font-size: 13px;
	word-break: break-all;
	flex: 1;
}

.btn-small {
	padding: 4px 10px;
	font-size: 13px;
}

.btn-large {
	padding: 12px 32px;
	font-size: 16px;
	font-weight: 600;
}

/* ============================================================
   Sending Overlay
   ============================================================ */

.sending-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba( 0, 0, 0, 0.6 );
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
}

.sending-modal {
	background: var(--color-surface);
	border-radius: var(--radius);
	padding: 48px 40px;
	text-align: center;
	max-width: 420px;
	width: 90%;
	box-shadow: var(--shadow-md);
}

.sending-modal h2 {
	margin: 20px 0 8px;
	font-size: 22px;
}

.sending-modal p {
	color: var(--color-text-muted);
	font-size: 14px;
	margin: 0 0 4px;
}

.sending-warning {
	color: var(--color-warning) !important;
	font-weight: 600;
	margin-top: 16px !important;
}

.sending-spinner {
	width: 48px;
	height: 48px;
	border: 4px solid var(--color-border);
	border-top-color: var(--color-primary);
	border-radius: 50%;
	margin: 0 auto;
	animation: spin 0.8s linear infinite;
}

@keyframes spin {
	to { transform: rotate( 360deg ); }
}

/* ============================================================
   Flash Messages
   ============================================================ */

.flash-message {
	padding: 12px 16px;
	margin: 16px 0;
	background: #ecfdf5;
	border: 1px solid #a7f3d0;
	color: var(--color-success);
	border-radius: var(--radius-sm);
	font-size: 14px;
	font-weight: 500;
}

.error-box {
	padding: 12px 16px;
	margin: 0 0 24px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	color: var(--color-danger);
	border-radius: var(--radius-sm);
	font-size: 14px;
}
.error-box ul {
	margin: 8px 0 0 16px;
}


/* ============================================================
   Newsletter Tabs
   ============================================================ */

.newsletter-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 24px;
	border-bottom: 1px solid var(--color-border);
	padding-bottom: 0;
}

.tab {
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 500;
	color: var(--color-text-muted);
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	transition: all 0.15s ease;
}
.tab:hover {
	text-decoration: none;
	color: var(--color-text);
}
.tab-active {
	color: var(--color-primary);
	border-bottom-color: var(--color-primary);
}


/* ============================================================
   Article Grid
   ============================================================ */

.article-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 20px;
}

.article-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	transition: box-shadow 0.15s ease;
}
.article-card:hover {
	box-shadow: var(--shadow-md);
}

.article-image {
	width: 100%;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	background: var(--color-bg);
}
.article-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.article-image-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 48px;
	font-weight: 700;
	color: var(--color-border);
}

.article-body {
	padding: 16px;
	flex: 1;
}

.article-meta {
	display: flex;
	gap: 6px;
	margin-bottom: 8px;
}

.badge {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 2px 8px;
	border-radius: 10px;
}
.badge-platform {
	background: #ede9fe;
	color: #6d28d9;
}
.badge-status {
	background: var(--color-border);
	color: var(--color-text-muted);
}
.badge-status-draft {
	background: #f3f4f6;
	color: #6b7280;
}
.badge-status-approved {
	background: #d1fae5;
	color: #065f46;
}
.badge-status-published {
	background: #dbeafe;
	color: #1e40af;
}
.badge-status-cancelled {
	background: #fee2e2;
	color: #991b1b;
}

.article-title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 4px;
}
.article-title a {
	color: var(--color-text);
}
.article-title a:hover {
	color: var(--color-primary);
	text-decoration: none;
}

.article-source {
	font-size: 13px;
	color: var(--color-text-muted);
	margin-bottom: 8px;
}

.article-excerpt {
	font-size: 14px;
	color: var(--color-text-muted);
	line-height: 1.5;
	margin-bottom: 12px;
}

.article-footer {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	color: var(--color-text-muted);
	margin-top: auto;
}

.article-actions {
	padding: 12px 16px;
	border-top: 1px solid var(--color-border);
	display: flex;
	gap: 8px;
}


/* ============================================================
   Article Detail
   ============================================================ */

.article-detail {
	display: grid;
	grid-template-columns: 1fr 300px;
	gap: 32px;
	margin-top: 8px;
}

.article-detail-image {
	border-radius: var(--radius);
	overflow: hidden;
	margin-bottom: 24px;
	text-align: center;
}
.article-detail-image img {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
}

.article-detail-description {
	font-size: 15px;
	line-height: 1.7;
	margin-bottom: 24px;
}

.article-detail-link {
	font-size: 14px;
	font-weight: 500;
}

.article-detail-sidebar {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	padding: 20px;
	height: fit-content;
}

.detail-list {
	font-size: 14px;
}
.detail-list dt {
	font-weight: 600;
	color: var(--color-text-muted);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	margin-top: 16px;
}
.detail-list dt:first-child {
	margin-top: 0;
}
.detail-list dd {
	margin: 2px 0 0;
	display: flex;
	align-items: center;
	gap: 6px;
}


/* ============================================================
   Forms
   ============================================================ */

.article-form {
	max-width: 720px;
}

.form-section {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	padding: 24px;
	margin-bottom: 20px;
}

.form-section h2 {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--color-border);
}

.form-row {
	margin-bottom: 16px;
}
.form-row:last-child {
	margin-bottom: 0;
}

.form-group-wide {
	width: 100%;
}
.form-group-wide input,
.form-group-wide textarea,
.form-group-wide select {
	width: 100%;
}

.form-row-2col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.form-group label {
	display: block;
	font-size: 14px;
	font-weight: 500;
	margin-bottom: 4px;
	color: var(--color-text);
}

.required {
	color: var(--color-danger);
}
.optional {
	color: var(--color-text-muted);
	font-weight: 400;
	font-size: 12px;
}

.form-help {
	font-size: 13px;
	color: var(--color-text-muted);
	margin-bottom: 12px;
}

input[type="text"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="email"],
select,
textarea {
	width: 100%;
	padding: 8px 12px;
	font-size: 14px;
	font-family: var(--font-sans);
	line-height: 1.5;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
	color: var(--color-text);
	transition: border-color 0.15s ease;
}
input:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: var(--color-primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input[type="file"] {
	font-size: 14px;
}

textarea {
	resize: vertical;
	min-height: 80px;
}

.input-with-action {
	display: flex;
	gap: 8px;
}
.input-with-action input {
	flex: 1;
}

.field-error {
	display: block;
	font-size: 13px;
	color: var(--color-danger);
	margin-top: 4px;
}
.field-hint {
	display: block;
	font-size: 13px;
	color: var(--color-text-muted);
	margin-top: 4px;
}

.current-image {
	margin-bottom: 16px;
}
.current-image img {
	border-radius: var(--radius-sm);
	border: 1px solid var(--color-border);
	max-width: 300px;
}

.form-actions {
	display: flex;
	gap: 8px;
	margin-top: 24px;
}


/* ============================================================
   Empty State
   ============================================================ */

.empty-state {
	text-align: center;
	padding: 64px 24px;
	color: var(--color-text-muted);
}
.empty-state p {
	margin-bottom: 16px;
	font-size: 16px;
}


/* ============================================================
   Error Pages
   ============================================================ */

.error-page {
	text-align: center;
	padding: 80px 24px;
}
.error-page h1 {
	font-size: 72px;
	font-weight: 700;
	color: var(--color-border);
	margin-bottom: 8px;
}
.error-page p {
	font-size: 16px;
	color: var(--color-text-muted);
	margin-bottom: 24px;
}


/* ============================================================
   Scraper Loading State
   ============================================================ */

.scrape-loading {
	opacity: 0.6;
	pointer-events: none;
}

#scrape-btn.loading {
	position: relative;
	color: transparent;
}
#scrape-btn.loading::after {
	content: '';
	position: absolute;
	width: 16px;
	height: 16px;
	border: 2px solid var(--color-border);
	border-top-color: var(--color-primary);
	border-radius: 50%;
	animation: spin 0.6s linear infinite;
}

@keyframes spin {
	to { transform: rotate(360deg); }
}


/* ============================================================
   Edition List
   ============================================================ */

.edition-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

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

.edition-card-header {
	margin-bottom: 12px;
}

.edition-card-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 4px;
}
.edition-card-title h3 {
	font-size: 17px;
	font-weight: 600;
}
.edition-card-title h3 a {
	color: var(--color-text);
}
.edition-card-title h3 a:hover {
	color: var(--color-primary);
	text-decoration: none;
}

.edition-card-meta {
	font-size: 13px;
	color: var(--color-text-muted);
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}

.edition-scheduled {
	color: var(--color-primary);
	font-weight: 500;
}

.edition-card-intro {
	font-size: 14px;
	color: var(--color-text-muted);
	margin-bottom: 12px;
	line-height: 1.5;
}

.edition-card-actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.edition-section-divider {
	border-top: 1px solid var(--color-border);
	padding-top: 8px;
	margin-top: 8px;
}
.edition-section-divider h2 {
	font-size: 14px;
	font-weight: 600;
	color: var(--color-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}


/* ============================================================
   Edition Intro Preview
   ============================================================ */

.edition-intro-preview {
	background: #eff6ff;
	border: 1px solid #bfdbfe;
	border-radius: var(--radius-sm);
	padding: 12px 16px;
	margin-bottom: 20px;
	font-size: 14px;
	color: #1e40af;
}


/* ============================================================
   Curation Layout
   ============================================================ */

.curation-layout {
	display: grid;
	grid-template-columns: minmax( 0, 1fr ) 360px;
	gap: 24px;
	align-items: start;
}

.curation-selected h2,
.curation-available h2 {
	font-size: 16px;
	font-weight: 600;
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.article-count {
	background: var(--color-border);
	color: var(--color-text-muted);
	font-size: 12px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 10px;
}


/* ============================================================
   Sortable List (Selected Articles)
   ============================================================ */

.sortable-list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 100px;
}

.empty-drop-zone {
	border: 2px dashed var(--color-border);
	border-radius: var(--radius);
	padding: 40px 24px;
	text-align: center;
	color: var(--color-text-muted);
	font-size: 14px;
}

.sortable-item {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 12px;
	box-shadow: var(--shadow);
	transition: box-shadow 0.15s ease;
	min-width: 0;
}
.sortable-item:hover {
	box-shadow: var(--shadow-md);
}

.sortable-handle {
	cursor: grab;
	color: var(--color-text-muted);
	font-size: 16px;
	padding: 4px;
	flex-shrink: 0;
	user-select: none;
}
.sortable-handle:active {
	cursor: grabbing;
}

.sortable-number {
	background: var(--color-primary);
	color: #ffffff;
	font-size: 12px;
	font-weight: 700;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.sortable-thumb {
	width: 60px;
	height: 40px;
	border-radius: var(--radius-sm);
	overflow: hidden;
	flex-shrink: 0;
}
.sortable-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.sortable-content {
	flex: 1;
	min-width: 0;
}

.sortable-headline {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	margin-bottom: 2px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sortable-meta {
	font-size: 12px;
	color: var(--color-text-muted);
}

.sortable-description {
	font-size: 13px;
	color: var(--color-text-muted);
	margin-top: 4px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sortable-actions {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.sortable-item.dragging {
	opacity: 0.9;
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
	background: #eef2ff;
}

.sortable-placeholder {
	border: 2px dashed var(--color-primary);
	border-radius: var(--radius-sm);
	background: #eef2ff;
	opacity: 0.5;
}


/* ============================================================
   Available Articles List
   ============================================================ */

.curation-available {
	position: sticky;
	top: 72px;
}

.available-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-height: calc( 100vh - 220px );
	overflow-y: auto;
}

.available-item {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 8px 10px;
	font-size: 13px;
}

.available-thumb {
	width: 48px;
	height: 32px;
	border-radius: 3px;
	overflow: hidden;
	flex-shrink: 0;
}
.available-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.available-content {
	flex: 1;
	min-width: 0;
}

.available-headline {
	font-weight: 600;
	font-size: 13px;
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.available-meta {
	font-size: 11px;
	color: var(--color-text-muted);
	display: flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
}

.empty-state-small {
	text-align: center;
	padding: 24px 12px;
	color: var(--color-text-muted);
	font-size: 13px;
}


/* ── Workflow Actions (right column) ── */

.curation-workflow-actions {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-bottom: 10px;
	padding: 8px 10px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
}

/* ── Available Articles Filters ── */

.available-filters {
	display: flex;
	gap: 12px;
	align-items: center;
	margin-bottom: 10px;
	padding: 8px 10px;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: 13px;
}

.available-filters .filter-group {
	display: flex;
	align-items: center;
	gap: 6px;
}

.available-filters .filter-group > label {
	font-weight: 600;
	color: var(--color-text-muted);
	white-space: nowrap;
}

.available-filters select {
	padding: 4px 8px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: 12px;
	background: #fff;
}

.filter-checkbox {
	display: flex;
	align-items: center;
	gap: 5px;
	cursor: pointer;
	font-weight: 400 !important;
	color: var(--color-text) !important;
	user-select: none;
}

.filter-checkbox input[type="checkbox"] {
	margin: 0;
}

.badge-newsletter-social {
	background: #dbeafe;
	color: #1e40af;
}
.badge-newsletter-tech {
	background: #fce7f3;
	color: #9d174d;
}
.badge-used {
	background: #fef3c7;
	color: #92400e;
	font-size: 10px;
}


/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 200;
}

.modal {
	background: var(--color-surface);
	border-radius: var(--radius);
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	width: 560px;
	max-width: 90vw;
	max-height: 90vh;
	overflow-y: auto;
}

.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--color-border);
}
.modal-header h3 {
	font-size: 16px;
	font-weight: 600;
}

.modal-close {
	background: none;
	border: none;
	font-size: 20px;
	cursor: pointer;
	color: var(--color-text-muted);
	padding: 4px;
}

.modal-body {
	padding: 20px;
}
.modal-body .form-group {
	margin-bottom: 16px;
}
.modal-body .form-group:last-child {
	margin-bottom: 0;
}

.modal-footer {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	padding: 16px 20px;
	border-top: 1px solid var(--color-border);
}


/* ============================================================
   Preview
   ============================================================ */

.preview-container {
	display: flex;
	justify-content: center;
	padding: 24px 0;
	background: #e5e5e5;
	border-radius: var(--radius);
	max-height: 80vh;
	overflow-y: auto;
}

.preview-iframe {
	border: none;
	background: #ffffff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
	height: 100px; /* initial — resized by JS to content height */
	transition: width 0.3s ease;
}

.preview-desktop {
	width: 620px;
}

.preview-mobile {
	width: 375px;
}

.preview-toggle {
	display: inline-flex;
	gap: 0;
	margin-right: 8px;
}
.btn-toggle {
	border-radius: 0;
	border: 1px solid var(--color-border);
	background: var(--color-surface);
	color: var(--color-text-muted);
	padding: 4px 12px;
	font-size: 13px;
	cursor: pointer;
}
.btn-toggle:first-child {
	border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.btn-toggle:last-child {
	border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
	border-left: none;
}
.btn-toggle.active {
	background: var(--color-primary);
	border-color: var(--color-primary);
	color: #ffffff;
}

.preview-empty {
	padding: 40px 28px;
	text-align: center;
	color: #9ca3af;
}


/* ============================================================
   Stats Bar
   ============================================================ */

.stats-bar {
	display: flex;
	gap: 12px;
	margin-bottom: 20px;
}

.stat-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	padding: 12px 16px;
	text-align: center;
	flex: 1;
}

.stat-value {
	font-size: 24px;
	font-weight: 700;
	color: var(--color-primary);
}

.stat-label {
	font-size: 12px;
	color: var(--color-text-muted);
	margin-top: 2px;
}
.stat-card-muted {
	background: var(--color-bg);
	border-style: dashed;
}
.stat-card-muted .stat-value {
	color: var(--color-text-muted);
	font-size: 20px;
}


/* ============================================================
   Data Tables
   ============================================================ */

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

.data-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	overflow: hidden;
	font-size: 14px;
}

.data-table th {
	text-align: left;
	padding: 10px 14px;
	background: var(--color-bg);
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--color-text-muted);
	border-bottom: 1px solid var(--color-border);
}

.data-table td {
	padding: 10px 14px;
	border-bottom: 1px solid var(--color-border);
	vertical-align: middle;
}

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

.data-table-compact td,
.data-table-compact th {
	padding: 6px 10px;
}

.cell-email {
	font-family: var(--font-mono);
	font-size: 13px;
}

.cell-actions {
	white-space: nowrap;
}
.cell-actions .btn,
.cell-actions .inline-form {
	display: inline-block;
	vertical-align: middle;
	margin-left: 4px;
}
.cell-actions .btn:first-child,
.cell-actions .inline-form:first-child {
	margin-left: 0;
}

.text-muted {
	color: var(--color-text-muted);
}


/* ============================================================
   Subscriber Badges
   ============================================================ */

.badge-internal {
	background: #dbeafe;
	color: #1e40af;
}
.badge-external {
	background: #fef3c7;
	color: #92400e;
}
.badge-newsletter {
	background: #ede9fe;
	color: #6d28d9;
}


/* ============================================================
   Checkbox Group
   ============================================================ */

.checkbox-group {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.checkbox-label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 10px 12px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: border-color 0.15s ease;
}
.checkbox-label:hover {
	border-color: var(--color-primary);
}

.checkbox-label input[type="checkbox"] {
	margin-top: 3px;
	flex-shrink: 0;
}

.checkbox-text {
	font-size: 14px;
	line-height: 1.4;
}
.checkbox-text small {
	color: var(--color-text-muted);
	font-size: 12px;
}

.subscriber-form {
	max-width: 600px;
}


/* ============================================================
   Public Pages (subscribe / unsubscribe)
   ============================================================ */

.public-page {
	display: flex;
	justify-content: center;
	padding: 40px 0;
}

.public-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	padding: 32px;
	width: 480px;
	max-width: 100%;
	box-shadow: var(--shadow-md);
}

.public-card h1 {
	font-size: 22px;
	font-weight: 700;
	margin-bottom: 8px;
}

.public-subtitle {
	color: var(--color-text-muted);
	margin-bottom: 24px;
}

.public-card-success h1 {
	color: var(--color-success);
}

.subscribe-form .form-group {
	margin-bottom: 16px;
}

.btn-full {
	width: 100%;
}

.public-legal {
	font-size: 12px;
	color: var(--color-text-muted);
	margin-top: 16px;
	line-height: 1.5;
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 768px) {
	.article-grid {
		grid-template-columns: 1fr;
	}

	.article-detail {
		grid-template-columns: 1fr;
	}

	.curation-layout {
		grid-template-columns: 1fr;
	}

	.curation-available {
		position: static;
	}

	.form-row-2col {
		grid-template-columns: 1fr;
	}

	.page-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}

	.preview-container {
		padding: 16px 0;
	}

	.preview-iframe {
		width: 100% !important;
	}

	.stats-bar {
		flex-wrap: wrap;
	}

	.stat-card {
		min-width: 80px;
	}
}


/* ============================================================
   Users
   ============================================================ */

.cell-avatar {
	width: 40px;
	padding-right: 0 !important;
}

.user-avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	object-fit: cover;
	display: block;
}

.user-avatar-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--color-border);
	color: var(--color-text-muted);
	font-size: 12px;
	font-weight: 700;
	text-transform: uppercase;
}

.row-inactive {
	opacity: 0.5;
}

.current-photo {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 10px;
}

.photo-preview {
	width: 80px;
	height: 80px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--color-border);
}

.form-row {
	display: flex;
	gap: 16px;
}

.form-row-half .form-group {
	flex: 1;
}


/* ============================================================
   Image Library
   ============================================================ */

.image-library-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 240px, 1fr ) );
	gap: 20px;
	margin-top: 20px;
}

.image-library-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	overflow: hidden;
	transition: box-shadow 0.15s;
}
.image-library-card:hover {
	box-shadow: var(--shadow-md);
}

.image-library-card.image-retired {
	opacity: 0.55;
}

.image-library-thumb {
	display: block;
	position: relative;
	background: #f0f0f0;
}
.image-library-thumb img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}
.image-library-thumb:hover {
	text-decoration: none;
}

.image-retired-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	background: var(--color-danger);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: var(--radius-sm);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.image-library-info {
	padding: 12px 14px;
}

.image-library-title {
	display: block;
	font-size: 14px;
	line-height: 1.3;
	margin-bottom: 4px;
}

.image-library-desc {
	font-size: 13px;
	color: var(--color-text-muted);
	margin-bottom: 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.image-library-meta {
	font-size: 12px;
}

.image-edit-preview {
	margin-bottom: 16px;
}

.image-edit-thumb {
	max-width: 300px;
	border-radius: var(--radius);
	border: 1px solid var(--color-border);
}


/* ============================================================
   Image Picker (Article Form)
   ============================================================ */

/* Image preview with hover-to-replace overlay */
.image-preview-wrap {
	margin-bottom: 16px;
}
.image-preview-hover {
	position: relative;
	display: inline-block;
	border-radius: var(--radius-sm);
	overflow: hidden;
	border: 1px solid var(--color-border);
}
.image-preview-hover img {
	display: block;
	max-width: 300px;
	height: auto;
}
.image-preview-overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.55);
	opacity: 0;
	transition: opacity 0.15s;
	cursor: pointer;
}
.image-preview-overlay span {
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
}
.image-preview-hover:hover .image-preview-overlay {
	opacity: 1;
}

.image-preview-wrap .form-help {
	margin-top: 6px;
	font-size: 13px;
}
#image-preview-title {
	color: var(--color-text-muted);
}
#image-preview-remove {
	margin-left: 8px;
	font-size: 12px;
	color: var(--color-danger);
}

/* Choose Upload / Library action buttons */
.image-choose-actions {
	display: flex;
	gap: 10px;
}
.image-choose-actions .btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.image-choose-actions .btn svg {
	flex-shrink: 0;
}

/* Image library modal */
.modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 1000;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
	padding: 0;
}
.modal-dialog {
	background: var(--color-surface);
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}
.modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--color-border);
}
.modal-header h3 {
	font-size: 16px;
	font-weight: 600;
	margin: 0;
}
.modal-close {
	background: none;
	border: none;
	font-size: 22px;
	color: var(--color-text-muted);
	cursor: pointer;
	padding: 0 4px;
	line-height: 1;
}
.modal-close:hover {
	color: var(--color-text);
}
.modal-body {
	padding: 16px 20px;
	overflow-y: auto;
	flex: 1;
	min-height: 0;
}

/* Compact confirmation modal — centered, not full-screen */
.modal-backdrop:has(.modal-dialog-compact) {
	align-items: center;
	justify-content: center;
}
.modal-dialog-compact {
	width: 420px;
	max-width: 90vw;
	height: auto;
	border-radius: 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.image-picker-search {
	margin-bottom: 12px;
}

.image-picker-search input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: 14px;
}

.image-picker-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 140px, 1fr ) );
	gap: 10px;
	overflow-y: auto;
	padding: 4px;
}

.image-picker-item {
	border: 2px solid var(--color-border);
	border-radius: var(--radius-sm);
	overflow: hidden;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s;
	background: #f8f8f8;
}
.image-picker-item:hover {
	border-color: var(--color-primary);
	box-shadow: 0 0 0 1px var(--color-primary);
}
.image-picker-item.image-picker-selected {
	border-color: var(--color-primary);
	box-shadow: 0 0 0 2px var(--color-primary);
}

.image-picker-item img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

.image-picker-label {
	display: block;
	padding: 4px 8px;
	font-size: 11px;
	color: var(--color-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.image-library-meta-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}

@media ( max-width: 768px ) {
	.image-library-grid {
		grid-template-columns: repeat( auto-fill, minmax( 160px, 1fr ) );
	}

	.image-picker-grid {
		grid-template-columns: repeat( auto-fill, minmax( 100px, 1fr ) );
	}
}


/* ============================================================
   AI Disclosure Badges
   ============================================================ */

.badge-ai {
	font-size: 10px;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: var(--radius-sm);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.badge-ai-ai_assisted {
	background: #fef3c7;
	color: #92400e;
}
.badge-ai-ai_enhanced {
	background: #e0e7ff;
	color: #3730a3;
}
.badge-ai-ai_generated {
	background: #fce7f3;
	color: #9d174d;
}


/* ============================================================
   Cancelled Articles
   ============================================================ */

.article-card-cancelled {
	opacity: 0.5;
}
.article-card-cancelled:hover {
	opacity: 0.75;
}

.cancelled-section {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--color-border);
}

.cancelled-toggle {
	margin-bottom: 16px;
}


/* ============================================================
   Login Page
   ============================================================ */

.login-page {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 60vh;
	padding: 40px 20px;
}

.login-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	box-shadow: var(--shadow-md);
	padding: 48px 40px;
	max-width: 420px;
	width: 100%;
	text-align: center;
}

.login-title {
	font-size: 24px;
	font-weight: 700;
	margin-bottom: 8px;
}

.login-subtitle {
	color: var(--color-text-muted);
	margin-bottom: 32px;
	font-size: 15px;
}

.login-providers {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 24px;
}

.btn-provider {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 12px 20px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-surface);
	color: var(--color-text);
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
	text-decoration: none;
}
.btn-provider:hover {
	background: var(--color-bg);
	border-color: var(--color-text-muted);
	box-shadow: var(--shadow);
	text-decoration: none;
}
.btn-provider svg {
	flex-shrink: 0;
}

.login-help {
	font-size: 13px;
	color: var(--color-text-muted);
}


/* ============================================================
   Public Home Page
   ============================================================ */

.public-home {
	padding: 20px 0 60px;
}

.home-hero {
	text-align: center;
	padding: 40px 0 32px;
}
.home-hero h1 {
	font-size: 36px;
	font-weight: 800;
	margin-bottom: 8px;
}
.home-tagline {
	font-size: 17px;
	color: var(--color-text-muted);
}
.home-user-bar {
	margin-top: 12px;
	font-size: 14px;
	color: var(--color-text-muted);
}

.home-articles {
	margin-bottom: 48px;
}
.home-articles h2 {
	font-size: 20px;
	font-weight: 700;
	margin-bottom: 20px;
}

.home-article-grid {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( 260px, 1fr ) );
	gap: 20px;
}

.home-article-card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	overflow: hidden;
	text-decoration: none;
	color: var(--color-text);
	transition: box-shadow 0.15s, transform 0.15s;
}
.home-article-card:hover {
	box-shadow: var(--shadow-md);
	transform: translateY( -2px );
	text-decoration: none;
}

.home-article-img {
	display: block;
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}

.home-article-body {
	padding: 14px 16px;
}
.home-article-body h3 {
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	margin-top: 6px;
}
.home-article-source {
	font-size: 13px;
	color: var(--color-text-muted);
	margin-top: 4px;
}

.home-subscribe {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	padding: 40px;
	text-align: center;
	max-width: 520px;
	margin: 0 auto;
}
.home-subscribe h2 {
	font-size: 22px;
	margin-bottom: 8px;
}
.home-subscribe > p {
	color: var(--color-text-muted);
	margin-bottom: 20px;
}

.home-subscribe-form {
	margin-bottom: 16px;
}

.home-subscribe-row {
	display: flex;
	gap: 8px;
	max-width: 400px;
	margin: 0 auto;
}
.home-subscribe-row input[type="email"] {
	flex: 1;
	padding: 10px 14px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: 15px;
}

.home-manage-link {
	font-size: 13px;
	color: var(--color-text-muted);
}

@media ( max-width: 768px ) {
	.home-subscribe-row {
		flex-direction: column;
	}
}


/* ============================================================
   Test Send — Recipient Picker
   ============================================================ */

.test-send-recipients {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 16px 0;
}

.test-send-recipient {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-bg);
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s;
}

.test-send-recipient:hover {
	border-color: var(--color-primary);
	background: #f8f7ff;
}

.test-send-recipient input[type="checkbox"] {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	accent-color: var(--color-primary);
}

.test-send-recipient-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.test-send-recipient-name {
	font-weight: 500;
	font-size: 14px;
	color: var(--color-text);
}

.test-send-recipient-email {
	font-size: 13px;
	color: var(--color-text-muted);
}
