/* =========================================================================
 * Account — dashboard: nav column, stat tiles, content, reset, responsive, greeting
 * =========================================================================
 * Owns: the logged-in dashboard shell and its navigation; the stat tiles;
 * WooCommerce content inside the dashboard card (orders table, addresses,
 * notification list); the password-reset screen; every responsive rule for
 * the screens above; and the greeting headline effect.
 *
 * Sections 5, 6, 7, 7b, 8 and 11 of the original file.
 *
 * IMPORTANT: section 8 holds the shared media queries (1023 / 767 / 420 / 380
 * and reduced-motion) for BOTH this file and the layout file, because that is
 * where they were. They must keep loading after account-layout.css — moving
 * this file earlier would leave the layout file's desktop rules unoverridden
 * on a phone.
 *
 * Loaded: account pages only, after account-layout.css
 *
 * Part of the account design system. Split out of a single 2135-line
 * account.css in stage 6 of the architecture work; the rules below are
 * unchanged, in their original order. The order matters: these files are
 * enqueued in sequence (theme -> layout -> dashboard -> address) and the
 * cascade between them is the cascade that used to live inside one file.
 * ========================================================================= */

/* =========================================================================
 * 5. Logged-in dashboard: nav column + content card
 * ========================================================================= */

.mg-acc__dash {
	display: grid;
	grid-template-columns: 264px minmax(0, 1fr);
	gap: var(--mg-acc-s-6);
	max-width: none;
	margin: 0;
	align-items: start;
	flex: 1 1 auto;
}

/* Nothing is stretched to fill the viewport. Every card is exactly as tall as
 * its own content, so there is never an empty band under the last element. */
.mg-account .mg-acc__dash,
.mg-account .mg-acc__grid {
	flex: 0 0 auto;
	align-items: start;
}

.mg-account .mg-acc__grid {
	align-items: center;
}

/* --- left column: who + menu -------------------------------------- */
.mg-side {
	border: 1px solid var(--mg-acc-line);
	border-radius: var(--mg-acc-r-sm);
	background: var(--mg-acc-surface);
	align-self: start;
	overflow: hidden;
	position: sticky;
	top: 20px;
}

.mg-side__who {
	display: flex;
	align-items: center;
	gap: var(--mg-acc-s-3);
	padding: 18px;
	border-bottom: 1px solid var(--mg-acc-line);
}

.mg-side__avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--mg-acc-ink);
	color: var(--mg-acc-surface);
	display: grid;
	place-items: center;
	font-size: var(--mg-acc-fs-base);
	font-weight: 600;
	flex: 0 0 auto;
}

.mg-side__who b {
	display: block;
	font-size: var(--mg-acc-fs-base);
	line-height: 1.5;
}

.mg-side__who small {
	display: block;
	font-size: var(--mg-acc-fs-xs);
	color: var(--mg-acc-ink-muted);
	direction: ltr;
	text-align: right;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 150px;
}

.mg-side .woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.mg-side .woocommerce-MyAccount-navigation li {
	margin: 0;
	border: 0;
	display: block;
}

/* Every item is a full-width button of one fixed height, so the column reads
 * as one stack instead of links of drifting length. Height comes from a token
 * so it still shrinks on phones with the rest of the controls. */
.mg-side .woocommerce-MyAccount-navigation li a {
	position: relative;
	overflow: hidden;
	display: flex;
	align-items: center;
	gap: 10px;
	width: 100%;
	min-height: var(--mg-acc-h-control-sm);
	box-sizing: border-box;
	padding: 0 14px;
	border-radius: var(--mg-acc-r-xs);
	white-space: nowrap;
	font-size: var(--mg-acc-fs-base);
	color: var(--mg-acc-ink-soft);
	text-decoration: none;
	/* Light grey resting fill, as asked: the menu should not read as a row of
	 * black blocks. --mg-acc-surface-sunken is #fafafa in the default theme, so a
	 * step lighter than that is used instead to stay visible on white. */
	background: var(--mg-nav-btn-bg);
	transition: transform 120ms ease-out, background 0.14s ease, color 0.14s ease;
}

