/* ==========================================================================
   Shared components (foundation, stage D0). Prefix `ds-`. Logical properties
   only. Reference and markup: docs/ui-redesign/components.md
   ========================================================================== */

/* Badge icons are CSS masks so a badge ALWAYS carries an icon next to its text, even if the markup forgets one. */
:root {
	--ds-i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m8 12 3 3 5-6'/%3E%3C/svg%3E");
	--ds-i-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 20h20z'/%3E%3Cpath d='M12 10v4M12 17h.01'/%3E%3C/svg%3E");
	--ds-i-x: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 9 6 6M15 9l-6 6'/%3E%3C/svg%3E");
	--ds-i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
	--ds-i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
	--ds-i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* ---------- Button ---------- */
.ds-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--ds-space-2);
	min-height: var(--ds-control-h);
	min-width: var(--ds-control-h);
	padding: var(--ds-space-2) var(--ds-space-5);
	border: 1px solid transparent;
	border-radius: var(--ds-radius-control);
	background: transparent;
	color: var(--ds-deep);
	font: inherit;
	font-size: var(--ds-fs-sm);
	font-weight: var(--ds-fw-semibold);
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	position: relative;
	transition: background var(--ds-dur) var(--ds-ease), border-color var(--ds-dur) var(--ds-ease), color var(--ds-dur) var(--ds-ease);
}
.ds-btn:hover { text-decoration: none; }
.ds-btn--primary { background: var(--ds-action); color: var(--ds-on-action); }
.ds-btn--primary:hover { background: var(--ds-action-hover); color: var(--ds-on-action); }
.ds-btn--secondary { background: var(--ds-surface); color: var(--ds-deep); border-color: var(--ds-action); }
.ds-btn--secondary:hover { background: var(--ds-mint-strong); }
.ds-btn--ghost { color: var(--ds-action); }
.ds-btn--ghost:hover { background: var(--ds-mint-strong); color: var(--ds-deep); }
.ds-btn--danger { background: var(--ds-danger); color: var(--ds-on-action); }
.ds-btn--danger:hover { background: var(--ds-danger-hover); color: var(--ds-on-action); }
.ds-btn--danger-outline { background: var(--ds-surface); color: var(--ds-danger); border-color: var(--ds-danger); }
.ds-btn--danger-outline:hover { background: var(--ds-danger-bg); }
.ds-btn--block { display: flex; width: 100%; }
.ds-btn--sm { padding-inline: var(--ds-space-3); font-size: var(--ds-fs-xs); }   /* still 44px tall */
.ds-btn--lg { padding-inline: var(--ds-space-8); font-size: var(--ds-fs-md); }
.ds-btn[disabled], .ds-btn[aria-disabled="true"] {
	background: var(--ds-disabled-bg);
	color: var(--ds-disabled-text);
	border-color: transparent;
	cursor: not-allowed;
}
/* Loading: the label stays (so the button keeps its width and its name); a spinner is added. aria-busy comes from MentayarUI.guard. */
.ds-btn[aria-busy="true"] { cursor: progress; pointer-events: none; }
.ds-btn[aria-busy="true"]::after, .ds-spinner {
	content: "";
	inline-size: 1em; block-size: 1em;
	border: 2px solid currentColor;
	border-inline-end-color: transparent;
	border-radius: 50%;
	animation: ds-spin 0.8s linear infinite;
	flex: none;
}
.ds-spinner { display: inline-block; vertical-align: -0.15em; }
@keyframes ds-spin { to { transform: rotate(360deg); } }

.ds-icon-btn {
	display: inline-flex; align-items: center; justify-content: center;
	inline-size: var(--ds-control-h); block-size: var(--ds-control-h);
	padding: 0; border: 1px solid transparent; border-radius: var(--ds-radius-control);
	background: transparent; color: var(--ds-text); cursor: pointer;
}
.ds-icon-btn:hover { background: var(--ds-mint-strong); color: var(--ds-deep); }
.ds-icon-btn svg { inline-size: 1.25rem; block-size: 1.25rem; }

