/*
Theme Name: UT CRM Theme
Description: Minimal chrome for a UT-CRM install — a dark app-style header with a tab menu (WordPress menus), the CRM body flush underneath, no page titles, no dead space. HubSpot-like layout.
Version: 1.1.11
Author: Pham Ha
Text Domain: ut-crm-theme
*/

/* ==========================================================================
   Reset / base
   ========================================================================== */
* { box-sizing: border-box; }
html, body {
	margin: 0;
	padding: 0;
}
body {
	font-family: Roboto, Arial, "Segoe UI", "Helvetica Neue", -apple-system, BlinkMacSystemFont, sans-serif;
	font-size: 14px;
	line-height: 1.5;
	color: #1e293b;
	background: #f6f8fa;
}
img { max-width: 100%; height: auto; }
a { color: #0088b0; }

/* ==========================================================================
   Header — dark app bar, flush with the body (no gap below).
   ========================================================================== */
.crm-header {
	display: flex;
	align-items: stretch;
	gap: 18px;
	background: #213343;
	color: #eaf0f6;
	padding: 0 18px;
	min-height: 70px;
}
.crm-header__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	text-decoration: none;
	white-space: nowrap;
}
.crm-header__brand:hover { color: #fff; }
.crm-header__logo-dot {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #1099c4;
	display: inline-block;
	flex: 0 0 auto;
}

/* --- Tab menu (WP menu, location: crm_primary) --------------------------- */
.crm-nav { display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0; }
.crm-nav ul {
	display: flex;
	align-items: stretch;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
}
.crm-nav li { position: relative; display: flex; }
.crm-nav a {
	display: flex;
	align-items: center;
	padding: 0 14px;
	color: #cbd6e2;
	text-decoration: none;
	font-size: 14px;
	font-weight: 500;
	white-space: nowrap;
}
.crm-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
/* Active tab — the teal underline. */
.crm-nav .current-menu-item > a,
.crm-nav .current-menu-ancestor > a,
.crm-nav .current_page_item > a,
.crm-nav .current_page_ancestor > a {
	color: #fff;
	background: #2a5275;
}
/* Parent-with-children caret. */
.crm-nav .menu-item-has-children > a::after {
	content: "";
	width: 6px;
	height: 6px;
	margin-left: 7px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-2px);
	opacity: 0.7;
}
/* Dropdown (one level is plenty for an app bar). */
.crm-nav .sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 1000;
	flex-direction: column;
	min-width: 200px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
	padding: 6px 0;
}
.crm-nav li:hover > .sub-menu,
.crm-nav li:focus-within > .sub-menu { display: flex; }
.crm-nav .sub-menu li { display: block; }
.crm-nav .sub-menu a {
	display: block;
	padding: 8px 14px;
	color: #1e293b;
	border: 0;
	font-weight: 400;
}
.crm-nav .sub-menu a:hover { background: #f1f5f9; color: #0088b0; }
/* The current page INSIDE a dropdown: a light tint, a shade deeper than the
   hover — not the dark tab colour of the top bar, which it used to inherit
   from the rule above (the dropdown is white). */
.crm-nav .sub-menu .current-menu-item > a,
.crm-nav .sub-menu .current_page_item > a { color: #0088b0; font-weight: 600; background: #e3eaf1; }

/* --- Right cluster: search + user dropdown ------------------------------- */
.crm-header__right {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
	flex: 0 0 auto;
}

/* --- Search box: dark-header repaint of the PLUGIN's component ------------
   The box itself (markup, typeahead, base styling) ships with UT-CRM as
   .ut-crm-gsearch (embedded via ut_crm_global_search() in header.php). The
   theme only recolours it for the dark app bar; the dropdown keeps the
   plugin's light card styling, which reads correctly against the page. */
.crm-header .ut-crm-gsearch {
	background: #334c62;
	border-color: #3d6695;
}
.crm-header .ut-crm-gsearch__input { color: #ddd; }
.crm-header .ut-crm-gsearch__input::placeholder { color: #94a3b8; }
/* Freeze the autofill repaint so the browser's light highlight never paints
   over the dark pill (a transparent inset shadow would reveal it instead). */
.crm-header .ut-crm-gsearch__input:-webkit-autofill,
.crm-header .ut-crm-gsearch__input:-webkit-autofill:hover,
.crm-header .ut-crm-gsearch__input:-webkit-autofill:focus,
.crm-header .ut-crm-gsearch__input:autofill {
	-webkit-text-fill-color: #ddd;
	caret-color: #ddd;
	transition: background-color 100000s 0s, color 100000s 0s;
}
/* Light "clear letters" glyph + reset ✕ on the dark pill. */
.crm-header .ut-crm-gsearch__input::-webkit-search-cancel-button {
	background-image: url( "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e2e8f0' stroke-width='2.5' stroke-linecap='round'><line x1='6' y1='6' x2='18' y2='18'/><line x1='18' y1='6' x2='6' y2='18'/></svg>" );
}
.crm-header .ut-crm-gsearch__clear { color: #cbd6e2; }
.crm-header .ut-crm-gsearch__clear:hover { background: rgba( 255, 255, 255, 0.14 ); color: #fff; }
.crm-header .ut-crm-gsearch__btn { background: #3766ce; transition: all .3s;}
.crm-header .ut-crm-gsearch__btn:hover { background: #1d4ed8; color: #fff;}

/* --- Notifications bell (plugin pill relocated into the header) ----------- */
/* Plugin v0.87.273 removed the List View / Table Look statusbars, so the header
   bell is the only pill on the page — no in-content copy left to suppress. */

/* Header bell: strip the light chip look + the "notifications" word — just a
   light bell icon + count badge, matching the app-bar. */
.crm-header .ut-crm-notif-bar { display: inline-flex; align-items: center; }
.crm-header .ut-crm-notif-bar__chip {
	background: none;
	border: 0;
	padding: 4px;
	color: #cbd6e2;
	position: relative;
}
.crm-header .ut-crm-notif-bar__chip:hover { color: #fff; }
.crm-header .ut-crm-notif-bar__icon { font-size: 17px; line-height: 1; }
.crm-header .ut-crm-notif-bar__text { display: none; }
/* Count as a small red badge pinned to the bell corner. */
.crm-header .ut-crm-notif-bar__count {
	position: absolute;
	top: -1px;
	right: -2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: #ef4444;
	color: #fff;
	font-size: 10px;
	line-height: 16px;
	text-align: center;
}
/* Pop hangs below-right (bell is near the header's right edge). */
.crm-header .ut-crm-notif-bar__pop { left: auto; right: 0; }

/* Avatar shared look */
.crm-header__avatar {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #1099c4;
	color: #04283a;
	font-weight: 700;
	font-size: 13px;
	text-transform: uppercase;
	flex: 0 0 auto;
}

/* User dropdown — avatar is the trigger; opens on hover (desktop) OR
   focus-within (tap on mobile focuses the button → menu opens; tapping away
   blurs → closes). Same pure-CSS pattern as the nav sub-menu. */
.crm-userdd { position: relative; display: flex; align-items: center; }
.crm-userdd__trigger {
	border: 0;
	padding: 0;
	background: none;
	cursor: pointer;
	display: inline-flex;
	border-radius: 50%;
	line-height: 0;
}
.crm-userdd__trigger:focus-visible {
	outline: 2px solid #1099c4;
	outline-offset: 2px;
}
.crm-userdd__menu {
	display: none;
	position: absolute;
	top: 100%;
	right: 0;
	margin-top: 8px;
	z-index: 1000;
	min-width: 180px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
	padding: 6px 0;
	/* NO overflow:hidden — it would clip the ::before hover bridge that sits
	   ABOVE the menu (top:-8px), leaving the 8px gap "dead" so the menu closed
	   the moment the cursor left the avatar. The 6px vertical padding keeps the
	   rounded corners clean without clipping. */
}
/* A hover bridge over the 8px gap so moving from the avatar to the menu never
   crosses "dead air" that would close it. */
.crm-userdd__menu::before {
	content: "";
	position: absolute;
	top: -8px;
	left: 0;
	right: 0;
	height: 8px;
}
.crm-userdd:hover .crm-userdd__menu,
.crm-userdd:focus-within .crm-userdd__menu { display: block; }
.crm-userdd__name {
	padding: 8px 14px;
	font-weight: 600;
	color: #1e293b;
	border-bottom: 1px solid #f1f5f9;
	margin-bottom: 4px;
	white-space: nowrap;
}
.crm-userdd__item {
	display: block;
	padding: 8px 14px;
	color: #1e293b;
	text-decoration: none;
	font-size: 13px;
	white-space: nowrap;
}
.crm-userdd__item:hover { background: #f1f5f9; color: #0088b0; }
.crm-userdd__login { color: #cbd6e2; text-decoration: none; font-size: 13px; }
.crm-userdd__login:hover { color: #fff; }

/* ==========================================================================
   Body (.crm-container — NOT "crm-main": that name collides with a section custom class already used inside the CRM schemas) — the CRM starts IMMEDIATELY below the header. No title, no hero,
   no max-width strait-jacket (CRM grids are wide), just working padding.
   ========================================================================== */
.crm-container {
	padding: 15px 15px 80px;
	background: #ddd;
}
/* --- Page layouts (page templates) ---------------------------------------
   .crm-container keeps the page background full-bleed; .crm-inner is what each
   layout constrains, so a narrow page still paints its background edge to
   edge. Pick per page in the editor: Page Attributes → Template.
     default            → 1200px, centred (page.php)
     Full width         → edge to edge (template-fullwidth.php)
     Content + Sidebar  → 900px + 300px widget column (template-sidebar.php) */
.crm-inner { width: 100%; }
.crm-layout--default .crm-inner {
	max-width: 1200px;
	margin-inline: auto;
	background: #fff;   /* owner 03/11: a white sheet — previews posts (contracts, day snippets) as a page */
	padding: 50px;
}
@media (max-width: 640px) {
	.crm-layout--default .crm-inner { padding: 16px; }   /* a phone keeps its width for the content */
	.crm-container.crm-layout--default { padding: 0; }                       /* 1.1.9 (owner): no grey frame around the page on a phone */
	.mail .crm-container {padding-left: 0; padding-right: 0;}
	.ut-crm-mbx__foot {max-width: calc(100% - 30px); margin: 20px auto;}
	.ut-crm-mbx__bar {max-width: calc(100% - 30px); margin: 0 auto 10px auto !important;}
}


.crm-layout--full .crm-inner {
	max-width: none;
}
/* 1.1.11 — an App page (template-app.php): no dark bar above, so a white page
   with a little working room instead of the grey frame. */
.crm-app .crm-container { padding: 12px 16px 16px; background: #fff; }
@media (max-width: 640px) {
	.crm-app .crm-container { padding: 8px 0 12px; }
}
.crm-layout--sidebar .crm-inner {
	max-width: 1224px;   /* 900 + 300 + 24 gap */
	margin-inline: auto;
	display: grid;
	grid-template-columns: minmax(0, 900px) 300px;
	gap: 24px;
	align-items: start;
}
.crm-sidebar {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}
.crm-widget {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 14px 16px;
}
.crm-widget__title {
	margin: 0 0 10px;
	font-size: 13px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #64748b;
}
.crm-widget ul { margin: 0; padding-left: 18px; }
/* Content column must be allowed to shrink or a wide CRM grid would blow the
   track out (min-width:auto is the grid default). */
.crm-layout--sidebar .crm-content { min-width: 0; }
@media ( max-width: 1024px ) {
	.crm-layout--sidebar .crm-inner { grid-template-columns: minmax(0, 1fr); }
}

/* Entry titles are never printed by the templates; kill any block-level H1
   a page might carry anyway. */
.crm-container .entry-title, .crm-container .wp-block-post-title { display: none; }

/* Comments/asides WP might inject on generic templates — keep it lean. */
.crm-container .post-edit-link { display: none; }

/* --- Basic table format --------------------------------------------------
   A sensible default for a PLAIN table dropped into a CRM page (a Gutenberg
   table block, raw HTML). The plugin's own tables (ut-crm-*) ship their own
   styling — excluded here so this never fights them. */
.crm-container table:not([class*="ut-crm"]) {
	border-collapse: collapse;
	width: 100%;
	margin: 0 0 14px;
	background: #fff;
	font-size: 13px;
}
.crm-container table:not([class*="ut-crm"]) th,
.crm-container table:not([class*="ut-crm"]) td {
	border: 1px solid #eee;
	padding: 8px 10px;
	text-align: left;
	vertical-align: top;
}
.crm-container table:not([class*="ut-crm"]) th {
	background: #f8fafc;
	font-weight: 600;
}

/* --- Mobile burger (≤900px; 782 until 1.1.8) ----------------------------------------------
   The tab menu folds behind a burger at the left of the bar; tapping it opens
   the menu as a full-width panel below the bar (nav.js toggles
   .is-nav-open). Sub-menus show expanded and indented — a hover dropdown
   means nothing on a touch screen. */
.crm-header__burger { display: none; }

@media ( max-width: 900px ) {
	.crm-header { flex-wrap: wrap; padding: 6px 10px; row-gap: 6px; }
	.crm-header__burger {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		align-self: center;
		order: -1;
		width: 40px;
		height: 40px;
		margin-right: -8px;
		padding: 0;
		border: 0;
		border-radius: 8px;
		background: transparent;
		color: #eaf0f6;
		cursor: pointer;
	}
	.crm-header__burger:hover,
	.crm-header.is-nav-open .crm-header__burger { background: rgba( 255, 255, 255, 0.1 ); color: #fff; }
	.crm-header__brand { padding: 4px 0; }
	.crm-header__right { order: 2; }        /* search + avatar stay on the top row, right side */
	.crm-nav { display: none; order: 3; flex-basis: 100%; }
	.crm-header.is-nav-open .crm-nav { display: block; padding-bottom: 6px; border-top: 1px solid rgba( 255, 255, 255, 0.1 ); }
	.crm-nav ul { flex-direction: column; flex-wrap: nowrap; }
	.crm-nav li { display: block; }
	.crm-nav a { padding: 12px 10px; font-size: 15px; border-radius: 6px; }
	.crm-nav .menu-item-has-children > a::after { display: none; }
	.crm-nav .sub-menu {
		display: flex;
		position: static;
		min-width: 0;
		padding: 0 0 0 16px;
		background: transparent;
		border: 0;
		box-shadow: none;
	}
	.crm-nav .sub-menu a { color: #cbd6e2; padding: 10px 10px; }
	.crm-nav .sub-menu a:hover { background: rgba( 255, 255, 255, 0.06 ); color: #fff; }
	.crm-nav .sub-menu .current-menu-item > a,
	.crm-nav .sub-menu .current_page_item > a { color: #fff; background: #2a5275; }
	.crm-header .ut-crm-gsearch__input { width: 130px; }
}

.ut-crm-tl-wrapper, .ut-crm-lv-wrapper {
    background: unset;
    padding: 0;
}
