:root {
  font-family: "Inter", sans-serif;
  color: #111827;
  background: #f8fafc;

  --primary: #00a6a6;
  --primary-dark: #008b8b;
  --primary-soft: #e9f9f7;

  --brand-red: #e00000;
  --brand-red-dark: #bb0000;

  --surface: #ffffff;
  --background: #f8fafc;

  --text: #111827;
  --secondary: #6b7280;
  --muted: #9ca3af;

  --border: #e5e7eb;

  --success: #00a6a6;
  --warning: #f59e0b;
  --critical: #e00000;

  --radius: 12px;
  --sidebar-width: 250px;
}

* {
  box-sizing: border-box;
}

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

body {
  background: var(--background);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-logo {
  width: 115px;
  height: auto;
  display: block;
  object-fit: contain;
}

.desktop-brand-logo {
  width: 145px;
}

.mobile-brand .brand-logo {
  width: 120px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 14px;
  letter-spacing: 0.08em;
}

.brand span {
  margin-top: 2px;
  color: var(--secondary);
  font-size: 12px;
}

.brand-light strong,
.brand-light span {
  color: #fff;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow-light {
  color: #00a6a6;
}

/* Login */

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(500px, 1.05fr);
  background: #fff;
}

.login-brand-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px;
  color: #ffffff;
  background:
    radial-gradient(
      circle at 75% 20%,
      rgb(0 166 166 / 16%),
      transparent 34%
    ),
    radial-gradient(
      circle at 85% 80%,
      rgb(224 0 0 / 10%),
      transparent 30%
    ),
    #050505;
}

.login-message {
  width: min(540px, 100%);
  margin: auto 0;
}

.login-message h1 {
  margin: 18px 0;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1.03;
  letter-spacing: -0.05em;
}

.login-message p {
  max-width: 500px;
  color: #cbd5e1;
  font-size: 17px;
  line-height: 1.7;
}

.feature-list {
  display: grid;
  gap: 14px;
  margin-top: 32px;
  color: #e2e8f0;
  font-size: 14px;
}

.brand-footer {
  margin: 40px 0 0;
  color: #64748b;
  font-size: 13px;
}

.login-form-panel {
  display: grid;
  place-items: center;
  padding: 40px 28px;
}

.login-card {
  width: min(430px, 100%);
}

.mobile-brand {
  display: none;
  margin-bottom: 42px;
}

