/* FluxCore Client Portal -- design tokens
   Layout: fixed dark slate sidebar + light content area (the ClickUp/Notion/Monday pattern the
   brief asked for). One accent color (brand-configurable via --fcap-accent, set inline by PHP).
   Type: system font stack only -- zero webfont download, so the portal never has a flash of
   unstyled text and stays fast even on a slow connection. */

.fca-portal {
	--fcap-accent: #4F46E5;
	--fcap-bg: #F6F7FB;
	--fcap-surface: #FFFFFF;
	--fcap-border: #E6E8F0;
	--fcap-text: #1A1D29;
	--fcap-text-muted: #6B7085;
	--fcap-sidebar-bg: #14161F;
	--fcap-sidebar-text: #C9CBDA;
	--fcap-sidebar-text-active: #FFFFFF;
	--fcap-radius: 12px;
	--fcap-shadow: 0 1px 2px rgba(20,22,31,0.04), 0 8px 24px rgba(20,22,31,0.06);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--fcap-text);
	-webkit-font-smoothing: antialiased;
}
.fca-portal[data-theme="dark"] {
	--fcap-bg: #0E0F16;
	--fcap-surface: #171923;
	--fcap-border: #2A2D3C;
	--fcap-text: #EEEFF5;
	--fcap-text-muted: #9497AB;
	--fcap-sidebar-bg: #0B0C12;
}
.fca-portal * { box-sizing: border-box; }
.fca-portal button { font-family: inherit; cursor: pointer; }

/* ============ GUEST STATE ============ */
.fcap-guest {
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 480px;
	background: var(--fcap-bg);
	border-radius: var(--fcap-radius);
	padding: 40px 20px;
}
.fcap-guest-card {
	width: 100%;
	max-width: 380px;
	background: var(--fcap-surface);
	border: 1px solid var(--fcap-border);
	border-radius: var(--fcap-radius);
	box-shadow: var(--fcap-shadow);
	padding: 36px 32px;
}
.fcap-guest-logo {
	font-weight: 700;
	font-size: 15px;
	letter-spacing: 0.02em;
	color: var(--fcap-accent);
	margin-bottom: 20px;
	display: flex;
	align-items: center;
}
.fcap-logo-img {
	display: block;
	height: 28px;
	width: auto;
	max-width: 100%;
	object-fit: contain;
}
/* The <a> every logo is wrapped in -- inherits the surrounding text color/size and never
   shows the default link underline or color, whether it's rendering an <img> or the plain
   brand-name text fallback. */
.fcap-logo-link {
	display: flex; align-items: center; color: inherit; text-decoration: none;
}
.fcap-logo-link:hover, .fcap-logo-link:focus { color: inherit; text-decoration: none; }
/* Dark/light logo swap: both <img> variants are always rendered; CSS shows only the one
   matching the current theme (avoids a JS-driven swap / flash on toggle). */
.fcap-logo-dark { display: none; }
.fca-portal[data-theme="dark"] .fcap-logo-light { display: none; }
.fca-portal[data-theme="dark"] .fcap-logo-dark { display: block; }
.fcap-guest-heading { font-size: 22px; font-weight: 700; margin: 0 0 6px; color: var(--fcap-text); }
.fcap-guest-sub { font-size: 14px; color: var(--fcap-text-muted); margin: 0 0 24px; line-height: 1.5; }

