/* ==========================================================================
   Flatsome Child – CRM workspace (Returns Hub)
   Loaded only on the My Account (homepage) and Returns Dashboard screens.
   ========================================================================== */

body.fc-crm {
	--crm-brand: #0c203f;
	--crm-bg: #f3f5f8;
	--crm-surface: #fff;
	--crm-text: #1d2433;
	--crm-muted: #69707d;
	--crm-line: #e2e6ec;
	--crm-sidebar-w: 260px;
	--crm-topbar-h: 64px;
	--crm-radius: 12px;
	--crm-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
	margin: 0;
	background: var(--crm-bg);
	color: var(--crm-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}
body.fc-crm *, body.fc-crm *::before, body.fc-crm *::after { box-sizing: border-box; }
body.fc-crm .screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
body.fc-crm a { color: var(--crm-brand); }

/* Hub dashboard component variables follow the CRM theme. */
body.fc-crm .crhub {
	--crhub-brand: var(--crm-brand);
	--crhub-text: var(--crm-text);
	--crhub-muted: var(--crm-muted);
	--crhub-line: var(--crm-line);
	--crhub-bg: #f6f8fa;
	--crhub-radius: var(--crm-radius);
	max-width: none;
}
body.fc-crm .crhub-card,
body.fc-crm .crhub-table-wrap { box-shadow: var(--crm-shadow); }
body.fc-crm .crhub-card .crhub-table-wrap { box-shadow: none; }
/* The shell already shows the page title. */
body.fc-crm .crhub-header:not(.crhub-header--detail) .crhub-title { display: none; }
body.fc-crm .crhub-header:not(.crhub-header--detail) { justify-content: flex-end; margin-bottom: 12px; }

/* ---------------------------------------------------------------- Layout */
.fc-crm-app { display: flex; min-height: 100vh; }
.fc-crm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--crm-sidebar-w); }
.fc-crm-content { padding: 28px 32px 48px; flex: 1; }

/* Sidebar */
.fc-crm-sidebar {
	position: fixed; inset: 0 auto 0 0; width: var(--crm-sidebar-w); z-index: 40;
	background: var(--crm-brand); color: rgba(255, 255, 255, .86);
	display: flex; flex-direction: column; overflow-y: auto;
	background-image: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(0, 0, 0, .18));
}
body.admin-bar .fc-crm-sidebar { top: 32px; }
.fc-crm-brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px; min-height: var(--crm-topbar-h); color: #fff !important; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.fc-crm-logo-img { max-height: 36px; max-width: 180px; width: auto; filter: brightness(0) invert(1); }
.fc-crm-monogram { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 9px; background: rgba(255, 255, 255, .16); font-weight: 800; font-size: 16px; flex: none; }
.fc-crm-brand-name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.fc-crm-nav { padding: 14px 12px 24px; }
.fc-crm-nav-group + .fc-crm-nav-group { margin-top: 18px; }
.fc-crm-nav-label { margin: 0 0 6px; padding: 0 10px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255, 255, 255, .5); }
.fc-crm-nav ul { list-style: none; margin: 0; padding: 0; }
.fc-crm-nav li { margin: 0; }
.fc-crm-nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: rgba(255, 255, 255, .82) !important; text-decoration: none; font-size: 14px; font-weight: 500; }
.fc-crm-nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff !important; }
.fc-crm-nav-link.is-active { background: rgba(255, 255, 255, .16); color: #fff !important; font-weight: 600; }
.fc-crm-nav-link > span:not(.fc-crm-dot) { flex: 1; }
.fc-crm-nav-link .fc-crm-dot { margin: 0 5px; }
.fc-crm-icon { flex: none; }
.fc-crm-count { font-style: normal; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .14); border-radius: 999px; padding: 0 8px; line-height: 20px; }