.mg-side .woocommerce-MyAccount-navigation li a::before {
	content: "";
	width: 6px;
	height: 6px;
	border-radius: 50%;
	border: 1px solid var(--mg-acc-line-mid);
	flex: 0 0 auto;
	transition: background 0.14s ease, border-color 0.14s ease;
}

.mg-side .woocommerce-MyAccount-navigation li a:hover {
	background: var(--mg-nav-btn-bg-hover);
	color: var(--mg-acc-ink);
}

.mg-side .woocommerce-MyAccount-navigation li.is-active a {
	background: var(--mg-nav-btn-bg-active);
	color: var(--mg-acc-ink);
	font-weight: 600;
}

.mg-side .woocommerce-MyAccount-navigation li.is-active a::before {
	background: var(--mg-acc-ink);
	border-color: var(--mg-acc-ink);
}

/* Logout keeps its own tone but sits in the same stack, so nothing floats. */
.mg-side .woocommerce-MyAccount-navigation-link--customer-logout {
	margin-top: 4px !important;
}

.mg-side .woocommerce-MyAccount-navigation-link--customer-logout a {
	color: var(--mg-acc-ink-danger);
}

.mg-side .woocommerce-MyAccount-navigation-link--customer-logout a:hover {
	background: var(--mg-nav-btn-bg-hover);
	color: var(--mg-acc-ink-danger);
}

.mg-side .woocommerce-MyAccount-navigation-link--customer-logout a::before {
	border-color: currentColor;
}


/* --- right column: content card ------------------------------------ */
.mg-acc__dash .woocommerce-MyAccount-content {
	border: 1px solid var(--mg-acc-line);
	border-radius: var(--mg-acc-r-sm);
	padding: clamp(20px, 2.4vw, 32px);
	background: var(--mg-acc-surface);
	font-size: var(--mg-acc-fs-base);
	min-width: 0; /* lets wide order tables shrink instead of overflowing */

	/* WooCommerce core ships float + width:68% for this element. Inside a grid
	 * those are ignored for layout yet `width` still applies, which left the
	 * card at two-thirds of its column with dead space beside it. */
	width: 100% !important;
	max-width: none !important;
	float: none !important;
}

/* WooCommerce core also puts width:30% on the navigation element itself, not
 * just the column around it. The aside above is 100% wide, but this element
 * was still a 30% box inside it, which is what squeezed every menu button
 * down to a sliver. Its own width has to be reset too. */
.mg-acc__dash .mg-side .woocommerce-MyAccount-navigation {
	width: 100% !important;
	max-width: none !important;
	float: none !important;
}

/* Same story for the navigation column: core gives it float + width:30%. */
.mg-acc__dash .mg-side {
	width: 100% !important;
	max-width: none !important;
	float: none !important;
}

/* =========================================================================
 * 6. Dashboard stat tiles
 * ========================================================================= */

.mg-acc__dash .mg-stats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--mg-acc-s-3);
	margin: 0 0 var(--mg-acc-s-6);
	max-width: none;
}

.mg-acc__dash .mg-stat {
	background: var(--mg-acc-surface-sunken);
	border: 1px solid var(--mg-acc-line);
	border-radius: var(--mg-acc-r-sm);
	padding: 16px 18px;
}

.mg-acc__dash .mg-stat small {
	display: block;
	font-size: var(--mg-acc-fs-xs);
	color: var(--mg-acc-ink-muted);
	margin-bottom: 6px;
}

.mg-acc__dash .mg-stat b {
	font-family: var(--mg-acc-font-display);
	font-weight: 500;
	font-size: 22px;
	line-height: 1.2;
	display: block;
}

.mg-acc__dash .mg-stat span {
	font-size: var(--mg-acc-fs-xs);
	color: var(--mg-acc-ink-faint);
}

/* =========================================================================
 * 7. WooCommerce content inside the dashboard card
 * ========================================================================= */

