/* Sew & Grow — Front-end Quote Workspace styles
   Brand: #ee8585 primary, soft creams + greys, system fonts.
   Scoped under .sg-workspace so it never leaks to the rest of the theme.
   v1.0.5 — mobile full-width: trimmed nested L/R padding (workspace 12→8, card 11→6,
   row 10→9) so quote cards span the screen; shorter rows (row vert 8→7, column gap 16→6)
   v1.0.6 — mobile full-width pt.2: override Avada #main 5% L/R padding → 8px (scoped to
   .page-id-8876) and zero .sg-workspace's own 8px so the gutter no longer stacks
   v1.0.7 — fix #main override specificity (Avada uses html .fusion-body #main); now
   .page-id-8876.fusion-body #main so it actually wins. Page also added to LiteSpeed
   optm-exc (URI excludes) so the full CSS loads instead of a tree-shaken UCSS file
   v1.0.8 — subtle per-row Delete control: .sg-ws-row-wrap / .sg-ws-del-form /
   .sg-ws-del-btn. Desktop = right-gutter (no extra height); mobile = drops below
   the row with a 44px tap target. Branding/colours otherwise unchanged */

.sg-workspace {
	max-width: 1100px;
	margin: 30px auto;
	padding: 0 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: #2b2b2b;
	font-size: 15px;
	line-height: 1.5;
}

.sg-workspace * { box-sizing: border-box; }

