/* The Scout Portal — Design System
   Tokens and components derived from the leave-behind design language.
   Font: Barlow | Accent: #c94d1a | Dark: #1a1a28 | Cream: #faf7f2 */

@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@300;400;500;600;700;800&display=swap');

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Barlow', sans-serif; background: #f0ede8; color: #1a1a28; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: 'Barlow', sans-serif; }

/* ── Design Tokens ───────────────────────────────────────── */
:root {
  --brand-dark:        #1a1a28;
  --brand-orange:      #c94d1a;
  --brand-orange-lite: rgba(201, 77, 26, 0.12);
  --brand-cream:       #faf7f2;
  --brand-warm:        #f0ede8;

  --sidebar-w:         220px;
  --topbar-h:          56px;

  --card-bg:           #ffffff;
  --card-border:       rgba(26, 26, 40, 0.08);
  --card-radius:       6px;
  --card-shadow:       0 1px 4px rgba(26, 26, 40, 0.07);

  --text-primary:      #1a1a28;
  --text-secondary:    rgba(26, 26, 40, 0.55);
  --text-muted:        rgba(26, 26, 40, 0.35);

  --border:            rgba(26, 26, 40, 0.08);

  /* Pressure cell colors */
  --p-none-bg:   #f0ede8;
  --p-none-text: rgba(26,26,40,0.3);
  --p-low-bg:    #d8f0de;
  --p-low-text:  #1a5c2b;
  --p-mod-bg:    #fff0c2;
  --p-mod-text:  #7a5500;
  --p-high-bg:   #ffdcc8;
  --p-high-text: #8a2800;
  --p-tight-bg:  #c94d1a;
  --p-tight-text:#ffffff;
}

/* ── Layout Shell ────────────────────────────────────────── */
.portal-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--brand-dark);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.logo-mark {
  width: 32px; height: 32px;
  background: var(--brand-orange);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.logo-name {
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffffff;
  line-height: 1;
}

.logo-product {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  margin-top: 3px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  padding: 16px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}

.nav-item:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.04);
}

.nav-item.active {
  color: #ffffff;
  background: rgba(201, 77, 26, 0.15);
  border-left-color: var(--brand-orange);
}

.nav-item .nav-icon {
  font-size: 14px;
  opacity: 0.7;
  width: 16px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}

.sidebar-data-status {
  font-size: 10px;
  color: rgba(255,255,255,0.3);
  line-height: 1.5;
}

.data-status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4caf50;
  margin-right: 5px;
  vertical-align: middle;
}

/* ── Main Content Area ───────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top Bar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-orange);
}

.page-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-sep {
  color: var(--border);
  font-size: 18px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-company {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-sep { color: var(--text-muted); font-size: 12px; }

.user-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}

/* ── Page Content ────────────────────────────────────────── */
.page-content {
  padding: 28px 32px;
  flex: 1;
}

/* ── Metric Cards ────────────────────────────────────────── */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 20px 22px;
  box-shadow: var(--card-shadow);
}

.metric-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.metric-card.accent .metric-value { color: var(--brand-orange); }

/* ── Section Header ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.section-meta {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Card Container ──────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.card-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-body { padding: 20px 22px; }

/* ── Pressure Matrix ─────────────────────────────────────── */
.pressure-matrix {
  width: 100%;
  overflow-x: auto;
}

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

.pressure-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px 10px;
  white-space: nowrap;
}

.pressure-table th:first-child { padding-left: 0; width: 140px; }

.pressure-table td {
  padding: 5px 10px;
  vertical-align: middle;
}

.pressure-table td:first-child {
  padding-left: 0;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-primary);
}

.pressure-table tr:hover td { background: rgba(26,26,40,0.02); }

.pressure-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.p-none  { background: var(--p-none-bg);  color: var(--p-none-text); }
.p-low   { background: var(--p-low-bg);   color: var(--p-low-text);  }
.p-mod   { background: var(--p-mod-bg);   color: var(--p-mod-text);  }
.p-high  { background: var(--p-high-bg);  color: var(--p-high-text); }
.p-tight { background: var(--p-tight-bg); color: var(--p-tight-text);}

/* ── Labor Supply Table ──────────────────────────────────── */
.supply-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.supply-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border);
}

.supply-table td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid rgba(26,26,40,0.04);
  color: var(--text-primary);
  font-size: 12px;
}

.supply-table tr:last-child td { border-bottom: none; }

.rate-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rate-bar {
  height: 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.rate-bar.tight  { background: var(--brand-orange); }
.rate-bar.mod    { background: #f0b429; }
.rate-bar.loose  { background: #4caf50; }

.rate-val {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 36px;
}

/* ── Activity Feed ───────────────────────────────────────── */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(26,26,40,0.04);
}

.activity-item:last-child { border-bottom: none; }

.activity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.badge-job   { background: rgba(201,77,26,0.12); color: var(--brand-orange); }
.badge-news  { background: rgba(26,26,40,0.07);  color: var(--text-secondary); }

.activity-body { flex: 1; min-width: 0; }

.activity-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.activity-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(26,26,40,0.06);
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── Two/Three Column Grids ──────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.grid-3-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover,
.filter-chip.active {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
  background: var(--brand-orange-lite);
}

/* ── Methodology Note ────────────────────────────────────── */
.methodology-note {
  background: rgba(201,77,26,0.06);
  border-left: 3px solid var(--brand-orange);
  border-radius: 0 4px 4px 0;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.methodology-note strong { color: var(--text-primary); }

/* ── Loading Skeleton ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0ede8 25%, #e8e5e0 50%, #f0ede8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Login Screen ────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  background: var(--brand-warm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(26,26,40,0.10);
  padding: 40px 44px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  margin-bottom: 28px;
  text-align: center;
}

.login-logo .logo-mark {
  margin: 0 auto 10px;
  width: 40px; height: 40px;
  font-size: 16px;
}

.login-logo .logo-name {
  font-size: 13px;
  letter-spacing: 0.18em;
}

.login-logo .logo-product {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(26,26,40,0.18);
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Barlow', sans-serif;
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 3px rgba(201,77,26,0.1);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--brand-orange);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 6px;
}

.btn-primary:hover  { background: #b04016; }
.btn-primary:active { background: #9a3712; }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--brand-orange);
  font-weight: 600;
}

.error-msg {
  background: #fff0ed;
  border: 1px solid rgba(201,77,26,0.3);
  border-radius: 4px;
  padding: 10px 14px;
  font-size: 12px;
  color: #8a2800;
  margin-bottom: 18px;
  display: none;
}

.error-msg.visible { display: block; }

/* ── Agreement Page ──────────────────────────────────────── */
.agreement-shell {
  min-height: 100vh;
  background: var(--brand-warm);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px;
}

.agreement-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(26,26,40,0.10);
  padding: 40px 48px;
  width: 100%;
  max-width: 720px;
}

.agreement-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  margin-bottom: 28px;
}

.agreement-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-orange);
  margin-bottom: 8px;
}

.agreement-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
}

.agreement-body {
  max-height: 480px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 28px;
  padding-right: 8px;
}

.agreement-body h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 20px 0 8px;
}

.agreement-body h3:first-child { margin-top: 0; }

.agreement-accept {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.agreement-accept input[type="checkbox"] {
  width: 16px; height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--brand-orange);
}

.agreement-accept label {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .metrics-row { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3-1 { grid-template-columns: 1fr; }
}