.mg-acc__dash .woocommerce-MyAccount-content > h2,
.mg-acc__dash .woocommerce-MyAccount-content > h3 {
	font-family: var(--mg-acc-font-display);
	font-weight: 500;
	font-size: var(--mg-acc-fs-lg);
	margin: 0 0 var(--mg-acc-s-4);
	line-height: 1.5;
}

.mg-acc__dash .woocommerce-MyAccount-content p {
	font-size: var(--mg-acc-fs-base);
	color: var(--mg-acc-ink-soft);
}

.mg-acc__dash .woocommerce-MyAccount-content a {
	color: var(--mg-acc-ink);
	text-underline-offset: 3px;
}

/* -------------------------------------------------------------------------
 * Saved addresses: two cards, built like a business card
 *
 * Design A ("index card"): white card, hairline edge, and one 3px accent rule
 * on the reading edge as the only colour. The address block takes the free
 * space so the action lands on the same baseline in both cards.
 *
 * Layout detail: WooCommerce puts the action INSIDE the <header> and the
 * address AFTER it, so a plain block layout would put the button above the
 * address. `display: contents` on the header promotes the heading and the link
 * to flex items of the card, which lets `order` place them as
 * heading → address → button without touching the template.
 *
 * Empty vs filled is decided in CSS via :has(): a formatted address always
 * contains <br>, the "not set up yet" sentence never does.
 * ------------------------------------------------------------------------- */
.mg-acc__dash .woocommerce-MyAccount-content .col2-set,
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Addresses {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--mg-acc-s-4);
	width: 100% !important;
	float: none !important;
	align-items: stretch;
}

.mg-acc__dash .woocommerce-MyAccount-content .u-column1,
.mg-acc__dash .woocommerce-MyAccount-content .u-column2 {
	display: block;
	width: 100% !important;
	float: none !important;
	margin: 0 !important;
}

.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address {
	position: relative;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 232px;
	padding: 20px 20px 18px;
	border: 1px solid var(--mg-acc-line-strong);
	border-radius: var(--mg-acc-r-md);
	background: var(--mg-acc-surface);
	/* A single address is the norm on this store, so cap the card rather than
	 * letting it stretch the full content column and read as a banner. The two-
	 * column grid case already keeps it narrower than this, so the cap is inert
	 * there. */
	max-width: 520px !important;
}

/* The accent spine: the single point of colour, on the reading edge. */
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	inset-inline-end: 0;
	width: 3px;
	background: var(--mg-acc-accent);
}

/* WooCommerce adds ::before/::after to .col2-set as a float clearfix.
 * Inside a GRID container those pseudo-elements become real grid items, so
 * they consumed two cells and pushed the second card onto its own row - which
 * is why the two cards sat diagonally. There are no floats left to clear, so
 * they are removed outright. */
.mg-acc__dash .woocommerce-MyAccount-content .col2-set::before,
.mg-acc__dash .woocommerce-MyAccount-content .col2-set::after,
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Addresses::before,
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Addresses::after {
	content: none;
	display: none;
}

/* Promote the heading and the link out of the header so they can be ordered
 * around the address. */
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address-title {
	display: contents;
}

.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address-title h2,
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address-title h3 {
	order: 1;
	margin: 0 0 var(--mg-acc-s-4);
	font-size: 15.5px;
	font-weight: 700;
	line-height: 1.5;
	white-space: normal;
	text-align: right; /* the parent theme centres every h2 on the site */
}

/* Small kicker above the title. Content comes from CSS so the
 * template keeps its own heading untouched.
 *
 * The kicker text is Persian («آدرس», «حمل و نقل»), so the 0.16em tracking
 * that shipped here separated the joined letters, and 10px is below the point
 * where Persian is legible at all. 13px, untracked, still reads as a label
 * rather than a heading. */
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address-title h2::before,
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address-title h3::before {
	display: block;
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0;
	line-height: 1.8;
	color: var(--mg-acc-ink-muted);
	margin-bottom: 7px;
}

