:root {
  --bws-primary: #0b3d91;
  --bws-primary-dark: #082e6e;
  --bws-accent: #f0a202;
  --bws-bg: #f4f7fb;
  --bws-card: #ffffff;
  --bws-text: #1a2332;
  --bws-muted: #6b7a90;
  --bws-border: #e2e8f0;
  --bws-success: #0d9488;
  --bws-warn: #d97706;
  --shadow: 0 8px 24px rgba(11, 61, 145, 0.08);
  --radius: 12px;
  --font: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--bws-text);
  background: var(--bws-bg);
}

a {
  color: var(--bws-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--bws-primary), var(--bws-accent));
}

/* —— Auth —— */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(11, 61, 145, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 90%, rgba(240, 162, 2, 0.1), transparent 45%),
    var(--bws-bg);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--bws-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--bws-border);
  overflow: hidden;
}

.auth-card .brand {
  background: var(--bws-primary);
  color: #fff;
  padding: 1.5rem 1.75rem 1.25rem;
}

.auth-card .brand .brand-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: 260px;
  margin-bottom: 0.85rem;
}

.auth-card .brand .eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 0 0 0.35rem;
}

.auth-card .brand h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.auth-card .body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.auth-card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.auth-card input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--bws-border);
  border-radius: 8px;
  font: inherit;
  margin-bottom: 1rem;
}

.auth-card input:focus {
  outline: 2px solid rgba(11, 61, 145, 0.25);
  border-color: var(--bws-primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
}

.btn-primary {
  background: var(--bws-primary);
  color: #fff;
  width: 100%;
}

.btn-primary:hover {
  background: var(--bws-primary-dark);
}

.btn-ghost {
  background: transparent;
  color: var(--bws-primary);
  border-color: var(--bws-border);
}

.btn-ghost:hover {
  background: #eef2f8;
}

.auth-hint {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--bws-muted);
  line-height: 1.45;
}

.auth-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: none;
}

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

/* —— Shell —— */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--bws-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  flex-wrap: wrap;
}

.topbar .brand-block {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar .brand-logo {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.topbar h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.topbar .sub {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.85;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.topbar-nav a {
  color: #fff;
  opacity: 0.9;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.topbar-nav a:hover,
.topbar-nav a.active {
  background: rgba(255, 255, 255, 0.15);
  opacity: 1;
  text-decoration: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
}

.main {
  flex: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
}

.page-header p {
  margin: 0;
  color: var(--bws-muted);
}

.notice {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a5f;
  border-radius: 10px;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.45;
}

.notice strong {
  color: var(--bws-primary);
}

/* —— App grid —— */
.group-title {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bws-muted);
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
}

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

.app-card {
  background: var(--bws-card);
  border: 1px solid var(--bws-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 180px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(11, 61, 145, 0.12);
}

.app-card .icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(11, 61, 145, 0.08);
  color: var(--bws-primary);
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  margin-bottom: 0.85rem;
}

.app-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.app-card p {
  margin: 0;
  flex: 1;
  color: var(--bws-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.app-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1rem;
}

.badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.badge-live {
  background: #ccfbf1;
  color: #0f766e;
}

.badge-soon {
  background: #ffedd5;
  color: #c2410c;
}

.app-card .open-link {
  font-weight: 700;
  font-size: 0.9rem;
}

.app-card.disabled {
  opacity: 0.72;
}

.app-card.disabled:hover {
  transform: none;
}

/* —— Analytics —— */
.viz-frame {
  background: var(--bws-card);
  border: 1px solid var(--bws-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.viz-frame iframe {
  display: block;
  width: 100%;
  border: 0;
  min-height: 640px;
}

.placeholder-dash {
  padding: 1.25rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.kpi {
  background: linear-gradient(180deg, #fff, #f8fafc);
  border: 1px solid var(--bws-border);
  border-radius: 10px;
  padding: 1rem;
}

.kpi .label {
  font-size: 0.75rem;
  color: var(--bws-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.kpi .value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--bws-primary);
  margin-top: 0.25rem;
}

.chart-mock {
  height: 280px;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  background:
    linear-gradient(180deg, transparent 60%, rgba(11, 61, 145, 0.06)),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 48px,
      rgba(11, 61, 145, 0.04) 48px,
      rgba(11, 61, 145, 0.04) 49px
    );
  position: relative;
  overflow: hidden;
}

.chart-bars {
  position: absolute;
  inset: auto 1.5rem 1.5rem 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  height: 70%;
}

.chart-bars span {
  flex: 1;
  background: linear-gradient(180deg, var(--bws-accent), var(--bws-primary));
  border-radius: 6px 6px 2px 2px;
  opacity: 0.85;
}

.placeholder-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--bws-muted);
  line-height: 1.5;
}

.footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--bws-muted);
  border-top: 1px solid var(--bws-border);
  background: #fff;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .topbar {
    padding: 0.75rem 1rem;
  }

  .main {
    padding: 1.25rem 1rem 2rem;
  }
}
