/**
 * BrikPanel — Scheduled Tasks page
 * Monochrome design system, matches expenses/segments/dashboard.
 */

:root {
	--cron-bg:             #f1f1f1;
	--cron-card:           #ffffff;
	--cron-text:           #303030;
	--cron-text-secondary: #616161;
	--cron-text-muted:     #8a8a8a;
	--cron-border:         #e3e3e3;
	--cron-input-border:   #8a8a8a;
	--cron-input-focus:    #303030;
	--cron-primary:        #303030;
	--cron-primary-hover:  #1a1a1a;
	--cron-success:        #1a8917;
	--cron-success-bg:     #e4f5e1;
	--cron-error:          #d72c0d;
	--cron-error-bg:       #fce4e4;
	--cron-warning-bg:     #fff8e1;
	--cron-warning-fg:     #8a6d00;
	--cron-radius:         0.5rem;
	--cron-radius-card:    0.75rem;
}

.brikpanel-cron-wrap {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 0 2rem;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	color: var(--cron-text);
	box-sizing: border-box;
}

.brikpanel-cron-wrap *,
.brikpanel-cron-wrap *::before,
.brikpanel-cron-wrap *::after {
	box-sizing: border-box;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.brikpanel-cron-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	padding: 1.5rem 0 1rem;
	gap: 1rem;
	flex-wrap: wrap;
}

.brikpanel-cron-header h1 {
	margin: 0 0 0.25rem;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.3;
	color: var(--cron-text);
}

.brikpanel-cron-subtitle {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--cron-text-secondary);
	line-height: 1.5;
}

/* ── Cards ──────────────────────────────────────────────────────────────── */
.brikpanel-cron-card {
	background: var(--cron-card);
	border: 1px solid var(--cron-border);
	border-radius: var(--cron-radius-card);
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	margin-bottom: 1rem;
}

.brikpanel-cron-warning {
	padding: 1rem 1.25rem;
	background: var(--cron-warning-bg);
	border-color: #f0d97a;
}

.brikpanel-cron-warning strong {
	color: var(--cron-warning-fg);
	display: block;
	margin-bottom: 0.25rem;
}

.brikpanel-cron-warning p {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--cron-text-secondary);
}

/* ── KPI cards ──────────────────────────────────────────────────────────── */
.brikpanel-cron-kpis {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1rem;
	margin-bottom: 1rem;
}

.brikpanel-cron-kpi {
	background: var(--cron-card);
	border: 1px solid var(--cron-border);
	border-radius: var(--cron-radius-card);
	padding: 1rem 1.25rem;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.brikpanel-cron-kpi-label {
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--cron-text-secondary);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.375rem;
}

.brikpanel-cron-kpi-value {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--cron-text);
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.brikpanel-cron-kpi[data-kpi="failed"] .brikpanel-cron-kpi-value {
	color: var(--cron-error);
}

.brikpanel-cron-kpi[data-kpi="complete"] .brikpanel-cron-kpi-value {
	color: var(--cron-success);
}

/* ── Filters ────────────────────────────────────────────────────────────── */
.brikpanel-cron-filters {
	padding: 1.125rem 1.25rem;
}

.brikpanel-cron-filter-row {
	display: flex;
	gap: 0.75rem;
	align-items: flex-end;
	flex-wrap: wrap;
}

.brikpanel-cron-field {
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
	min-width: 180px;
}

.brikpanel-cron-field label {
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--cron-text);
	letter-spacing: 0;
}

.brikpanel-cron-field input,
.brikpanel-cron-field select {
	padding: 0.625rem 0.75rem;
	border: 1px solid var(--cron-input-border);
	border-radius: var(--cron-radius);
	font-size: 0.875rem;
	color: var(--cron-text);
	background: #fff;
	transition: box-shadow 0.15s ease, border-color 0.15s ease;
	min-height: 38px;
	width: 100%;
}

.brikpanel-cron-field input:focus,
.brikpanel-cron-field select:focus {
	outline: none;
	border-color: var(--cron-input-focus);
	box-shadow: 0 0 0 1px var(--cron-input-focus);
}

.brikpanel-cron-filter-actions {
	display: flex;
	gap: 0.5rem;
	margin-left: auto;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.brikpanel-cron-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5rem 1rem;
	border: 0;
	border-radius: var(--cron-radius);
	font-size: 0.8125rem;
	font-weight: 550;
	cursor: pointer;
	transition: background 0.15s ease, box-shadow 0.15s ease;
	font-family: inherit;
	white-space: nowrap;
	min-height: 38px;
}

.brikpanel-cron-btn-primary {
	background: var(--cron-primary);
	color: #fff;
	box-shadow: inset 0 -1px 0 rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}

.brikpanel-cron-btn-primary:hover {
	background: var(--cron-primary-hover);
}

.brikpanel-cron-btn-secondary {
	background: #fff;
	color: var(--cron-text);
	box-shadow: inset 0 0 0 1px var(--cron-border), 0 1px 0 rgba(0,0,0,0.05);
}

.brikpanel-cron-btn-secondary:hover {
	background: #f7f7f7;
}

.brikpanel-cron-btn-icon {
	padding: 0.375rem 0.625rem;
	min-height: 0;
	font-size: 0.75rem;
}

.brikpanel-cron-btn-danger {
	color: var(--cron-error);
}

.brikpanel-cron-btn-danger:hover {
	background: #fce4e4;
}

/* ── Table ──────────────────────────────────────────────────────────────── */
.brikpanel-cron-table-card {
	overflow: hidden;
}

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