.mg-acc__dash .woocommerce-MyAccount-content .u-column1 .woocommerce-Address-title h2::before,
.mg-acc__dash .woocommerce-MyAccount-content .u-column1 .woocommerce-Address-title h3::before {
	content: "آدرس";
}

.mg-acc__dash .woocommerce-MyAccount-content .u-column2 .woocommerce-Address-title h2::before,
.mg-acc__dash .woocommerce-MyAccount-content .u-column2 .woocommerce-Address-title h3::before {
	content: "حمل و نقل";
}

/* The address carries the content and absorbs the free space. */
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address address {
	order: 2;
	flex: 1 1 auto;
	margin: 0;
	font-style: normal;
	font-size: 12.5px;
	line-height: 2.15;
	color: var(--mg-acc-ink-soft);
	overflow-wrap: anywhere;
}

/* ---- the action: a real button, full width at the card foot ------------ */
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address-title .edit {
	order: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	box-sizing: border-box;
	margin-top: var(--mg-acc-s-4);
	padding: 0 16px;
	border: 1px solid var(--mg-acc-ink);
	border-radius: var(--mg-acc-r-xs);
	background: var(--mg-acc-ink);
	color: var(--mg-acc-surface);
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address-title .edit:hover {
	background: #242424;
	border-color: #242424;
	color: var(--mg-acc-surface);
}

/* Empty card: the action steps back to an outline so a blank address does not
 * shout. A filled address always has <br>; the "nothing yet" sentence has none. */
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address:not(:has(address br)) .edit {
	background: transparent;
	color: var(--mg-acc-ink);
	border-color: var(--mg-acc-line-strong);
}

.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address:not(:has(address br)) .edit:hover {
	background: var(--mg-nav-btn-bg);
	border-color: var(--mg-acc-ink-muted);
	color: var(--mg-acc-ink);
}

/* The "nothing yet" sentence is a placeholder, not copy: mute it. */
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-Address:not(:has(address br)) address {
	color: var(--mg-acc-ink-faint);
	font-size: 12px;
	line-height: 2;
}

/* Tables: order history, downloads. Scroll rather than overflow the page. */
.mg-acc__dash .woocommerce-MyAccount-content table,
.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--mg-acc-fs-base);
}

.mg-acc__dash .woocommerce-MyAccount-content table th,
.mg-acc__dash .woocommerce-MyAccount-content table td {
	padding: 12px 10px;
	border-bottom: 1px solid var(--mg-acc-line);
	text-align: right;
	vertical-align: middle;
}

.mg-acc__dash .woocommerce-MyAccount-content table th {
	font-size: var(--mg-acc-fs-sm);
	font-weight: 600;
	color: var(--mg-acc-ink);
	background: var(--mg-acc-surface-sunken);
}

.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-orders-table__cell-order-status {
	font-size: var(--mg-acc-fs-sm);
}

/* Buttons inside content (view order, edit address, save). */
.mg-acc__dash .woocommerce-MyAccount-content .button,
.mg-acc__dash .woocommerce-MyAccount-content button.button,
.mg-acc__dash .woocommerce-MyAccount-content input.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: var(--mg-acc-h-control-sm);
	padding: 0 18px;
	border: 1px solid var(--mg-acc-ink);
	border-radius: var(--mg-acc-r-sm);
	background: var(--mg-acc-ink);
	color: var(--mg-acc-surface);
	font-family: inherit;
	font-size: var(--mg-acc-fs-base);
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.16s ease, color 0.16s ease;
}

.mg-acc__dash .woocommerce-MyAccount-content .button:hover,
.mg-acc__dash .woocommerce-MyAccount-content input.button:hover {
	background: var(--mg-acc-surface);
	color: var(--mg-acc-ink);
}

