/**
 * TeamMon Design System — scoped to .teammon-app
 */

.teammon-app {
	--tm-primary: #807af8;
	--tm-secondary: #33c5c8;
	--tm-gradient: linear-gradient(135deg, var(--tm-primary) 0%, var(--tm-secondary) 100%);
	--tm-success: #22c55e;
	--tm-warning: #f59e0b;
	--tm-danger: #ef4444;
	--tm-info: #3b82f6;
	--tm-bg: #f6f7fb;
	--tm-surface: #ffffff;
	--tm-border: #e6e8f0;
	--tm-text: #1e2130;
	--tm-muted: #6b7280;
	--tm-overlay: rgba(15, 17, 23, .45);
	--tm-radius-sm: 8px;
	--tm-radius-input: 10px;
	--tm-radius-btn: 12px;
	--tm-radius-card: 16px;
	--tm-radius-popup: 20px;
	--tm-radius-pill: 999px;
	--tm-shadow-light: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
	--tm-shadow-hover: 0 8px 20px rgba(128, 122, 248, .18);
	--tm-shadow-popup: 0 24px 60px rgba(16, 24, 40, .24);
	--tm-shadow-float: 0 12px 32px rgba(16, 24, 40, .14);
	font-family: "Tajawal", sans-serif;
	color: var(--tm-text);
	background: var(--tm-bg);
	max-width: 1200px;
	margin: 20px 20px 40px 0;
	padding: 0 0 40px;
	border-radius: var(--tm-radius-card);
}

.teammon-app[data-theme="dark"] {
	--tm-bg: #0f1117;
	--tm-surface: #1a1d27;
	--tm-border: #2a2e3a;
	--tm-text: #f2f3f8;
	--tm-muted: #9aa0ae;
	--tm-overlay: rgba(0, 0, 0, .6);
}

.tm-hero {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 24px 28px;
	background: var(--tm-gradient);
	color: #fff;
	border-radius: var(--tm-radius-card) var(--tm-radius-card) 0 0;
}