.login-card h2 {
  margin: 12px 0 10px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.login-card > p {
  margin: 0 0 28px;
  color: var(--secondary);
  font-size: 14px;
}

.login-card form {
  display: grid;
  gap: 10px;
}

.login-card label {
  margin-top: 7px;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.login-card input:focus {
  border-color: var(--primary);
  outline: 3px solid rgb(0 166 166 / 18%);
}

.primary-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-size: 13px;
  font-weight: 600;
}

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

.login-button {
  width: 100%;
  height: 47px;
  margin-top: 14px;
  background: var(--brand-red);
}

.login-button:hover {
  background: var(--brand-red-dark);
}

.form-error {
  padding: 10px 12px;
  border-radius: 8px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 12px;
}

.demo-notice {
  display: grid;
  gap: 4px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  color: #1e3a8a;
  background: var(--primary-soft);
}

.demo-notice strong {
  font-size: 12px;
}

.demo-notice span {
  font-size: 11px;
  line-height: 1.5;
}

/* App */

.application {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #fff;
}

.sidebar-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-navigation {
  flex: 1;
  padding: 20px 12px;
}

.navigation-label {
  display: block;
  margin: 0 10px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.navigation-item {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #4b5563;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}

.navigation-item + .navigation-item {
  margin-top: 3px;
}

.navigation-item:hover {
  color: var(--text);
  background: #f3f4f6;
}

.navigation-item.active {
  color: var(--primary);
}

.navigation-divider {
  height: 1px;
  margin: 20px 10px;
  background: var(--border);
}

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
}

.user-card,
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-card {
  padding: 8px;
}

.user-card strong,
.user-card span,
.header-user strong,
.header-user span {
  display: block;
}

.user-card strong,
.header-user strong {
  font-size: 11px;
}

.user-card span,
.header-user span {
  margin-top: 2px;
  color: var(--secondary);
  font-size: 9px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #1e40af;
  background: #dbeafe;
  font-size: 10px;
  font-weight: 700;
}

.small-avatar {
  width: 30px;
  height: 30px;
  font-size: 9px;
}

.logout-button {
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  color: var(--secondary);
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.logout-button:hover {
  color: #991b1b;
  background: #fef2f2;
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 13px 28px;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 94%);
  backdrop-filter: blur(12px);
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.header-title p {
  margin: 3px 0 0;
  color: var(--secondary);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  width: 260px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 12px;
}

.page-content {
  padding: 26px 28px 48px;
}

.app-page {
  display: none;
  width: min(1500px, 100%);
  margin: 0 auto;
}

.app-page.active-page {
  display: block;
}

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

.summary-card,
.content-card,
.client-card,
.template-card,
.team-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(15 23 42 / 6%);
}

.summary-card {
  padding: 18px;
}

.summary-label {
  display: block;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 600;
}

.summary-card strong {
  display: block;
  margin-top: 18px;
  font-size: 30px;
  line-height: 1;
}

.summary-card small {
  display: block;
  margin-top: 7px;
  color: var(--secondary);
  font-size: 10px;
}

.warning-summary {
  border-color: #fde68a;
}

.critical-summary {
  border-color: #fecaca;
}

.content-card {
  margin-top: 18px;
}

.section-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  margin: 5px 0 4px;
  font-size: 18px;
}

.section-header p {
  margin: 0;
  color: var(--secondary);
  font-size: 12px;
}

.compact-header {
  min-height: 78px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 14px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary);
  font-size: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #fff;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}

.healthy {
  background: var(--success);
}

.attention {
  background: var(--warning);
}

.critical {
  background: var(--critical);
}

.complete {
  background: var(--success);
}

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

.race-grid {
  min-width: 900px;
  display: grid;
  grid-template-columns:
    minmax(210px, 1.2fr)
    minmax(270px, 1.8fr)
    minmax(130px, 0.75fr)
    minmax(120px, 0.65fr)
    88px;
  align-items: center;
  gap: 18px;
}

.race-header {
  min-height: 42px;
  padding: 0 22px;
  color: var(--muted);
  background: #fbfcfd;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.race-row {
  min-height: 78px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

.race-row:hover {
  background: #fbfcfe;
}

.project-identity,
.owner-cell,
.race-controls {
  display: flex;
  align-items: center;
}

.project-identity {
  gap: 11px;
}

.project-identity strong,
.project-identity small {
  display: block;
}

.project-identity strong {
  font-size: 12px;
}

.project-identity small {
  margin-top: 4px;
  color: var(--secondary);
  font-size: 10px;
}

.project-status {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 10px;
}

.progress-copy span {
  color: var(--secondary);
}

.progress-track {
  position: relative;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.progress-marker {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  font-size: 8px;
  font-weight: 700;
  transform: translate(-50%, -50%);
}

.owner-cell {
  gap: 8px;
  font-size: 11px;
}

.due-cell {
  color: var(--secondary);
  font-size: 10px;
}

.race-controls {
  justify-content: flex-end;
  gap: 6px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #4b5563;
  background: #fff;
}

.icon-button:hover {
  background: #f9fafb;
}

.race-controls .icon-button {
  width: 30px;
  height: 30px;
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.simple-list,
.activity-list,
.project-list,
.audit-list {
  padding: 5px 18px 12px;
}

.simple-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 4px;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  background: transparent;
  text-align: left;
}

.simple-list button:last-child {
  border-bottom: 0;
}

.simple-list button span {
  min-width: 0;
  flex: 1;
}

.simple-list strong,
.simple-list small {
  display: block;
}

.simple-list strong {
  font-size: 11px;
}

.simple-list small {
  margin-top: 4px;
  color: var(--secondary);
  font-size: 9px;
}

.activity-item,
.project-item,
.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child,
.project-item:last-child,
.audit-item:last-child {
  border-bottom: 0;
}

.activity-item p,
.project-item p,
.audit-item p {
  margin: 0;
  color: #374151;
  font-size: 10px;
  line-height: 1.55;
}

.activity-item small,
.project-item small,
.audit-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

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

.page-toolbar h2 {
  margin: 0;
  font-size: 21px;
}

.page-toolbar p {
  margin: 6px 0 0;
  color: var(--secondary);
  font-size: 12px;
}

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

.client-card,
.template-card,
.team-card {
  padding: 20px;
}

.client-card h3,
.template-card h3,
.team-card h3 {
  margin: 14px 0 7px;
  font-size: 15px;
}

.client-card p,
.template-card p,
.team-card p {
  margin: 0;
  color: var(--secondary);
  font-size: 11px;
  line-height: 1.6;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 9px;
}

.badge {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: #1d4ed8;
  background: var(--primary-soft);
  font-size: 9px;
  font-weight: 600;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 13px 16px;
  border-radius: 9px;
  color: #fff;
  background: #111827;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.sidebar-overlay {
  display: none;
}

.mobile-only {
  display: none;
}

@media (max-width: 1100px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .client-grid,
  .template-grid,
  .team-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 820px) {
  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    display: none;
  }

  .login-form-panel {
    min-height: 100vh;
  }

  .mobile-brand {
    display: flex;
  }

  .sidebar {
    transform: translateX(-102%);
    transition: transform 180ms ease;
  }

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

  .sidebar-overlay.visible {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    border: 0;
    background: rgb(15 23 42 / 35%);
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-only {
    display: grid;
  }

  .search-box {
    display: none;
  }

  .top-header,
  .page-content {
    padding-right: 18px;
    padding-left: 18px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .legend {
    justify-content: flex-start;
  }
}

@media (max-width: 600px) {
  .summary-grid,
  .client-grid,
  .template-grid,
  .team-grid {
    grid-template-columns: 1fr;
  }

  .header-user div:last-child {
    display: none;
  }

  .page-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