/* Form fields in the content area follow the same ruleset as the login card. */
.mg-acc__dash .woocommerce-MyAccount-content .form-row input.input-text,
.mg-acc__dash .woocommerce-MyAccount-content .form-row select,
.mg-acc__dash .woocommerce-MyAccount-content input[type="text"],
.mg-acc__dash .woocommerce-MyAccount-content input[type="email"],
.mg-acc__dash .woocommerce-MyAccount-content input[type="password"],
.mg-acc__dash .woocommerce-MyAccount-content input[type="tel"] {
	height: var(--mg-acc-h-control-sm) !important;
	padding: 0 14px !important;
	border: 1px solid var(--mg-acc-line-strong) !important;
	border-radius: var(--mg-acc-r-sm) !important;
	background: var(--mg-acc-surface) !important;
	color: var(--mg-acc-ink) !important;
	font-family: inherit !important;
	font-size: var(--mg-acc-fs-base) !important;
	box-shadow: none !important;
	width: 100%;
	max-width: 100%;
}

.mg-acc__dash .woocommerce-MyAccount-content .form-row input.input-text:focus,
.mg-acc__dash .woocommerce-MyAccount-content input[type="text"]:focus,
.mg-acc__dash .woocommerce-MyAccount-content input[type="email"]:focus,
.mg-acc__dash .woocommerce-MyAccount-content input[type="password"]:focus {
	border-color: var(--mg-acc-ink) !important;
	box-shadow: 0 0 0 3px var(--mg-acc-ring) !important;
	outline: none !important;
}

.mg-acc__dash .woocommerce-MyAccount-content .form-row label {
	font-size: var(--mg-acc-fs-sm);
	color: var(--mg-acc-ink-soft);
	margin-bottom: var(--mg-acc-s-2);
	display: block;
}

/* Notices (success / error) — WooCommerce prints these inline.
 *
 * WooCommerce absolutely pins a glyph from its own icon font to the notice,
 * with no padding reserved by us, so on this site it collided with the first
 * word and — because the WooCommerce webfont does not reliably load here —
 * degraded to an empty tofu box next to the action button.
 *
 * The glyph is therefore gone rather than restyled. Nothing is lost: the
 * 2px top border already carries the notice type by colour (ink = success /
 * info, danger = error), and every notice on this site opens with a full
 * sentence. Getting rid of it also removes a webfont dependency and a whole
 * class of RTL/LTR overlap bugs.
 */
.mg-account .woocommerce-message,
.mg-account .woocommerce-info,
.mg-account .woocommerce-error {
	border: 1px solid var(--mg-acc-line-strong);
	border-top-width: 2px;
	border-radius: var(--mg-acc-r-sm);
	background: var(--mg-acc-surface-sunken);
	color: var(--mg-acc-ink-soft);
	font-size: var(--mg-acc-fs-base);
	padding: 14px 18px;
	margin: 0 0 var(--mg-acc-s-5);
	list-style: none;
}

/* Kills the icon-font glyph (and its reserved gutter) in one place. */
.mg-account .woocommerce-message::before,
.mg-account .woocommerce-info::before,
.mg-account .woocommerce-error::before {
	display: none !important;
}

.mg-account .woocommerce-error {
	border-top-color: var(--mg-acc-ink-danger);
}

.mg-account .woocommerce-message,
.mg-account .woocommerce-info {
	border-top-color: var(--mg-acc-ink);
}

/* The action button sits inline with the copy instead of floating over it. */
.mg-account .woocommerce-message .button,
.mg-account .woocommerce-info .button,
.mg-account .woocommerce-error .button {
	float: none;
	margin-inline-start: 0.75em;
	vertical-align: middle;
}
/* =========================================================================
 * 7b. Password-reset screen: one quiet card
 * =========================================================================
 * The stock form ran the full width of the page - a paragraph from edge to
 * edge, the field pinned right, the button under it and the left half empty.
 * It is the only account screen with a single job, so it gets a single centred
 * column, as wide as a comfortable line of text.
 *
 * Nothing here restyles a field or a button: `.mg-card form ...` already owns
 * those, and this only has to place the card and set its rhythm.
 * ========================================================================= */

.mg-acc--single {
	align-items: center;
	justify-content: center;
}