/* ---------- Form field ---------- */
.ds-field { display: block; margin: 0 0 var(--ds-space-4); }
.ds-field__label { display: block; margin-block-end: var(--ds-space-1); font-weight: var(--ds-fw-semibold); font-size: var(--ds-fs-sm); color: var(--ds-text); }
.ds-field__req { color: var(--ds-danger); margin-inline-start: 0.25em; }          /* paired with the word in .ds-field__req-text for screen readers */
.ds-field__optional { color: var(--ds-text-2); font-weight: var(--ds-fw-regular); margin-inline-start: 0.25em; }
/* File picker: the native control is only 22px tall; give it a 44px box and a real button. */
input[type="file"] { box-sizing: border-box; inline-size: 100%; min-block-size: var(--ds-control-h); padding: var(--ds-space-2); border: 1px solid var(--ds-control-line); border-radius: var(--ds-radius-control); background: var(--ds-surface); color: var(--ds-text); font: inherit; font-size: var(--ds-fs-sm); }
input[type="file"]::file-selector-button { min-block-size: 32px; margin-inline-end: var(--ds-space-3); padding-inline: var(--ds-space-3); border: 1px solid var(--ds-control-line); border-radius: var(--ds-radius-sm); background: var(--ds-mint); color: var(--ds-deep); font: inherit; font-weight: var(--ds-fw-semibold); cursor: pointer; }
.ds-field__hint { display: block; margin-block-start: var(--ds-space-1); font-size: var(--ds-fs-xs); color: var(--ds-text-2); }
.ds-field__control,
.ds-field input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
.ds-field select,
.ds-field textarea {
	display: block;
	inline-size: 100%;
	min-height: var(--ds-control-h);
	padding: var(--ds-space-2) var(--ds-space-3);
	border: 1px solid var(--ds-control-line);
	border-radius: var(--ds-radius-control);
	background-color: var(--ds-surface);
	color: var(--ds-text);
	font: inherit;
	font-size: var(--ds-fs-md);   /* 16px: iOS Safari does not zoom the page on focus */
	line-height: 1.5;
}
.ds-field textarea { min-block-size: 6.5rem; resize: vertical; }
.ds-field input:hover, .ds-field select:hover, .ds-field textarea:hover { border-color: var(--ds-deep); }
.ds-field input:focus-visible, .ds-field select:focus-visible, .ds-field textarea:focus-visible { outline: var(--ds-focus-width) solid var(--ds-focus); outline-offset: 1px; }
.ds-field [aria-invalid="true"] { border-color: var(--ds-danger); border-width: 2px; }
.ds-field__error {
	display: flex; gap: var(--ds-space-2); align-items: flex-start;
	margin-block-start: var(--ds-space-1);
	font-size: var(--ds-fs-xs); font-weight: var(--ds-fw-medium); color: var(--ds-danger);
}
.ds-field__error::before { content: ""; flex: none; inline-size: 1rem; block-size: 1rem; margin-block-start: 0.2em; background: currentColor; -webkit-mask: var(--ds-i-x) center / contain no-repeat; mask: var(--ds-i-x) center / contain no-repeat; }
.ds-field__error[hidden] { display: none; }
/* Error summary at the top of a long form (focus moves to it after a failed submit). */
.ds-errsum { margin-block-end: var(--ds-space-4); }

/* Checkbox / radio rows: the whole row is the 44px target. */
.ds-check { display: flex; align-items: flex-start; gap: var(--ds-space-3); min-height: var(--ds-control-h); padding-block: var(--ds-space-2); cursor: pointer; }
.ds-check input { flex: none; inline-size: 1.25rem; block-size: 1.25rem; margin-block-start: 0.15rem; accent-color: var(--ds-action); }

/* ---------- Card ---------- */
.ds-card {
	position: relative;
	background: var(--ds-surface);
	border: var(--ds-border);
	border-radius: var(--ds-radius-card);
	padding: var(--ds-space-5);
}
.ds-card--tint { background: var(--ds-mint); }
.ds-card--flat { border: 0; background: transparent; padding: 0; }
.ds-card--compact { padding: var(--ds-space-4); }
.ds-card__title { margin: 0 0 var(--ds-space-2); font-size: var(--ds-fs-lg); line-height: var(--ds-lh-tight); }
/* A card that is one link: a real <a> inside, stretched over the card (replaces card-link.js div clicks). */
.ds-card--link:hover { border-color: var(--ds-action); }
.ds-card__link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.ds-card__link { color: inherit; text-decoration: none; }
.ds-card--link :where(a, button):not(.ds-card__link) { position: relative; z-index: 1; }
.ds-card--link:focus-within { outline: var(--ds-focus-width) solid var(--ds-focus); outline-offset: 2px; }

