/*
 * Astra already gives #page a flex column layout with min-height:100vh and
 * flex-grows #page .site-content (see astra/assets/css .ast-container /
 * #page rules) - that's its native sticky-footer mechanism, so the footer
 * naturally sits at the bottom of the viewport on short-content pages
 * without us reimplementing it. And since inc/astra-layout.php no longer
 * forces the "page-builder" content layout, #content.site-content keeps
 * Astra's normal .ast-container (max-width:1240px) - the same container
 * the header and footer use - so our content lines up with them for free.
 */

#ss-app {
	--ss-bg: #f8fafc;
	--ss-card-bg: #ffffff;
	--ss-card-bg-alt: #f1f5f9;
	--ss-border: #e2e8f0;
	--ss-input-border: #64748b;
	--ss-text: #0f172a;
	--ss-text-muted: oklch(45% 0.02 265);
	--ss-accent: oklch(50% 0.19 300);
	--ss-accent-dark: oklch(44% 0.19 300);
	--ss-btn-hover-bg: oklch(50% 0.19 300);
	--ss-green: #047857;
	--ss-danger: #b91c1c;
	--ss-focus-ring: oklch(55% 0.18 300 / 0.25);
	--ss-grad-1: oklch(58% 0.19 265);
	--ss-grad-2: oklch(60% 0.19 330);
	--ss-grad: linear-gradient(120deg, var(--ss-grad-1), var(--ss-grad-2));
	--ss-grad-soft: linear-gradient(100deg, oklch(97% 0.02 265), oklch(97% 0.02 320));

	box-sizing: border-box;
	width: 100%;
	flex: 1 0 auto;
	background: var(--ss-bg);
	color: var(--ss-text);
	font-family: 'Manrope', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 14px;
    padding: 20px 30px 40px;
    margin: 40px 0;
    border-radius: 20px;
	color-scheme: light;
}

#ss-app[data-theme="dark"] {
	--ss-bg: #0f172a;
	--ss-card-bg: #1e293b;
	--ss-card-bg-alt: #17212f;
	--ss-border: #334155;
	--ss-input-border: #64748b;
	--ss-text: #f1f5f9;
	--ss-text-muted: #94a3b8;
	--ss-accent: oklch(72% 0.16 300);
	--ss-accent-dark: oklch(78% 0.14 300);
	--ss-btn-hover-bg: oklch(50% 0.19 300);
	--ss-green: #34d399;
	--ss-danger: #f87171;
	--ss-focus-ring: oklch(72% 0.16 300 / 0.35);
	--ss-grad-1: oklch(62% 0.19 265);
	--ss-grad-2: oklch(64% 0.19 330);
	--ss-grad-soft: linear-gradient(100deg, oklch(28% 0.05 265), oklch(28% 0.05 320));

	color-scheme: dark;
}

#ss-app * {
	box-sizing: border-box;
	border: none;
}

#ss-app .ss-theme-toggle {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	position: fixed;
	bottom: 24px;
	right: 24px;
	z-index: 100;
	display: flex;
	align-items: center;
	gap: 8px;
	height: 44px;
	padding: 0 18px 0 14px;
	background-color: var(--ss-card-bg);
	background-image: none;
	border: 1px solid var(--ss-border);
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18), 0 1px 3px rgba(15, 23, 42, 0.1);
	border-radius: 999px;
	color: var(--ss-text);
	font-size: 13px;
	font-weight: 600;
	font-family: inherit;
	cursor: pointer;
	transition: transform 0.15s ease, border-color 0.15s ease;
}

#ss-app .ss-theme-toggle:hover,
#ss-app .ss-theme-toggle:focus,
#ss-app .ss-theme-toggle:active {
	background-color: var(--ss-card-bg);
	background-image: none;
	color: var(--ss-text);
}

#ss-app .ss-theme-toggle:hover {
	border-color: var(--ss-accent);
	transform: translateY(-2px);
}

#ss-app .ss-theme-toggle:focus {
	outline: none;
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18), 0 1px 3px rgba(15, 23, 42, 0.1);
}

#ss-app .ss-theme-toggle:focus-visible {
	box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18), 0 0 0 3px var(--ss-focus-ring);
}