.mg-acc--single .mg-card--reset {
	justify-self: center;
	max-width: 460px;
	/* A card floating in the middle of a tall, empty page reads as unfinished. */
	margin: clamp(16px, 5vh, 56px) auto;
	/* The card is one column: heading, a line, a field, one button. Every other
	 * card on the site is read right-to-left, so this one is too — the reset
	 * form had been centred only because the card filled the width. */
	text-align: right;
}

/* One sentence, so it can sit on one line: the column is 378px and the lead
 * was breaking with a single word stranded on the second line. */
.mg-card--reset .mg-card__lead {
	max-width: none;
	line-height: 1.85;
}

/* The label sits above a full-width field, then the one button.
 * `width: 100% !important` is deliberate: WooCommerce ships
 *   .woocommerce form .form-row-first { width: 47% }
 * which is (0,3,0) and would otherwise win over anything sane written here,
 * leaving a 178px field in a 460px card. */
.mg-card--reset .woocommerce-ResetPassword .woocommerce-form-row,
.mg-card--reset .woocommerce-ResetPassword .form-row {
	float: none !important;
	width: 100% !important;
	padding: 0;
	margin: 0 0 var(--mg-acc-s-4);
}

.mg-card--reset .woocommerce-form-row label {
	display: block;
	font-size: var(--mg-acc-fs-eyebrow);
	letter-spacing: 0;
	color: var(--mg-acc-ink-muted);
	margin-bottom: 8px;
}

/* The required asterisk and its screen-reader label are separate inline nodes;
 * at this label size they were wrapping onto a second line on their own. */
.mg-card--reset .woocommerce-form-row label .required,
.mg-card--reset .woocommerce-form-row label .screen-reader-text {
	display: inline;
	font-size: inherit;
}

/* WooCommerce prints an empty .clear div and a second, button-only row. The
 * button is styled below, the spacer is not needed once the row is a block. */
.mg-card--reset .clear {
	display: none;
}

.mg-card--reset .woocommerce-ResetPassword .form-row:last-of-type {
	margin: var(--mg-acc-s-5) 0 0;
}

.mg-card--reset .woocommerce-ResetPassword button.button,
.mg-card--reset .woocommerce-ResetPassword .woocommerce-Button {
	width: 100%;
	height: var(--mg-acc-h-control);
	line-height: var(--mg-acc-h-control);
}

/* The result of a reset request lands inside this card. WooCommerce's stock
 * notice is a bordered box with a coloured fill; inside a 460px card next to
 * our own type it read like an error from another site. A quiet rule on the
 * leading edge carries the same meaning in this card's own language. */
.mg-card--reset .bpa-reset-notice {
	border: 0;
	border-inline-start: 2px solid var(--mg-acc-ink);
	background: none;
	padding: 0 14px 0 0;
	margin: 0 0 var(--mg-acc-s-5);
	font-size: var(--mg-acc-fs-sm);
	line-height: 1.95;
	color: var(--mg-acc-ink-soft);
}

.mg-card--reset .bpa-reset-notice.woocommerce-error {
	border-inline-start-color: #a33a3a;
}

.mg-card--reset .bpa-reset-notice a {
	color: var(--mg-acc-ink);
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Back to sign-in: quieter than the button, still clearly a link. */
.mg-card__alt {
	margin: var(--mg-acc-s-4) 0 0;
	text-align: center;
	font-size: var(--mg-acc-fs-sm);
}

.mg-card__alt a {
	color: var(--mg-acc-ink-muted);
	text-decoration: underline;
	text-underline-offset: 4px;
}

.mg-card__alt a:hover {
	color: var(--mg-acc-ink);
}

/* =========================================================================
 * 8. Responsive
 * =========================================================================
 * Three regions, and only three, to keep the system predictable:
 *   ≤1023px  tablet   → single column, form first
 *   ≤767px   phone    → tighter type, horizontal nav rail
 *   ≤420px   small    → reduced padding, table scroll
 * ========================================================================= */

@media (max-width: 1023px) {
	.mg-acc__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--mg-acc-s-6);
		align-items: start;
	}

	/* The person who came to log in should not scroll past a promo first. */
	.mg-card {
		order: 1;
		max-width: none;
		justify-self: stretch;
	}

	.mg-panel {
		order: 2;
	}

	.mg-acc__dash {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--mg-acc-s-4);
	}

	.mg-side {
		position: static;
		order: 2;
	}

	.mg-acc__dash .woocommerce-MyAccount-content {
		order: 1;
	}

	.mg-acc__links {
		grid-template-columns: minmax(0, 1fr);
		gap: var(--mg-acc-s-2);
	}

	.mg-panel__title {
		font-size: clamp(21px, 4vw, 28px);
	}

	/* Only the first two proof items survive on tablet and below; the rest
	 * stay in the DOM for search engines and screen readers. */
	.mg-panel__list li:nth-child(n + 3) {
		display: none;
	}
}

