/* =========================================================================
 * Unbox Painel — Design System Unbox v2.3 (scoped to .ubp-panel)
 * Light mode FIXO. Tokens exatos da seção 21 do DS.
 * ====================================================================== */

.ubp-panel {
	/* Fontes oficiais */
	--font-display: 'Sora', system-ui, sans-serif;
	--font-text: 'Inter', system-ui, sans-serif;
	--font-mono: 'JetBrains Mono', ui-monospace, monospace;

	/* Light mode — padrão */
	--bg0: #f1f3f7;
	--bg1: #ffffff;
	--bg2: #ffffff;
	--bg3: #f7f8fb;
	--bg4: #e8ecf3;

	--b1: #e0e5ee;
	--b2: #cfd7e6;
	--b3: #b7c1d2;

	--t1: #111318;
	--t2: #3f4654;
	--t3: #778092;
	--t4: #a0a8b7;

	--inp: #ffffff;
	--inpb: #d4dbe8;
	--ti: #111318;

	/* Cores fixas da marca */
	--or: #f97316;
	--or2: #ea650b;
	--or3: #c94f05;
	--og: rgba(249, 115, 22, .12);
	--og2: rgba(249, 115, 22, .20);

	--info: #3b82f6;
	--success: #22c55e;
	--danger: #ef4444;
	--warning: #f59e0b;

	/* Layout */
	--sidebar-w: 252px;
	--topbar-h: 72px;
	--content-max: 1480px;
	--page-gap: clamp(16px, 2.2vw, 36px);
	--bottom-safe-gap: 48px;

	--radius-card: 12px;
	--radius-control: 8px;
	--shadow-card: 0 10px 28px rgba(15, 23, 42, .07);

	--scrollbar-size: 8px;
	--scrollbar-thumb: var(--or);
	--scrollbar-thumb-hover: var(--or2);
	--scrollbar-track: transparent;

	font-family: var(--font-text);
	color: var(--t1);
	font-size: 14px;
	line-height: 1.55;
	box-sizing: border-box;
}

.ubp-panel *,
.ubp-panel *::before,
.ubp-panel *::after {
	box-sizing: border-box;
}

/* ---------- Scrollbar padrão Unbox (fina, laranja) ---------- */
.ubp-panel,
.ubp-panel * {
	scrollbar-width: thin;
	scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.ubp-panel *::-webkit-scrollbar {
	width: var(--scrollbar-size);
	height: var(--scrollbar-size);
}

.ubp-panel *::-webkit-scrollbar-track {
	background: var(--scrollbar-track);
}

.ubp-panel *::-webkit-scrollbar-thumb {
	background: var(--scrollbar-thumb);
	border-radius: 999px;
	border: 2px solid transparent;
	background-clip: content-box;
}

.ubp-panel *::-webkit-scrollbar-thumb:hover {
	background: var(--scrollbar-thumb-hover);
	background-clip: content-box;
}

.ubp-panel *::-webkit-scrollbar-corner {
	background: transparent;
}

/* ---------- Tipografia ---------- */
.ubp-panel h1,
.ubp-panel h2,
.ubp-panel h3,
.ubp-panel h4,
.ubp-panel button,
.ubp-panel label,
.ubp-panel nav {
	font-family: var(--font-display);
}

.ubp-panel h1,
.ubp-panel h2,
.ubp-panel h3,
.ubp-panel h4 {
	margin: 0 0 .4em;
	font-weight: 600;
	color: var(--t1);
	line-height: 1.25;
}

.ubp-panel p {
	font-family: var(--font-text);
}

.ubp-panel a {
	color: var(--or2);
	text-decoration: none;
}

.ubp-panel code,
.ubp-panel pre,
.ubp-panel .ubp-mono {
	font-family: var(--font-mono);
	font-size: .85em;
}

/* ---------- Ícones (SVG monocromático laranja) ---------- */
.ubp-ico {
	display: inline-flex;
	width: 18px;
	height: 18px;
	flex: none;
	color: var(--or);
	vertical-align: middle;
}

.ubp-ico svg {
	width: 100%;
	height: 100%;
	display: block;
}

/* ---------- Botões ---------- */
.ubp-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 14px;
	border-radius: var(--radius-control);
	border: 1px solid transparent;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: 13px;
	cursor: pointer;
	transition: background .15s, border-color .15s, color .15s, opacity .15s, box-shadow .15s;
	white-space: nowrap;
	text-decoration: none;
}

.ubp-btn:disabled,
.ubp-btn.is-loading {
	opacity: .6;
	cursor: not-allowed;
}

.ubp-btn--primary {
	background: var(--or);
	border-color: var(--or);
	color: #fff;
}

.ubp-btn--primary:hover {
	background: var(--or2);
	border-color: var(--or2);
	color: #fff;
	/* Realce sutil no hover (sombra suave na cor da marca). */
	box-shadow: 0 2px 8px rgba(249, 115, 22, .35);
}