#ss-app .ss-icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	color: var(--ss-accent);
}

#ss-app .ss-icon-moon {
	display: none;
}

#ss-app[data-theme="dark"] .ss-icon-sun {
	display: none;
}

#ss-app[data-theme="dark"] .ss-icon-moon {
	display: block;
}

.ss-portal-narrow {
	max-width: 440px;
	margin: 0 auto;
	padding-left: 20px;
	padding-right: 20px;
}

/*
 * No max-width of its own: Astra's own .ast-container (already wrapping
 * this, at max-width:1240px) matches the header/footer container exactly,
 * so this just needs to fill it rather than adding a second constraint.
 */
.ss-portal-wide {
	width: 100%;
}

#ss-app .ss-brand {
	text-align: center;
	margin-bottom: 28px;
}

#ss-app .ss-brand h1 {
	margin: 0 0 4px;
	font-family: 'Space Grotesk', sans-serif;
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--ss-text);
}

#ss-app .ss-brand p {
	margin: 0;
	color: var(--ss-text-muted);
	font-size: 13px;
}

#ss-app .ss-card {
	background: var(--ss-card-bg);
	border: 1px solid var(--ss-border);
	border-radius: 10px;
	padding: 24px;
}

#ss-app .ss-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12px;
	color: var(--ss-text-muted);
	margin-bottom: 14px;
}

#ss-app .ss-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

#ss-app .ss-phone-row {
	display: grid;
	grid-template-columns: 110px 1fr;
	gap: 12px;
}

#ss-app select,
#ss-app input[type="text"],
#ss-app input[type="email"],
#ss-app input[type="password"],
#ss-app input[type="tel"] {
	background: var(--ss-card-bg-alt);
	border: 1px solid var(--ss-input-border);
	border-radius: 6px;
	color: var(--ss-text);
	padding: 9px 11px;
	font-size: 14px;
	font-family: inherit;
	width: 100%;
}

#ss-app select {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	padding-right: 30px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23475569' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 8px center;
	background-size: 14px;
}

#ss-app[data-theme="dark"] select {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%2394a3b8' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

#ss-app select:focus,
#ss-app input:focus {
	outline: none;
	border-color: var(--ss-accent);
	box-shadow: 0 0 0 3px var(--ss-focus-ring);
}

#ss-app .ss-btn {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	font-size: 14px;
	font-family: inherit;
}

#ss-app .ss-btn-primary {
	background: var(--ss-grad);
	color: #fff;
	padding: 11px 20px;
	font-weight: 700;
	width: 100%;
	box-shadow: 0 6px 16px oklch(55% 0.18 300 / 0.3);
}

#ss-app .ss-btn-primary:hover,
#ss-app .ss-btn-primary:focus,
#ss-app .ss-btn-primary:active {
	background: var(--ss-grad);
	color: #fff;
	filter: brightness(1.08);
}

#ss-app .ss-btn-primary:focus {
	outline: none;
	box-shadow: 0 0 0 3px var(--ss-focus-ring);
}

#ss-app .ss-link-btn {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	background-color: transparent;
	background-image: none;
	border: none;
	box-shadow: none;
	color: var(--ss-accent);
	font-size: 13px;
	cursor: pointer;
	padding: 0;
	text-decoration: none;
}

#ss-app .ss-link-btn:hover {
	color: var(--ss-accent-dark);
	text-decoration: underline;
}

#ss-app .ss-footnote {
	text-align: center;
	margin-top: 18px;
	font-size: 13px;
	color: var(--ss-text-muted);
}

#ss-app .ss-banner {
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 14px;
	margin-bottom: 18px;
}

#ss-app .ss-banner-success {
	background: rgba(4, 120, 87, 0.12);
	color: var(--ss-green);
	border: 1px solid rgba(4, 120, 87, 0.3);
}

#ss-app .ss-banner-error {
	background: rgba(185, 28, 28, 0.1);
	color: var(--ss-danger);
	border: 1px solid rgba(185, 28, 28, 0.3);
}

/* Dashboard-specific */

#ss-app .ss-dashboard-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 24px;
}