/* ---------- Status badge: icon (mask) + text, never colour alone ---------- */
.ds-badge {
	display: inline-flex; align-items: center; gap: 0.375em;
	padding: 0.125rem 0.625rem;
	padding-inline: 0.5rem 0.625rem;
	border: 1px solid var(--ds-neutral-line);
	border-radius: var(--ds-radius-pill);
	background: var(--ds-neutral-bg);
	color: var(--ds-neutral);
	font-size: var(--ds-fs-xs);
	font-weight: var(--ds-fw-semibold);
	line-height: 1.5;
	max-inline-size: 100%; overflow-wrap: anywhere; /* a long status sentence wraps inside its box instead of running off the card */
}
.ds-badge::before {
	content: ""; flex: none; inline-size: 1em; block-size: 1em;
	background: currentColor;
	-webkit-mask: var(--ds-i-clock) center / contain no-repeat; mask: var(--ds-i-clock) center / contain no-repeat;
}
.ds-badge--success { background: var(--ds-success-bg); color: var(--ds-success); border-color: var(--ds-success-line); }
.ds-badge--success::before { -webkit-mask-image: var(--ds-i-check); mask-image: var(--ds-i-check); }
.ds-badge--warning { background: var(--ds-warning-bg); color: var(--ds-warning); border-color: var(--ds-warning-line); }
.ds-badge--warning::before { -webkit-mask-image: var(--ds-i-warn); mask-image: var(--ds-i-warn); }
.ds-badge--danger { background: var(--ds-danger-bg); color: var(--ds-danger); border-color: var(--ds-danger-line); }
.ds-badge--danger::before { -webkit-mask-image: var(--ds-i-x); mask-image: var(--ds-i-x); }
.ds-badge--info { background: var(--ds-info-bg); color: var(--ds-info); border-color: var(--ds-info-line); }
.ds-badge--info::before { -webkit-mask-image: var(--ds-i-info); mask-image: var(--ds-i-info); }
.ds-badge--neutral::before { -webkit-mask-image: var(--ds-i-clock); mask-image: var(--ds-i-clock); }
.ds-badge--no-icon::before { display: none; }

/* ---------- Alert ---------- */
.ds-alert {
	display: flex; gap: var(--ds-space-3); align-items: flex-start;
	padding: var(--ds-space-3) var(--ds-space-4);
	border: 1px solid var(--ds-info-line); border-radius: var(--ds-radius-control);
	background: var(--ds-info-bg); color: var(--ds-text);
	font-size: var(--ds-fs-sm);
}
.ds-alert::before { content: ""; flex: none; inline-size: 1.25rem; block-size: 1.25rem; margin-block-start: 0.15rem; background: var(--ds-info); -webkit-mask: var(--ds-i-info) center / contain no-repeat; mask: var(--ds-i-info) center / contain no-repeat; }
.ds-alert__body { flex: 1; min-width: 0; }
.ds-alert__title { display: block; font-weight: var(--ds-fw-semibold); }
.ds-alert--success { background: var(--ds-success-bg); border-color: var(--ds-success-line); }
.ds-alert--success::before { background: var(--ds-success); -webkit-mask-image: var(--ds-i-check); mask-image: var(--ds-i-check); }
.ds-alert--warning { background: var(--ds-warning-bg); border-color: var(--ds-warning-line); }
.ds-alert--warning::before { background: var(--ds-warning); -webkit-mask-image: var(--ds-i-warn); mask-image: var(--ds-i-warn); }
.ds-alert--danger { background: var(--ds-danger-bg); border-color: var(--ds-danger-line); }
.ds-alert--danger::before { background: var(--ds-danger); -webkit-mask-image: var(--ds-i-x); mask-image: var(--ds-i-x); }