.brikpanel-cron-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.brikpanel-cron-table thead th {
	background: #fafafa;
	border-bottom: 1px solid var(--cron-border);
	padding: 0.75rem 1rem;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--cron-text-secondary);
	text-align: left;
	white-space: nowrap;
}

.brikpanel-cron-table tbody td {
	padding: 0.875rem 1rem;
	border-bottom: 1px solid var(--cron-border);
	vertical-align: middle;
	color: var(--cron-text);
}

.brikpanel-cron-table tbody tr:last-child td {
	border-bottom: 0;
}

.brikpanel-cron-table tbody tr:hover td {
	background: #fafafa;
}

.brikpanel-cron-actions-th {
	width: 1%;
	white-space: nowrap;
}

.brikpanel-cron-row-actions {
	display: flex;
	gap: 0.375rem;
	justify-content: flex-end;
	white-space: nowrap;
}

.brikpanel-cron-empty {
	text-align: center;
	color: var(--cron-text-muted);
	padding: 2rem 1rem !important;
	font-size: 0.875rem;
}

.brikpanel-cron-job-cell strong {
	display: block;
	font-weight: 600;
	color: var(--cron-text);
	margin-bottom: 2px;
}

.brikpanel-cron-job-cell small {
	font-size: 0.75rem;
	color: var(--cron-text-muted);
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.brikpanel-cron-args {
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	font-size: 0.75rem;
	color: var(--cron-text-secondary);
	max-width: 280px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: inline-block;
}

/* ── Status badges ──────────────────────────────────────────────────────── */
.brikpanel-cron-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.1875rem 0.5rem;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 550;
	background: #f1f1f1;
	color: var(--cron-text-secondary);
}

.brikpanel-cron-badge::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: currentColor;
}

.brikpanel-cron-badge[data-tone="pending"] {
	background: #eef2f7;
	color: #4b5563;
}

.brikpanel-cron-badge[data-tone="running"] {
	background: #fff8e1;
	color: var(--cron-warning-fg);
}

.brikpanel-cron-badge[data-tone="success"] {
	background: var(--cron-success-bg);
	color: var(--cron-success);
}

.brikpanel-cron-badge[data-tone="error"] {
	background: var(--cron-error-bg);
	color: var(--cron-error);
}

.brikpanel-cron-badge[data-tone="neutral"] {
	background: #f1f1f1;
	color: var(--cron-text-secondary);
}

/* ── Recurring marker ───────────────────────────────────────────────────── */
.brikpanel-cron-recurring-yes {
	color: var(--cron-text);
	font-weight: 550;
}

.brikpanel-cron-recurring-no {
	color: var(--cron-text-muted);
}

/* ── Pagination ─────────────────────────────────────────────────────────── */
.brikpanel-cron-pagination {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	padding: 0.875rem 1rem;
	border-top: 1px solid var(--cron-border);
	background: #fafafa;
}

.brikpanel-cron-page-info {
	font-size: 0.8125rem;
	color: var(--cron-text-secondary);
	font-variant-numeric: tabular-nums;
}

/* ── Modal (for log viewer) ─────────────────────────────────────────────── */
.brikpanel-cron-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.45);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.brikpanel-cron-modal {
	background: var(--cron-card);
	border-radius: var(--cron-radius-card);
	box-shadow: 0 10px 30px rgba(0,0,0,0.2);
	max-width: 640px;
	width: 100%;
	max-height: 80vh;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.brikpanel-cron-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--cron-border);
}

.brikpanel-cron-modal-header h2 {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
}

.brikpanel-cron-modal-close {
	background: transparent;
	border: 0;
	font-size: 1.5rem;
	line-height: 1;
	color: var(--cron-text-muted);
	cursor: pointer;
	padding: 0.25rem 0.5rem;
}

.brikpanel-cron-modal-close:hover {
	color: var(--cron-text);
}

.brikpanel-cron-modal-body {
	padding: 1rem 1.25rem;
	overflow-y: auto;
}

.brikpanel-cron-log-entry {
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--cron-border);
	font-size: 0.8125rem;
}

.brikpanel-cron-log-entry:last-child {
	border-bottom: 0;
}

.brikpanel-cron-log-date {
	font-family: ui-monospace, "SF Mono", Menlo, monospace;
	color: var(--cron-text-muted);
	font-size: 0.75rem;
	margin-bottom: 0.25rem;
}

.brikpanel-cron-log-message {
	color: var(--cron-text);
	white-space: pre-wrap;
	word-break: break-word;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.brikpanel-cron-toast {
	position: fixed;
	top: 44px;
	right: 20px;
	padding: 0.75rem 1rem;
	border-radius: var(--cron-radius);
	font-size: 0.8125rem;
	font-weight: 550;
	box-shadow: 0 4px 12px rgba(0,0,0,0.15);
	z-index: 100001;
	transform: translateX(110%);
	transition: transform 0.3s cubic-bezier(.4,0,.2,1);
	max-width: 380px;
}

.brikpanel-cron-toast.is-visible {
	transform: translateX(0);
}

.brikpanel-cron-toast[data-tone="success"] {
	background: var(--cron-success-bg);
	color: var(--cron-success);
	border: 1px solid #b7e1b0;
}

.brikpanel-cron-toast[data-tone="error"] {
	background: var(--cron-error-bg);
	color: var(--cron-error);
	border: 1px solid #f1b0b0;
}

/* Hide WP heading screen-reader rules / minor */
.brikpanel-cron-wrap [hidden] {
	display: none !important;
}
