:root {
	--fd-navy: #071a2b;
	--fd-navy-soft: #0d2940;
	--fd-teal: #1dc7ad;
	--fd-lime: #c8f56b;
	--fd-paper: #f5f7f4;
	--fd-line: #dbe4e4;
	--fd-ink: #102637;
	--fd-muted: #526977;
	--fd-link: #087466;
	--fd-control-line: #7c919b;
	--fd-danger: #a82727;
}

.fd-auth-card {
	width: min(100% - 32px, 520px);
	margin: 80px auto;
	padding: 36px;
	border: 1px solid var(--fd-line);
	border-radius: 22px;
	background: #fff;
	box-shadow: 0 24px 70px rgba(4, 17, 30, .12);
}

.fd-auth-card h2 { margin: 0 0 18px; color: var(--fd-navy); }
.fd-auth-form { display: grid; gap: 10px; }
.fd-auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
:is(.fd-platform, .fd-public-quote) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
:is(.fd-platform, .fd-public-quote) select,
:is(.fd-platform, .fd-public-quote) textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--fd-control-line);
	border-radius: 9px;
	background: #fff;
	color: var(--fd-ink);
}
.fd-auth-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
:is(.fd-platform, .fd-public-quote) input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
:is(.fd-platform, .fd-public-quote) select { min-height: 44px; }
:is(.fd-platform, .fd-public-quote) textarea { min-height: 88px; resize: vertical; }
.fd-check { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.fd-check input { width: auto; }
.fd-primary-button,
.fd-secondary-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 18px;
	border: 0;
	border-radius: 9px;
	font-weight: 750;
	cursor: pointer;
}
.fd-primary-button { background: var(--fd-teal); color: var(--fd-navy); }
.fd-secondary-button { border: 1px solid var(--fd-line); background: #fff; color: var(--fd-navy); }
.fd-primary-button:hover, .fd-secondary-button:hover { transform: translateY(-1px); }

.fd-notice { margin: 12px 0 20px; padding: 12px 14px; border-radius: 9px; background: #e7f8f4; color: #085f52; }
.fd-notice-error { background: #fff0f0; color: var(--fd-danger); }
.fd-notice-success { background: #e7f8f4; color: #085f52; }

.fd-platform { width: 100%; color: var(--fd-ink); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
/* Explicit grid/flex styles must not override permission-driven hidden fields. */
.fd-platform [hidden] { display: none !important; }
.fd-portal-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 760px; border-radius: 22px; overflow: hidden; background: var(--fd-paper); box-shadow: 0 24px 70px rgba(4, 17, 30, .14); }
.fd-portal-sidebar { padding: 28px 18px; background: var(--fd-navy); color: #fff; }
.fd-portal-brand { margin: 0 12px 28px; font-size: 24px; font-weight: 850; letter-spacing: -.04em; }
.fd-portal-brand span { color: var(--fd-teal); }
.fd-portal-nav { display: grid; gap: 5px; }
.fd-portal-nav button { width: 100%; padding: 12px 14px; border: 0; border-radius: 9px; background: transparent; color: #d7e3e8; font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
.fd-portal-nav button:hover, .fd-portal-nav button.is-active { background: var(--fd-navy-soft); color: #fff; }
.fd-portal-nav button.is-active { box-shadow: inset 3px 0 var(--fd-teal); }
.fd-platform .fd-portal-nav a.fd-account-security-link { display: block; padding: 12px 14px; border-radius: 9px; color: #d7e3e8; background: transparent; font-weight: 650; text-decoration: none; }
.fd-platform .fd-portal-nav a.fd-account-security-link:hover,
.fd-platform .fd-portal-nav a.fd-account-security-link:focus-visible { color: #fff; background: var(--fd-navy-soft); }
.fd-portal-main { min-width: 0; padding: 0 32px 44px; }
.fd-portal-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 84px; border-bottom: 1px solid var(--fd-line); }
.fd-portal-topbar strong, .fd-portal-topbar span { display: block; }
.fd-portal-topbar span { margin-top: 3px; color: var(--fd-muted); font-size: 13px; }
.fd-topbar-actions { display: flex; align-items: center; gap: 12px; }
.fd-topbar-actions select { min-width: 190px; }
.fd-view { display: none; padding-top: 34px; }
.fd-view.is-active { display: block; }
.fd-view h1 { margin: 0 0 24px; font-size: clamp(28px, 4vw, 42px); line-height: 1.15; letter-spacing: -.04em; }
.fd-view h2 { font-size: 21px; }
.fd-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fd-stat, .fd-panel { padding: 22px; border: 1px solid var(--fd-line); border-radius: 15px; background: #fff; }
.fd-stat span { display: block; color: var(--fd-muted); font-size: 13px; }
.fd-stat strong { display: block; margin-top: 8px; font-size: 26px; }
.fd-panel { margin-top: 24px; }
.fd-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.fd-form-grid label, .fd-filter-row label { display: grid; gap: 6px; color: var(--fd-muted); font-size: 13px; font-weight: 650; }
.fd-field-help { color: var(--fd-muted); font-size: 12px; font-weight: 450; }
.fd-form-wide { grid-column: 1 / -1; }
.fd-filter-row { display: grid; grid-template-columns: minmax(220px, 1fr) repeat(2, 160px) auto; align-items: end; gap: 12px; margin-bottom: 22px; }
.fd-checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.fd-checkbox-grid label { display: flex; align-items: center; gap: 8px; }
.fd-checkbox-grid input { width: auto; }
.fd-table-wrap { overflow-x: auto; border: 1px solid var(--fd-line); border-radius: 13px; background: #fff; }
.fd-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.fd-table th, .fd-table td { padding: 13px 14px; border-bottom: 1px solid #edf1f1; text-align: left; vertical-align: middle; }
.fd-table th { color: var(--fd-muted); font-size: 12px; letter-spacing: .03em; text-transform: uppercase; }
.fd-table tr:last-child td { border-bottom: 0; }
.fd-table button { min-height: 40px; padding: 7px 10px; border: 1px solid var(--fd-control-line); border-radius: 7px; background: #fff; color: var(--fd-ink); cursor: pointer; }
.fd-badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; background: #e8f8f4; color: #086454; font-size: 12px; font-weight: 750; }
.fd-badge-muted { background: #edf1f2; color: #51636f; }
.fd-table .fd-doc-link { display: inline-flex; margin: 2px 4px 2px 0; padding: 6px 9px; border: 0; border-radius: 7px; background: var(--fd-navy); color: #fff !important; font-size: 12px; }
.fd-doc-link:disabled { cursor: progress; }
.fd-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }
.fd-empty { padding: 28px; border: 1px dashed #bfcdd1; border-radius: 12px; color: var(--fd-muted); text-align: center; }
.fd-loading { cursor: progress; pointer-events: none; }
.fd-preview-group { margin-top: 18px; padding: 16px; border-radius: 11px; background: #f0f7f5; }
.fd-preview-group h3 { margin: 0 0 10px; }
.fd-pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; color: var(--fd-muted); font-size: 13px; }
.fd-pagination div { display: flex; gap: 8px; }
.fd-pagination button { padding: 8px 12px; border: 1px solid var(--fd-line); border-radius: 8px; background: #fff; color: var(--fd-navy); cursor: pointer; }
.fd-pagination button:disabled { cursor: default; }

.fd-dialog {
	width: min(560px, calc(100% - 32px));
	padding: 0;
	border: 0;
	border-radius: 18px;
	max-height: calc(100dvh - 32px);
	overflow: auto;
	background: #fff;
	color: var(--fd-ink);
	box-shadow: 0 28px 90px rgba(4, 17, 30, .34);
}
.fd-dialog-wide { width: min(980px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow: auto; }
.fd-dialog-content { padding: 26px; }
.fd-action-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.fd-inline-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.fd-quote-line { display: grid; grid-template-columns: minmax(190px, 2fr) repeat(5, minmax(90px, 1fr)) auto; align-items: end; gap: 9px; margin: 10px 0; padding: 12px; border: 1px solid var(--fd-line); border-radius: 11px; background: var(--fd-paper); }
.fd-quote-line label { display: grid; gap: 5px; color: var(--fd-muted); font-size: 12px; font-weight: 650; }
.fd-quote-line button { min-height: 44px; padding: 8px 10px; border: 1px solid #e8bcbc; border-radius: 8px; background: #fff; color: var(--fd-danger); }
.fd-public-quote { width: min(1040px, calc(100% - 32px)); margin: 48px auto; padding: clamp(24px, 5vw, 56px); border-radius: 22px; background: #fff; color: var(--fd-ink); box-shadow: 0 24px 80px rgba(4, 17, 30, .14); }
.fd-public-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 32px; }
.fd-public-heading span { color: #087e6c; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.fd-public-heading h1 { margin: 4px 0 0; color: var(--fd-navy); }
.fd-public-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0 0 24px; padding: 18px; border-radius: 13px; background: var(--fd-paper); }
.fd-public-meta p { margin: 0; }
.fd-public-totals { width: min(100%, 440px); margin: 24px 0 24px auto; }
.fd-public-totals p { display: flex; justify-content: space-between; gap: 20px; margin: 8px 0; }
.fd-public-total { padding-top: 12px; border-top: 2px solid var(--fd-navy); font-size: 18px; }
.fd-public-decision { margin-top: 30px; padding: 24px; border: 1px solid var(--fd-line); border-radius: 15px; background: var(--fd-paper); }
.fd-dialog::backdrop { background: rgba(4, 17, 30, .68); backdrop-filter: blur(3px); }
.fd-dialog form { padding: 26px; }
.fd-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.fd-dialog-heading h2 { margin: 3px 0 0; color: var(--fd-navy); font-size: 26px; }
.fd-dialog-kicker { color: #087e6c; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.fd-dialog-description { margin: 12px 0 0; color: var(--fd-muted); }
.fd-dialog-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #edf3f2; color: var(--fd-navy); font-size: 25px; line-height: 1; cursor: pointer; }
.fd-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.fd-dialog[open] { animation: fd-dialog-in .16s ease-out; }

/* These components are light surfaces even when Avada uses a dark palette.
   Explicit scoped colors prevent theme heading/link rules from erasing text.
   Keep all contrast overrides inside FlyttDrift's real portal components. */
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) {
	color: var(--fd-ink);
	color-scheme: light;
	text-shadow: none;
}
:is(.fd-platform, .fd-auth-card, .fd-public-quote),
:is(.fd-platform, .fd-auth-card, .fd-public-quote) * { box-sizing: border-box; }
:is(.fd-auth-card, .fd-public-quote) { background: #fff; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(h1, h2, h3, h4, h5, h6) {
	color: var(--fd-navy) !important;
	text-shadow: none;
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) p { color: inherit; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) a:not([class*="fd-"]) {
	color: var(--fd-link);
	text-decoration: underline;
	text-underline-offset: 3px;
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) a:not([class*="fd-"]):is(:hover, :focus-visible) { color: #05574d; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(.fd-primary-button, .fd-secondary-button) {
	color: var(--fd-navy);
	text-decoration: none;
	text-shadow: none;
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) .fd-primary-button { background: var(--fd-teal); }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) .fd-primary-button:not(:disabled):hover { background: #27d8bc; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) .fd-secondary-button {
	background: #fff;
	border: 1px solid var(--fd-control-line);
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) .fd-secondary-button:not(:disabled):hover { background: #e8f8f4; }
html body .fd-platform .fd-portal-main { background: var(--fd-paper); color: var(--fd-ink); }
html body .fd-platform .fd-portal-sidebar {
	background: var(--fd-navy);
	color: #fff;
	color-scheme: dark;
}
html body .fd-platform .fd-portal-sidebar :is(a, a:visited, p, h1, h2, h3, h4, h5, h6, .fd-portal-brand) { color: #fff !important; }
html body .fd-platform .fd-portal-sidebar a:is(:hover, :focus-visible) { color: var(--fd-lime) !important; }
html body .fd-platform .fd-portal-nav button {
	min-height: 44px;
	background: transparent;
	color: #d7e3e8;
	white-space: normal;
	text-shadow: none;
}
html body .fd-platform .fd-portal-nav button:is(:hover, .is-active) { background: var(--fd-navy-soft); color: #fff; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(input, select, textarea) {
	font: inherit;
	font-size: 16px;
	max-width: 100%;
	background-color: #fff;
	color: var(--fd-ink);
	border-color: var(--fd-control-line);
	box-shadow: none;
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(input, textarea)::placeholder { color: var(--fd-muted); opacity: 1; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(option, optgroup) { color: var(--fd-ink); background: #fff; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(input, select, textarea):is(:disabled, [readonly]) {
	color: #455e6b;
	-webkit-text-fill-color: #455e6b;
	background: #edf1f2;
	opacity: 1;
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(input[type="checkbox"], input[type="radio"]) {
	width: 18px;
	height: 18px;
	min-height: 18px;
	flex: 0 0 18px;
	padding: 0;
	accent-color: var(--fd-link);
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(input, select, textarea)[aria-invalid="true"] { border: 2px solid var(--fd-danger); }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--fd-link);
	outline-offset: 3px;
	box-shadow: 0 0 0 2px #fff;
}
html body .fd-platform .fd-portal-sidebar :is(a, button):focus-visible {
	outline-color: var(--fd-lime);
	outline-offset: 2px;
	box-shadow: none;
}
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) button:disabled {
	color: #455e6b;
	background: #edf1f2;
	border: 1px solid var(--fd-control-line);
	opacity: 1;
	transform: none;
	box-shadow: none;
}
html body :is(.fd-platform, .fd-public-quote) .fd-table { background: #fff; color: var(--fd-ink); }
html body :is(.fd-platform, .fd-public-quote) .fd-table th { background: #f0f5f3; color: var(--fd-muted); }
html body :is(.fd-platform, .fd-public-quote) .fd-table td { background: #fff; color: var(--fd-ink); }
html body :is(.fd-platform, .fd-public-quote) .fd-table button:not(.fd-doc-link):not(:disabled):hover { background: #e8f8f4; color: var(--fd-navy); }
html body :is(.fd-platform, .fd-public-quote) .fd-doc-link:not(:disabled) { background: var(--fd-navy); color: #fff !important; }
html body :is(.fd-platform, .fd-public-quote) .fd-doc-link:not(:disabled):hover { background: #173b55; }
html body :is(.fd-platform, .fd-public-quote) .fd-doc-link:disabled { color: #455e6b !important; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) .fd-notice { background: #e7f8f4; color: #085f52; }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) .fd-notice-error { background: #fff0f0; color: var(--fd-danger); }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) :is(.fd-notice, .fd-notice-error) a { color: inherit; text-decoration: underline; }
html body .fd-platform :is(.fd-field-help, .fd-dialog-description) { color: var(--fd-muted); }
html body :is(.fd-platform, .fd-auth-card, .fd-public-quote) label { color: var(--fd-muted); }
.fd-platform code { color: var(--fd-ink); background: #edf1f2; overflow-wrap: anywhere; }
.fd-dialog-close { flex: 0 0 44px; min-width: 44px; min-height: 44px; }
.fd-topbar-actions > a { white-space: nowrap; }
.fd-section-heading, .fd-dialog-heading, .fd-public-heading { flex-wrap: wrap; }
.fd-auth-form label.fd-check { color: var(--fd-ink); }

@media (max-width: 600px) {
	.fd-dialog-content, .fd-dialog form { padding: 20px; }
	.fd-dialog-actions { flex-wrap: wrap; }
	.fd-dialog-actions > button { flex: 1 1 140px; }
	.fd-section-heading { gap: 4px; margin-bottom: 16px; }
	.fd-section-heading h1 { margin-bottom: 6px; }
	.fd-pagination { align-items: flex-start; flex-wrap: wrap; }
	.fd-public-quote { padding: 20px 16px; }
}

@keyframes fd-dialog-in {
	from { opacity: 0; transform: translateY(8px) scale(.985); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.fd-dialog[open] { animation: none; }
	.fd-primary-button:hover, .fd-secondary-button:hover { transform: none; }
}

@media (max-width: 900px) {
	.fd-portal-shell { grid-template-columns: 1fr; }
	.fd-portal-sidebar { padding: 18px; }
	.fd-portal-brand { margin-bottom: 14px; }
	.fd-portal-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.fd-portal-nav button { text-align: center; }
	.fd-stat-grid { grid-template-columns: 1fr; }
	.fd-quote-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.fd-filter-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
	.fd-portal-main { padding: 0 18px 34px; }
	.fd-portal-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.fd-portal-topbar { align-items: flex-start; flex-direction: column; padding: 18px 0; }
	.fd-topbar-actions { width: 100%; }
	.fd-topbar-actions select { min-width: 0; flex: 1; }
	.fd-form-grid, .fd-filter-row, .fd-checkbox-grid { grid-template-columns: 1fr; }
	.fd-form-wide { grid-column: auto; }
	.fd-auth-card { padding: 24px; }
	.fd-quote-line, .fd-public-meta { grid-template-columns: 1fr; }
	.fd-public-heading { flex-direction: column; }
}