/* Toast stack (MentayarUI.toast). Messages are also sent to the live region. */
.ds-toast-region {
	position: fixed; z-index: var(--ds-z-toast);
	inset-inline: var(--ds-space-4);
	inset-block-end: calc(var(--ds-space-4) + var(--ds-safe-bottom));
	display: flex; flex-direction: column; align-items: center; gap: var(--ds-space-2);
	pointer-events: none;
}
body.ds-has-tabbar .ds-toast-region { inset-block-end: calc(var(--ds-tabbar-h) + var(--ds-space-4) + var(--ds-safe-bottom)); }
.ds-toast {
	pointer-events: auto; max-inline-size: 28rem;
	display: flex; gap: var(--ds-space-3); align-items: center;
	padding: var(--ds-space-3) var(--ds-space-4);
	border-radius: var(--ds-radius-control);
	background: var(--ds-ink); color: var(--ds-on-ink);
	box-shadow: var(--ds-shadow-pop); font-size: var(--ds-fs-sm);
}
.ds-toast button { min-block-size: var(--ds-control-h); min-inline-size: var(--ds-control-h); background: none; border: 0; color: inherit; font: inherit; font-weight: var(--ds-fw-semibold); text-decoration: underline; cursor: pointer; }
.ds-toast button:focus-visible { outline-color: var(--ds-focus-on-dark); }

/* ---------- Table ---------- */
.ds-table-wrap { position: relative; overflow-x: auto; border: var(--ds-border); border-radius: var(--ds-radius-card); background: var(--ds-surface); }
.ds-table { inline-size: 100%; border-collapse: collapse; font-size: var(--ds-fs-sm); }
.ds-table caption { padding: var(--ds-space-3) var(--ds-space-4); text-align: start; font-weight: var(--ds-fw-semibold); color: var(--ds-text); }
.ds-table th, .ds-table td { padding: var(--ds-space-3) var(--ds-space-4); text-align: start; vertical-align: top; border-block-end: var(--ds-border); }
.ds-table thead th { font-size: var(--ds-fs-xs); font-weight: var(--ds-fw-semibold); color: var(--ds-text-2); background: var(--ds-tint); white-space: nowrap; }
.ds-table tbody tr:last-child > * { border-block-end: 0; }
.ds-table td.is-num, .ds-table th.is-num { text-align: end; }
/* Phone: rows become labelled blocks. Each <td> needs data-label="column title". */
@media (max-width: 639.98px) {
	.ds-table--stack thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
	.ds-table--stack, .ds-table--stack tbody, .ds-table--stack tr, .ds-table--stack td { display: block; inline-size: 100%; }
	.ds-table--stack tr { padding-block: var(--ds-space-2); border-block-end: var(--ds-border); }
	.ds-table--stack tbody tr:last-child { border-block-end: 0; }
	.ds-table--stack td { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--ds-space-1) var(--ds-space-4); padding: var(--ds-space-2) var(--ds-space-4); border: 0; text-align: end; overflow-wrap: anywhere; }
	/* a value that does not fit beside its label (a very large amount, an IBAN, a long name) drops under it instead of being cut off */
	.ds-table--stack td > * { min-inline-size: 0; max-inline-size: 100%; }
	.ds-table--stack td::before { content: attr(data-label); flex: none; max-inline-size: 45%; font-size: var(--ds-fs-xs); font-weight: var(--ds-fw-semibold); color: var(--ds-text-2); text-align: start; }
	.ds-table--stack td[data-label=""]::before, .ds-table--stack td:not([data-label])::before { display: none; }
}

/* ---------- Dialog and bottom sheet ---------- */
.ds-dialog-root {
	position: fixed; inset: 0; z-index: var(--ds-z-overlay);
	display: flex; align-items: center; justify-content: center;
	padding: var(--ds-space-4);
}
.ds-dialog-backdrop { position: absolute; inset: 0; background: var(--ds-overlay); }
.ds-dialog {
	position: relative;
	display: flex; flex-direction: column;
	inline-size: min(100%, 32rem);
	max-block-size: calc(100vh - 2rem);
	max-block-size: calc(100dvh - 2rem);
	background: var(--ds-surface); color: var(--ds-text);
	border-radius: var(--ds-radius-card);
	box-shadow: var(--ds-shadow-pop);
	overflow: hidden;
}
.ds-dialog--wide { inline-size: min(100%, 56rem); }
.ds-dialog--narrow { inline-size: min(100%, 24rem); }
.ds-dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--ds-space-3); padding: var(--ds-space-5) var(--ds-space-5) var(--ds-space-2); }
.ds-dialog__title { margin: 0; font-size: var(--ds-fs-lg); line-height: var(--ds-lh-tight); }
.ds-dialog__body { padding: var(--ds-space-2) var(--ds-space-5) var(--ds-space-5); overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; }
.ds-dialog__foot { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); justify-content: flex-end; padding: var(--ds-space-3) var(--ds-space-5) var(--ds-space-5); border-block-start: var(--ds-border); }
.ds-dialog__foot .ds-btn { flex: 0 1 auto; }
@media (max-width: 639.98px) {
	.ds-dialog-root { align-items: flex-end; padding: 0; }
	.ds-dialog {
		inline-size: 100%;
		max-block-size: 90vh; max-block-size: 90dvh;
		border-end-start-radius: 0; border-end-end-radius: 0;
		padding-block-end: var(--ds-safe-bottom);
		animation: ds-sheet-up 180ms var(--ds-ease);
	}
	.ds-dialog__foot { flex-direction: column-reverse; }
	.ds-dialog__foot .ds-btn { inline-size: 100%; }
	.ds-dialog::before { content: ""; align-self: center; inline-size: 2.5rem; block-size: 0.25rem; margin-block-start: var(--ds-space-2); border-radius: var(--ds-radius-pill); background: var(--ds-line); }
}
@keyframes ds-sheet-up { from { transform: translateY(24px); opacity: 0.4; } to { transform: none; opacity: 1; } }

