:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --green: #16a34a;
  --yellow: #ca8a04;
  --red: #dc2626;
  --border: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DejaVu Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 290px;
  background: #0f172a;
  color: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

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

.logo {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: #134e4a;
  display: grid;
  place-items: center;
  font-size: 26px;
}

.brand h1 {
  margin: 0;
  font-size: 19px;
}

.brand p {
  margin: 4px 0 0;
  color: #cbd5e1;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  text-align: left;
  background: transparent;
  border: 0;
  color: #cbd5e1;
  padding: 13px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
}

.nav-item.active, .nav-item:hover {
  background: #134e4a;
  color: #fff;
}

.sidebar-note {
  margin-top: auto;
  background: rgba(255,255,255,.08);
  padding: 16px;
  border-radius: 16px;
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: #e2e8f0;
}

.main {
  flex: 1;
  padding: 28px;
  overflow: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.topbar h2 {
  margin: 0;
  font-size: 30px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.primary, .secondary {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  background: var(--primary);
  color: white;
}

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

.secondary {
  background: #ecfeff;
  color: #155e75;
}

.page { display: none; }
.page.active { display: block; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stat-card, .card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .05);
}

.stat-card {
  padding: 20px;
  display: grid;
  gap: 10px;
}

.stat-card span { color: var(--muted); }
.stat-card strong { font-size: 34px; }
.stat-card.danger strong { color: var(--red); }
.stat-card.warning strong { color: var(--yellow); }
.stat-card.success strong { color: var(--green); }

.grid-two {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
}

.card {
  padding: 22px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.card h3 {
  margin: 0 0 16px;
}

.pill {
  background: #eef2ff;
  color: #3730a3;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.green {
  background: #dcfce7;
  color: #166534;
}

.priority-list {
  display: grid;
  gap: 12px;
}

.priority-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.priority-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.badge.red { background: #fee2e2; color: #991b1b; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.green { background: #dcfce7; color: #166534; }

.ai-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  padding: 18px;
  line-height: 1.65;
  white-space: pre-line;
}

.empty {
  color: var(--muted);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.score {
  font-weight: 800;
}

label {
  display: block;
  margin: 14px 0 7px;
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px;
  font: inherit;
  background: white;
}

textarea {
  resize: vertical;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.plan {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: #fcfcfd;
}

.plan h4 {
  margin: 0 0 8px;
}

.plan p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 980px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; }
  .stats-grid, .grid-two, .plan-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 12px; }
}
