/* Asset DNA Dashboard — mobile-first, light theme only */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #1B3A5C;
  --mid-blue:   #2E6DA4;
  --light-blue: #D5E8F0;
  --white:      #FFFFFF;
  --grey-50:    #F8FAFC;
  --grey-100:   #F1F5F9;
  --grey-200:   #E2E8F0;
  --grey-400:   #94A3B8;
  --grey-700:   #374151;
  --green:      #15803D;
  --green-bg:   #DCFCE7;
  --yellow:     #92400E;
  --yellow-bg:  #FEF3C7;
  --red:        #B91C1C;
  --red-bg:     #FEE2E2;
  --orange:     #C2410C;
  --radius:     8px;
  --shadow:     0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
}

/* Force light mode regardless of system preference */
html { color-scheme: light only; background: var(--grey-100); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--grey-700);
  background: var(--grey-100);
  min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 0 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-md);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.site-title { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.3px; color: var(--white); }
.site-nav { display: flex; gap: 0.25rem; }
.nav-link {
  color: rgba(255,255,255,0.70);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.nav-link:hover { background: rgba(255,255,255,0.12); color: var(--white); }
.nav-link.active { background: rgba(255,255,255,0.18); color: var(--white); }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── Stats row ─────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 560px) { .stats-row { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 0.9rem;
  text-align: center;
  border-top: 3px solid var(--mid-blue);
}
.stat-value { font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat-label { font-size: 0.75rem; color: var(--grey-400); margin-top: 0.3rem; text-transform: uppercase; letter-spacing: 0.3px; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  text-align: left;
  padding: 0.55rem 0.85rem;
  background: var(--light-blue);
  color: var(--navy);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.data-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--grey-200);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--grey-50); }
.record-row { cursor: pointer; }
.record-row:active td { background: var(--light-blue); }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-high    { background: var(--green-bg);  color: var(--green);  }
.badge-medium  { background: var(--yellow-bg); color: var(--yellow); }
.badge-low     { background: var(--red-bg);    color: var(--red);    }
.badge-pending { background: var(--light-blue); color: var(--mid-blue); }
.badge-approved { background: var(--green-bg); color: var(--green); }
.badge-challenged { background: var(--red-bg); color: var(--red); }
.badge-draft { background: var(--grey-200); color: var(--grey-700); }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  min-height: 44px;
  min-width: 44px;
  transition: opacity 0.15s, background 0.15s, transform 0.1s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--mid-blue);  color: var(--white); }
.btn-primary:hover:not(:disabled)   { background: var(--navy); }
.btn-secondary { background: var(--grey-200);  color: var(--grey-700); }
.btn-secondary:hover:not(:disabled) { background: var(--grey-400); color: var(--white); }
.btn-warning   { background: #D97706;           color: var(--white); }
.btn-warning:hover:not(:disabled)   { background: var(--orange); }
.btn-danger    { background: var(--red);        color: var(--white); }
.btn-ghost     { background: transparent; color: var(--mid-blue); border: 1.5px solid var(--mid-blue); }
.btn-ghost:hover:not(:disabled) { background: var(--light-blue); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; min-height: 36px; }

/* ── Action bar ────────────────────────────────────────────────────────────── */
.action-bar  { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.action-row  { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.action-msg  {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  font-weight: 500;
}
.action-msg:empty  { display: none; }
.action-msg.success { background: var(--green-bg);  color: var(--green); }
.action-msg.error   { background: var(--red-bg);    color: var(--red); }
.action-msg.info    { background: var(--light-blue); color: var(--navy); }

/* ── Activity feed ─────────────────────────────────────────────────────────── */
.activity-list { list-style: none; }
.activity-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--grey-200);
  font-size: 0.85rem;
  flex-wrap: wrap;
  align-items: baseline;
}
.activity-item:last-child { border-bottom: none; }
.activity-sha  { font-family: "SF Mono", "Fira Code", monospace; color: var(--mid-blue); flex-shrink: 0; font-size: 0.78rem; }
.activity-msg  { flex: 1; min-width: 0; word-break: break-word; }
.activity-date { color: var(--grey-400); font-size: 0.75rem; flex-shrink: 0; }

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.page-header h2 { font-size: 1.35rem; font-weight: 700; color: var(--navy); flex: 1; }

/* ── Group header (review page) ─────────────────────────────────────────────── */
.group-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.group-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  text-transform: capitalize;
  flex: 1;
}

/* ── Record detail ─────────────────────────────────────────────────────────── */
.record-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.record-title    { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.record-subtitle { color: var(--grey-400); margin-top: 0.2rem; text-transform: capitalize; font-size: 0.875rem; }
.sub-title { font-size: 0.875rem; font-weight: 600; color: var(--navy); margin: 1rem 0 0.5rem; text-transform: uppercase; letter-spacing: 0.3px; }

/* ── Field list (definition list) ──────────────────────────────────────────── */
.field-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1.25rem;
  font-size: 0.875rem;
}
.field-list dt { font-weight: 600; color: var(--grey-400); text-transform: capitalize; white-space: nowrap; }
.field-list dd { color: var(--grey-700); word-break: break-word; }
.field-list a  { color: var(--mid-blue); }

/* ── Challenge panel ───────────────────────────────────────────────────────── */
.challenge-panel {
  background: var(--yellow-bg);
  border: 1.5px solid #F59E0B;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.challenge-input {
  width: 100%;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  font-size: 0.875rem;
  font-family: inherit;
  margin-bottom: 0.6rem;
  resize: vertical;
  color: var(--grey-700);
  background: var(--white);
}
.challenge-input:focus { outline: 2px solid var(--mid-blue); border-color: var(--mid-blue); }

/* ── Editable fields ───────────────────────────────────────────────────────── */
.editable {
  background: var(--light-blue);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  outline: 1.5px solid var(--mid-blue);
  cursor: text;
}

/* ── States ────────────────────────────────────────────────────────────────── */
.loading-cell {
  color: var(--grey-400);
  font-style: italic;
  padding: 1.5rem 0;
  text-align: center;
  display: block;
}
.empty-msg { color: var(--grey-400); font-style: italic; font-size: 0.875rem; padding: 0.5rem 0; }
.error-text { color: var(--red); font-size: 0.875rem; }

/* ── Responsive tweaks ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .data-table th:nth-child(n+5),
  .data-table td:nth-child(n+5) { display: none; }
  .field-list { grid-template-columns: 1fr; }
  .field-list dt { margin-top: 0.5rem; }
}