/* ---------- Amount / date-time ---------- */
.ds-amount { font-variant-numeric: tabular-nums; font-weight: var(--ds-fw-semibold); white-space: nowrap; }
.ds-amount--wrap { white-space: normal; }
.ds-amount__part { white-space: nowrap; }
.ds-amount--unavailable { font-weight: var(--ds-fw-regular); color: var(--ds-text-2); white-space: normal; direction: inherit; unicode-bidi: normal; }
.ds-datetime { display: inline-flex; flex-direction: column; gap: 0; line-height: 1.5; }
.ds-datetime__main { font-weight: var(--ds-fw-semibold); }
.ds-datetime__zone, .ds-datetime__alt { font-size: var(--ds-fs-xs); color: var(--ds-text-2); }

/* ---------- Fee breakdown: server rows only; no arithmetic ---------- */
.ds-fee { margin: 0; padding: 0; list-style: none; border: var(--ds-border); border-radius: var(--ds-radius-card); background: var(--ds-surface); }
.ds-fee__row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--ds-space-4); padding: var(--ds-space-3) var(--ds-space-4); border-block-end: var(--ds-border); font-size: var(--ds-fs-sm); }
.ds-fee__row dt, .ds-fee__label { color: var(--ds-text-2); min-width: 0; }
.ds-fee__row dd, .ds-fee__value { margin: 0; text-align: end; font-weight: var(--ds-fw-semibold); }
.ds-fee__row--unconfigured .ds-fee__value { font-weight: var(--ds-fw-regular); color: var(--ds-text-2); }
.ds-fee__row--total { border-block-end: 0; background: var(--ds-mint); border-end-start-radius: var(--ds-radius-card); border-end-end-radius: var(--ds-radius-card); font-size: var(--ds-fs-md); }
.ds-fee__row--total .ds-fee__label, .ds-fee__row--total dt { color: var(--ds-text); font-weight: var(--ds-fw-semibold); }
.ds-fee__row--total .ds-fee__value, .ds-fee__row--total dd { font-size: var(--ds-fs-lg); }
.ds-fee__note { margin: var(--ds-space-2) 0 0; font-size: var(--ds-fs-xs); color: var(--ds-text-2); }
dl.ds-fee { display: block; }

/* ---------- Subscription summary ---------- */
.ds-subsum { display: grid; gap: var(--ds-space-3); }
.ds-subsum__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--ds-space-2); }
.ds-subsum__plan { margin: 0; font-size: var(--ds-fs-lg); }
.ds-subsum__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: var(--ds-space-3); margin: 0; }
.ds-subsum__grid dt { font-size: var(--ds-fs-xs); color: var(--ds-text-2); }
.ds-subsum__grid dd { margin: 0; font-weight: var(--ds-fw-semibold); }
.ds-subsum__actions { display: flex; flex-wrap: wrap; gap: var(--ds-space-2); }
.ds-subsum__note { margin: 0; font-size: var(--ds-fs-xs); color: var(--ds-text-2); }

/* ---------- Appointment card: one primary action, the rest in the overflow menu ---------- */
.ds-appt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--ds-space-3) var(--ds-space-4); align-items: start; }
.ds-appt__when { grid-column: 1; }
.ds-appt__who { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--ds-space-2); color: var(--ds-text-2); font-size: var(--ds-fs-sm); }
.ds-appt__status { grid-column: 2; grid-row: 1; justify-self: end; }
.ds-appt__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: var(--ds-space-2); }
.ds-appt__actions .ds-btn--primary { flex: 1 1 auto; }
@media (min-width: 640px) { .ds-appt__actions .ds-btn--primary { flex: 0 0 auto; } }