#ss-app .ss-dashboard-header h1 {
	margin: 0;
	font-size: 22px;
	color: var(--ss-text);
}

#ss-app .ss-panel-header {
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--ss-border);
}

#ss-app .ss-panel-title {
	margin: 0;
	font-family: 'Space Grotesk', sans-serif;
	font-size: 18px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--ss-text);
}

#ss-app .ss-panel-subtitle {
	margin: 4px 0 0;
	font-size: 13px;
	color: var(--ss-text-muted);
}

/*
 * Also used by the submission page, but that template's stylesheet is not
 * enqueued on the dashboard - without a definition here the class renders
 * with no styling at all.
 */
#ss-app .ss-eyebrow {
	margin: 0 0 8px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--ss-text-muted);
}

#ss-app .ss-tabs {
	display: flex;
	gap: 8px;
	margin-bottom: 20px;
	border-bottom: 1px solid var(--ss-border);
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

#ss-app .ss-tab {
	-webkit-appearance: none;
	appearance: none;
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	color: var(--ss-text-muted);
	padding: 10px 4px;
	margin-right: 20px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	flex-shrink: 0;
	white-space: nowrap;
}

#ss-app .ss-tab.is-active {
	color: var(--ss-accent-dark);
	border-bottom-color: var(--ss-accent-dark);
}

#ss-app .ss-tab-panel {
	display: none;
}

#ss-app .ss-tab-panel.is-active {
	display: block;
}

#ss-app .ss-stat-cards {
	display: flex;
	gap: 16px;
	margin-bottom: 28px;
}

#ss-app .ss-stat-card {
	flex: 1;
	background: var(--ss-card-bg);
	border: 1px solid var(--ss-border);
	border-radius: 18px;
	padding: 20px 22px;
}

#ss-app .ss-stat-card-hero {
	position: relative;
	overflow: hidden;
	background: linear-gradient(120deg, oklch(46% 0.17 266), oklch(50% 0.19 320));
	border: none;
	color: #ffffff;
}

#ss-app .ss-stat-card-hero::before {
	content: "";
	position: absolute;
	top: -40px;
	right: -20px;
	width: 140px;
	height: 140px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	pointer-events: none;
}

#ss-app .ss-stat-label {
	position: relative;
	margin: 0 0 6px;
	font-size: 12px;
	font-weight: 600;
	color: inherit;
	opacity: 0.85;
}

#ss-app .ss-stat-card:not(.ss-stat-card-hero) .ss-stat-label {
	color: var(--ss-text-muted);
	opacity: 1;
}

#ss-app .ss-stat-value {
	position: relative;
	margin: 0;
	font-family: 'Space Grotesk', sans-serif;
	font-size: 30px;
	font-weight: 800;
}

#ss-app .ss-stat-value-plain {
	color: var(--ss-text);
}

#ss-app .ss-table-card {
	border: 1px solid var(--ss-border);
	border-radius: 18px;
}

#ss-app table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	margin-bottom: 0;
    overflow: hidden;
    border-radius: 17px;
}

#ss-app thead tr {
	background: linear-gradient(100deg, oklch(95% 0.03 265), oklch(95% 0.03 330));
}

#ss-app[data-theme="dark"] thead tr {
	background: linear-gradient(100deg, oklch(24% 0.05 265), oklch(24% 0.05 320));
}

#ss-app th {
	text-align: left;
	border: none;
	color: oklch(45% 0.1 300);
	font-weight: 700;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	padding: 14px 18px;
}

#ss-app[data-theme="dark"] th {
	color: oklch(78% 0.1 300);
}

#ss-app td {
	border: none;
	padding: 14px 18px;
	border-bottom: 1px solid var(--ss-border);
}

#ss-app tbody tr:last-child td,
#ss-app tfoot th {
	border-bottom: none;
}

#ss-app tbody tr:hover {
	background: oklch(97% 0.02 300 / 0.5);
}

#ss-app[data-theme="dark"] tbody tr:hover {
	background: oklch(30% 0.05 300 / 0.5);
}

#ss-app .ss-col-right {
	text-align: right;
}

#ss-app .ss-col-strong {
	font-weight: 700;
}