/* Header */
.sg-ws-header {
	background: #fff;
	border: 1px solid #efe3e3;
	border-top: 4px solid #ee8585;
	border-radius: 6px;
	padding: 22px 28px;
	margin-bottom: 18px;
}
.sg-ws-header-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px;
	margin-bottom: 10px;
}
.sg-ws-title {
	font-size: 24px;
	font-weight: 700;
	margin: 0;
	color: #2b2b2b;
	letter-spacing: -0.3px;
}
.sg-ws-tabs {
	display: flex;
	gap: 6px;
}
.sg-ws-tabs a {
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 600;
	color: #777;
	text-decoration: none;
	border-radius: 4px;
	transition: all 0.15s ease;
}
.sg-ws-tabs a:hover { color: #ee8585; background: #fbf3f3; }
.sg-ws-tabs a.is-active { color: #fff; background: #ee8585; }
.sg-ws-sub {
	margin: 0;
	font-size: 13px;
	color: #777;
}

/* Flash messages */
.sg-ws-flash {
	padding: 14px 18px;
	border-radius: 6px;
	margin-bottom: 16px;
	font-size: 14px;
	border: 1px solid;
}
.sg-ws-flash-success { background: #f0fdf4; border-color: #b8e3c7; color: #1d6633; }
.sg-ws-flash-error   { background: #fdf2f2; border-color: #f0c0c0; color: #8a2828; }

/* Cards */
.sg-ws-card {
	background: #fff;
	border: 1px solid #ececec;
	border-radius: 6px;
	padding: 24px 28px;
	margin-bottom: 18px;
}
.sg-ws-card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px;
	border-bottom: 1px solid #f0f0f0;
	padding-bottom: 14px;
	margin-bottom: 18px;
}
.sg-ws-card-head h2 {
	font-size: 18px;
	font-weight: 700;
	margin: 0;
	color: #2b2b2b;
}
.sg-ws-ref-tag {
	font-size: 13px;
	font-weight: 500;
	color: #888;
	margin-left: 8px;
}
.sg-ws-empty {
	padding: 30px 0;
	text-align: center;
	color: #888;
	font-style: italic;
}

/* Buttons */
.sg-ws-btn {
	display: inline-block;
	padding: 9px 18px;
	font-size: 14px;
	font-weight: 600;
	border-radius: 4px;
	border: 1px solid transparent;
	background: #fff;
	color: #ee8585;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.15s ease;
	font-family: inherit;
	line-height: 1.3;
}
.sg-ws-btn-primary {
	background: #ee8585;
	color: #fff;
	border-color: #ee8585;
}
.sg-ws-btn-primary:hover { background: #e66c6c; border-color: #e66c6c; color: #fff; }
.sg-ws-btn-ghost {
	background: transparent;
	color: #777;
	border-color: #ddd;
}
.sg-ws-btn-ghost:hover { color: #ee8585; border-color: #ee8585; background: #fbf3f3; }
.sg-ws-btn-dashed {
	background: #fff;
	color: #ee8585;
	border: 1.5px dashed #ee8585;
	padding: 10px 20px;
	margin-top: 10px;
}
.sg-ws-btn-dashed:hover { background: #fdf2f2; }
.sg-ws-btn-large { padding: 12px 26px; font-size: 15px; }

/* v1.0.8: subtle per-row Delete control. The wrapper is relative so the delete
   form can sit in a reserved gutter at the row's right edge on desktop — adding
   NO extra height — then it drops below the row as a 44px tap target on mobile
   (see the @media block). Muted/secondary look so it never dominates the card. */
.sg-ws-row-wrap { position: relative; }
.sg-ws-row-wrap .sg-ws-request-row { padding-right: 86px; }
.sg-ws-del-form {
	position: absolute;
	top: 0;
	right: 10px;
	height: 100%;
	display: flex;
	align-items: center;
	margin: 0;
}
.sg-ws-del-btn {
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	border: 1px solid #e5d6d6;
	color: #b08a8a;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.2;
	padding: 5px 12px;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.15s ease;
}
.sg-ws-del-btn:hover,
.sg-ws-del-btn:focus {
	color: #fff;
	background: #d9534f;
	border-color: #d9534f;
	outline: none;
}

/* Request list rows */
.sg-ws-request-list { display: flex; flex-direction: column; gap: 8px; }
.sg-ws-request-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 18px;
	background: #fafafa;
	border: 1px solid #ececec;
	border-radius: 5px;
	color: #2b2b2b;
	text-decoration: none;
	transition: all 0.15s ease;
}
.sg-ws-request-row:hover {
	background: #fff;
	border-color: #ee8585;
	color: #2b2b2b;
	transform: translateX(2px);
	box-shadow: 0 2px 8px rgba(238,133,133,0.08);
}
.sg-ws-request-main { display: flex; gap: 14px; align-items: center; flex: 1; min-width: 0; }
.sg-ws-request-ref {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 13px;
	font-weight: 700;
	color: #ee8585;
	background: #fdf2f2;
	padding: 4px 9px;
	border-radius: 3px;
	flex-shrink: 0;
}
.sg-ws-request-name { font-weight: 600; font-size: 15px; }
.sg-ws-request-email { color: #888; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-ws-request-meta { display: flex; align-items: center; gap: 14px; flex-shrink: 0; font-size: 12px; color: #888; }
.sg-ws-request-counts { white-space: nowrap; }
.sg-ws-request-date { white-space: nowrap; }
.sg-ws-request-status {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	padding: 3px 9px;
	border-radius: 3px;
}
.sg-ws-status-pending { background: #fff8e1; color: #9b7a1f; }
.sg-ws-status-converted { background: #f0fdf4; color: #1d6633; }

@media (max-width: 700px) {
	.sg-ws-request-row { flex-direction: column; align-items: flex-start; }
	.sg-ws-request-main { flex-wrap: wrap; }
	.sg-ws-request-meta { align-self: stretch; justify-content: space-between; }
}

/* Forms */
.sg-ws-form { position: relative; }
.sg-ws-fs {
	border: 1px solid #ececec;
	border-radius: 5px;
	padding: 18px 22px;
	margin: 0 0 18px;
	background: #fdfdfd;
}
.sg-ws-fs legend {
	font-size: 14px;
	font-weight: 700;
	color: #ee8585;
	padding: 0 8px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}
.sg-ws-hint {
	margin: -4px 0 14px;
	font-size: 13px;
	color: #888;
}
.sg-ws-fineprint {
	margin: 18px 0 0;
	font-size: 12px;
	color: #888;
	border-top: 1px solid #eee;
	padding-top: 14px;
}
.sg-ws-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 14px;
}
.sg-ws-grid-3 {
	grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 600px) {
	.sg-ws-grid-3 { grid-template-columns: 1fr; }
}
.sg-ws-grid-span-2 { grid-column: span 2; }
@media (max-width: 600px) {
	.sg-ws-grid-span-2 { grid-column: span 1; }
}
.sg-ws-form label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: #555;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1.5;
}
.sg-ws-req { color: #ee8585; }
.sg-ws-form input[type="text"],
.sg-ws-form input[type="email"],
.sg-ws-form input[type="number"],
.sg-ws-form select,
.sg-ws-form textarea {
	width: 100%;
	padding: 9px 12px;
	margin-top: 4px;
	border: 1px solid #d8d8d8;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 400;
	color: #2b2b2b;
	background: #fff;
	font-family: inherit;
	text-transform: none;
	letter-spacing: normal;
	transition: border 0.15s ease;
}
.sg-ws-form textarea { min-height: 70px; resize: vertical; }
.sg-ws-form input:focus,
.sg-ws-form select:focus,
.sg-ws-form textarea:focus {
	outline: none;
	border-color: #ee8585;
	box-shadow: 0 0 0 2px rgba(238,133,133,0.15);
}

.sg-ws-actions {
	margin-top: 18px;
	padding-top: 18px;
	border-top: 1px solid #eee;
}

/* "Add items to this quote" subheadings */
.sg-ws-add-subhead {
	font-size: 13px;
	font-weight: 700;
	color: #555;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin: 18px 0 6px;
	padding-top: 14px;
	border-top: 1px dashed #e8d6d6;
}
.sg-ws-add-subhead:first-of-type {
	margin-top: 6px;
	padding-top: 0;
	border-top: none;
}

/* Custom line items */
.sg-ws-custom-row {
	background: #fafafa;
	border: 1px solid #e0e0e0;
	border-radius: 4px;
	padding: 14px 16px 14px 16px;
	margin: 10px 0;
	position: relative;
}
.sg-ws-custom-remove {
	position: absolute;
	top: 8px;
	right: 8px;
	background: transparent;
	border: none;
	color: #c44;
	font-size: 22px;
	font-weight: bold;
	cursor: pointer;
	line-height: 1;
	padding: 4px 8px;
}
.sg-ws-custom-remove:hover { color: #8a2828; }

/* Review screen */
.sg-ws-customer-block {
	background: #fafafa;
	border: 1px solid #ececec;
	border-radius: 5px;
	padding: 14px 18px;
	margin-bottom: 18px;
}
.sg-ws-customer-block p { margin: 0 0 6px; font-size: 14px; color: #2b2b2b; }
.sg-ws-customer-block p:last-child { margin-bottom: 0; }
.sg-ws-cust-label {
	display: inline-block;
	min-width: 80px;
	font-size: 11px;
	font-weight: 700;
	color: #888;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.sg-ws-rev-item {
	background: #fafafa;
	border: 1px solid #e0e0e0;
	border-radius: 5px;
	padding: 14px 18px;
	margin: 0 0 12px;
	transition: all 0.2s ease;
}
.sg-ws-rev-item.is-removed,
.sg-ws-rev-item.is-rejected {
	border-color: #d0a0a0;
	background: #fdf2f2;
	opacity: 0.85;
}
.sg-ws-rev-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 12px;
}
.sg-ws-rev-name { flex: 1; font-size: 15px; font-weight: 700; color: #2b2b2b; }
.sg-ws-rev-tag {
	font-size: 10px;
	padding: 3px 8px;
	border-radius: 3px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 700;
	flex-shrink: 0;
}
.sg-ws-tag-wc     { background: #e3f1ff; color: #1565c0; }
.sg-ws-tag-custom { background: #fff3e0; color: #9b5e1f; }

.sg-ws-rev-status {
	display: flex;
	align-items: center;
	gap: 18px;
	margin: 8px 0;
}
.sg-ws-rev-status label {
	font-size: 13px;
	font-weight: 500;
	color: #444;
	cursor: pointer;
	text-transform: none;
	letter-spacing: normal;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.sg-ws-rev-status input[type="radio"] { width: auto; margin: 0; }

.sg-ws-rev-reason {
	display: none;
	margin-top: 8px;
}
.sg-ws-rev-reason.is-visible { display: block; }
.sg-ws-rev-reason textarea {
	background: #fffdf2;
	min-height: 50px;
}

/* ──────────────────────────────────────────────────────────────────────────
   MOBILE — phone-width fixes (≤ 640 px)
   All rules live inside max-width queries so desktop is completely untouched.
   ────────────────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {

	/* 5 + 4. Reduce top gap; prevent horizontal bleed; pad bottom so the
	         fixed WA button (bottom:30px, ~64px tall) and Avada scroll-to-top
	         (bottom:30px, 44px tall) never cover the last card row */
	.sg-workspace {
		margin-top: 10px;
		/* L/R gutter is provided by the .page-id-8876 #main override at the end
		   of this block (8px) — keep this 0 so the two don't stack */
		padding: 0 0 110px;
		max-width: 100%;
		overflow-x: hidden;
	}

	/* 1. Headings — reduce so they read on one line without giant single words */
	.sg-ws-title {
		font-size: 18px;
		letter-spacing: 0;
	}
	.sg-ws-card-head h2 {
		font-size: 15px;
		letter-spacing: 0;
	}

	/* Header box — tighter padding, title stacks above the nav */
	.sg-ws-header {
		padding: 14px 16px;
	}
	.sg-ws-header-row {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	/* 2. Tab/nav buttons — full-width stacked with 44px tap targets */
	.sg-ws-tabs {
		flex-direction: column;
		gap: 6px;
		width: 100%;
	}
	.sg-ws-tabs a {
		display: flex;
		align-items: center;
		justify-content: center;
		min-height: 44px;
		padding: 10px 16px;
		border: 1.5px solid #e0d0d0;
		border-radius: 5px;
		background: #fdf9f9;
		color: #777;
		font-size: 14px;
		font-weight: 600;
		text-align: center;
	}
	.sg-ws-tabs a:hover,
	.sg-ws-tabs a.is-active {
		background: #ee8585;
		color: #fff;
		border-color: #ee8585;
	}

	/* Card padding — tighter on mobile; minimal L/R so the quote rows inside
	         span nearly the full screen width (only the .sg-workspace 8px gutter
	         plus this 6px insets them from the edge) */
	.sg-ws-card {
		padding: 10px 6px;
	}
	.sg-ws-card-head {
		gap: 8px;
		padding-bottom: 8px;
		margin-bottom: 10px;
	}

	/* 7. Compact quote rows — reduce padding, internal gaps, and font sizes
	         so more rows fit on screen at once without losing readability */
	.sg-ws-request-list { gap: 4px; }
	/* Tighter L/R so text starts closer to the card edge (item 2); tighter
	         vertical padding + a small column gap (overriding the desktop 16px
	         that becomes a tall vertical gap once the row stacks) shortens each
	         card (item 3) */
	.sg-ws-request-row  { padding: 7px 9px; gap: 6px; }
	.sg-ws-request-main { gap: 8px; }
	.sg-ws-request-name { font-size: 13px; }
	.sg-ws-request-email { font-size: 12px; }
	.sg-ws-request-ref  { font-size: 12px; padding: 3px 7px; }

	/* 3. Badge / meta overflow — wrap row contents so badges drop to a new
	         line rather than bleeding past the right viewport edge */
	.sg-ws-request-row {
		overflow: hidden;
	}
	.sg-ws-request-meta {
		flex-wrap: wrap;
		gap: 6px;
	}

	/* Badges from class-quote-status.php carry inline display:inline-block;
	   override white-space so text wraps instead of escaping the card */
	.sg-status-badge {
		white-space: normal !important;
		word-break: break-word;
		max-width: 100%;
	}

	/* 6. Tap targets — all .sg-ws-btn elements */
	.sg-ws-btn {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	.sg-ws-btn-large {
		width: 100%;
		justify-content: center;
	}

	/* Inline-styled action links inside quote rows (e.g. "Resend Invoice")
	   that use no class — target by nearest known ancestor */
	.sg-ws-request-row a:not(.sg-ws-btn) {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding-top: 8px;
		padding-bottom: 8px;
	}

	/* v1.0.8: Delete control on mobile — drop it below the row (instead of the
	   desktop right-gutter) and give it a full 44px tap target. Restores the
	   compact row padding (no reserved right gutter needed when stacked). */
	.sg-ws-row-wrap .sg-ws-request-row { padding-right: 9px; }
	.sg-ws-del-form {
		position: static;
		height: auto;
		justify-content: flex-end;
		padding: 2px 2px 4px;
	}
	.sg-ws-del-btn {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		padding: 8px 18px;
		font-size: 13px;
	}

	/* Avada wrapper override — the only horizontal padding OUTSIDE this
	   stylesheet on mobile comes from Avada's #main, which applies
	   padding-left/right: 5% (≈19px on a ~390px phone) under its own
	   @media (max-device-width:640px) rule. (.fusion-row is already zeroed
	   below 1023px; .post-content/.hentry add none.) Override it to a small
	   8px gutter so the workspace spans nearly the full screen width.
	   Scoped to .page-id-8876 (the /admin-quotes/ page) so no other page is
	   touched; this stylesheet also only loads on that page. Avada's rule is
	   `html .fusion-body #main` (1 id, 1 class, 1 type); matching both body
	   classes here gives (1 id, 2 classes, 0 types) which wins on the class
	   column without needing !important. */
	.page-id-8876.fusion-body #main {
		padding-left: 8px;
		padding-right: 8px;
	}
}