/* Overflow / popup menu (MentayarUI.menu). */
.ds-menu { position: relative; display: inline-block; }
.ds-menu__list {
	position: absolute; z-index: var(--ds-z-dropdown);
	inset-block-start: calc(100% + 4px); inset-inline-end: 0;
	min-inline-size: 13rem; max-inline-size: calc(100vw - 2rem);
	margin: 0; padding: var(--ds-space-1); list-style: none;
	background: var(--ds-surface); border: var(--ds-border); border-radius: var(--ds-radius-control);
	box-shadow: var(--ds-shadow-pop);
}
.ds-menu__list[hidden] { display: none; }
.ds-menu__item { display: flex; align-items: center; inline-size: 100%; min-height: var(--ds-control-h); padding: var(--ds-space-2) var(--ds-space-3); border: 0; border-radius: var(--ds-radius-sm); background: none; color: var(--ds-text); font: inherit; font-size: var(--ds-fs-sm); text-align: start; text-decoration: none; cursor: pointer; }
.ds-menu__item:hover, .ds-menu__item:focus-visible { background: var(--ds-mint-strong); color: var(--ds-deep); }
.ds-menu__item--danger { color: var(--ds-danger); }

/* ---------- States: loading / empty / error / unavailable ---------- */
.ds-state { display: flex; flex-direction: column; align-items: center; gap: var(--ds-space-2); padding: var(--ds-space-8) var(--ds-space-4); text-align: center; color: var(--ds-text-2); }
.ds-state__title { margin: 0; font-size: var(--ds-fs-md); font-weight: var(--ds-fw-semibold); color: var(--ds-text); }
.ds-state__text { margin: 0; max-inline-size: 30rem; font-size: var(--ds-fs-sm); }
.ds-state__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--ds-space-2); margin-block-start: var(--ds-space-2); }
.ds-state--error .ds-state__title { color: var(--ds-danger); }
.ds-state--unavailable { background: var(--ds-tint); border-radius: var(--ds-radius-card); }
.ds-skel { display: block; border-radius: var(--ds-radius-sm); background: linear-gradient(90deg, var(--ds-tint) 25%, var(--ds-line) 50%, var(--ds-tint) 75%); background-size: 200% 100%; animation: ds-shimmer 1.4s linear infinite; min-block-size: 1rem; }
.ds-skel + .ds-skel { margin-block-start: var(--ds-space-2); }
.ds-skel--title { inline-size: 40%; min-block-size: 1.25rem; }
.ds-skel--block { min-block-size: 4rem; }
@keyframes ds-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Tabs (roving tabindex; MentayarUI.tabs) ---------- */
.ds-tabs { position: relative; display: flex; gap: var(--ds-space-1); overflow-x: auto; border-block-end: var(--ds-border); scrollbar-width: thin; }
.ds-tabs [role="tab"] {
	flex: none; min-height: var(--ds-control-h); padding: var(--ds-space-2) var(--ds-space-4);
	border: 0; border-block-end: 3px solid transparent; background: none;
	color: var(--ds-text-2); font: inherit; font-size: var(--ds-fs-sm); font-weight: var(--ds-fw-semibold); cursor: pointer; white-space: nowrap;
}
/* Phone: tabs share the line and wrap their label instead of being cut off at the edge (the strip still scrolls when even the shortest words do not fit). */
@media (max-width: 639.98px) { .ds-tabs [role="tab"] { flex: 1 0 auto; min-inline-size: 5.5rem; max-inline-size: 9.5rem; white-space: normal; text-align: center; padding-inline: var(--ds-space-3); line-height: 1.35; } }
.ds-tabs [role="tab"]:hover { color: var(--ds-deep); background: var(--ds-mint); }
.ds-tabs [role="tab"][aria-selected="true"] { color: var(--ds-deep); border-block-end-color: var(--ds-action); }
.ds-tabpanel { padding-block-start: var(--ds-space-4); }
.ds-tabpanel[hidden] { display: none; }