#ss-app .ss-col-muted {
	color: var(--ss-text-muted);
}

#ss-app .ss-col-grad {
	font-weight: 800;
	font-size: 15px;
	background: linear-gradient(120deg, oklch(50% 0.19 265), oklch(52% 0.19 330));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

#ss-app .ss-status-pill {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
}

#ss-app .ss-status-pending {
	background: rgba(202, 138, 4, 0.12);
	color: #a16207;
}

#ss-app .ss-status-awaiting {
	background: rgba(202, 138, 4, 0.12);
	color: #a16207;
	margin-left: 4px;
}

#ss-app .ss-status-active {
	background: oklch(93% 0.08 155 / 0.6);
	color: oklch(40% 0.13 155);
}

#ss-app .ss-status-modified {
	background: oklch(93% 0.05 300 / 0.6);
	color: oklch(45% 0.15 300);
}

#ss-app .ss-status-rejected {
	background: rgba(185, 28, 28, 0.1);
	color: var(--ss-danger);
}

#ss-app .ss-status-deactivated {
	background: rgba(100, 116, 139, 0.12);
	color: #475569;
}

#ss-app tr.ss-row-deactivated,
#ss-app tr.ss-row-rejected {
	opacity: 0.55;
}

#ss-app .ss-empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 48px 24px;
	margin-bottom: 0;
}

#ss-app .ss-empty-state-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 999px;
	background: oklch(93% 0.05 300 / 0.5);
	color: var(--ss-accent);
	margin-bottom: 16px;
}

#ss-app .ss-empty-state-icon svg {
	width: 22px;
	height: 22px;
}

#ss-app .ss-empty-state-title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 700;
	color: var(--ss-text);
}

#ss-app .ss-empty-state-subtitle {
	margin: 0;
	font-size: 13px;
	color: var(--ss-text-muted);
}

#ss-app .ss-report-filter {
	margin-bottom: 28px;
}

#ss-app .ss-report-filter-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

#ss-app .ss-report-filter-top .ss-eyebrow {
	margin: 0;
}

#ss-app .ss-report-year-field {
	margin-bottom: 0;
	flex-direction: row;
	align-items: center;
	gap: 8px;
	font-size: 13px;
}

#ss-app .ss-report-year-field select {
	width: auto;
	min-width: 100px;
}

#ss-app .ss-month-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

#ss-app .ss-month-pill {
	-webkit-appearance: none;
	appearance: none;
	background: var(--ss-card-bg);
	border: 1px solid var(--ss-accent);
	color: var(--ss-accent);
	border-radius: 999px;
	padding: 7px 16px;
	font-size: 13px;
	font-weight: 700;
	cursor: pointer;
	min-width: 56px;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

#ss-app .ss-month-pill:hover {
	background: oklch(55% 0.18 300 / 0.08);
}

#ss-app .ss-month-pill.is-active {
	background: var(--ss-grad);
	border-color: transparent;
	color: #fff;
}

#ss-app .ss-month-pill.is-active.is-range-middle {
	background: linear-gradient(120deg, oklch(72% 0.13 265), oklch(74% 0.13 330));
	border-color: transparent;
	color: #fff;
}

#ss-app .ss-driver-earnings-filter {
	margin-bottom: 28px;
}

#ss-app .ss-driver-earnings-filter .ss-field {
	margin-bottom: 14px;
}

#ss-app .ss-driver-earnings-filter .ss-field select {
	max-width: 260px;
}

#ss-app .ss-driver-earnings-filter .ss-field-row {
	margin-bottom: 14px;
}

#ss-app .ss-note {
	color: var(--ss-text-muted);
	font-size: 12px;
	margin: 0 0 12px;
}

#ss-app tfoot tr {
	background: var(--ss-grad-soft);
}

#ss-app tfoot th {
	border-bottom: none;
	border-top: 2px solid oklch(90% 0.02 300);
	color: var(--ss-text);
	font-size: 15px;
	font-weight: 800;
	text-transform: none;
	letter-spacing: normal;
}

#ss-app tfoot th:last-child {
	background: linear-gradient(120deg, oklch(50% 0.19 265), oklch(52% 0.19 330));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	font-size: 17px;
}

