/* Plataforma de Nuvens — Trevisan Prime (estilos compartilhados: login, dashboard, projeto, admin) */
:root {
  /* Paleta da Trevisan Prime (trevisanprime.com.br) — azul-marinho escuro +
     azul vivo de destaque, no lugar do âmbar genérico usado antes. */
  --navy: #0a1428;
  --navy-deep: #060c1a;
  --brand: #2f7dff;
  --brand-rgb: 47, 125, 255;
  --brand-dark: #1450c4;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  min-height: 100%;
  background: var(--navy-deep);
  color: #f1f5f9;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.bg-gradient {
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(circle at 20% 20%, rgba(var(--brand-rgb),0.12), transparent 45%),
              radial-gradient(circle at 80% 80%, rgba(var(--brand-rgb),0.08), transparent 45%),
              var(--navy-deep);
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10,20,40,0.9); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.02rem; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; color: #fff; font-weight: 900;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.crumb { color: #64748b; font-size: 0.86rem; }
.crumb a:hover { color: var(--brand); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 0.84rem; color: #cbd5e1; }
.role-badge {
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 20px;
  background: rgba(var(--brand-rgb),0.14); border: 1px solid rgba(var(--brand-rgb),0.35); color: var(--brand);
}
.role-badge.viewer { background: rgba(148,163,184,0.12); border-color: rgba(148,163,184,0.3); color: #94a3b8; }
.role-badge.editor { background: rgba(59,130,246,0.12); border-color: rgba(59,130,246,0.3); color: #60a5fa; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.page { max-width: 1080px; margin: 0 auto; padding: 32px 28px 60px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 800; }
.page-sub { color: #64748b; font-size: 0.86rem; margin-top: 4px; }
.section { margin-bottom: 34px; }
.section-title {
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #475569; margin-bottom: 12px;
}

/* ── Botões ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 9px 16px; border-radius: 9px; font-size: 0.82rem; font-weight: 700;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); color: #cbd5e1;
  transition: all 0.15s;
}
.btn:hover { background: rgba(255,255,255,0.07); color: #f1f5f9; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); color: #fff; border: none; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.3); color: #ef4444; }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 6px 11px; font-size: 0.74rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Cards / Grids ──────────────────────────────────────────────────── */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card {
  background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.07); border-radius: 14px;
  padding: 18px; transition: all 0.15s;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { background: rgba(255,255,255,0.05); border-color: rgba(var(--brand-rgb),0.3); }
.card-title { font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }
.card-desc { color: #94a3b8; font-size: 0.82rem; line-height: 1.5; margin-bottom: 12px; min-height: 18px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.74rem; color: #64748b; }
.card-actions { display: flex; gap: 6px; margin-top: 12px; }

/* ── Status badges ──────────────────────────────────────────────────── */
.status { font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.03em; }
.status.ready { background: rgba(34,197,94,0.14); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.status.converting, .status.processing, .status.pending { background: rgba(59,130,246,0.14); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.status.error { background: rgba(239,68,68,0.14); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.status.needs_pdal, .status.unsupported_format { background: rgba(245,158,11,0.14); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }

/* ── Forms ──────────────────────────────────────────────────────────── */
.form-card {
  background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.07); border-radius: 14px;
  padding: 20px; max-width: 480px;
}
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.74rem; color: #94a3b8; margin-bottom: 5px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="file"], .field select, .field textarea {
  width: 100%; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; padding: 9px 11px; color: #e2e8f0; font-size: 0.86rem;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: rgba(var(--brand-rgb),0.5); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.alert { padding: 10px 14px; border-radius: 9px; font-size: 0.82rem; margin-bottom: 14px; }
.alert-error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.alert-ok { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86efac; }

/* ── Tabela ─────────────────────────────────────────────────────────── */
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
table.tbl th { text-align: left; color: #64748b; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); }
table.tbl td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); color: #e2e8f0; }
table.tbl tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Login ──────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; padding: 36px 32px;
  background: rgba(13,17,23,0.9); backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.07); border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; }
.login-title { font-size: 1.15rem; font-weight: 800; }
.login-sub { font-size: 0.78rem; color: #64748b; }

/* ── Barra de progresso (conversão de nuvens) ──────────────────────────── */
.progress-wrap { margin: 8px 0 2px; }
.progress-track { height: 6px; border-radius: 4px; background: rgba(255,255,255,0.07); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); transition: width 0.4s; }
.progress-fill.indeterminate { width: 40% !important; animation: progress-indeterminate 1.4s ease-in-out infinite; }
@keyframes progress-indeterminate {
  0%   { margin-left: 0%; }
  50%  { margin-left: 60%; }
  100% { margin-left: 0%; }
}
.progress-label { font-size: 0.7rem; color: #64748b; margin-top: 4px; }

.empty-state { color: #475569; font-size: 0.84rem; padding: 18px 0; text-align: center; }
.muted { color: #64748b; }
.spin {
  width: 30px; height: 30px; border: 3px solid rgba(var(--brand-rgb),0.15); border-top-color: var(--brand);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

[data-editor-only], [data-admin-only] { }
body[data-role="viewer"] [data-editor-only],
body[data-role="viewer"] [data-admin-only],
body[data-role="editor"] [data-admin-only] { display: none !important; }