/* ---------- Stepper and choice cards ---------- */
.ds-steps { display: flex; gap: var(--ds-space-2); margin: 0 0 var(--ds-space-4); padding: 0; list-style: none; counter-reset: ds-step; }
.ds-steps__item { flex: 1; display: flex; flex-direction: column; gap: var(--ds-space-1); padding-block-start: var(--ds-space-2); border-block-start: 4px solid var(--ds-line); font-size: var(--ds-fs-xs); color: var(--ds-text-2); counter-increment: ds-step; }
.ds-steps__item::before { content: counter(ds-step, decimal); font-weight: var(--ds-fw-bold); }
:lang(fa) .ds-steps__item::before { content: counter(ds-step, persian); }
.ds-steps__item[aria-current="step"] { border-block-start-color: var(--ds-action); color: var(--ds-deep); font-weight: var(--ds-fw-semibold); }
.ds-steps__item.is-done { border-block-start-color: var(--ds-action); }
.ds-choice-group { display: grid; gap: var(--ds-space-2); border: 0; margin: 0; padding: 0; }
.ds-choice { position: relative; display: flex; gap: var(--ds-space-3); align-items: flex-start; min-height: var(--ds-control-h); padding: var(--ds-space-3) var(--ds-space-4); border: 1px solid var(--ds-control-line); border-radius: var(--ds-radius-control); background: var(--ds-surface); cursor: pointer; }
.ds-choice input { flex: none; inline-size: 1.25rem; block-size: 1.25rem; margin-block-start: 0.2rem; accent-color: var(--ds-action); }
.ds-choice:hover { border-color: var(--ds-deep); }
.ds-choice:has(input:checked) { border-color: var(--ds-action); border-width: 2px; padding: calc(var(--ds-space-3) - 1px) calc(var(--ds-space-4) - 1px); background: var(--ds-mint); }
.ds-choice:has(input:focus-visible) { outline: var(--ds-focus-width) solid var(--ds-focus); outline-offset: 2px; }
.ds-choice__title { display: block; font-weight: var(--ds-fw-semibold); }
.ds-choice__desc { display: block; font-size: var(--ds-fs-xs); color: var(--ds-text-2); }
.ds-chip { display: inline-flex; align-items: center; min-height: var(--ds-control-h); padding: var(--ds-space-1) var(--ds-space-4); border: 1px solid var(--ds-control-line); border-radius: var(--ds-radius-pill); background: var(--ds-surface); color: var(--ds-text); font: inherit; font-size: var(--ds-fs-sm); cursor: pointer; }
.ds-chip[aria-pressed="true"], .ds-chip.is-active { background: var(--ds-action); border-color: var(--ds-action); color: var(--ds-on-action); }

/* ---------- Page header and breadcrumb ---------- */
.ds-pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--ds-space-3); margin-block-end: var(--ds-space-5); }
.ds-pagehead__title { margin: 0; font-size: var(--ds-fs-2xl); line-height: var(--ds-lh-tight); }
.ds-pagehead__sub { margin: var(--ds-space-1) 0 0; color: var(--ds-text-2); font-size: var(--ds-fs-sm); }
.ds-breadcrumb ol { display: flex; flex-wrap: wrap; gap: var(--ds-space-1) var(--ds-space-2); margin: 0 0 var(--ds-space-2); padding: 0; list-style: none; font-size: var(--ds-fs-xs); color: var(--ds-text-2); }
.ds-breadcrumb li + li::before { content: "/"; margin-inline-end: var(--ds-space-2); color: var(--ds-text-2); }
.ds-breadcrumb [aria-current="page"] { color: var(--ds-text); font-weight: var(--ds-fw-semibold); }