.fcap-guest-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--fcap-bg); border-radius: 8px; padding: 4px; }
.fcap-subtabs { display: flex; gap: 4px; margin-bottom: 16px; background: var(--fcap-bg); border-radius: 8px; padding: 4px; }
.fcap-tab-btn {
	flex: 1; border: none; background: transparent; padding: 8px 10px; border-radius: 6px;
	font-size: 13px; font-weight: 600; color: var(--fcap-text-muted); transition: all 0.15s ease;
}
.fcap-tab-btn.is-active { background: var(--fcap-surface); color: var(--fcap-text); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.fcap-subtabs .fcap-tab-btn:hover:not(.is-active),
.fcap-subtabs .fcap-tab-btn:focus:not(.is-active) {
	background: color-mix(in srgb, var(--fcap-surface) 60%, transparent);
	color: var(--fcap-text);
}

.fcap-form { display: flex; flex-direction: column; gap: 6px; }
.fcap-form label { font-size: 13px; font-weight: 600; color: var(--fcap-text); margin-top: 10px; }
.fcap-form input {
	width: 100%; padding: 10px 12px; border: 1px solid var(--fcap-border); border-radius: 8px;
	background: var(--fcap-bg); color: var(--fcap-text); font-size: 14px; transition: border-color 0.15s ease;
}
.fcap-form input:focus { outline: none; border-color: var(--fcap-accent); }

.fcap-password-wrap { position: relative; }
.fcap-password-wrap input { padding-right: 40px; }
.fcap-password-toggle {
	position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
	width: 30px; height: 30px; border: none; background: transparent; border-radius: 6px;
	font-size: 15px; line-height: 1; color: var(--fcap-text-muted);
	display: flex; align-items: center; justify-content: center;
}
.fcap-password-toggle:hover { background: var(--fcap-bg); color: var(--fcap-text); }

.fcap-btn-primary {
	margin-top: 18px; width: 100%; border: none; border-radius: 8px; padding: 11px 16px;
	background: var(--fcap-accent); color: #fff; font-size: 14px; font-weight: 600;
	transition: opacity 0.15s ease, transform 0.1s ease;
}
.fcap-btn-primary:hover { opacity: 0.92; }
.fcap-btn-primary:active { transform: scale(0.98); }
.fcap-btn-primary[disabled] { opacity: 0.6; cursor: default; }

.fcap-link-btn {
	margin-top: 12px; border: none; background: transparent; color: var(--fcap-accent);
	font-size: 13px; font-weight: 600; text-align: center; padding: 4px;
}
.fcap-link-btn:hover { text-decoration: underline; }

.fcap-form-status {
	margin-top: 12px; font-size: 13px; padding: 8px 10px; border-radius: 6px; display: none;
}
.fcap-form-status.is-error { display: block; background: #FDECEC; color: #B4232C; }
.fcap-form-status.is-success { display: block; background: #E7F7EF; color: #1F7A4D; }

/* ============ CLIENT STATE: layout ============ */
.fcap-client { display: flex; flex-direction: column; height: min(78vh, 780px); min-height: 560px; background: var(--fcap-bg); border-radius: var(--fcap-radius); overflow: hidden; border: 1px solid var(--fcap-border); }
.fcap-client-body { display: flex; flex: 1; min-height: 0; }
.fcap-portal-footer {
	flex-shrink: 0; text-align: center; padding: 10px 16px; font-size: 11.5px;
	color: var(--fcap-text-muted); border-top: 1px solid var(--fcap-border); background: var(--fcap-surface);
}

.fcap-sidebar {
	width: 220px; flex-shrink: 0; background: var(--fcap-sidebar-bg); color: var(--fcap-sidebar-text);
	display: flex; flex-direction: column; padding: 20px 12px;
}
.fcap-sidebar-logo { font-weight: 700; font-size: 15px; color: #fff; padding: 6px 10px 20px; letter-spacing: 0.02em; display: flex; align-items: center; }
.fcap-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.fcap-nav-item {
	display: flex; align-items: center; gap: 10px; border: none; background: transparent;
	color: var(--fcap-sidebar-text); text-align: left; padding: 9px 10px; border-radius: 8px;
	font-size: 13.5px; font-weight: 500; transition: background 0.15s ease, color 0.15s ease;
}
.fcap-nav-icon { width: 16px; display: inline-block; text-align: center; opacity: 0.85; flex-shrink: 0; }
.fcap-nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcap-nav-badge {
	margin-left: auto; background: #E5484D; color: #fff; font-size: 10px; font-weight: 700;
	min-width: 16px; height: 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
	padding: 0 4px; line-height: 1; flex-shrink: 0;
}
.fcap-nav-item.is-active .fcap-nav-badge { background: #fff; color: var(--fcap-accent); }
.fcap-nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.fcap-nav-item.is-active { background: var(--fcap-accent); color: #fff; }
.fcap-theme-toggle {
	margin-top: 12px; border: 1px solid rgba(255,255,255,0.12); background: transparent;
	color: var(--fcap-sidebar-text); padding: 8px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600;
	display: flex; align-items: center; justify-content: center; gap: 6px;
}
.fcap-theme-toggle:hover { background: rgba(255,255,255,0.06); }

/* Mobile/tablet-only elements -- hidden on desktop, styled and shown inside the max-width:900px block below. */
.fcap-drawer-profile,
.fcap-drawer-logout-btn,
.fcap-mobile-topbar,
.fcap-drawer-backdrop { display: none; }

.fcap-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.fcap-topbar {
	display: flex; align-items: center; justify-content: space-between; padding: 16px 24px;
	border-bottom: 1px solid var(--fcap-border); background: var(--fcap-surface);
}
.fcap-topbar-title { font-size: 16px; font-weight: 700; }
.fcap-topbar-right { display: flex; align-items: center; gap: 14px; }
.fcap-client-name { font-size: 13.5px; color: var(--fcap-text-muted); font-weight: 500; }
.fcap-btn-logout {
	border: 1px solid var(--fcap-border); background: var(--fcap-surface); color: var(--fcap-text);
	padding: 7px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; transition: background 0.15s ease;
}
.fcap-btn-logout:hover { background: var(--fcap-bg); }

.fcap-notif-wrap { position: relative; }
.fcap-notif-bell {
	position: relative; background: none; border: none; font-size: 18px; cursor: pointer;
	padding: 6px; border-radius: 7px; line-height: 1; color: var(--fcap-text);
}
.fcap-notif-bell:hover { background: var(--fcap-bg); }
.fcap-notif-badge {
	position: absolute; top: 0; right: 0; background: #E5484D; color: #fff; font-size: 10px; font-weight: 700;
	min-width: 16px; height: 16px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
	padding: 0 3px; line-height: 1;
}
.fcap-notif-dropdown {
	position: absolute; top: calc(100% + 8px); right: 0; width: 320px; max-height: 380px; overflow-y: auto;
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: 10px;
	box-shadow: 0 12px 28px rgba(0,0,0,0.14); z-index: 40;
}
.fcap-notif-dropdown-head { font-size: 13px; font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--fcap-border); }
.fcap-notif-item { padding: 12px 16px; border-bottom: 1px solid var(--fcap-border); }
.fcap-notif-item:last-child { border-bottom: none; }
.fcap-notif-item-unread { background: color-mix(in srgb, var(--fcap-accent) 6%, transparent); }
.fcap-notif-item-text { font-size: 13px; color: var(--fcap-text); line-height: 1.4; }
.fcap-notif-item-time { font-size: 11.5px; color: var(--fcap-text-muted); margin-top: 3px; }
.fcap-notif-item-clickable { cursor: pointer; }
.fcap-notif-item-clickable:hover, .fcap-notif-item-clickable:focus-visible { background: var(--fcap-bg); outline: none; }
.fcap-notif-dropdown-mobile { right: 0; width: 280px; }
.fcap-mobile-topbar-right { display: flex; align-items: center; gap: 4px; }

.fcap-section { display: none; padding: 24px; overflow-y: auto; animation: fcap-fade-in 0.18s ease; flex: 1; min-height: 0; }

/* A thin, unobtrusive scrollbar for every internally-scrolling area (tab content, chat messages,
   the notification dropdown) instead of the browser's bulky default -- shows only when there's
   actually something to scroll, and stays out of the way otherwise. */
.fcap-section, .fcap-chat-messages, .fcap-notif-dropdown {
	scrollbar-width: thin;
	scrollbar-color: var(--fcap-border) transparent;
}
.fcap-section::-webkit-scrollbar, .fcap-chat-messages::-webkit-scrollbar, .fcap-notif-dropdown::-webkit-scrollbar { width: 8px; }
.fcap-section::-webkit-scrollbar-track, .fcap-chat-messages::-webkit-scrollbar-track, .fcap-notif-dropdown::-webkit-scrollbar-track { background: transparent; }
.fcap-section::-webkit-scrollbar-thumb, .fcap-chat-messages::-webkit-scrollbar-thumb, .fcap-notif-dropdown::-webkit-scrollbar-thumb {
	background: var(--fcap-border); border-radius: 999px;
}
.fcap-section::-webkit-scrollbar-thumb:hover, .fcap-chat-messages::-webkit-scrollbar-thumb:hover, .fcap-notif-dropdown::-webkit-scrollbar-thumb:hover {
	background: var(--fcap-text-muted);
}
.fcap-section.is-active { display: block; }
@keyframes fcap-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.fcap-welcome { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

.fcap-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.fcap-card {
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: var(--fcap-radius);
	padding: 18px; box-shadow: var(--fcap-shadow);
}
.fcap-card-value { font-size: 26px; font-weight: 800; color: var(--fcap-accent); }
.fcap-card-label { font-size: 12.5px; color: var(--fcap-text-muted); margin-top: 4px; font-weight: 500; }

.fcap-card-clickable { cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease; }
.fcap-card-clickable:hover, .fcap-card-clickable:focus-visible { transform: translateY(-2px); border-color: var(--fcap-accent); box-shadow: 0 6px 16px rgba(0,0,0,0.08); outline: none; }

.fcap-empty-state {
	display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: 420px;
	background: var(--fcap-surface); border: 1px dashed var(--fcap-border); border-radius: var(--fcap-radius);
	padding: 28px;
}
.fcap-empty-title { font-size: 16px; font-weight: 700; }
.fcap-empty-copy { font-size: 13.5px; color: var(--fcap-text-muted); margin: 0; line-height: 1.5; }
.fcap-empty-tag {
	margin: 6px 0 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
	color: var(--fcap-accent); background: color-mix(in srgb, var(--fcap-accent) 12%, transparent);
	padding: 3px 8px; border-radius: 999px; display: inline-block;
}

.fcap-loading-text { color: var(--fcap-text-muted); font-size: 13.5px; }

/* ---- Projects ---- */
.fcap-project-card {
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: var(--fcap-radius);
	padding: 20px; box-shadow: var(--fcap-shadow); margin-bottom: 16px; max-width: 640px;
}
.fcap-project-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.fcap-project-name { font-size: 15.5px; font-weight: 700; }
.fcap-status-pill {
	font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
	padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.fcap-status-active { background: #E7F0FE; color: #2563AE; }
.fcap-status-on_hold { background: #FEF3E2; color: #B5720C; }
.fcap-status-completed { background: #E7F7EF; color: #1F7A4D; }
.fcap-project-desc { font-size: 13.5px; color: var(--fcap-text-muted); margin: 0 0 14px; line-height: 1.5; }
.fcap-progress-track { background: var(--fcap-bg); border-radius: 999px; height: 8px; overflow: hidden; margin-bottom: 6px; }
.fcap-progress-fill { background: var(--fcap-accent); height: 100%; border-radius: 999px; transition: width 0.3s ease; }
.fcap-progress-label { font-size: 12px; color: var(--fcap-text-muted); font-weight: 600; }

/* ---- Timeline ---- */
.fcap-timeline-project { font-size: 13px; font-weight: 700; color: var(--fcap-text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 22px 0 10px; }
.fcap-timeline-project:first-child { margin-top: 0; }
.fcap-timeline-item {
	display: flex; align-items: flex-start; gap: 12px; padding: 10px 0;
	border-bottom: 1px solid var(--fcap-border); max-width: 560px;
}
.fcap-timeline-item:last-child { border-bottom: none; }
.fcap-timeline-dot {
	width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
	display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
	background: var(--fcap-border); color: var(--fcap-text-muted);
}
.fcap-timeline-dot.is-done { background: #3FC178; color: #fff; }
.fcap-timeline-dot.is-in_progress { background: var(--fcap-accent); color: #fff; }
.fcap-timeline-title { font-size: 13.5px; font-weight: 600; }
.fcap-timeline-meta { font-size: 12px; color: var(--fcap-text-muted); margin-top: 2px; }

/* ---- Files (rendered inline inside each project card -- see .fcap-project-files below) ---- */
.fcap-file-row {
	display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px; max-width: 640px;
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: 10px;
}
.fcap-file-icon { font-size: 18px; flex-shrink: 0; }
.fcap-file-info { flex: 1; min-width: 0; }
.fcap-file-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcap-file-meta { font-size: 11.5px; color: var(--fcap-text-muted); margin-top: 2px; }
.fcap-file-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.fcap-btn-small {
	border: 1px solid var(--fcap-border); background: var(--fcap-surface); color: var(--fcap-text);
	padding: 6px 11px; border-radius: 7px; font-size: 12px; font-weight: 600; text-decoration: none; display: inline-block;
}
.fcap-btn-small:hover { background: var(--fcap-bg); }
.fcap-btn-approve { border-color: #3FC178; color: #1F7A4D; }
.fcap-btn-reject { border-color: #E5484D; color: #B4232C; }
.fcap-approval-pill {
	font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
	padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.fcap-approval-pending { background: #FEF3E2; color: #B5720C; }
.fcap-approval-approved { background: #E7F7EF; color: #1F7A4D; }
.fcap-approval-rejected, .fcap-approval-declined { background: #FDECEC; color: #B4232C; }

.fcap-milestones-toggle {
	display: flex; align-items: center; gap: 4px; background: none; border: none; padding: 0;
	font: inherit; cursor: pointer; text-align: left;
}
.fcap-milestones-toggle-arrow { display: inline-block; transition: transform 0.2s ease; font-size: 10px; }
.fcap-milestones-toggle.is-open .fcap-milestones-toggle-arrow { transform: rotate(-180deg); }
.fcap-project-milestones { display: none; margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--fcap-border); }
.fcap-project-milestones.is-open { display: block; }

/* Same collapsible pattern as milestones above, just for a project's files instead -- merged
   in here from what used to be a separate top-level "Files" tab, since a file only ever
   belongs to one project. Reuses .fcap-milestones-toggle-arrow's base styling (unscoped, so it
   already applies here too) -- only the open/rotated state needs its own selector below since
   that one *is* scoped to the parent toggle class. */
.fcap-files-toggle {
	display: flex; align-items: center; gap: 4px; background: none; border: none; padding: 0;
	font: inherit; cursor: pointer; text-align: left; margin-top: 10px;
}
.fcap-files-toggle.is-open .fcap-milestones-toggle-arrow { transform: rotate(-180deg); }
.fcap-project-files { display: none; margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--fcap-border); }
.fcap-project-files.is-open { display: block; }
.fcap-project-files .fcap-file-row:last-of-type { margin-bottom: 12px; }
.fcap-milestone-row {
	display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0;
	border-bottom: 1px solid var(--fcap-border);
}
.fcap-milestone-row:last-child { border-bottom: none; }
.fcap-milestone-info { min-width: 0; }
.fcap-milestone-title { font-size: 13.5px; font-weight: 600; }
.fcap-milestone-meta { font-size: 12px; color: var(--fcap-text-muted); margin-top: 2px; }
.fcap-milestone-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

.fcap-upload-row {
	display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; max-width: 640px;
}
/* Native <input type="file"> controls (especially on mobile Chrome) don't shrink like a normal
   flex item -- they keep their default rendered width regardless of flex-basis/flex-grow, which
   was pushing the "Upload file" button completely outside the card on narrow screens instead of
   wrapping. min-width: 0 lets it actually shrink to fit, flex-wrap above gives the button
   somewhere to go (its own line) if there still isn't room for both on one line. */
.fcap-upload-row input[type="file"] { flex: 1 1 180px; min-width: 0; max-width: 100%; font-size: 12.5px; }
.fcap-upload-row .fcap-btn-small { flex-shrink: 0; }

/* ---- Support Tickets ---- */
.fcap-tickets-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; max-width: 640px; }
.fcap-ticket-row {
	display: flex; align-items: center; gap: 12px; padding: 13px 16px; margin-bottom: 8px; max-width: 640px;
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: 10px; cursor: pointer;
	transition: border-color 0.15s ease;
}
.fcap-ticket-row:hover { border-color: var(--fcap-accent); }
.fcap-ticket-subject { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcap-ticket-meta { font-size: 11.5px; color: var(--fcap-text-muted); flex-shrink: 0; }
.fcap-status-pill-ticket {
	font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
	padding: 3px 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.fcap-status-open { background: #E7F0FE; color: #2563AE; }
.fcap-status-closed { background: #E7F7EF; color: #1F7A4D; }

.fcap-new-ticket-form, .fcap-ticket-thread { max-width: 640px; }
.fcap-new-ticket-form input, .fcap-new-ticket-form textarea,
.fcap-ticket-thread textarea {
	width: 100%; padding: 10px 12px; border: 1px solid var(--fcap-border); border-radius: 8px;
	background: var(--fcap-bg); color: var(--fcap-text); font-size: 13.5px; font-family: inherit;
	margin-bottom: 10px;
}
.fcap-back-link {
	display: inline-block; margin-bottom: 14px; font-size: 13px; font-weight: 600;
	color: var(--fcap-text-muted); background: none; border: none; padding: 0;
}
.fcap-back-link:hover { color: var(--fcap-accent); }

/* Defensive fix: some themes/plugins ship a global "reset.css" rule --
   button:focus, button:hover, [type=button]:focus, [type=submit]:focus { background-color: #c36; color: #fff; }
   -- that matches every <button> on the page, including these plain/"ghost" buttons here that
   only declare their (transparent) background on the base class rather than on :hover/:focus.
   This guarantees it can never show through inside the portal, without touching buttons that
   already have their own intentional colored background (Log in, nav items, etc). Scoped to
   .fcap-guest-tabs (the Log in / Register switcher) only -- the dashboard sub-tabs
   (.fcap-subtabs, Active/Completed etc.) now have their own intentional hover style above and
   are handled separately so an Elementor-set hover color isn't clobbered by this !important. */
.fcap-back-link:hover, .fcap-back-link:focus,
.fcap-link-btn:hover, .fcap-link-btn:focus,
.fcap-guest-tabs .fcap-tab-btn:hover, .fcap-guest-tabs .fcap-tab-btn:focus,
.fcap-hamburger:hover, .fcap-hamburger:focus,
.fcap-mobile-logo:hover, .fcap-mobile-logo:focus,
.fcap-mobile-theme-toggle:hover, .fcap-mobile-theme-toggle:focus,
.fcap-password-toggle:hover, .fcap-password-toggle:focus,
.fcap-drawer-logout-btn:focus,
.fcap-nav-item:focus:not(.is-active) {
	background-color: transparent !important;
}

.fcap-ticket-bubble { padding: 12px 14px; border-radius: 10px; margin-bottom: 10px; background: var(--fcap-bg); }
.fcap-ticket-bubble.is-admin { background: color-mix(in srgb, var(--fcap-accent) 8%, var(--fcap-bg)); }
.fcap-ticket-bubble-head { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.fcap-ticket-bubble-meta { font-size: 11px; color: var(--fcap-text-muted); font-weight: 500; }
.fcap-ticket-bubble-msg { font-size: 13.5px; white-space: pre-wrap; margin-top: 4px; line-height: 1.5; }

/* ---- Ticket attachments (new-ticket form, reply form, and the thread itself) ---- */
.fcap-attach-label { display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; cursor: pointer; }
.fcap-attach-btn {
	display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600;
	color: var(--fcap-text-muted); padding: 5px 10px; border: 1px dashed var(--fcap-border);
	border-radius: 7px; background: var(--fcap-bg); transition: color .15s ease, border-color .15s ease;
}
.fcap-attach-label:hover .fcap-attach-btn { color: var(--fcap-accent); border-color: var(--fcap-accent); }
.fcap-attach-filename { font-size: 12px; color: var(--fcap-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcap-ticket-bubble-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fcap-attachment-chip {
	display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
	padding: 4px 10px; border-radius: 14px; background: var(--fcap-surface); border: 1px solid var(--fcap-border);
	color: var(--fcap-text); text-decoration: none; max-width: 220px; overflow: hidden;
	text-overflow: ellipsis; white-space: nowrap;
}
.fcap-attachment-chip:hover { border-color: var(--fcap-accent); color: var(--fcap-accent); }

/* ---- Invoices ---- */
.fcap-invoice-card {
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: var(--fcap-radius);
	padding: 18px 20px; box-shadow: var(--fcap-shadow); margin-bottom: 16px; max-width: 560px;
}
.fcap-invoice-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.fcap-invoice-number { font-size: 14.5px; font-weight: 700; }
.fcap-invoice-due { font-size: 11.5px; color: var(--fcap-text-muted); margin-top: 2px; }
.fcap-invoice-lines { border-top: 1px solid var(--fcap-border); border-bottom: 1px solid var(--fcap-border); padding: 10px 0; margin-bottom: 10px; }
.fcap-invoice-line { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; color: var(--fcap-text-muted); }
.fcap-invoice-total { display: flex; justify-content: space-between; font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.fcap-invoice-payment-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fcap-invoice-actions { display: flex; gap: 8px; }
.fcap-invoice-note { font-size: 12.5px; color: var(--fcap-text-muted); margin-top: 8px; font-style: italic; }

/* ---- Contracts / proposals ---- */
.fcap-contract-inline {
	background: var(--fcap-bg); border: 1px solid var(--fcap-border); border-radius: 10px;
	padding: 14px 16px; margin-bottom: 14px;
}
.fcap-contract-inline-empty { font-style: italic; }
.fcap-contract-inline-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.fcap-contract-inline-title { font-size: 13.5px; font-weight: 700; }
.fcap-contract-inline-cost { font-size: 20px; font-weight: 800; color: var(--fcap-text); margin: 4px 0 8px; }
.fcap-contract-modal-cost { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.fcap-contract-card {
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: var(--fcap-radius);
	padding: 18px 20px; box-shadow: var(--fcap-shadow); margin-bottom: 16px; max-width: 560px;
}
.fcap-contract-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.fcap-contract-title { font-size: 14.5px; font-weight: 700; }
.fcap-contract-signed-note { font-size: 12.5px; color: #1f7a4d; font-weight: 600; margin-bottom: 10px; }
.fcap-contract-actions { display: flex; gap: 8px; margin-top: 4px; }

.fcap-contract-modal-card { max-width: 520px; text-align: left; }
.fcap-contract-modal-title { margin: 0 24px 14px 0; font-size: 18px; color: var(--fcap-text); }
.fcap-contract-modal-body {
	font-size: 13.5px; line-height: 1.6; color: var(--fcap-text); max-height: 40vh; overflow-y: auto;
	padding: 14px 16px; margin-bottom: 18px; background: var(--fcap-bg); border: 1px solid var(--fcap-border); border-radius: 10px;
}
.fcap-contract-agree { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--fcap-text-muted); margin: 4px 0 14px; }
.fcap-contract-agree input { margin-top: 3px; }
.fcap-contract-sign-form .fcap-btn-primary { width: 100%; }
.fcap-contract-decline-btn { width: 100%; margin-top: 8px; background: transparent; border: 1px solid var(--fcap-border); }

/* ---- Meetings ---- */
.fcap-meetings-toolbar { display: flex; justify-content: flex-end; margin-bottom: 14px; max-width: 560px; }
.fcap-meeting-row {
	display: flex; align-items: center; gap: 12px; padding: 13px 16px; margin-bottom: 8px; max-width: 560px;
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: 10px;
}
.fcap-meeting-info { flex: 1; min-width: 0; }
.fcap-meeting-when { font-size: 13.5px; font-weight: 700; }
.fcap-meeting-topic { font-size: 12.5px; color: var(--fcap-text-muted); margin-top: 2px; }
.fcap-request-form { max-width: 480px; }
.fcap-request-form input, .fcap-request-form textarea {
	width: 100%; padding: 10px 12px; border: 1px solid var(--fcap-border); border-radius: 8px;
	background: var(--fcap-bg); color: var(--fcap-text); font-size: 13.5px; font-family: inherit; margin-bottom: 10px;
}

/* ---- Live Chat ---- */
.fcap-chat-wrap { display: flex; flex-direction: column; height: 100%; max-width: 620px; }
.fcap-chat-messages { flex: 1; overflow-y: auto; padding-bottom: 12px; min-height: 300px; }
.fcap-chat-bubble-row { display: flex; margin-bottom: 8px; }
.fcap-chat-bubble-row.is-visitor { justify-content: flex-end; }
.fcap-chat-bubble {
	max-width: 75%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.45;
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); color: var(--fcap-text);
}
.fcap-chat-bubble-row.is-visitor .fcap-chat-bubble { background: var(--fcap-accent); color: #fff; border-color: transparent; }
.fcap-chat-input-row { display: flex; gap: 8px; align-items: flex-end; border-top: 1px solid var(--fcap-border); padding-top: 12px; }
.fcap-chat-input-row textarea {
	flex: 1; resize: none; padding: 9px 12px; border: 1px solid var(--fcap-border); border-radius: 8px;
	background: var(--fcap-bg); color: var(--fcap-text); font-size: 13.5px; font-family: inherit; max-height: 100px;
}
.fcap-chat-attach-btn {
	flex-shrink: 0; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--fcap-border);
	background: var(--fcap-surface); color: var(--fcap-text); cursor: pointer; font-size: 16px;
	display: flex; align-items: center; justify-content: center;
}
.fcap-chat-attach-btn:hover, .fcap-chat-attach-btn:focus { opacity: 0.75; }
.fcap-chat-attach-btn:disabled { opacity: 0.5; cursor: default; }
.fcap-chat-image { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; cursor: pointer; }

/* ---- Reviews ---- */
.fcap-review-prompt {
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: var(--fcap-radius);
	padding: 18px 20px; margin-bottom: 14px; max-width: 480px;
}
.fcap-review-prompt-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.fcap-star-picker { font-size: 26px; letter-spacing: 4px; cursor: pointer; margin-bottom: 10px; }
.fcap-star-picker span { color: var(--fcap-border); transition: color 0.1s ease; }
.fcap-star-picker span.is-filled { color: #F5A623; }
.fcap-review-card {
	background: var(--fcap-surface); border: 1px solid var(--fcap-border); border-radius: var(--fcap-radius);
	padding: 16px 18px; margin-bottom: 12px; max-width: 480px;
}
.fcap-review-card-stars { color: #F5A623; font-size: 15px; margin-bottom: 6px; }
.fcap-review-card-project { font-size: 11.5px; color: var(--fcap-text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 4px; }
.fcap-review-card-comment { font-size: 13.5px; line-height: 1.5; }

/* ============ First-login welcome tour ============ */
.fcap-welcome-modal {
	display: none; position: fixed; inset: 0; z-index: 200;
	align-items: center; justify-content: center; padding: 20px;
	background: rgba(0,0,0,.5);
}
.fcap-welcome-modal.is-open { display: flex; }
.fcap-welcome-card {
	position: relative; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto;
	background: var(--fcap-surface); border-radius: 16px; padding: 32px 28px 28px;
	box-shadow: 0 20px 60px rgba(0,0,0,.35);
	animation: fcapWelcomeIn 0.25s ease;
}
@keyframes fcapWelcomeIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.fcap-welcome-close {
	position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border: none; background: transparent;
	color: var(--fcap-text-muted); font-size: 14px; border-radius: 8px; cursor: pointer;
}
.fcap-welcome-close:hover { background: var(--fcap-bg); color: var(--fcap-text); }
.fcap-welcome-heading { text-align: center; margin-bottom: 20px; }
.fcap-welcome-emoji { font-size: 34px; margin-bottom: 8px; }
.fcap-welcome-heading h2 { margin: 0 0 6px; font-size: 20px; color: var(--fcap-text); }
.fcap-welcome-heading p { margin: 0; font-size: 13.5px; color: var(--fcap-text-muted); }
.fcap-welcome-checklist { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.fcap-welcome-item {
	display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
	padding: 12px 14px; border: 1px solid var(--fcap-border); border-radius: 12px; background: var(--fcap-bg);
	cursor: pointer;
}
.fcap-welcome-item:hover { border-color: var(--fcap-accent); background: color-mix(in srgb, var(--fcap-accent) 6%, var(--fcap-bg)); }
.fcap-welcome-item-icon {
	width: 34px; height: 34px; flex-shrink: 0; border-radius: 9px; display: flex; align-items: center; justify-content: center;
	background: var(--fcap-accent); color: #fff; font-size: 15px;
}
.fcap-welcome-item-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fcap-welcome-item-text strong { font-size: 13.5px; color: var(--fcap-text); }
.fcap-welcome-item-text small { font-size: 12px; color: var(--fcap-text-muted); }
.fcap-welcome-item-arrow { color: var(--fcap-text-muted); font-size: 14px; flex-shrink: 0; }
.fcap-welcome-skip { width: 100%; }

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

/* ---- Tablet: keep the left sidebar (there's room) but tighten it up ---- */
@media (max-width: 1024px) and (min-width: 901px) {
	.fcap-sidebar { width: 190px; padding: 18px 10px; }
	.fcap-nav-item { padding: 9px 8px; font-size: 13px; }
	.fcap-section { padding: 20px; }
}

/* ---- Small tablets / large phones in portrait: sidebar becomes a slide-out drawer menu ---- */
@media (max-width: 900px) {
	.fca-portal {
		/* Full-bleed: escape the theme/Elementor container's side padding so the portal
		   reaches the true edges of the screen, like a native app, instead of floating
		   as an inset card. */
		width: 100vw;
		margin-left: calc(50% - 50vw);
		margin-right: calc(50% - 50vw);
		border-radius: 0;
	}

	/* ---- Guest (login) state: fill the viewport, no floating card ---- */
	.fcap-guest {
		min-height: 100vh;
		min-height: 100dvh;
		border-radius: 0;
		padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
	}
	.fcap-guest-card {
		max-width: 440px;
		border: none;
		box-shadow: none;
		border-radius: 0;
		padding: 8px 4px;
	}

	/* ---- Client (dashboard) state: app shell that fills the screen, with its own
	   internal scroll area, and a hamburger-triggered slide-out menu for navigation ---- */
	.fcap-client {
		flex-direction: column;
		height: 100vh;
		height: 100dvh;
		min-height: 0;
		border: none;
		border-radius: 0;
		position: relative;
		overflow: hidden;
	}
	.fcap-main { flex: 1; min-height: 0; }
	.fcap-topbar { display: none; }
	.fcap-section { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; padding-bottom: 28px; }

	/* ---- Top bar: hamburger (left) / logo (center) / theme toggle (right) ---- */
	.fcap-mobile-topbar {
		display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
		position: sticky; top: 0; z-index: 15;
		padding: 8px 6px; padding-top: max(8px, env(safe-area-inset-top));
		background: var(--fcap-surface); border-bottom: 1px solid var(--fcap-border);
	}
	.fcap-hamburger {
		width: 44px; height: 44px; flex-shrink: 0; border: none; background: transparent;
		display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
	}
	.fcap-hamburger span {
		display: block; width: 20px; height: 2px; border-radius: 2px; background: var(--fcap-text);
		transition: transform 0.25s ease, opacity 0.2s ease;
	}
	.fcap-hamburger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	.fcap-hamburger.is-active span:nth-child(2) { opacity: 0; }
	.fcap-hamburger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
	.fcap-mobile-logo {
		flex: 1; display: flex; align-items: center; justify-content: center; border: none; background: transparent;
		color: var(--fcap-text); font-weight: 700; font-size: 14px; letter-spacing: 0.02em; min-width: 0; padding: 0 6px;
	}
	.fcap-mobile-logo .fcap-logo-img { height: 24px; margin: 0 auto; }
	.fcap-mobile-theme-toggle {
		width: 44px; height: 44px; flex-shrink: 0; border: none; background: transparent;
		display: flex; align-items: center; justify-content: center; font-size: 19px;
	}
	.fcap-mobile-theme-toggle .fcap-theme-icon { display: inline-block; transition: transform 0.3s ease; }
	.fca-portal[data-theme="dark"] .fcap-mobile-theme-toggle .fcap-theme-icon { transform: rotate(180deg); }

	/* ---- Slide-out drawer (the sidebar, repurposed as an off-canvas menu) ---- */
	.fcap-sidebar {
		position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
		width: min(300px, 82vw); flex-direction: column; align-items: stretch;
		padding: max(16px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom));
		transform: translateX(-100%);
		transition: transform 0.25s ease;
		overflow-y: auto; -webkit-overflow-scrolling: touch;
		box-shadow: 4px 0 28px rgba(0,0,0,0.35);
	}
	.fcap-client.is-drawer-open .fcap-sidebar { transform: translateX(0); }
	.fcap-sidebar-logo { display: none; }

	.fcap-drawer-backdrop {
		display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,0.45);
		opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
	}
	.fcap-client.is-drawer-open .fcap-drawer-backdrop { opacity: 1; pointer-events: auto; }

	/* Profile block at the top of the drawer */
	.fcap-drawer-profile {
		display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px;
		padding: 22px 16px 18px; margin: 0 12px 10px; border-radius: 14px;
		background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
	}
	.fcap-drawer-avatar {
		width: 56px; height: 56px; border-radius: 50%; margin-bottom: 6px;
		display: flex; align-items: center; justify-content: center;
		font-size: 19px; font-weight: 700; color: #fff; background: var(--fcap-accent);
	}
	.fcap-drawer-name { font-size: 14.5px; font-weight: 700; color: var(--fcap-sidebar-text-active); }
	.fcap-drawer-email { font-size: 12px; color: var(--fcap-sidebar-text); word-break: break-all; }
	.fcap-drawer-badge {
		margin-top: 8px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
		padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,0.1); color: var(--fcap-sidebar-text-active);
	}

	/* Menu items: bigger touch targets, icon + label, rounded, active state highlighted */
	.fcap-nav { flex: none; padding: 4px 10px; gap: 3px; }
	.fcap-nav-item { min-height: 48px; padding: 0 12px; border-radius: 12px; font-size: 14px; gap: 14px; }
	.fcap-nav-icon { font-size: 18px; width: 22px; }
	.fcap-nav-label { font-size: 14px; max-width: none; }
	.fcap-nav-item:active { background: rgba(255,255,255,0.1); }

	.fcap-theme-toggle { display: none; } /* replaced by the icon toggle in the mobile top bar */

	.fcap-drawer-logout-btn {
		display: flex; align-items: center; gap: 14px; min-height: 48px; margin: 10px 10px 0; padding: 0 12px;
		border: none; border-top: 1px solid rgba(255,255,255,0.1); border-radius: 12px; background: transparent;
		color: #ff8a8a; font-size: 14px; font-weight: 600;
	}
	.fcap-drawer-logout-btn:hover { background: rgba(255,255,255,0.06); }

	.fcap-cards { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }

	/* Rows/cards that cap their width on desktop should use the full available width here
	   instead of overflowing or leaving awkward empty space next to them. */
	.fcap-project-card, .fcap-invoice-card, .fcap-ticket-row, .fcap-meeting-row,
	.fcap-review-card, .fcap-review-prompt, .fcap-new-ticket-form, .fcap-ticket-thread,
	.fcap-request-form, .fcap-timeline-item, .fcap-chat-wrap, .fcap-upload-row, .fcap-file-row,
	.fcap-tickets-toolbar, .fcap-meetings-toolbar, .fcap-contract-card {
		max-width: 100%;
	}

	/* Prevent iOS Safari from auto-zooming the page when a field is focused (it does this
	   for any input/textarea with a computed font-size under 16px). */
	.fcap-form input, .fcap-form textarea,
	.fcap-new-ticket-form input, .fcap-new-ticket-form textarea, .fcap-ticket-thread textarea,
	.fcap-request-form input, .fcap-request-form textarea, .fcap-chat-input-row textarea {
		font-size: 16px;
	}
}

@media (max-width: 460px) {
	.fcap-cards { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
	.fcap-sidebar { width: min(280px, 86vw); }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
	.fca-portal * { animation: none !important; transition: none !important; }
}
