/* Shared styles of the private pages of app.chabim.com (same brand tokens as the viewer) */
:root {
	--brand-orange: #d78a49;
	--brand-orange-rgb: 215, 138, 73;
	--brand-orange-light: #e8a56c;
	--brand-navy: #262650;
	--brand-peach: #f2dac6;
	--bg-deep: #12122a;
	--panel: #191938;
	--line: rgba(255, 255, 255, 0.08);
	--text: #ececf6;
	--text-soft: #d6d6e8;
	--text-muted: #a3a3c2;
	--text-faint: #7a7a9e;
	--ok: #22c55e;
	--danger: #ef4444;
	color-scheme: dark;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	min-height: 100vh;
	font-family: 'Inter', sans-serif;
	color: var(--text);
	background: radial-gradient(ellipse at 50% 0%, #2a2a58 0%, #17173a 50%, #0c0c20 100%) fixed;
	-webkit-font-smoothing: antialiased;
}

a {
	color: var(--brand-orange-light);
}

/* ---------- Sign-in / sign-up card ---------- */
.auth-wrap {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px 16px;
}

.auth-card {
	width: 100%;
	max-width: 400px;
	background: rgba(25, 25, 56, 0.92);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 28px 24px 24px;
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 22px;
	text-decoration: none;
	color: #ffffff;
}

.brand img {
	width: 40px;
	height: 40px;
	border-radius: 9px;
	background: #ffffff;
	object-fit: contain;
	padding: 3px;
}

.brand span {
	font-family: 'Outfit', sans-serif;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 0.5px;
}

.brand small {
	display: block;
	font-family: 'Inter', sans-serif;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	color: var(--brand-orange);
}

h1 {
	margin: 0 0 6px;
	font-family: 'Outfit', sans-serif;
	font-size: 22px;
	font-weight: 600;
	color: #ffffff;
}

.lead {
	margin: 0 0 20px;
	font-size: 13px;
	line-height: 1.55;
	color: var(--text-muted);
}

form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

label {
	display: flex;
	flex-direction: column;
	gap: 6px;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-soft);
}

label small {
	font-weight: 400;
	color: var(--text-faint);
}

input {
	width: 100%;
	font: inherit;
	font-size: 14px;
	font-weight: 400;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 9px;
	padding: 11px 12px;
	outline: none;
}

input:focus {
	border-color: var(--brand-orange);
	box-shadow: 0 0 0 3px rgba(var(--brand-orange-rgb), 0.22);
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	border-radius: 9px;
	padding: 11px 16px;
	border: 1px solid transparent;
	cursor: pointer;
	text-decoration: none;
}

.btn-primary {
	background: var(--brand-orange);
	color: var(--bg-deep);
}

.btn-primary:hover {
	background: var(--brand-orange-light);
}

.btn-primary:disabled {
	opacity: 0.6;
	cursor: wait;
}

.btn-ghost {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.12);
	color: var(--text-soft);
}

.btn-ghost:hover {
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
}

.btn-sm {
	font-size: 12px;
	padding: 6px 10px;
	border-radius: 7px;
}

.btn-danger {
	background: rgba(239, 68, 68, 0.12);
	border-color: rgba(239, 68, 68, 0.35);
	color: #fca5a5;
}

.btn-danger:hover {
	background: rgba(239, 68, 68, 0.22);
}

.form-error {
	display: none;
	font-size: 13px;
	line-height: 1.45;
	color: #fecaca;
	background: rgba(239, 68, 68, 0.12);
	border: 1px solid rgba(239, 68, 68, 0.3);
	border-radius: 8px;
	padding: 9px 11px;
}

.form-error.show {
	display: block;
}

.alt {
	margin: 18px 0 0;
	text-align: center;
	font-size: 13px;
	color: var(--text-muted);
}

.cf-turnstile {
	min-height: 65px;
}

/* ---------- Signed-in pages ---------- */
.topbar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px 24px;
	background: rgba(18, 18, 42, 0.85);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	z-index: 10;
}

.topbar .brand {
	margin: 0;
}

.topbar nav {
	display: flex;
	gap: 6px;
	flex: 1;
}

.topbar nav a {
	font-size: 13px;
	font-weight: 600;
	color: var(--text-muted);
	text-decoration: none;
	padding: 6px 10px;
	border-radius: 7px;
}

.topbar nav a:hover,
.topbar nav a.current {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.06);
}

.user-chip {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 13px;
	color: var(--text-soft);
}

.role {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	padding: 2px 8px;
	border-radius: 10px;
	color: var(--bg-deep);
	background: var(--brand-orange);
}