/* ---------- Role shell: bottom tab bar (phones) ---------- */
.ds-tabbar { display: none; }
@media (max-width: 1023.98px) {
	body.ds-has-tabbar { padding-block-end: calc(var(--ds-tabbar-h) + var(--ds-safe-bottom)); }
	body.ds-has-tabbar .ds-tabbar {
		display: flex;
		position: fixed; inset-inline: 0; inset-block-end: 0; z-index: var(--ds-z-tabbar);
		padding-block-end: var(--ds-safe-bottom);
		padding-inline: var(--ds-safe-start) var(--ds-safe-end);
		background: var(--ds-surface);
		border-block-start: var(--ds-border);
	}
	/* The soft keyboard is up: the bar would sit on top of the field being typed in. */
	body.ds-has-tabbar.ds-kbd-open .ds-tabbar { display: none; }
	body.ds-has-tabbar.ds-kbd-open { padding-block-end: 0; }
	/* Existing sticky save bars must not be covered by the tab bar. */
	body.ds-has-tabbar .prof-savebar { inset-block-end: calc(var(--ds-tabbar-h) + var(--ds-safe-bottom) + 12px); }
}
.ds-tabbar__item {
	flex: 1 1 0; min-inline-size: 0;
	display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
	min-block-size: var(--ds-tabbar-h); padding: var(--ds-space-1) 2px;
	border: 0; background: none; color: var(--ds-text-2);
	font: inherit; font-size: clamp(0.8125rem, 3.4vw, 0.875rem); font-weight: var(--ds-fw-medium); line-height: 1.25; text-align: center; text-decoration: none; cursor: pointer;
	position: relative;
}
.ds-tabbar__item svg { inline-size: 1.5rem; block-size: 1.5rem; flex: none; }
.ds-tabbar__label { max-inline-size: 100%; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.1; font-size: clamp(0.75rem, 3.2vw, 0.875rem); }
.ds-tabbar__item[aria-current="page"] { color: var(--ds-deep); font-weight: var(--ds-fw-bold); }
.ds-tabbar__item[aria-current="page"]::before { content: ""; position: absolute; inset-block-start: 0; inset-inline: 25%; block-size: 3px; border-radius: 0 0 3px 3px; background: var(--ds-action); }
.ds-tabbar__badge { position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% + 4px); min-inline-size: 1.125rem; block-size: 1.125rem; padding-inline: 4px; border-radius: var(--ds-radius-pill); background: var(--ds-danger); color: var(--ds-on-action); font-size: 0.75rem; font-weight: var(--ds-fw-bold); line-height: 1.125rem; text-align: center; }
.ds-tabbar__badge[hidden] { display: none; }

/* "More" sheet: every nav item that is not one of the five tabs. */
.ds-morelist { list-style: none; margin: 0; padding: 0; display: grid; }
.ds-morelist__item { display: flex; align-items: center; gap: var(--ds-space-3); inline-size: 100%; min-height: var(--ds-control-h); padding: var(--ds-space-2) var(--ds-space-2); border: 0; border-block-end: var(--ds-border); background: none; color: var(--ds-text); font: inherit; font-size: var(--ds-fs-md); text-align: start; text-decoration: none; cursor: pointer; }
.ds-morelist__item svg { inline-size: 1.25rem; block-size: 1.25rem; color: var(--ds-text-2); flex: none; }
.ds-morelist__item:hover { background: var(--ds-mint); }
.ds-morelist__item[aria-current="page"] { color: var(--ds-deep); font-weight: var(--ds-fw-bold); }
.ds-morelist__group { padding: var(--ds-space-3) var(--ds-space-2) var(--ds-space-1); font-size: var(--ds-fs-xs); font-weight: var(--ds-fw-semibold); color: var(--ds-text-2); }

/* Desktop sidebar collapse button (injected by shell.js) */
.ds-collapse-btn { display: none; }
@media (min-width: 1024px) {
	.ds-collapse-btn { display: inline-flex; align-items: center; justify-content: center; margin: 0 var(--ds-space-2) var(--ds-space-2); inline-size: var(--ds-control-h); block-size: var(--ds-control-h); border: 1px solid var(--ds-line); border-radius: var(--ds-radius-control); background: var(--ds-surface); color: var(--ds-text-2); cursor: pointer; }
	.ds-collapse-btn:hover { background: var(--ds-mint-strong); color: var(--ds-deep); }
	.ds-collapse-btn svg { inline-size: 1.25rem; block-size: 1.25rem; }
	.dashboard-layout.is-collapsed > .dashboard-sidebar { inline-size: 5rem; }
	.dashboard-layout.is-collapsed .dashboard-nav__label,
	.dashboard-layout.is-collapsed .dashboard-sidebar__name,
	.dashboard-layout.is-collapsed .dashboard-nav__group-toggle,
	.dashboard-layout.is-collapsed .notif-bell-wrap {
		position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
	}
	.dashboard-layout.is-collapsed .dashboard-nav__item { justify-content: center; }
	.dashboard-layout.is-collapsed .dashboard-nav__group-items { max-height: none !important; visibility: visible !important; margin: 0; padding: 0; border: 0; }
	.dashboard-layout.is-collapsed .dashboard-sidebar__user { justify-content: center; padding-inline: 0; }
}