.tm-hero__brand { display: flex; align-items: center; gap: 14px; }
.tm-hero__logo {
	width: 48px; height: 48px; border-radius: 14px;
	background: rgba(255,255,255,.18); display: grid; place-items: center;
	font-weight: 700; letter-spacing: .5px;
}
.tm-hero__title { margin: 0; font-size: 22px; font-weight: 700; color: #fff; }
.tm-hero__meta { margin: 4px 0 0; opacity: .85; font-size: 13px; }

.tm-tabs {
	display: flex; flex-wrap: wrap; gap: 8px;
	padding: 16px 20px; background: var(--tm-surface);
	border-bottom: 1px solid var(--tm-border);
}
.tm-tabs__item {
	text-decoration: none; color: var(--tm-muted);
	padding: 10px 16px; border-radius: var(--tm-radius-pill);
	font-weight: 600; transition: all .2s ease;
}
.tm-tabs__item:hover { color: var(--tm-primary); background: rgba(128,122,248,.08); }
.tm-tabs__item.is-active { color: #fff; background: var(--tm-gradient); }

.tm-page { padding: 24px; }
.tm-card {
	background: var(--tm-surface); border: 1px solid var(--tm-border);
	border-radius: var(--tm-radius-card); box-shadow: var(--tm-shadow-light);
	margin-bottom: 20px; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease;
}
.tm-card__header {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 16px 20px; border-bottom: 1px solid var(--tm-border);
}
.tm-card__header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.tm-card__header-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
}
.tm-card__body { padding: 20px; }

.tm-btn {
	height: 44px; padding: 0 20px; border-radius: var(--tm-radius-btn);
	font: 600 15px/1 "Tajawal", sans-serif; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	border: 0; cursor: pointer; transition: all .2s ease; text-decoration: none;
}
.tm-btn--primary { background: var(--tm-gradient); color: #fff; }
.tm-btn--primary:hover { transform: translateY(-1px); box-shadow: var(--tm-shadow-hover); color: #fff; }
.tm-btn--secondary { background: rgba(51,197,200,.12); color: var(--tm-secondary); border: 1px solid rgba(51,197,200,.35); }
.tm-btn--ghost { background: transparent; color: var(--tm-primary); border: 1px solid transparent; }
.tm-btn--ghost:hover { background: rgba(128,122,248,.08); }
.tm-btn--danger { background: var(--tm-danger); color: #fff; }
.tm-btn--danger:hover { background: #dc2626; color: #fff; transform: translateY(-1px); box-shadow: 0 8px 18px rgba(239,68,68,.28); }
.tm-btn--neutral {
	background: #f3f4f8;
	color: #374151;
	border: 1px solid #e5e7ef;
}
.tm-btn--neutral:hover {
	background: #ebeef5;
	color: #111827;
}
.tm-btn--sm { height: 36px; padding: 0 14px; font-size: 13px; }
.tm-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.tm-btn.is-busy {
	position: relative;
	pointer-events: none;
	opacity: .85;
}
.tm-btn.is-busy .tm-btn__label::before {
	content: "";
	display: inline-block;
	width: 14px;
	height: 14px;
	margin-inline-end: 10px;
	border: 2px solid rgba(255,255,255,.35);
	border-top-color: #fff;
	border-radius: 50%;
	vertical-align: -2px;
	animation: tm-spin .7s linear infinite !important;
}
@keyframes tm-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

.tm-create-feedback {
	margin-top: 20px;
	padding: 28px 22px;
	border-radius: var(--tm-radius-card);
	border: 1px solid var(--tm-border);
	background: linear-gradient(160deg, rgba(128,122,248,.07), rgba(51,197,200,.06));
	text-align: center;
	animation: tm-toast-in .28s ease;
}
.tm-order-create-card > .tm-create-feedback,
.tm-form > .tm-create-feedback {
	margin-top: 0;
}
.tm-create-compose[hidden] { display: none !important; }
.tm-create-feedback[hidden],
.tm-create-feedback__state[hidden] { display: none !important; }
.tm-create-feedback--creating { border-color: rgba(128,122,248,.28); }
.tm-create-feedback--success {
	border-color: rgba(34,197,94,.3);
	background: linear-gradient(160deg, rgba(34,197,94,.1), rgba(128,122,248,.05));
}
.tm-create-feedback__spinner {
	display: block;
	box-sizing: border-box;
	width: 46px;
	height: 46px;
	margin: 0 auto 14px;
	border-radius: 50%;
	border: 3px solid rgba(128,122,248,.22);
	border-top-color: var(--tm-primary, #807af8);
	border-right-color: var(--tm-primary, #807af8);
	animation: tm-spin .75s linear infinite !important;
	will-change: transform;
	transform-origin: center center;
}
.tm-create-feedback--creating .tm-create-feedback__title {
	animation: tm-creating-pulse 1.2s ease-in-out infinite !important;
}
@keyframes tm-creating-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: .55; }
}
.tm-create-feedback__check {
	width: 56px;
	height: 56px;
	margin: 0 auto 14px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--tm-success, #22c55e);
	color: #fff;
	font-size: 28px;
	font-weight: 700;
	box-shadow: 0 10px 24px rgba(34,197,94,.28);
	animation: tm-pop .35s ease;
}
@keyframes tm-pop {
	0% { transform: scale(.6); opacity: 0; }
	70% { transform: scale(1.08); opacity: 1; }
	100% { transform: scale(1); }
}
.tm-create-feedback__title {
	margin: 0 0 6px;
	font-size: 17px;
	font-weight: 700;
}
.tm-create-feedback__sub { margin: 0; }
.tm-create-feedback__awb {
	margin: 14px 0 6px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
}
.tm-create-feedback__awb span {
	color: var(--tm-muted);
	font-size: 13px;
}
.tm-create-feedback__awb-value {
	font-size: 24px;
	letter-spacing: .03em;
	font-variant-numeric: tabular-nums;
}
.tm-create-feedback__ref { margin: 0 0 12px; }
.tm-create-feedback__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: stretch;
	gap: 10px;
	margin-top: 16px;
}
.tm-create-feedback__actions .tm-btn {
	min-height: 44px;
	min-width: 132px;
	padding: 0 18px;
	box-sizing: border-box;
	text-decoration: none !important;
	box-shadow: none;
}
.tm-create-feedback__actions .tm-btn--neutral {
	background: #fff;
	color: #374151;
	border: 1px solid #d7dbe7;
}
.tm-create-feedback__actions .tm-btn--neutral:hover {
	background: #f5f6fa;
	border-color: #c5cad8;
	color: #111827;
}
.tm-order-create-card > .tm-create-feedback {
	width: 100%;
	box-sizing: border-box;
}
.tm-order-create .tm-create-feedback {
	margin-top: 16px;
	width: 100%;
	align-self: stretch;
	box-sizing: border-box;
}

.tm-badge {
	display: inline-flex; align-items: center; padding: 4px 10px;
	border-radius: var(--tm-radius-pill); font-size: 12px; font-weight: 600;
	background: rgba(128,122,248,.12); color: var(--tm-primary);
}
.tm-badge--success { background: rgba(34,197,94,.12); color: var(--tm-success); }
.tm-badge--warning { background: rgba(245,158,11,.14); color: var(--tm-warning); }
.tm-badge--danger { background: rgba(239,68,68,.12); color: var(--tm-danger); }
.tm-badge--info { background: rgba(59,130,246,.12); color: var(--tm-info); }
.tm-badge--muted { background: rgba(107,114,128,.12); color: var(--tm-muted); }

.tm-stats {
	display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px;
}
.tm-stat-card {
	background: var(--tm-surface); border: 1px solid var(--tm-border);
	border-radius: var(--tm-radius-card); padding: 18px; box-shadow: var(--tm-shadow-light);
}
.tm-stat-card__label { display: block; color: var(--tm-muted); font-size: 13px; margin-bottom: 8px; }
.tm-stat-card__value { font-size: 28px; font-weight: 700; }
.tm-stat-card__value--sm { font-size: 18px; }
.tm-stat-card--success { border-top: 3px solid var(--tm-success); }
.tm-stat-card--warning { border-top: 3px solid var(--tm-warning); }
.tm-stat-card--danger { border-top: 3px solid var(--tm-danger); }

.tm-grid { display: grid; gap: 16px; }
.tm-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tm-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tm-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tm-field--full { grid-column: 1 / -1; }

.tm-status-checks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin-top: 4px;
}
.tm-status-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 500 !important;
	margin: 0 !important;
	cursor: pointer;
}

.tm-ship-chooser {
	text-align: center;
	padding: 8px 4px 4px;
	max-width: 440px;
	margin: 0 auto;
}
.tm-ship-chooser__intro {
	margin-bottom: 4px;
}
.tm-ship-chooser__intro .tm-order-create-card__title {
	margin-bottom: 8px;
}
.tm-ship-chooser__intro .tm-help {
	margin: 0 auto;
	max-width: 36em;
	line-height: 1.55;
}
.tm-ship-chooser__options {
	display: grid;
	gap: 12px;
	margin-top: 18px;
}
.tm-ship-chooser__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 100%;
	padding: 18px 16px;
	border: 1px solid #e6e8f0;
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
	cursor: pointer;
	text-align: center;
	transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.tm-ship-chooser__card:hover {
	border-color: #c7c9d9;
	box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
	transform: translateY(-1px);
}
.tm-ship-chooser__card--accent {
	border-color: #d9d6fe;
	background: linear-gradient(180deg, #fafaff 0%, #fff 100%);
}
.tm-ship-chooser__card-kicker {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #64748b;
}
.tm-ship-chooser__card-title {
	font-size: 17px;
	font-weight: 800;
	color: #0f172a;
}
.tm-ship-chooser__card-desc {
	font-size: 13px;
	line-height: 1.45;
	color: #64748b;
	max-width: 28em;
}
.tm-ship-chooser__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
	justify-content: center;
}

.tm-smsa-ship-modal__dialog--chooser {
	height: auto;
	max-height: min(90vh, 640px);
}
.tm-smsa-ship-modal__dialog--chooser .tm-smsa-ship-modal__body {
	display: flex;
	align-items: center;
	justify-content: center;
}

.tm-field { margin-bottom: 0; }
.tm-field > label {
	display: block;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
	color: var(--tm-text);
	margin-bottom: 8px;
	letter-spacing: 0;
}
.tm-field .tm-optional {
	font-size: 13px;
	font-weight: 500;
	color: var(--tm-muted);
}
.tm-field input[type="text"],
.tm-field input[type="password"],
.tm-field input[type="number"],
.tm-field input[type="date"],
.tm-field input[type="email"],
.tm-field input[type="tel"],
.tm-field input[type="color"],
.tm-field input:not([type]),
.tm-field select,
.tm-field textarea,
.tm-filters input,
.tm-filters select,
.tm-national-bar input {
	width: 100%; height: 48px; border-radius: var(--tm-radius-input);
	border: 1px solid var(--tm-border); background: var(--tm-surface); color: var(--tm-text);
	padding: 0 14px; font: 500 15px/1.4 "Tajawal", sans-serif; transition: border .2s ease, box-shadow .2s ease;
}
.tm-field textarea { height: auto; padding: 12px 14px; }
.tm-field input:focus,
.tm-field select:focus,
.tm-field textarea:focus,
.tm-national-bar input:focus {
	outline: none; border-color: var(--tm-primary);
	box-shadow: 0 0 0 3px rgba(128,122,248,.18);
}
.tm-field input.is-autofilled,
.tm-field select.is-autofilled {
	border-color: rgba(51, 197, 200, .55);
	background: rgba(51, 197, 200, .06);
}
.tm-help, .tm-muted { color: var(--tm-muted); font-size: 13px; margin: 8px 0 0; line-height: 1.45; }
.tm-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.tm-actions--sticky {
	margin-top: 8px;
	padding-top: 8px;
}
.tm-btn--lg { height: 52px; padding: 0 28px; font-size: 16px; }
.tm-field--inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.tm-field--inline input { flex: 1; min-width: 140px; }
.tm-field--grow { flex: 1; min-width: 200px; }

.tm-card__subtitle {
	margin: 6px 0 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--tm-muted);
	line-height: 1.45;
}

.tm-form { display: flex; flex-direction: column; gap: 20px; }
.tm-form-section {
	border: 1px solid var(--tm-border);
	border-radius: var(--tm-radius-card);
	padding: 20px;
	background: linear-gradient(180deg, rgba(128,122,248,.03) 0%, var(--tm-surface) 48%);
}
.tm-form-section--accent {
	border-color: rgba(128,122,248,.28);
	background:
		radial-gradient(120% 80% at 100% 0%, rgba(51,197,200,.12), transparent 55%),
		linear-gradient(180deg, rgba(128,122,248,.08) 0%, var(--tm-surface) 55%);
}
.tm-form-section__head { margin-bottom: 16px; }
.tm-form-section__badge {
	display: inline-flex;
	align-items: center;
	height: 26px;
	padding: 0 10px;
	border-radius: var(--tm-radius-pill);
	background: var(--tm-gradient);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	margin-bottom: 8px;
}
.tm-form-section__title {
	margin: 0;
	font-size: 18px;
	font-weight: 800;
	color: var(--tm-text);
	line-height: 1.3;
}
.tm-form-section__desc {
	margin: 6px 0 0;
	font-size: 14px;
	color: var(--tm-muted);
	line-height: 1.45;
	max-width: 52ch;
}
.tm-national-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: end;
}
.tm-btn--national {
	height: 48px;
	min-width: 160px;
	white-space: nowrap;
}