/* Status dots (sidebar + legend) */
.fc-crm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 5px; flex: none; background: #a7aaad; }
.fc-crm-dot--pending   { background: #f0b429; }
.fc-crm-dot--approved  { background: #3b82f6; }
.fc-crm-dot--received  { background: #8b5cf6; }
.fc-crm-dot--completed { background: #22a55b; }
.fc-crm-dot--rejected  { background: #dc3545; }
.fc-crm-dot--cancelled { background: #a7aaad; }

/* Top bar */
.fc-crm-topbar {
	position: sticky; top: 0; z-index: 30; height: var(--crm-topbar-h);
	display: flex; align-items: center; gap: 16px; padding: 0 32px;
	background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px);
	border-bottom: 1px solid var(--crm-line);
}
body.admin-bar .fc-crm-topbar { top: 32px; }
.fc-crm-page-title { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.2; color: var(--crm-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.fc-crm-menu-btn { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; margin: 0; padding: 0; border: 1px solid var(--crm-line); border-radius: 8px; background: #fff; color: var(--crm-text); cursor: pointer; min-height: 0; }
.fc-crm-search { position: relative; margin: 0 0 0 auto; width: min(420px, 40vw); }
.fc-crm-search .fc-crm-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--crm-muted); pointer-events: none; }
.fc-crm-search input[type="search"] {
	width: 100%; height: 40px; margin: 0; padding: 0 12px 0 38px; border: 1px solid var(--crm-line); border-radius: 10px;
	background: #f6f8fa; font-size: 14px; color: var(--crm-text); box-shadow: none;
}
.fc-crm-search input[type="search"]:focus { background: #fff; border-color: var(--crm-brand); outline: 2px solid color-mix(in srgb, var(--crm-brand) 20%, transparent); }
.fc-crm-user { display: flex; align-items: center; gap: 10px; color: var(--crm-text) !important; text-decoration: none; font-weight: 600; font-size: 14px; }
.fc-crm-search + .fc-crm-user { margin-left: 0; }
.fc-crm-page-title + .fc-crm-user { margin-left: auto; }
.fc-crm-avatar { border-radius: 50%; width: 32px; height: 32px; }

/* -------------------------------------------------------------- Overview */
.fc-crm-overview { display: grid; gap: 22px; }
.fc-crm-hero {
	display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
	padding: 24px 28px; border-radius: var(--crm-radius); color: #fff;
	background: var(--crm-brand); background-image: linear-gradient(120deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 60%);
}
.fc-crm-hero h2 { margin: 0 0 4px; font-size: 24px; color: #fff; letter-spacing: -.01em; }
.fc-crm-hero p { margin: 0; color: rgba(255, 255, 255, .82); }
.fc-crm-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.fc-crm-hero .crhub-btn { background: #fff; border-color: #fff; color: var(--crm-brand) !important; }
.fc-crm-hero .crhub-btn--ghost { background: transparent; border-color: rgba(255, 255, 255, .5); color: #fff !important; }
.fc-crm-hero .crhub-btn--ghost:hover { background: rgba(255, 255, 255, .1); }

.fc-crm-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.fc-crm-kpi {
	display: flex; flex-direction: column; gap: 2px; padding: 16px 18px;
	background: var(--crm-surface); border: 1px solid var(--crm-line); border-radius: var(--crm-radius); box-shadow: var(--crm-shadow);
	text-decoration: none; color: var(--crm-text) !important; border-top: 3px solid var(--crm-brand);
	transition: transform .12s ease, box-shadow .12s ease;
}
.fc-crm-kpi:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }
.fc-crm-kpi--pending { border-top-color: #f0b429; }
.fc-crm-kpi--approved { border-top-color: #3b82f6; }
.fc-crm-kpi-label { font-size: 13px; font-weight: 600; color: var(--crm-muted); }
.fc-crm-kpi-value { font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.fc-crm-kpi-hint { font-size: 12px; color: var(--crm-muted); }
.fc-crm-latest td:last-child { white-space: nowrap; }

.fc-crm-columns { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.fc-crm-stack { display: grid; gap: 22px; }
.fc-crm-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.fc-crm-card-head h3 { margin: 0 !important; }
.fc-crm-muted { color: var(--crm-muted); font-size: 14px; margin: 0; }

.fc-crm-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--crm-line); margin: 4px 0 14px; gap: 2px; }
.fc-crm-bar-seg { display: block; min-width: 4px; }
.fc-crm-bar-seg--pending   { background: #f0b429; }
.fc-crm-bar-seg--approved  { background: #3b82f6; }
.fc-crm-bar-seg--received  { background: #8b5cf6; }
.fc-crm-bar-seg--completed { background: #22a55b; }
.fc-crm-bar-seg--rejected  { background: #dc3545; }
.fc-crm-bar-seg--cancelled { background: #a7aaad; }
.fc-crm-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.fc-crm-legend a { display: flex; align-items: center; gap: 4px; padding: 5px 4px; border-radius: 6px; text-decoration: none; color: var(--crm-text) !important; font-size: 14px; }
.fc-crm-legend a:hover { background: #f6f8fa; }
.fc-crm-legend strong { margin-left: auto; }
.fc-crm-legend .fc-crm-dot { margin-left: 0; }

.fc-crm-list { list-style: none; margin: 0; padding: 0; }
.fc-crm-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--crm-line); margin: 0; }
.fc-crm-list li:last-child { border-bottom: 0; }
.fc-crm-list a { display: flex; flex-direction: column; flex: 1; min-width: 0; text-decoration: none; color: var(--crm-text) !important; }
.fc-crm-list a strong { font-size: 14px; }
.fc-crm-list a span { font-size: 13px; color: var(--crm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-crm-list time { font-size: 12px; color: var(--crm-muted); white-space: nowrap; }

.fc-crm-empty-state { max-width: 520px; margin: 60px auto; text-align: center; background: var(--crm-surface); border: 1px solid var(--crm-line); border-radius: var(--crm-radius); padding: 36px; box-shadow: var(--crm-shadow); }
.fc-crm-empty-state h2 { margin-top: 0; }

/* --------------------------------------------- WooCommerce account screens */
body.fc-crm .woocommerce-MyAccount-navigation { display: none; }
body.fc-crm .woocommerce-MyAccount-content { width: 100%; float: none; padding: 0; }
body.fc-crm--app .woocommerce-EditAccountForm,
body.fc-crm--app .woocommerce-ResetPassword {
	max-width: 760px; background: var(--crm-surface); border: 1px solid var(--crm-line); border-radius: var(--crm-radius);
	padding: 24px 28px; box-shadow: var(--crm-shadow);
}
body.fc-crm .woocommerce-notices-wrapper:empty { display: none; }
body.fc-crm .woocommerce-message,
body.fc-crm .woocommerce-error,
body.fc-crm .woocommerce-info { border-radius: 10px; }
body.fc-crm input[type="text"], body.fc-crm input[type="email"], body.fc-crm input[type="password"], body.fc-crm input[type="tel"] { border-radius: 8px; }
body.fc-crm .button,
body.fc-crm button[type="submit"]:not(.crhub-btn):not(.crhub-chip):not(.crhub-link) {
	background-color: var(--crm-brand); border-color: var(--crm-brand); color: #fff; border-radius: 8px; text-transform: none; letter-spacing: 0;
}

/* ------------------------------------------------------------ Sign-in screen */
.fc-crm-auth {
	min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px;
	background: var(--crm-brand); background-image: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, .14), transparent 45%), radial-gradient(circle at 90% 90%, rgba(0, 0, 0, .25), transparent 50%);
}
.fc-crm-auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 32px 32px 24px; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.fc-crm-auth-brand { display: flex; align-items: center; gap: 10px; color: var(--crm-brand); }
.fc-crm-auth-brand .fc-crm-monogram { background: var(--crm-brand); color: #fff; }
.fc-crm-auth-brand .fc-crm-logo-img { filter: none; max-height: 44px; }
.fc-crm-auth-brand .fc-crm-brand-name { font-size: 18px; }
.fc-crm-auth-sub { margin: 6px 0 18px; color: var(--crm-muted); font-size: 14px; }
.fc-crm-auth .account-container, .fc-crm-auth .account-login-inner { padding: 0; margin: 0; }
.fc-crm-auth h2 { font-size: 18px !important; text-transform: none !important; margin: 0 0 14px; }
.fc-crm-auth .woocommerce-form-login .button { width: 100%; margin: 6px 0 0; padding: 10px 16px; }
.fc-crm-auth .woocommerce-form-login__rememberme { display: block; margin: 0 0 10px; }
.fc-crm-auth .lost_password { margin: 14px 0 0; text-align: center; font-size: 14px; }
.fc-crm-auth .woocommerce-form-row label { font-weight: 600; font-size: 13px; }
.fc-crm-auth-foot { margin: 18px 0 0; color: rgba(255, 255, 255, .6); font-size: 12px; }

/* --------------------------------------------------------------- Responsive */
.fc-crm-scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 35; }
.fc-crm-scrim[hidden] { display: none; }

@media (max-width: 1100px) {
	.fc-crm-columns { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
	.fc-crm-main { margin-left: 0; }
	.fc-crm-sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility .2s; }
	body.fc-crm-nav-open .fc-crm-sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
	.fc-crm-menu-btn { display: inline-flex; }
	.fc-crm-topbar { padding: 0 16px; gap: 10px; }
	.fc-crm-content { padding: 20px 16px 40px; }
	.fc-crm-user-name { display: none; }
}
@media (max-width: 782px) {
	body.admin-bar .fc-crm-topbar, body.admin-bar .fc-crm-sidebar { top: 46px; }
}
@media (max-width: 640px) {
	.fc-crm-topbar { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; }
	.fc-crm-search { order: 5; width: 100%; margin: 0; }
	.fc-crm-page-title { font-size: 17px; flex: 1; }
	.fc-crm-hero { padding: 20px; }
	.fc-crm-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.fc-crm-kpi { padding: 12px 14px; }
	.fc-crm-kpi-value { font-size: 24px; }
}
