:root {
  --bg: #070819;
  --bg-2: #0d0f2b;
  --card: rgba(255, 255, 255, 0.08);
  --card-strong: rgba(255, 255, 255, 0.13);
  --stroke: rgba(255, 255, 255, 0.14);
  --text: #f8f7ff;
  --muted: rgba(248, 247, 255, 0.68);
  --soft: rgba(248, 247, 255, 0.1);
  --purple: #713df4;
  --purple-2: #9f90ff;
  --purple-3: #4b16db;
  --danger: #ff5370;
  --success: #50f3b7;
  --warning: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --radius: 24px;
  --radius-sm: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(159, 144, 255, 0.3), transparent 34rem),
    radial-gradient(circle at 90% 5%, rgba(113, 61, 244, 0.32), transparent 32rem),
    linear-gradient(135deg, var(--bg), var(--bg-2) 55%, #14033f);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
  z-index: -1;
}

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

button,
a,
.record-item,
.nav-link {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, rgba(113, 61, 244, 0.32), transparent 34rem),
    #070819;
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.loader-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader-card {
  width: min(92vw, 430px);
  padding: 34px;
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  text-align: center;
  animation: floatIn 0.9s ease both;
}

.loader-logo {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  box-shadow: 0 18px 50px rgba(113, 61, 244, 0.45);
  animation: pulseLogo 1.8s ease-in-out infinite;
}

.loader-title {
  margin-top: 18px;
  font-weight: 900;
  letter-spacing: 0.22em;
  font-size: 1.35rem;
}

.loader-subtitle {
  color: var(--muted);
  margin: 8px 0 22px;
}

.loader-bar {
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
}

.loader-bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--purple-3), var(--purple-2), #ffffff);
  animation: loading 1.15s ease-in-out infinite;
}

@keyframes loading {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(280%); }
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(159,144,255,0)); }
  50% { transform: scale(1.035); filter: drop-shadow(0 0 20px rgba(159,144,255,0.55)); }
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.app,
.public-view {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 32px;
  align-items: center;
  width: min(1160px, calc(100% - 36px));
  margin: 0 auto;
  padding: 42px 0;
}

.login-art {
  padding: 38px;
  border: 1px solid var(--stroke);
  border-radius: 36px;
  min-height: 520px;
  background: linear-gradient(135deg, rgba(113, 61, 244, 0.46), rgba(255,255,255,0.07));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: floatIn 0.85s ease both;
}

.login-art::after {
  content: "";
  position: absolute;
  inset: auto -10% -35% 35%;
  height: 70%;
  background: radial-gradient(circle, rgba(255,255,255,0.26), transparent 55%);
  filter: blur(12px);
}

.login-art img {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  box-shadow: 0 18px 45px rgba(0,0,0,0.28);
}

.login-art h1 {
  font-size: clamp(2.9rem, 7vw, 6rem);
  line-height: 0.9;
  margin: 32px 0 18px;
  letter-spacing: -0.08em;
}

.login-art p {
  max-width: 520px;
  color: rgba(255,255,255,0.78);
  font-size: 1.08rem;
  line-height: 1.7;
}

.login-card,
.form-card,
.panel,
.search-card,
.modal-card,
.public-card {
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255,255,255,0.105), rgba(255,255,255,0.055));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.login-card {
  padding: 34px;
  animation: floatIn 1s ease 0.1s both;
}

.logo-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--soft);
  border: 1px solid var(--stroke);
  color: var(--muted);
}

.logo-chip img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
}

.login-card h2 {
  margin: 26px 0 8px;
  font-size: 2rem;
}

.login-card p,
.section-heading p,
.progress-info p,
.empty-state,
.form-card span,
.public-note,
.meta-value small {
  color: var(--muted);
}

label {
  display: grid;
  gap: 8px;
  color: rgba(255,255,255,0.82);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.28);
  border-radius: 15px;
  outline: none;
  padding: 13px 14px;
  transition: border 0.2s ease, transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(159,144,255,0.95);
  box-shadow: 0 0 0 4px rgba(113, 61, 244, 0.18);
  background: rgba(0,0,0,0.36);
}

select option {
  background: #16133d;
  color: #fff;
}

.primary-btn,
.ghost-btn,
.soft-btn,
.import-btn {
  border: 0;
  border-radius: 15px;
  padding: 13px 18px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease, border 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--purple), var(--purple-2));
  box-shadow: 0 16px 40px rgba(113, 61, 244, 0.34);
}

