@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;600;700&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #101417;
  --muted: #667085;
  --brand: #1c4f4a;
  --brand-2: #e2b76a;
  --accent: #2f7bff;
  --accent-2: #e37757;
  --border: #e3e7ef;
  --shadow: 0 20px 60px rgba(16, 24, 40, 0.12);
  --shadow-soft: 0 10px 40px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 700px at 10% -20%, #eaf0ff, transparent),
    radial-gradient(800px 500px at 90% -10%, #f4efe4, transparent),
    linear-gradient(180deg, #f5f7fb 0%, #eff3f8 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.auth-body {
  background: radial-gradient(900px 600px at 12% 12%, rgba(22, 127, 194, 0.2), transparent),
    radial-gradient(700px 520px at 88% 8%, rgba(22, 127, 194, 0.12), transparent),
    linear-gradient(160deg, #f7f9fc 0%, #eef2f7 45%, #e9eef5 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: 100vh;
  flex: 1;
}

.sidebar {
  width: 260px;
  background: linear-gradient(165deg, #1a1a1a 0%, #060606 55%, #000 100%);
  color: #f7f7fb;
  padding: 28px 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px;
}

.sidebar .brand.has-logo .brand-logo {
  width: calc(100% + 44px);
  height: auto;
  margin: 0 -22px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  display: block;
}

.brand-text {
  line-height: 1.1;
}

.nav-section {
  margin-top: 12px;
}

.nav-title {
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 1.2px;
  color: rgba(247, 241, 231, 0.6);
  margin-bottom: 10px;
}

.nav-link {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: transparent;
  color: #f7f7fb;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 12px;
  color: rgba(247, 241, 231, 0.6);
}

.main {
  flex: 1;
  padding: 24px 36px 64px;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  box-shadow: var(--shadow-soft);
}

.topbar .meta {
  font-size: 13px;
  color: var(--muted);
}

.topbar .actions {
  display: flex;
  gap: 10px;
}

.button {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #00aeff;
  color: #0a0a0a;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 8px 16px rgba(0, 174, 255, 0.35);
}

.auth-card .button {
  background: #00aeff;
  color: #0a0a0a;
  border-color: #00aeff;
  box-shadow: 0 12px 24px rgba(0, 174, 255, 0.35);
}

.button.small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.button.is-left {
  justify-self: start;
}

.button.secondary {
  background: transparent;
  border-color: #00aeff;
  color: #00aeff;
  box-shadow: none;
}

.button:hover {
  transform: translateY(-1px);
}

.content {
  margin-top: 24px;
  flex: 1;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.inline-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.28);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  padding: 2px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-thumb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
  transform: translateX(0);
  transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-track {
  background: rgba(22, 163, 74, 0.35);
  border-color: rgba(22, 163, 74, 0.55);
}

.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

.toggle-label {
  font-weight: 600;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: rgba(47, 123, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(47, 123, 255, 0.15);
}

.label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}

.auth-shell {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.auth-shell.has-aside {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 28px;
  align-items: stretch;
  max-width: 1120px;
  margin: 0 auto;
  padding: 64px 24px;
  width: 100%;
}

.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(0);
  opacity: 0.4;
}

.auth-orb.orb-1 {
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(22, 127, 194, 0.32) 0%, rgba(22, 127, 194, 0) 70%);
  top: -80px;
  left: -60px;
}

.auth-orb.orb-2 {
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(28, 79, 74, 0.35) 0%, rgba(28, 79, 74, 0) 70%);
  bottom: 10%;
  right: 10%;
}

.auth-orb.orb-3 {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(22, 127, 194, 0.35) 0%, rgba(22, 127, 194, 0) 70%);
  top: 30%;
  right: 35%;
}

.auth-aside {
  background: linear-gradient(145deg, #006aa0, #00aeff);
  color: #f8fafc;
  border-radius: 24px;
  padding: 36px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.auth-aside::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.12), transparent 50%),
    radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.08), transparent 45%);
  opacity: 0.9;
  pointer-events: none;
}

.auth-aside-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-aside h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-family: "Space Grotesk", sans-serif;
}

.auth-aside p {
  margin: 0;
  color: rgba(248, 250, 252, 0.8);
}

.auth-highlights {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.auth-highlight {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.auth-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand-2);
  margin-top: 6px;
}

.auth-highlight-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.auth-highlight-text {
  color: rgba(248, 250, 252, 0.75);
  font-size: 13px;
}