.role.tecnico { background: var(--brand-peach); }
.role.cliente { background: #a3a3c2; }

main {
	max-width: 1080px;
	margin: 0 auto;
	padding: 32px 24px 64px;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 16px;
}

.card {
	background: rgba(25, 25, 56, 0.9);
	border: 1px solid var(--line);
	border-radius: 14px;
	padding: 18px;
}

.project-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s, transform 0.15s;
}

.project-card:hover {
	border-color: rgba(var(--brand-orange-rgb), 0.5);
	transform: translateY(-2px);
}

.project-card h3 {
	margin: 0;
	font-family: 'Outfit', sans-serif;
	font-size: 17px;
	color: #ffffff;
}

.project-card .meta {
	font-size: 12px;
	color: var(--text-muted);
}

.project-card .open {
	margin-top: 4px;
	font-size: 13px;
	font-weight: 700;
	color: var(--brand-orange);
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

th {
	text-align: left;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--text-faint);
	padding: 10px;
	border-bottom: 1px solid var(--line);
}

td {
	padding: 10px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
	vertical-align: middle;
}

td small {
	display: block;
	color: var(--text-faint);
}

.state {
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 10px;
}

.state.pendiente { color: #fde68a; background: rgba(234, 179, 8, 0.15); }
.state.activo { color: #86efac; background: rgba(34, 197, 94, 0.15); }
.state.rechazado { color: #fca5a5; background: rgba(239, 68, 68, 0.15); }

.actions {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	align-items: center;
}

select {
	font: inherit;
	font-size: 12px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 7px;
	padding: 5px 8px;
}

select option {
	background: var(--panel);
}

.notice {
	font-size: 13px;
	line-height: 1.5;
	color: var(--text-soft);
	background: rgba(var(--brand-orange-rgb), 0.1);
	border: 1px solid rgba(var(--brand-orange-rgb), 0.3);
	border-radius: 10px;
	padding: 12px 14px;
	margin-bottom: 16px;
}

.notice code {
	font-size: 14px;
	font-weight: 700;
	color: #ffffff;
	user-select: all;
}

.table-wrap {
	overflow-x: auto;
}

@media (max-width: 640px) {
	.topbar {
		flex-wrap: wrap;
		padding: 10px 16px;
	}

	.topbar nav {
		order: 3;
		flex-basis: 100%;
	}

	.user-chip .name {
		display: none;
	}

	main {
		padding: 24px 16px 48px;
	}
}

/* ---------- Workspace, plans and projects (stage 1) ---------- */
.role.admin { background: var(--brand-orange); }
.role.superadmin { background: #a855f7; color: #ffffff; }

.page-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 20px;
}

.plan-card {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 6px 16px;
	min-width: 280px;
	max-width: 380px;
	flex: 1;
	padding: 14px 16px;
}

.plan-card .plan-name {
	font-family: 'Outfit', sans-serif;
	font-size: 15px;
	font-weight: 700;
	color: #ffffff;
}

.plan-card .plan-name small {
	display: block;
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 500;
	color: var(--text-muted);
}

.plan-badge {
	align-self: start;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	padding: 3px 10px;
	border-radius: 10px;
	background: rgba(var(--brand-orange-rgb), 0.15);
	color: var(--brand-orange-light);
	border: 1px solid rgba(var(--brand-orange-rgb), 0.35);
}

.plan-card .meter,
.plan-card .plan-meta {
	grid-column: 1 / -1;
}

.meter {
	display: flex;
	flex-direction: column;
	gap: 5px;
	font-size: 12px;
	color: var(--text-muted);
}

.meter-bar {
	height: 6px;
	border-radius: 3px;
	background: rgba(255, 255, 255, 0.08);
	overflow: hidden;
}

.meter-bar span {
	display: block;
	height: 100%;
	border-radius: 3px;
	background: var(--brand-orange);
}

.meter-bar span.full {
	background: var(--danger);
}

.plan-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 14px;
	font-size: 12px;
	color: var(--text-muted);
}

.plan-meta .warn {
	color: #fca5a5;
	font-weight: 600;
}

.toolbar {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.toolbar .spacer {
	flex: 1;
}

.project-list {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.project {
	padding: 16px 18px;
}

.project-top {
	display: flex;
	align-items: flex-start;
	gap: 12px;
}

.project-top .titles {
	flex: 1;
	min-width: 0;
}

.project-top h3 {
	margin: 0;
	font-family: 'Outfit', sans-serif;
	font-size: 17px;
	color: #ffffff;
}

.project-top .desc {
	margin: 4px 0 0;
	font-size: 13px;
	color: var(--text-muted);
	white-space: pre-line;
}

.project-top .meta {
	margin-top: 6px;
	font-size: 11px;
	color: var(--text-faint);
}

.icon-btn {
	width: 32px;
	height: 32px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: rgba(255, 255, 255, 0.04);
	color: var(--text-muted);
	cursor: pointer;
}

.icon-btn:hover {
	color: #ffffff;
	background: rgba(255, 255, 255, 0.1);
}

.icon-btn.danger:hover {
	color: #fca5a5;
	border-color: rgba(239, 68, 68, 0.4);
	background: rgba(239, 68, 68, 0.12);
}

.icon-btn svg {
	width: 15px;
	height: 15px;
	stroke: currentColor;
	stroke-width: 2;
	fill: none;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.clouds {
	margin-top: 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.clouds-title {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--text-faint);
}

.cloud {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	padding: 10px 12px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid rgba(255, 255, 255, 0.06);
}

.cloud .name {
	flex: 1;
	min-width: 160px;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-soft);
}

.cloud .facts {
	display: flex;
	gap: 14px;
	flex-wrap: wrap;
	font-size: 12px;
	color: var(--text-muted);
	font-variant-numeric: tabular-nums;
}

.chip {
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 10px;
}

.chip.lista { color: #86efac; background: rgba(34, 197, 94, 0.15); }
.chip.subiendo, .chip.en_cola, .chip.convirtiendo { color: #fde68a; background: rgba(234, 179, 8, 0.15); }
.chip.error { color: #fca5a5; background: rgba(239, 68, 68, 0.15); }

.empty {
	font-size: 13px;
	color: var(--text-faint);
	padding: 6px 2px;
}

/* Dialog */
.dialog-backdrop {
	position: fixed;
	inset: 0;
	z-index: 50;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba(12, 12, 32, 0.7);
}

.dialog-backdrop.open {
	display: flex;
}

.dialog {
	width: 100%;
	max-width: 460px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 16px;
	padding: 22px;
	box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55);
}

.dialog h2 {
	margin: 0 0 16px;
	font-family: 'Outfit', sans-serif;
	font-size: 19px;
	color: #ffffff;
}

.dialog textarea,
.dialog select {
	width: 100%;
	font: inherit;
	font-size: 14px;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.04);
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 9px;
	padding: 10px 12px;
	outline: none;
	resize: vertical;
}

.dialog textarea:focus,
.dialog select:focus {
	border-color: var(--brand-orange);
}

.dialog-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 6px;
}

/* Tabs */
.tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 16px;
	border-bottom: 1px solid var(--line);
}

.tabs button {
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--text-muted);
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	padding: 10px 14px;
	cursor: pointer;
}

.tabs button.current {
	color: #ffffff;
	border-bottom-color: var(--brand-orange);
}

td input[type="date"],
td input[type="text"] {
	font-size: 12px;
	padding: 5px 8px;
	border-radius: 7px;
	width: auto;
}

td .meter {
	min-width: 140px;
}

/* Table cells holding a control plus its button */
.cell-row {
	display: flex;
	align-items: center;
	gap: 8px;
	white-space: nowrap;
}

.cell-stack {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
}

/* Administration: wider page and tighter table so every column fits without scrolling */
main.wide {
	max-width: 1280px;
}

.admin-table th,
.admin-table td {
	padding: 10px 8px;
}

.admin-table td input[type="text"] {
	width: 150px;
}

.admin-table td .meter {
	min-width: 120px;
}

/* ---------- Uploads (stage 2) ---------- */
.tabs button .soon {
	font-size: 10px;
	font-weight: 500;
	color: var(--text-muted);
	margin-left: 4px;
}

.small-link {
	margin: -6px 0 14px;
	font-size: 12px;
}

button.link {
	font: inherit;
	color: var(--brand-orange);
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	text-decoration: underline;
}

.drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 26px 16px;
	margin-bottom: 14px;
	border: 2px dashed rgba(var(--brand-orange-rgb), 0.45);
	border-radius: 12px;
	background: rgba(var(--brand-orange-rgb), 0.05);
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s, border-color 0.15s;
}

.drop:hover,
.drop.over {
	background: rgba(var(--brand-orange-rgb), 0.12);
	border-color: var(--brand-orange);
}

.drop-title {
	font-size: 14px;
	font-weight: 700;
	color: #ffffff;
}

.drop-sub {
	font-size: 12px;
	font-weight: 400;
	color: var(--text-muted);
}

.file-info {
	margin-bottom: 14px;
	padding: 9px 12px;
	border-radius: 9px;
	font-size: 12px;
	color: var(--text-soft);
	background: rgba(34, 197, 94, 0.1);
	border: 1px solid rgba(34, 197, 94, 0.3);
	word-break: break-all;
}

.upload-progress {
	flex: 1 1 220px;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.upload-text {
	font-size: 11px;
	color: var(--text-muted);
	font-variant-numeric: tabular-nums;
}