#ss-app .ss-inline-form {
	display: inline;
}

#ss-app .ss-row-actions {
	display: flex;
	gap: 10px;
	align-items: center;
}

#ss-app .ss-btn-small {
	-webkit-appearance: none;
	appearance: none;
	display: inline-block;
	border: 1.5px solid var(--ss-accent);
	background: var(--ss-card-bg);
	color: var(--ss-accent);
	border-radius: 999px;
	padding: 6px 16px;
	font-size: 12px;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#ss-app .ss-btn-small:hover,
#ss-app .ss-btn-small:focus {
	background: var(--ss-grad);
	border-color: transparent;
	color: #ffffff;
	text-decoration: none;
}

#ss-app .ss-btn-small-danger {
	border-color: var(--ss-danger);
	color: var(--ss-danger);
}

#ss-app .ss-btn-small-danger:hover,
#ss-app .ss-btn-small-danger:focus {
	background: var(--ss-danger);
	border-color: var(--ss-danger);
	color: #ffffff;
}

@media (max-width: 700px) {

	#ss-app .ss-field-row,
	#ss-app .ss-phone-row {
		grid-template-columns: 1fr;
	}

	#ss-app .ss-dashboard-header {
		flex-wrap: wrap;
		gap: 8px;
	}

	#ss-app .ss-panel-title {
		font-size: 16px;
	}

	#ss-app .ss-stat-cards {
		flex-direction: column;
	}

	#ss-app .ss-report-filter-top {
		flex-wrap: wrap;
		gap: 8px;
	}

	/*
	 * Each row becomes its own bordered/rounded card below (see #ss-app tr),
	 * so the .ss-table-card wrapper's own border+radius just doubles up as
	 * a second, near-flush outline around the row cards - drop it here and
	 * let the wrapper be a plain spacer instead.
	 */
	#ss-app .ss-table-card {
		border: none;
		border-radius: 0;
	}

	#ss-app table {
		overflow: visible;
		border-radius: 0;
	}

	#ss-app table,
	#ss-app thead,
	#ss-app tbody,
	#ss-app tfoot,
	#ss-app th,
	#ss-app td,
	#ss-app tr {
		display: block;
	}

	#ss-app thead {
		display: none;
	}

	#ss-app tr {
		border: 1px solid var(--ss-border);
		border-radius: 8px;
		margin-bottom: 12px;
		padding: 4px 14px;
	}

	/*
	 * Each td/th keeps its desktop padding (14px 18px, sized for a cell
	 * sitting beside others in a row) even after being blockified above -
	 * stacked 4-5 deep per card, that compounds into a lot of dead air.
	 * Cut it down to a tight single-column rhythm instead.
	 */
	#ss-app td,
	#ss-app tbody th {
		padding: 8px 0;
		border-bottom: 1px solid var(--ss-border);
	}

	/*
	 * #ss-app tbody tr:last-child td (desktop rule, above) drops the
	 * border under a table's final row so it doesn't double up against
	 * the table's own bottom edge - meaningless once every row is its own
	 * bordered card here, but it still wins on specificity and strips the
	 * divider lines from just the last card. Put them back, then let the
	 * per-cell :last-child rule below remove only the true last field in
	 * each card, same as every other row.
	 */
	#ss-app tbody tr:last-child td {
		border-bottom: 1px solid var(--ss-border);
	}

	#ss-app tbody tr td:last-child,
	#ss-app tr th:last-child {
		border-bottom: none;
	}

	/*
	 * tfoot's totals row uses <th colspan="3"> + <th> to span the table
	 * width on desktop - colspan is meaningless once cells are blockified
	 * above, so the two cells just stack. Lay them out as a label/value
	 * row instead, and drop the border-top meant to divide the totals row
	 * from tbody above it (the card border here already does that job -
	 * left in place it shows up as a stray line between the two cells).
	 */
	#ss-app tfoot tr {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 12px;
		flex-wrap: wrap;
		background: var(--ss-grad-soft);
		border-color: transparent;
	}

	#ss-app tfoot th {
		border-top: none;
	}
}