.ubp-btn--primary:active {
	background: var(--or3);
	border-color: var(--or3);
}

.ubp-btn--primary .ubp-ico { color: #fff; }

.ubp-btn--ghost {
	background: var(--bg1);
	border-color: var(--b2);
	color: var(--t2);
}

.ubp-btn--ghost:hover {
	border-color: rgba(249, 115, 22, .45);
	color: var(--or);
}

.ubp-btn--danger {
	background: transparent;
	border-color: var(--danger);
	color: var(--danger);
}

.ubp-btn--danger:hover {
	background: var(--danger);
	color: #fff;
}

.ubp-btn--danger .ubp-ico { color: currentColor; }

.ubp-btn--sm {
	padding: 7px 11px;
	font-size: 12px;
}

.ubp-btn--block {
	width: 100%;
	justify-content: center;
}

/* Anchors styled as buttons inherit the global link color — re-assert. */
.ubp-panel a.ubp-btn--primary,
.ubp-panel a.ubp-btn--primary:hover {
	color: #fff;
}

.ubp-panel a.ubp-btn--ghost,
.ubp-panel .ubp-btn--ghost {
	color: var(--t2);
}

.ubp-panel a.ubp-btn--ghost:hover,
.ubp-panel .ubp-btn--ghost:hover {
	color: var(--or);
}

/* ---------- Cards / seções ---------- */
.ubp-card {
	background: var(--bg2);
	border: 1px solid var(--b1);
	border-radius: var(--radius-card);
	padding: 18px 22px;
	box-shadow: var(--shadow-card);
}

.ubp-card__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-display);
	font-size: 13px;
	font-weight: 600;
	color: var(--t2);
	margin-bottom: 12px;
}

.ubp-card__subtitle {
	font-weight: 700;
	margin-bottom: 12px;
}

.ubp-card--danger { border-color: var(--danger); }
.ubp-danger-text { color: var(--danger); }

.ubp-divider {
	height: 1px;
	background: var(--b1);
	margin: 18px 0;
}

/* ---------- Stat cards ---------- */
.ubp-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 14px;
}

.ubp-stat {
	background: var(--bg2);
	border: 1px solid var(--b1);
	border-radius: var(--radius-card);
	padding: 16px 18px;
	box-shadow: var(--shadow-card);
}

.ubp-stat__value {
	font-family: var(--font-display);
	font-size: 28px;
	font-weight: 700;
	color: var(--t1);
	line-height: 1.1;
}

.ubp-stat__label {
	font-size: 12px;
	color: var(--t3);
	margin-top: 4px;
}

.ubp-stat--accent {
	border-color: var(--og2);
	box-shadow: inset 3px 0 0 var(--or), var(--shadow-card);
}

/* ---------- Formulários ---------- */
.ubp-form-grid {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: 14px;
	align-items: start;
}

.ubp-col-6 { grid-column: span 6; }
.ubp-col-12 { grid-column: span 12; }

.ubp-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	align-self: start;
	margin-bottom: 16px;
}

.ubp-field > label {
	display: block;
	font-family: var(--font-display);
	font-size: 12px;
	font-weight: 600;
	color: var(--t2);
}

.ubp-req { color: var(--or); }

.ubp-input,
.ubp-select,
.ubp-textarea {
	width: 100%;
	padding: 10px 14px;
	background: var(--inp);
	border: 1px solid var(--inpb);
	border-radius: var(--radius-control);
	color: var(--ti);
	font-family: var(--font-text);
	font-size: 13px;
	transition: border-color .15s, box-shadow .15s;
}

.ubp-input:focus,
.ubp-select:focus,
.ubp-textarea:focus {
	outline: none;
	border-color: rgba(249, 115, 22, .55);
	box-shadow: 0 0 0 3px rgba(249, 115, 22, .12);
}

.ubp-input--color {
	height: 42px;
	padding: 4px;
}

.ubp-textarea {
	min-height: 110px;
	resize: vertical;
}

.ubp-field__hint,
.ubp-hint {
	font-size: 11px;
	color: var(--t3);
	line-height: 1.45;
}

.ubp-check {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-text);
	font-size: 13px;
	color: var(--t2);
	cursor: pointer;
}

/* ---------- Badges / pills ---------- */
.ubp-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 10px;
	border-radius: 999px;
	font-family: var(--font-display);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
}

.ubp-badge--muted   { background: var(--bg4); color: var(--t2); }
.ubp-badge--info    { background: rgba(59, 130, 246, .13); color: var(--info); }
.ubp-badge--success { background: rgba(34, 197, 94, .13); color: var(--success); }
.ubp-badge--warning { background: rgba(245, 158, 11, .13); color: var(--warning); }
.ubp-badge--danger  { background: rgba(239, 68, 68, .13); color: var(--danger); }

/* ---------- Tabelas ---------- */
.ubp-table-wrap {
	overflow-x: auto;
	border-radius: var(--radius-card);
}

