/* Dark navy + gold, matching the Power BI reports the portal frames, so the
   site and the report read as one product. One theme on purpose: a light
   portal around a dark report looks like two different tools. */
:root {
  --bg: #0b1526;
  --bg-2: #0e1b30;
  --surface: #13223b;
  --surface-2: #182a47;
  --line: #22385a;
  --text: #e8edf5;
  --muted: #93a3bc;
  --accent: #f2a900;
  --accent-hover: #ffbd2e;
  --accent-ink: #0b1526;
  --danger: #ff8a7a;
  --danger-bg: rgba(255, 138, 122, 0.1);
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
.muted { color: var(--muted); margin: 0; }
.fine { color: var(--muted); font-size: 0.8rem; opacity: 0.75; text-align: center; margin: 0; }

.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Brand ---------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-mark-bg { fill: var(--surface-2); stroke: var(--line); }
.brand-bar { fill: var(--accent); }
.brand-bar.b1 { fill-opacity: 0.55; }
.brand-bar.b2 { fill-opacity: 0.8; }
.brand-name { font-size: 1.05rem; font-weight: 400; letter-spacing: 0.01em; white-space: nowrap; }
.brand-name b { font-weight: 700; }
.brand-lg .brand-mark { width: 44px; height: 44px; }
.brand-lg .brand-name { font-size: 1.4rem; }

/* Buttons and fields ---------------------------------------------------- */
.btn-primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.7; cursor: progress; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.9rem;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn-ghost:hover { border-color: var(--accent); background: var(--surface); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover, .icon-btn.on { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { display: grid; gap: 6px; }
.field label { font-size: 0.85rem; color: var(--muted); }
.field input {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  transition: border-color 0.15s;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 169, 0, 0.18); }
.password { position: relative; }
.password input { padding-right: 46px; }
.password .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.caps { color: var(--accent); font-size: 0.82rem; margin: 2px 0 0; }
.alert {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 138, 122, 0.35);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.9rem;
}

/* Sign-in: artwork panel + form ---------------------------------------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 48px;
  background: var(--bg-2) url("/static/login-art.svg") center / cover no-repeat;
  border-right: 1px solid var(--line);
}
.auth-tagline { font-size: 2rem; line-height: 1.25; font-weight: 600; margin: 0 0 12vh; white-space: nowrap; }
.auth-panel { display: grid; place-items: center; padding: 32px 16px; }
.auth-form { width: 100%; max-width: 380px; display: grid; gap: 18px; }
.auth-form h1 { margin-top: 4px; }
.auth-form .muted { margin-top: -10px; }
.auth-form .btn-primary { margin-top: 6px; width: 100%; }
.auth-form-brand { display: none; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-form-brand { display: inline-flex; margin-bottom: 8px; }
}

/* Header bar ------------------------------------------------------------ */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 60px;
  padding: 10px 20px;
  background: rgba(11, 21, 38, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.crumb {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.bar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.85rem; min-width: 0; }
.user-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

@media (max-width: 760px) {
  .bar { gap: 10px; padding: 8px 12px; }
  .brand-name, .user-name, .btn-ghost span { display: none; }
  .crumb { padding-left: 10px; }
}

/* Home: report tiles ---------------------------------------------------- */
.home-body main, .message-body main { max-width: 1160px; margin: 0 auto; padding: 40px 20px 32px; }
.page-head { display: grid; gap: 6px; margin-bottom: 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; margin-bottom: 48px; }
.tile {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.tile:hover, .tile:focus-visible { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow); }
.tile-media { display: block; aspect-ratio: 1; background: var(--bg-2); overflow: hidden; }
.tile-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.tile:hover .tile-media img { transform: scale(1.04); }
.tile-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--accent);
  font-size: 3.5rem;
  font-weight: 700;
  background: radial-gradient(circle at 50% 55%, rgba(242, 169, 0, 0.16), transparent 60%), var(--bg-2);
}
.tile-body { display: grid; align-content: start; gap: 4px; padding: 16px 18px 18px; }
.tile-title { font-weight: 650; font-size: 1.05rem; }
.tile-desc { color: var(--muted); font-size: 0.9rem; }
.tile-cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--accent); font-size: 0.88rem; font-weight: 600; }
.tile-cta .icon { width: 16px; height: 16px; transition: transform 0.18s; }
.tile:hover .tile-cta .icon { transform: translateX(3px); }

/* Report: frame under the header, loading screen over it ----------------- */
.report-body { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
/* margin 0, not a centring "0 auto": an auto margin in a flex column shrinks
   main to its content, squeezing the frame until Power BI switches to its
   phone layout. */
.report-body main { flex: 1; min-height: 0; width: 100%; margin: 0; padding: 0; display: flex; }
.report-wrap { position: relative; flex: 1; display: flex; background: var(--bg); }
.report { flex: 1; width: 100%; height: 100%; border: 0; display: block; }
.report-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  background: var(--bg);
  transition: opacity 0.35s;
}
.report-loading.done { opacity: 0; pointer-events: none; }
.spinner {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Messages (404, errors) -------------------------------------------------- */
.message {
  max-width: 460px;
  margin: 10vh auto 0;
  padding: 36px 32px;
  display: grid;
  justify-items: start;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.message .btn-primary { margin-top: 8px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 0.01ms !important; }
}

/* Turnstile widget on the sign-in form (reserved height avoids a jump). */
.cf-turnstile { min-height: 65px; }