.ghost-btn,
.import-btn {
  color: var(--text);
  background: rgba(255,255,255,0.075);
  border: 1px solid rgba(255,255,255,0.16);
}

.soft-btn {
  color: var(--text);
  background: rgba(255,255,255,0.11);
}

.primary-btn:hover,
.ghost-btn:hover,
.soft-btn:hover,
.import-btn:hover,
.record-item:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

.error-message {
  min-height: 22px;
  color: var(--danger);
  font-weight: 700;
}

.dashboard {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid rgba(255,255,255,0.1);
  background: rgba(4, 6, 22, 0.56);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
}

.brand img,
.topbar-logo img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}

.brand strong {
  display: block;
  font-size: 1.1rem;
}

.brand span,
.topbar-logo span {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-link {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,0.72);
  padding: 13px 15px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 800;
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(113, 61, 244, 0.58), rgba(255,255,255,0.1));
  border-color: rgba(255,255,255,0.13);
}

.logout {
  margin-top: auto;
}

.content {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.eyebrow {
  color: var(--purple-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  font-weight: 900;
}

.topbar h1,
.section-heading h2,
.panel-title h2 {
  margin: 6px 0 0;
  letter-spacing: -0.04em;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 3.35rem);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
}

.page-section {
  display: none;
  animation: sectionIn 0.36s ease both;
}

.active-section {
  display: block;
}

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 166px;
  padding: 22px;
  border: 1px solid var(--stroke);
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(113, 61, 244, 0.12));
  border-radius: var(--radius);
}

.watermark::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -26px;
  width: 120px;
  height: 120px;
  background: url("assets/logo-rio-rise.jpg") center / cover no-repeat;
  opacity: 0.1;
  border-radius: 50%;
}

.stat-card span {
  color: var(--muted);
  font-weight: 800;
}

.stat-card strong {
  display: block;
  margin: 14px 0 8px;
  font-size: 2.45rem;
  letter-spacing: -0.06em;
}

.stat-card small {
  color: rgba(255,255,255,0.58);
}

.panel-row,
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 22px;
}

.panel-title,
.split-heading,
.form-actions,
.mini-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.goal-input {
  width: 120px;
  font-size: 0.86rem;
}

.goal-input input {
  padding: 10px 12px;
}

.progress-wrap {
  display: flex;
  gap: 22px;
  align-items: center;
  margin-top: 22px;
}

.progress-circle {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--purple-2) 0deg, rgba(255,255,255,0.1) 0deg);
  position: relative;
  flex: 0 0 auto;
}

.progress-circle::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: #11102c;
  border: 1px solid rgba(255,255,255,0.08);
}

.progress-circle span {
  position: relative;
  z-index: 1;
  font-size: 1.45rem;
  font-weight: 950;
}

.progress-info strong {
  display: block;
  font-size: 1.35rem;
}

.recent-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.recent-pill {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 15px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
}

.recent-pill b {
  display: block;
}

.recent-pill span {
  color: var(--muted);
  font-size: 0.9rem;
}

.chart-panel canvas {
  width: 100%;
  max-height: 320px;
  margin-top: 18px;
}

.section-heading {
  margin-bottom: 18px;
}

.form-card {
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wide {
  grid-column: 1 / -1;
}

.field-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.form-actions {
  justify-content: flex-start;
  margin-top: 20px;
  flex-wrap: wrap;
}

.search-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.search-card input {
  flex: 1;
}

.records-list {
  display: grid;
  gap: 12px;
}

.record-item {
  cursor: pointer;
  text-align: left;
  color: inherit;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(135deg, rgba(255,255,255,0.085), rgba(255,255,255,0.04));
  border-radius: 18px;
  padding: 16px;
  transition: transform 0.2s ease, border 0.2s ease, background 0.2s ease;
}

.record-item:hover {
  border-color: rgba(159,144,255,0.55);
  background: linear-gradient(135deg, rgba(113, 61, 244, 0.18), rgba(255,255,255,0.06));
}

.record-main strong {
  display: block;
  font-size: 1.1rem;
}

.record-main span,
.record-side,
.detail-meta span {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(113, 61, 244, 0.18);
  border: 1px solid rgba(159,144,255,0.35);
  font-size: 0.86rem;
  font-weight: 900;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 22px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 3, 11, 0.76);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(940px, 100%);
  max-height: 92vh;
  overflow: auto;
  padding: 24px;
  animation: floatIn 0.22s ease both;
}

.modal-close {
  position: sticky;
  float: right;
  top: 0;
  margin-left: auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.09);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.detail-header,
