/* Marea Gris. Tema oscuro: la marea es gris; lo pintado, en color. */

:root {
	--bg: #14181c;
	--surface: #1d2328;
	--surface-2: #262e35;
	--line: #323b44;
	--text: #e7eaec;
	--muted: #9aa3ab;
	--accent: #4fb3a9;
	--accent-ink: #0d2523;
	--danger: #e0675f;
	--radius: 12px;
	--s-no_tengo: #3d454d;
	--s-sin_montar: #6c747c;
	--s-montada: #8b939b;
	--s-imprimada: #b5bcc2;
	--s-pintando: #e2a84b;
	--s-pintada: #4fb3a9;
	color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

a { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 1.15rem; }

button, input, select, textarea {
	font: inherit;
	color: inherit;
}

button {
	background: var(--accent);
	color: var(--accent-ink);
	border: 0;
	border-radius: 10px;
	padding: .65rem 1rem;
	font-weight: 600;
	cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: var(--surface-2); color: var(--text); }
button.danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
button.link { background: none; color: var(--accent); padding: .25rem 0; font-weight: 500; }

.icon-button {
	background: none;
	color: var(--text);
	font-size: 1.6rem;
	line-height: 1;
	padding: .35rem .6rem;
	min-width: 2.75rem;
}

input, select, textarea {
	width: 100%;
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: .6rem .7rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type="color"] { padding: .2rem; height: 2.6rem; }
textarea { min-height: 6rem; resize: vertical; }
label { display: block; color: var(--muted); font-size: .9rem; }
label > input, label > select, label > textarea { margin-top: .3rem; color: var(--text); }

.error { color: var(--danger); min-height: 1.2em; margin: .5rem 0 0; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

/* ---------- Entrada ---------- */

.login {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 1.5rem;
}
.login-box {
	width: min(22rem, 100%);
	display: grid;
	gap: 1rem;
	text-align: center;
}
.login-box img { margin: 0 auto; border-radius: 18px; }
.login-box label { text-align: left; }

/* ---------- Estructura ---------- */

.top {
	position: sticky;
	top: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	gap: .25rem;
	padding: calc(env(safe-area-inset-top) + .5rem) .5rem .5rem;
	background: rgba(20, 24, 28, .94);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--line);
}
.top h1 {
	flex: 1;
	font-size: 1.1rem;
	padding-left: .5rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

main {
	max-width: 46rem;
	margin: 0 auto;
	padding: 1rem 1rem calc(5rem + env(safe-area-inset-bottom));
}

.tabs {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 5;
	display: flex;
	background: var(--surface);
	border-top: 1px solid var(--line);
	padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
	flex: 1;
	text-align: center;
	padding: .85rem 0;
	color: var(--muted);
	text-decoration: none;
	font-weight: 600;
}
.tabs a.active { color: var(--accent); }

.section { margin: 1.5rem 0 .75rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.stack { display: grid; gap: .75rem; }
.row { display: flex; gap: .5rem; align-items: center; }
.row > * { flex: 1; }
.row > .shrink { flex: 0 0 auto; }

/* ---------- Resumen ---------- */

.hero {
	background: var(--surface);
	border-radius: var(--radius);
	padding: 1.1rem;
	display: grid;
	gap: .8rem;
}
.hero-number { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.hero-number small { font-size: 1rem; font-weight: 500; color: var(--muted); margin-left: .35rem; }

.bar {
	display: flex;
	height: .55rem;
	border-radius: 99px;
	overflow: hidden;
	background: var(--surface-2);
}
.bar span { display: block; height: 100%; }

.legend { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .85rem; color: var(--muted); }
.legend i, .dot {
	display: inline-block;
	width: .7rem;
	height: .7rem;
	border-radius: 50%;
	margin-right: .3rem;
	vertical-align: -.05rem;
}

/* ---------- Tarjetas y listas ---------- */

.card {
	display: flex;
	gap: .85rem;
	align-items: center;
	background: var(--surface);
	border-radius: var(--radius);
	padding: .75rem;
	color: inherit;
	text-decoration: none;
}
.card-link {
	flex: 1;
	min-width: 0;
	display: flex;
	gap: .85rem;
	align-items: center;
	color: inherit;
	text-decoration: none;
}
.card-body { flex: 1; min-width: 0; display: grid; gap: .35rem; }
.card-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-sub { color: var(--muted); font-size: .85rem; }

.thumb {
	flex: 0 0 auto;
	width: 3.5rem;
	height: 3.5rem;
	border-radius: 10px;
	background: var(--surface-2);
	object-fit: cover;
	display: grid;
	place-items: center;
	color: var(--muted);
	font-size: 1.3rem;
}

.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; }
.chip {
	flex: 0 0 auto;
	background: var(--surface);
	color: var(--muted);
	border: 1px solid var(--line);
	border-radius: 99px;
	padding: .35rem .8rem;
	font-weight: 500;
	font-size: .9rem;
}
.chip.active { background: var(--surface-2); color: var(--text); border-color: var(--muted); }

.mini-status {
	flex: 0 0 auto;
	width: auto;
	padding: .35rem .5rem;
	font-size: .85rem;
	border-left: 4px solid var(--s-sin_montar);
}

.statuses { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.statuses button {
	background: var(--surface-2);
	color: var(--muted);
	font-weight: 500;
	font-size: .9rem;
	padding: .6rem .3rem;
	border: 2px solid transparent;
}
.statuses button.active { color: var(--text); border-color: currentColor; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .5rem; }
.photo { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo.uploading { display: grid; place-items: center; color: var(--muted); font-size: .85rem; }

.paint-row {
	display: flex;
	align-items: center;
	gap: .6rem;
	background: var(--surface);
	border-radius: 10px;
	padding: .55rem .7rem;
}
.paint-row .grow { flex: 1; min-width: 0; }
.swatch {
	flex: 0 0 auto;
	width: 1.6rem;
	height: 1.6rem;
	border-radius: 50%;
	border: 2px solid var(--line);
	background: var(--surface-2);
}

.brand { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin: 1rem 0 .4rem; }

/* ---------- Hoja (formularios) ---------- */

.sheet {
	position: fixed;
	inset: 0;
	z-index: 20;
	background: rgba(0, 0, 0, .55);
	display: flex;
	align-items: flex-end;
	justify-content: center;
}
.sheet-box {
	width: min(40rem, 100%);
	max-height: 92vh;
	overflow-y: auto;
	background: var(--surface);
	border-radius: 18px 18px 0 0;
	padding: 1.2rem 1rem calc(1.2rem + env(safe-area-inset-bottom));
}
.sheet-box form { display: grid; gap: .9rem; }
.sheet-box h2 { margin-bottom: .2rem; }
.sheet-actions { display: flex; gap: .5rem; justify-content: flex-end; }

@media (min-width: 42rem) {
	.sheet { align-items: center; }
	.sheet-box { border-radius: 18px; }
}

/* ---------- Visor de fotos ---------- */

.viewer {
	position: fixed;
	inset: 0;
	z-index: 30;
	background: #000;
	display: grid;
	place-items: center;
	padding: 1rem;
}
.viewer img { max-width: 100%; max-height: 85vh; object-fit: contain; }
.viewer p { position: absolute; bottom: calc(1rem + env(safe-area-inset-bottom)); left: 1rem; right: 1rem; text-align: center; margin: 0; }
.viewer .icon-button { position: absolute; top: calc(env(safe-area-inset-top) + .5rem); right: .5rem; font-size: 2rem; }

.toast {
	position: fixed;
	left: 50%;
	bottom: calc(4.5rem + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	z-index: 40;
	background: var(--surface-2);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: .6rem 1rem;
	max-width: calc(100% - 2rem);
}
.toast.bad { border-color: var(--danger); }
