:root {
  --color-primary: #7F4C37;
  --color-primary-dark: #5C3627;
  --color-primary-light: #A97A5D;
  --color-accent: #C98A4B;
  --color-accent-2: #A65A2E;
  --color-bg: #FBF6F2;
  --color-bg-alt: #F1E4DB;
  --color-surface: #FFFFFF;
  --color-text: #3A2A22;
  --color-text-muted: #8A6B5C;
  --color-border: #E4D3C7;

  --font-heading: "Cabinet Grotesk", "Poppins", "Helvetica Neue", Arial, sans-serif;
  --font-body: "General Sans", "Inter", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

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

h1, h2, h3 { font-family: var(--font-heading); margin: 0; }

ul { margin: 0; padding: 0; }

.layout {
  display: flex;
  align-items: stretch;
  height: 100vh;
  max-width: 1280px;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 16px;
  border-right: 1px solid var(--color-border);
  overflow: hidden;
}

.sidebar-top { text-align: center; }

.avatar {
  display: block;
  width: 160px;
  height: 180px;
  margin: 0 auto;
  border-radius: 22px;
  object-fit: cover;
  border: 3px solid var(--color-surface);
  box-shadow: 0 8px 20px rgba(92, 54, 39, 0.22);
}

.name {
  font-size: 1rem;
  margin-top: 14px;
  color: var(--color-primary-dark);
}

.handle {
  color: var(--color-text-muted);
  font-size: 0.78rem;
  margin: 3px 0 12px;
}

.social-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.social-row a {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-alt);
  color: var(--color-primary);
  transition: background 0.15s, color 0.15s;
}

.social-row a:hover {
  background: var(--color-primary);
  color: #fff;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 40px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.nav-link svg { flex-shrink: 0; }

.nav-link:hover { background: var(--color-bg-alt); }

.nav-link.is-active {
  background: var(--color-primary);
  color: #fff;
}

.sidebar-bottom {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.5;
}

/* Main */
.main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-shrink: 0;
}

.hero-text h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.9rem);
  line-height: 1.15;
  color: var(--color-primary-dark);
}

.hero-text p {
  max-width: 52ch;
  margin-top: 8px;
  color: var(--color-text-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(127, 76, 55, 0.28);
}

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

.drivers {
  margin-top: 16px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.drivers-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.drivers-row { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--color-bg-alt);
  color: var(--color-primary-dark);
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.chip-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.chip-logo-light {
  background: #fff;
  border: 1px solid var(--color-border);
}

.card-grid {
  margin-top: 16px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 14px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 16px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card.is-flashed {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(127, 76, 55, 0.18);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.card-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.card-head h3 { font-size: 0.88rem; color: var(--color-primary-dark); }

.card-tag {
  margin-left: auto;
  font-size: 0.65rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-body {
  margin-top: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow: auto;
}

.card-body a { color: var(--color-accent-2); font-weight: 600; }

.card-placeholder { color: var(--color-text-muted); font-style: italic; }

.mini-grid {
  margin-top: 10px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
}

.mini-item {
  background: var(--color-bg-alt);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}

.mini-title { font-weight: 600; color: var(--color-primary-dark); font-size: 0.76rem; }

.mini-desc { color: var(--color-text-muted); font-size: 0.68rem; line-height: 1.3; }

.simple-list {
  margin-top: 10px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.simple-list li {
  font-size: 0.8rem;
  padding: 7px 0;
  border-top: 1px solid var(--color-border);
}

.simple-list li:first-child { border-top: none; padding-top: 0; }

.tag-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  overflow: auto;
}

.tag-row span {
  background: var(--color-bg-alt);
  color: var(--color-primary-dark);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
}

/* Fallback: only if the viewport is too short to fit everything, allow scroll rather than clipping content */
@media (max-height: 640px), (max-width: 900px) {
  html, body { overflow: auto; }
  .layout { height: auto; min-height: 100vh; flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; margin-top: 12px; }
  .sidebar-bottom { display: none; }
  .main { overflow: visible; }
  .card-grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .mini-grid { grid-template-rows: none; }
}