.public-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.detail-header img,
.public-header img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  box-shadow: 0 16px 40px rgba(113, 61, 244, 0.28);
}

.detail-header h2,
.public-header h1 {
  margin: 0;
  letter-spacing: -0.04em;
}

.detail-grid,
.public-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.meta-value {
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 14px;
  min-height: 82px;
}

.meta-value small {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

.meta-value p,
.meta-value strong {
  margin: 0;
  overflow-wrap: anywhere;
}

.meta-value.wide {
  grid-column: 1 / -1;
}

.evidence-link-wrap {
  margin-bottom: 12px !important;
}

.evidence-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.evidence-link:hover {
  opacity: 0.84;
}

.evidence-preview {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}


.evidence-warning {
  margin: 8px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 209, 102, 0.25);
  background: rgba(255, 209, 102, 0.08);
  color: rgba(255,255,255,0.78);
}

.evidence-preview video {
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: contain;
}

.evidence-preview video,
.evidence-preview img,
.evidence-preview iframe {
  width: 100%;
  max-height: 460px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
}

.detail-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  padding: 14px 16px;
  border-radius: 15px;
  background: rgba(13, 15, 43, 0.94);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: var(--shadow);
  color: #fff;
  animation: floatIn 0.22s ease both;
}

.public-view {
  display: grid;
  place-items: center;
  padding: 24px;
}

.public-card {
  width: min(980px, 100%);
  padding: 24px;
}

.public-note {
  border: 1px solid rgba(255,255,255,0.13);
  background: rgba(255,255,255,0.06);
  padding: 12px 14px;
  border-radius: 16px;
  margin: 0 0 16px;
}

.import-btn input {
  display: none;
}

@media (max-width: 1060px) {
  .stats-grid,
  .panel-row,
  .charts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-screen {
    grid-template-columns: 1fr;
  }
  .login-art {
    min-height: 360px;
  }
}

@media (max-width: 820px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }
  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .content {
    padding: 18px;
  }
  .topbar,
  .split-heading,
  .panel-title,
  .progress-wrap {
    align-items: flex-start;
    flex-direction: column;
  }
  .stats-grid,
  .panel-row,
  .charts-grid,
  .form-grid,
  .detail-grid,
  .public-grid {
    grid-template-columns: 1fr;
  }
  .wide {
    grid-column: auto;
  }
  .search-card {
    flex-direction: column;
  }
  .record-item {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 680px) {
  body {
    background-attachment: fixed;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .public-view {
    padding: 12px;
    align-items: start;
  }

  .public-card {
    padding: 16px;
    border-radius: 22px;
  }

  .public-header,
  .detail-header {
    align-items: center;
    gap: 10px;
  }

  .public-header img,
  .detail-header img {
    width: 56px;
    height: 56px;
  }

  .public-header h1,
  .detail-header h2 {
    font-size: clamp(1.55rem, 8vw, 2rem);
  }

  .meta-value {
    min-height: auto;
    padding: 13px;
  }

  .evidence-preview video,
  .evidence-preview img,
  .evidence-preview iframe {
    max-height: 70vh;
    border-radius: 14px;
  }

  .topbar-logo {
    width: 100%;
    justify-content: center;
  }

  .chart-panel canvas {
    height: 220px;
  }
}

@media (max-width: 520px) {
  .login-screen {
    width: min(100% - 24px, 1160px);
    padding: 18px 0;
  }
  .login-art,
  .login-card,
  .form-card,
  .panel,
  .public-card,
  .modal-card {
    border-radius: 20px;
    padding: 18px;
  }
  .login-art h1 {
    font-size: 3.4rem;
  }
  .nav {
    grid-template-columns: 1fr;
  }
  .form-actions,
  .detail-actions,
  .mini-actions {
    flex-direction: column;
    align-items: stretch;
  }
}


.user-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}
.user-card {
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(135deg, rgba(255,255,255,0.085), rgba(255,255,255,0.04));
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 10px;
}
.user-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.user-card strong { font-size: 1.06rem; }
.user-card small { color: var(--muted); display:block; margin-top:4px; }
.user-actions { display:flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.user-actions button { padding: 10px 12px; border-radius: 12px; }
.role-pill, .blocked-pill {
  display:inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: .78rem;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
}
.blocked-pill { color: var(--danger); }
.admin-only-hidden { display:none !important; }
@media (max-width: 820px) { .user-grid { grid-template-columns: 1fr; } }