@media (max-width: 767px) {
	.mg-account {
		--mg-acc-fs-h1: 22px;
		--mg-acc-fs-h2: 20px;
		--mg-acc-h-control: 48px;
		--mg-acc-h-control-sm: 44px;
	}

	.mg-account .mg-acc {
		padding: var(--mg-acc-s-5) 0 var(--mg-acc-s-9);
	}

	.mg-acc__dash .mg-stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.mg-acc__dash .mg-stats .mg-stat:last-child {
		display: none;
	}

	/* The nav becomes a horizontal rail instead of a tall block that pushes
	 * the actual content below the fold. */
	.mg-side {
		overflow: visible;
		border-radius: var(--mg-acc-r-sm);
	}

	.mg-side__who {
		display: none;
	}

	.mg-side .woocommerce-MyAccount-navigation ul {
		flex-direction: row;
		overflow-x: auto;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.mg-side .woocommerce-MyAccount-navigation ul::-webkit-scrollbar {
		display: none;
	}

	/* Phones: a two-column grid instead of a sideways rail. Every cell is the
	 * same width and height by construction, so nothing looks scattered, and the
	 * whole menu still fits on one screen. */
	.mg-side .woocommerce-MyAccount-navigation ul {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
		padding: 12px;
		overflow-x: visible;
	}

	.mg-side .woocommerce-MyAccount-navigation li {
		min-width: 0;
	}

	.mg-side .woocommerce-MyAccount-navigation li a {
		border-bottom: 0;
		border-inline-start: 0;
		justify-content: center;
		padding: 0 8px;
		width: 100%;
		min-width: 0;
		background: var(--mg-nav-btn-bg);
		font-size: var(--mg-acc-fs-xs);
	}

	.mg-side .woocommerce-MyAccount-navigation li.is-active a {
		background: var(--mg-nav-btn-bg-active);
		border-bottom-color: transparent;
	}

	.mg-side .woocommerce-MyAccount-navigation li a::before {
		display: none;
	}


	.mg-side .woocommerce-MyAccount-navigation-link--customer-logout {
		border-top: 0 !important;
		margin-top: 0 !important;
	}

	.mg-acc__dash .woocommerce-MyAccount-content .col2-set,
	.mg-acc__dash .woocommerce-MyAccount-content .u-column1,
	.mg-acc__dash .woocommerce-MyAccount-content .u-column2 {
		grid-template-columns: minmax(0, 1fr);
	}

	/* Wide order tables: own scroll container rather than page overflow. */
	.mg-acc__dash .woocommerce-MyAccount-content .woocommerce-orders-table,
	.mg-acc__dash .woocommerce-MyAccount-content table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}

	.mg-account .mg-card .form-row.mg-row-between,
	.mg-account .mg-card .woocommerce-form-login__rememberme {
		gap: var(--mg-acc-s-2);
	}
}

@media (max-width: 420px) {
	.mg-account .mg-acc {
		padding-top: var(--mg-acc-s-4);
	}

	.mg-account .mg-card {
		padding: 20px 16px;
	}

	.mg-acc__links .mg-acc__link {
		padding: 13px 14px;
	}

	.mg-acc__dash .mg-stat {
		padding: 13px 14px;
	}

	.mg-acc__dash .mg-stat b {
		font-size: 19px;
	}
}