.ubp-table {
	width: 100%;
	border-collapse: collapse;
	background: var(--bg2);
	border: 1px solid var(--b1);
	border-radius: var(--radius-card);
	overflow: hidden;
}

.ubp-table th,
.ubp-table td {
	padding: 12px 14px;
	text-align: left;
	border-bottom: 1px solid var(--b1);
	font-size: 13px;
	vertical-align: middle;
}

.ubp-table th {
	background: var(--bg3);
	color: var(--t2);
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .03em;
}

.ubp-table tr:last-child td {
	border-bottom: none;
}

.ubp-table tbody tr:hover {
	background: var(--bg3);
}

.ubp-table__actions {
	display: flex;
	gap: 6px;
	justify-content: flex-end;
}

/* ---------- Empty state ---------- */
.ubp-empty {
	text-align: center;
	padding: 48px 24px;
	color: var(--t3);
}

.ubp-empty .ubp-ico {
	width: 42px;
	height: 42px;
	color: var(--or);
	opacity: .6;
	margin-bottom: 10px;
}

/* ---------- Modais (overlay embaçado + card 16px) ---------- */
.ubp-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .48);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 100000;
	padding: 20px;
}

.ubp-modal-overlay.is-open {
	display: flex;
}

.ubp-modal {
	background: var(--bg1);
	border: 1px solid var(--b1);
	border-radius: 16px;
	width: 100%;
	max-width: 520px;
	max-height: 90vh;
	overflow: auto;
	box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}

.ubp-modal--lg { max-width: 720px; }

.ubp-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 24px;
	border-bottom: 1px solid var(--b1);
}

.ubp-modal__head h3 { margin: 0; font-size: 16px; }

.ubp-modal__body { padding: 24px; }

.ubp-modal__foot {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	padding: 16px 24px;
	border-top: 1px solid var(--b1);
}

.ubp-modal__close {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--t3);
	font-size: 22px;
	line-height: 1;
}

.ubp-modal__close:hover { color: var(--or); }

/* ---------- Toasts ---------- */
.ubp-toasts {
	position: fixed;
	right: 20px;
	bottom: 96px; /* acima do botão de suporte */
	display: flex;
	flex-direction: column;
	gap: 10px;
	z-index: 100001;
}

.ubp-toast {
	min-width: 240px;
	max-width: 360px;
	padding: 13px 16px;
	border-radius: var(--radius-control);
	background: var(--t1);
	color: #fff;
	font-family: var(--font-text);
	font-size: 13px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
	animation: ubp-toast-in .2s ease;
}

.ubp-toast--success { background: #15803d; }
.ubp-toast--error   { background: var(--danger); }

@keyframes ubp-toast-in {
	from { transform: translateY(10px); opacity: 0; }
	to   { transform: translateY(0); opacity: 1; }
}

/* ---------- Skeleton / loading ---------- */
.ubp-skeleton {
	background: linear-gradient(90deg, var(--bg4) 25%, var(--bg3) 50%, var(--bg4) 75%);
	background-size: 200% 100%;
	animation: ubp-shimmer 1.2s infinite;
	border-radius: 10px;
	height: 14px;
}

@keyframes ubp-shimmer {
	from { background-position: 200% 0; }
	to   { background-position: -200% 0; }
}

.ubp-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, .4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ubp-spin .7s linear infinite;
	display: inline-block;
}

@keyframes ubp-spin { to { transform: rotate(360deg); } }

/* ---------- Botão flutuante de suporte Unbox (DS §15) ---------- */
.ubp-support-fab {
	position: fixed;
	right: 22px;
	bottom: 22px;
	width: 54px;
	height: 54px;
	border-radius: 50%;
	border: none;
	background: var(--or);
	color: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 12px 30px rgba(249, 115, 22, .4);
	z-index: 99990;
	transition: background .15s, transform .15s;
}

.ubp-support-fab:hover {
	background: var(--or2);
	transform: translateY(-2px);
}

.ubp-support-fab .ubp-ico {
	width: 24px;
	height: 24px;
	color: #fff;
}

.ubp-support-success__body {
	text-align: center;
	padding: 40px 24px;
}

.ubp-support-success__body h3 { margin: 12px 0 6px; }
.ubp-support-success__body p { color: var(--t2); margin: 0 0 18px; }

.ubp-support-success__icon {
	width: 44px;
	height: 44px;
	color: var(--success);
}

/* ---------- Slot de widgets do dashboard (contrato C2) ---------- */
.ubp-widgets {
	display: grid;
	grid-template-columns: 1fr;
	gap: 14px;
}

.ubp-widget {
	background: var(--bg2);
	border: 1px solid var(--b1);
	border-radius: var(--radius-card);
	padding: 18px 22px;
	box-shadow: var(--shadow-card);
}

.ubp-widget__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-display);
	font-size: 13px;
	font-weight: 600;
	color: var(--t2);
	margin-bottom: 12px;
}

.ubp-widget__body {
	font-family: var(--font-text);
	font-size: 13px;
	color: var(--t2);
}