@media (max-width: 782px) {
	.tm-grid--2, .tm-grid--3, .tm-grid--4 { grid-template-columns: 1fr; }
	.tm-national-bar { align-items: stretch; }
	.tm-btn--national { width: 100%; }
}

.tm-switch { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.tm-kv { list-style: none; margin: 0; padding: 0; }
.tm-kv li {
	display: flex; justify-content: space-between; gap: 12px;
	padding: 10px 0; border-bottom: 1px solid var(--tm-border); font-size: 14px;
}
.tm-kv--compact li { padding: 6px 0; }
.tm-kv span { color: var(--tm-muted); }

.tm-table { width: 100%; border-collapse: collapse; }
.tm-table th, .tm-table td { text-align: start; padding: 12px 14px; border-bottom: 1px solid var(--tm-border); font-size: 13px; }
.tm-table th { font-weight: 600; background: rgba(128,122,248,.04); }
.tm-table tr:hover td { background: rgba(128,122,248,.06); }
.tm-code {
	display: block; background: rgba(15,17,23,.04); border: 1px solid var(--tm-border);
	border-radius: 10px; padding: 12px; overflow: auto; font-size: 12px; white-space: pre-wrap;
}
.teammon-app[data-theme="dark"] .tm-code { background: rgba(255,255,255,.04); }

.tm-empty { text-align: center; padding: 40px 20px; }
.tm-empty--compact { padding: 16px; }
.tm-empty__icon { font-size: 36px; margin-bottom: 10px; }

.tm-skeleton {
	border-radius: 10px; background: linear-gradient(90deg, #e6e8f0 25%, #f3f4f8 37%, #e6e8f0 63%);
	background-size: 400% 100%; animation: tm-shimmer 1.2s ease infinite; margin-bottom: 10px;
}
@keyframes tm-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.tm-toasts {
	position: fixed; top: 40px; inset-inline-end: 24px; z-index: 100000;
	display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.tm-toast {
	pointer-events: auto; min-width: 280px; max-width: 360px;
	background: rgba(255,255,255,.86); backdrop-filter: blur(8px);
	border: 1px solid var(--tm-border); border-inline-start: 3px solid var(--tm-primary);
	border-radius: 12px; box-shadow: var(--tm-shadow-float); padding: 12px 16px;
	animation: tm-toast-in .25s ease;
}
.tm-toast--success { border-inline-start-color: var(--tm-success); }
.tm-toast--error { border-inline-start-color: var(--tm-danger); }
.tm-toast--warning { border-inline-start-color: var(--tm-warning); }
.tm-toast__bar { height: 3px; margin-top: 10px; background: currentColor; opacity: .35; transform-origin: left; animation: tm-toast-bar 4s linear forwards; }
@keyframes tm-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes tm-toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.tm-order-panel__actions {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin: 12px 0;
	width: 100%;
}
.tm-timeline { margin-top: 12px; }
.tm-timeline ol { margin: 8px 0 0; padding-inline-start: 18px; }
.tm-timeline li { margin-bottom: 10px; }
.tm-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.tm-filters > * { width: auto; min-width: 140px; flex: 1; }

/* Saudi Riyal (new official symbol) */
.tm-price,
.teammon-app .woocommerce-Price-amount {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	flex-wrap: wrap;
	font-variant-numeric: tabular-nums;
}
.teammon-app .woocommerce-Price-currencySymbol,
.teammon-app .custom-currency-symbol,
.tm-sar-symbol {
	display: inline-flex !important;
	align-items: center;
	line-height: 1;
	vertical-align: middle;
}
.teammon-app .currency_icon,
.tm-sar-symbol .currency_icon {
	width: 0.9em;
	height: 0.9em;
	fill: currentColor;
	color: inherit;
	display: inline-block;
	vertical-align: -0.12em;
}
.teammon-app[data-theme="dark"] .currency_icon path {
	fill: currentColor;
}

/* RTL refinements */
.teammon-app[dir="rtl"] .tm-tabs,
.teammon-app[dir="rtl"] .tm-hero,
.teammon-app[dir="rtl"] .tm-card__header,
.teammon-app[dir="rtl"] .tm-actions,
.teammon-app[dir="rtl"] .tm-kv li {
	direction: rtl;
}
.teammon-app[dir="rtl"] .tm-table th,
.teammon-app[dir="rtl"] .tm-table td {
	text-align: right;
}

@media (max-width: 960px) {
	.tm-stats, .tm-grid--2, .tm-grid--3, .tm-grid--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
	.teammon-app { margin: 10px; }
	.tm-stats, .tm-grid--2, .tm-grid--3, .tm-grid--4 { grid-template-columns: 1fr; }
	.tm-hero { flex-direction: column; align-items: flex-start; }
	.tm-btn { width: 100%; }
	.tm-order-panel__actions .tm-btn { width: 100%; }
	.tm-shipments-actions .tm-btn { width: auto !important; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation: none !important;
		transition: none !important;
	}
	/* Keep loading indicators moving — functional feedback, not decoration. */
	.tm-create-feedback__spinner,
	.tm-btn.is-busy .tm-btn__label::before {
		animation: tm-spin .75s linear infinite !important;
	}
	.tm-create-feedback--creating .tm-create-feedback__title {
		animation: tm-creating-pulse 1.2s ease-in-out infinite !important;
	}
}
