:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #d0d5dd;
  --text: #0f172a;
  --text-muted: #475467;
  --primary-1: #2b5b95;
  --primary-2: #3f6ba5;
  --primary-3: #14335b;
  --success-bg: #dff4e4;
  --success-text: #14532d;
  --warning-bg: #fff3cd;
  --warning-text: #854d0e;
  --danger-bg: #fde2e1;
  --danger-text: #7f1d1d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, #f9fbff 0%, rgba(249, 251, 255, 0) 40%),
    radial-gradient(circle at 90% 0%, #e8eef6 0%, rgba(232, 238, 246, 0) 40%),
    var(--bg);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

a { color: #25507f; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #1a365d 0%, #132f56 45%, #102a4c 100%);
  color: #e6edf7;
  display: flex;
  flex-direction: column;
  padding: 24px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 28px;
}

.brand small {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  opacity: 0.95;
}

.nav-group {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dde7f4;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.sidebar-footer {
  margin-top: auto;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #eef4ff;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

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

.page-title {
  font-size: 56px;
  margin: 0 0 18px;
  color: #13294b;
  line-height: 1.08;
  letter-spacing: -0.5px;
}

.page-subtitle {
  font-size: 36px;
  margin: 0;
  color: #13294b;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid #e4e7ec;
}

.card-body { padding: 16px; }

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid-one { display: grid; gap: 12px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.input-inline {
  width: 100%;
  height: 44px;
  border-radius: 9px;
  border: 1px solid #cad2dc;
  background: #fff;
  padding: 10px 12px;
  font-size: 16px;
  color: var(--text);
}

.field textarea { height: auto; min-height: 120px; }

.btn-primary {
  height: 44px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  font-size: 18px;
  background: linear-gradient(90deg, var(--primary-2), var(--primary-1));
  cursor: pointer;
}

.btn-secondary {
  height: 36px;
  border: 1px solid #c8d2e1;
  border-radius: 9px;
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  padding: 0 10px;
}

.btn-link {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #436ea6, #315988);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.btn-link:hover { opacity: 0.95; }

.table-wrap { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.table th {
  text-align: left;
  padding: 12px 14px;
  background: #eef2f6;
  border-bottom: 1px solid #d6dde6;
  font-size: 16px;
}

.table td {
  padding: 14px;
  border-bottom: 1px solid #e8ecf1;
  vertical-align: top;
  font-size: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 700;
}

.badge.success { background: var(--success-bg); color: var(--success-text); }
.badge.warning { background: var(--warning-bg); color: var(--warning-text); }
.badge.danger { background: var(--danger-bg); color: var(--danger-text); }
.badge.muted { background: #e8eef3; color: #475467; }

.warn {
  background: #fff4e5;
  border: 1px solid #ffcc80;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.error { color: #b42318; margin-top: 8px; }

.row-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.meta-title {
  color: var(--text-muted);
  font-size: 16px;
  margin: 0 0 4px;
}

.meta-value {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  word-break: break-word;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
}

.score-item {
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

.score-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  border: 7px solid #9ca3af;
  color: #374151;
  background: #f9fafb;
}

.score-ring.good { border-color: #26a065; color: #157347; background: #e7f8ef; }
.score-ring.warn { border-color: #e3b72c; color: #946200; background: #fff8dc; }
.score-ring.na { border-color: #b9c1cb; color: #667085; background: #f3f5f7; }

.pill-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.pill {
  border: 1px solid #d2dae4;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill.warn { border-color: #f2caa5; }
.pill.opportunity { border-color: #eddca3; }

.pill-icon { width: 18px; height: 18px; color: #9a3412; flex: 0 0 18px; }
.pill.opportunity .pill-icon { color: #a16207; }

.report-section { display: grid; gap: 14px; }

.email-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.email-preview {
  width: 100%;
  min-height: 360px;
  border: 1px solid #d6dee7;
  border-radius: 10px;
  background: #fff;
}

.copy-status { font-size: 14px; color: #0b6b2f; min-height: 16px; margin: 6px 0 0; }
.hidden-source { position: absolute; left: -9999px; top: -9999px; opacity: 0; pointer-events: none; }

.back-link {
  color: #25507f;
  text-decoration: none;
  font-size: 16px;
}

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

.mono-box {
  border: 1px solid #d9dfe7;
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
}

.mobile-toggle {
  display: none;
  border: 1px solid #cad5e2;
  background: #fff;
  border-radius: 8px;
  height: 38px;
  width: 38px;
  align-items: center;
  justify-content: center;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
  padding: 22px;
}

.auth-title {
  margin: 10px 0 2px;
  font-size: 34px;
  color: #13294b;
}

.auth-muted { color: #667085; margin: 0 0 16px; }

@media (max-width: 1200px) {
  .page-title { font-size: 46px; }
}

@media (max-width: 1024px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-toggle { display: inline-flex; }
  .main-content { padding: 16px; }
  .page-title { font-size: 38px; }
  .row-meta { grid-template-columns: 1fr 1fr; }
  .score-grid { grid-template-columns: 1fr 1fr; }
  .pill-list { grid-template-columns: 1fr 1fr; }
  .grid-two { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .row-meta,
  .score-grid,
  .pill-list,
  .form-grid-two { grid-template-columns: 1fr; }
  .page-title { font-size: 32px; }
  .meta-value { font-size: 22px; }
}
