:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #68748a;
  --line: #dbe3ee;
  --primary: #0e6b5c;
  --primary-soft: #e5f4f1;
  --danger: #c24b4b;
  --warning: #a56b06;
  --shadow: 0 16px 40px rgba(18, 33, 59, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

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

.sidebar {
  background: #0f1728;
  color: #eef4ff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1d8f7a, #0e6b5c);
  display: grid;
  place-items: center;
  font-weight: 700;
}
.brand h1 { font-size: 1.1rem; margin: 0; }
.brand p { margin: 4px 0 0; color: #afbdd6; font-size: .92rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.sidebar .card {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.08);
  box-shadow: none;
}
.sidebar label, .sidebar .small-label { color: #afbdd6; }
.sidebar select {
  width: 100%;
  margin-top: 8px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.1);
  color: white;
  padding: 11px 12px;
}
.sidebar option { color: #111827; }
.full-width { width: 100%; }

.nav-links {
  display: grid;
  gap: 8px;
}
.nav-link {
  border: none;
  background: transparent;
  color: #d8e3f6;
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.08); }
.sidebar-footer ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: #d8e3f6;
  font-size: .94rem;
  line-height: 1.7;
}

.content { padding: 28px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 22px;
}
.topbar h2 { margin: 0 0 8px; font-size: 1.7rem; }
.topbar p { margin: 0; color: var(--muted); }
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.primary-btn, .secondary-btn, .ghost-btn {
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .18s ease;
}
.primary-btn { background: var(--primary); color: white; }
.primary-btn:hover { filter: brightness(1.05); }
.secondary-btn { background: var(--primary-soft); color: var(--primary); border-color: #cce9e3; }
.secondary-btn:hover { transform: translateY(-1px); }
.ghost-btn { background: white; color: var(--text); border-color: var(--line); }

.grid { display: grid; gap: 20px; }
.two-col { grid-template-columns: 1.45fr 1fr; }
.hero-grid { align-items: start; }

.summary-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 18px;
}
.qr-box {
  text-align: center;
  min-width: 120px;
}
.qr-box img {
  width: 100px;
  height: 100px;
  margin: 0 auto 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: .82rem;
  margin-bottom: 8px;
}
.vehicle-summary h3 { margin: 0 0 6px; font-size: 1.45rem; }
.vehicle-summary p { margin: 0; color: var(--muted); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.stat-card {
  padding: 14px;
  border-radius: 16px;
  background: #f8fbff;
  border: 1px solid var(--line);
}
.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
  font-size: .92rem;
}
.stat-card strong { font-size: 1rem; }

.insight-card h3, .card h3 { margin-top: 0; }
.insight-list {
  display: grid;
  gap: 12px;
  margin: 16px 0;
}
.insight-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.notice {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #fff7e8;
  color: #6f551b;
  border: 1px solid #f0dfb4;
  font-size: .95rem;
}

.section-head, .row.between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.wrap-gap { flex-wrap: wrap; }
.small-label { font-size: .84rem; color: var(--muted); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.timeline {
  display: grid;
  gap: 14px;
}
.timeline.large { max-height: 72vh; overflow: auto; padding-right: 6px; }
.timeline-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
}
.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 10px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.timeline-body {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: #fcfdff;
}
.timeline-title { margin: 0; font-size: 1rem; }
.timeline-time, .timeline-meta {
  color: var(--muted);
  font-size: .9rem;
}
.timeline-desc { margin: 8px 0; }
.timeline-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.file-tag {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2f7;
  color: #465065;
  font-size: .84rem;
}

.stack-list {
  display: grid;
  gap: 12px;
}
.stack-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  background: #fcfdff;
}
.stack-item h4 { margin: 0 0 8px; }
.stack-item p { margin: 6px 0; color: #334155; }
.stack-item .meta-line { color: var(--muted); font-size: .92rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.form-grid label {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: .95rem;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}
.full-span { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; }

.checklist { display: grid; gap: 10px; }
.check-item {
  display: flex;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.check-item.checked {
  background: #eefaf6;
  border-color: #cdeadd;
}
.check-item input { margin-top: 4px; transform: scale(1.15); }
.check-item strong { display: block; margin-bottom: 4px; }

.doc-grid {
  display: grid;
  gap: 12px;
}
.doc-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fcfdff;
}
.doc-card h4 { margin: 0 0 8px; }
.doc-card p { margin: 0 0 12px; color: var(--muted); }

.vehicle-table {
  display: grid;
  gap: 10px;
}
.vehicle-row {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr .8fr 1fr;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  align-items: center;
}
.vehicle-row.header {
  background: #f7fafc;
  font-weight: 700;
}
.scope-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.9;
}
.scope-list .done { color: var(--primary); font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: .8rem;
  background: #eef2f7;
  color: #445168;
}
.badge.high, .badge.critical { background: #fdecec; color: var(--danger); }
.badge.medium { background: #fff4df; color: var(--warning); }
.badge.open { background: #fdecec; color: var(--danger); }
.badge.closed { background: #e9f8ef; color: #13784d; }
.badge.inprogress { background: #eef6ff; color: #245ea8; }

.hidden { display: none; }

@media (max-width: 1160px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 3; }
  .sidebar-footer { display: none; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .content { padding: 18px; }
  .topbar, .summary-header { flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .vehicle-row { grid-template-columns: 1fr; }
}


/* --- Phase 1 Login / Roles additions --- */
.user-chip{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:999px;
  background: rgba(255,255,255,0.03);
  color: #e6edf3;
  font-size: 13px;
}
.user-chip .role-badge{
  padding:2px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.14);
  font-size:12px;
  opacity:0.9;
}
.readonly-field{
  padding:10px 12px;
  border-radius:10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  margin-top: 6px;
  color: #e6edf3;
  min-height: 40px;
  display:flex;
  align-items:center;
}
.nav-link.hidden, .tab-panel.hidden{ display:none !important; }

.login-body{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background: radial-gradient(1200px 700px at 20% 20%, rgba(46, 204, 113, 0.12), transparent),
              radial-gradient(1200px 700px at 80% 0%, rgba(52, 152, 219, 0.12), transparent),
              #0b1220;
  color:#e6edf3;
}
.login-card{
  width:min(520px, 92vw);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius:16px;
  padding:22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
}
.login-brand{
  display:flex; gap:14px; align-items:center; margin-bottom:16px;
}
.login-brand h1{ margin:0; font-size:20px; }
.login-brand .muted{ margin:0; opacity:0.75; }
.login-form label{ display:block; margin:12px 0; }
.login-form input{
  width:100%;
  margin-top:6px;
  padding:10px 12px;
  border-radius:10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.2);
  color:#e6edf3;
}
.login-hint{ margin-top:14px; }
.demo-accounts div{ margin:6px 0; font-size:13px; opacity:0.9; }


.sep{border:none;border-top:1px solid var(--line);margin:16px 0;}