@media (max-width: 380px) {
	.mg-account {
		--mg-acc-fs-h1: 20px;
		--mg-acc-fs-h2: 18px;
	}

	.mg-acc__dash .mg-stats {
		grid-template-columns: minmax(0, 1fr);
	}

	.mg-acc__dash .mg-stats .mg-stat:nth-child(2) {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mg-account *,
	.mg-account *::before,
	.mg-account *::after {
		animation: none !important;
		transition-duration: 0.01ms !important;
	}
}

/* =========================================================================
 * 11. Greeting: the name gets a highlight that sweeps in behind it
 * =========================================================================
 * A CSS-only stand-in for the Animate UI <HighlightText> primitive. That is a
 * React component and this store is PHP, so the same look is built from a
 * pseudo-element band plus one keyframe - no JS, no dependency.
 *
 * The part that matters is geometry. The band is a child of an inline-block
 * wrapping the name, and its height and depth are expressed in em. So a short
 * name and a long name both get a band of the same visual weight sitting at the
 * same depth under the glyphs, and it keeps that relationship if the font size
 * ever changes. Nothing is measured against the text width in pixels.
 *
 * Colours are brand tokens rather than the reference blue/purple: this store is
 * typographic black-and-yellow, so the sweep is the accent yellow.
 * ========================================================================= */

/* Targets two things with one set of rules: the explicit .mg-hl class (for any
 * markup we control) and the <strong> WooCommerce already wraps the display
 * name in on the dashboard. Styling the existing element means no template
 * override and no filter fighting wp_kses. */
.mg-hl,
.mg-acc__dash .woocommerce-MyAccount-content > p:first-of-type > strong {
    position: relative;
    display: inline-block;
    isolation: isolate;   /* keeps the band behind the glyphs, not the page */
    font-weight: 700;
    max-width: 100%;
    overflow-wrap: anywhere;  /* a very long username must not widen the column */
}

.mg-hl::before,
.mg-acc__dash .woocommerce-MyAccount-content > p:first-of-type > strong::before {
    content: "";
    position: absolute;
    z-index: -1;
    left: 0;
    right: 0;
    /* Depth/thickness in em so they scale with the type. 0.52em sits the band
     * under the baseline with a little air, and 0.46em is thick enough to read
     * as a highlight rather than an underline. */
    bottom: 0.02em;
    height: 0.46em;
    border-radius: 0.08em;
    background: linear-gradient(90deg, var(--mg-hl-from) 0%, var(--mg-hl-to) 100%);
    transform: scaleX(0);
    transform-origin: right center;
    animation: mg-hl-sweep 520ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

@keyframes mg-hl-sweep {
    to { transform: scaleX(1); }
}

/* Cream to yellow: present, but never loud enough to fight the text. */
:root,
[data-mg-theme="default"],
body.mg-theme-default,
[data-mg-theme="light"],
body.mg-theme-light,
[data-mg-theme="nowruz"],
body.mg-theme-nowruz {
    --mg-hl-from: #fdf3d4;
    --mg-hl-to: #f8c13b;
}

[data-mg-theme="yalda"],
body.mg-theme-yalda {
    --mg-hl-from: rgba(248, 193, 59, 0.20);
    --mg-hl-to: rgba(248, 193, 59, 0.55);
}

/* The greeting paragraph WooCommerce prints at the top of the dashboard. */
.mg-acc__dash .woocommerce-MyAccount-content > p:first-of-type {
    font-size: var(--mg-acc-fs-md);
    margin: 0 0 var(--mg-acc-s-4);
}

/* The file-level reduced-motion rule above kills the sweep with animation:none.
 * That would leave the band at scaleX(0), i.e. invisible, so the finished state
 * is written explicitly here: same highlight, no movement. */
@media (prefers-reduced-motion: reduce) {
    .mg-hl::before,
    .mg-acc__dash .woocommerce-MyAccount-content > p:first-of-type > strong::before {
        transform: scaleX(1);
        animation: none;
    }
}