.auth-aside-footer {
  font-size: 12px;
  color: rgba(248, 250, 252, 0.7);
  margin-top: 10px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: #000;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: none;
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 65%;
  background: radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 65%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 60%);
  opacity: 0.85;
  pointer-events: none;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-brand.has-logo .brand-logo {
  width: 100%;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  display: block;
}

.auth-card h1 {
  margin: 0 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 28px;
}

.auth-card p {
  margin: 0 0 20px;
  color: #fff;
}

.auth-card .label,
.auth-card .helper,
.auth-card a {
  color: #fff;
}

.auth-card .input {
  color: #0a0a0a;
  background: #fff;
}

@media (max-width: 980px) {
  .auth-shell.has-aside {
    grid-template-columns: 1fr;
    padding: 32px 16px;
  }

  .auth-aside {
    order: 2;
  }

  .auth-card {
    max-width: 560px;
    justify-self: center;
  }
}

.helper {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.mobile-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.mobile-toggle svg {
  width: 18px;
  height: 18px;
  fill: var(--ink);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 20;
}

.footer-bar {
  margin-top: 24px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(16, 24, 40, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}


.alert {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 12px 0 16px;
  border: 1px solid transparent;
}

.alert.success {
  background: rgba(15, 92, 75, 0.12);
  border-color: rgba(15, 92, 75, 0.3);
  color: #0f3d33;
}

.alert.error {
  background: rgba(173, 62, 46, 0.12);
  border-color: rgba(173, 62, 46, 0.3);
  color: #7a2e22;
}

.alert.warning {
  background: rgba(194, 120, 26, 0.12);
  border-color: rgba(194, 120, 26, 0.35);
  color: #7a4b12;
}
.auth-card .alert {
  background: #ffffff;
  border-color: #e5e7eb;
  color: #111827;
}

.auth-card .alert.success {
  border-color: #16a34a;
}

.auth-card .alert.error {
  border-color: #dc2626;
}

.auth-card .alert.warning {
  border-color: #d97706;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: rgba(47, 123, 255, 0.04);
}

.table tbody tr.user-info-row {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.16), rgba(14, 165, 233, 0.08));
}

.table tbody tr.user-info-row:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(14, 165, 233, 0.12));
}

.table tbody tr.user-info-row td:first-child {
  border-left: 4px solid rgba(59, 130, 246, 0.45);
  padding-left: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 8px;
}

.filter-bar .input {
  width: auto;
  min-width: 0;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: var(--accent);
}

.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.template-section {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.template-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.template-editor h3 {
  margin: 0;
  font-size: 18px;
}

.template-preview {
  border-left: 1px solid var(--border);
  padding-left: 16px;
}

.template-preview.is-hidden {
  display: none;
}

.preview-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.preview-subject {
  font-weight: 700;
  margin-bottom: 10px;
}

.preview-block {
  margin-top: 12px;
}

.preview-text {
  white-space: pre-wrap;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.preview-html {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.preview-body {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.ytd-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ytd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ytd-metrics {
  display: grid;
  gap: 12px;
}

.ytd-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.metric-value.is-cpp {
  text-decoration: underline;
  text-decoration-color: var(--brand);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

.metric-value.is-ei {
  text-decoration: underline;
  text-decoration-color: var(--brand-2);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

.metric-value.is-federal {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

.metric-value.is-provincial {
  text-decoration: underline;
  text-decoration-color: var(--accent-2);
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

.donut {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--progress) * 1%), #e6ebf3 0);
  display: grid;
  place-items: center;
  position: relative;
}

.donut::after {
  content: "";
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: inset 0 2px 6px rgba(16, 24, 40, 0.08);
}

.donut-inner {
  position: absolute;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.donut-value {
  font-size: 18px;
  font-weight: 700;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.donut-label {
  font-size: 11px;
  color: var(--muted);
}

.quick-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.button-stack .button {
  width: 50%;
  justify-content: center;
  text-align: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  opacity: 0.85;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #0f3d33;
  background: rgba(28, 79, 74, 0.12);
  width: fit-content;
}

.status-pill.is-warning {
  color: #7a550e;
  background: rgba(226, 183, 106, 0.28);
}

.status-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.link-meta {
  display: grid;
  gap: 8px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.meta-label {
  color: var(--muted);
}

.meta-value {
  font-weight: 600;
}

@media (max-width: 1200px) {
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .template-section {
    grid-template-columns: 1fr;
  }

  .template-preview {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--border);
    padding-top: 16px;
  }
}

@media (max-width: 980px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.3s ease;
    z-index: 30;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  .mobile-toggle {
    display: inline-flex;
  }

  .main {
    padding: 20px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .button-stack .button {
    width: 100%;
  }

}
