:root {
  --brand: #159B53;
  --brand-dark: #0f7a41;
  --bg: #f3f5f7;
  --card-bg: #ffffff;
  --text: #1c2b2a;
  --muted: #6b7b79;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Tajawal", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---------- تسجيل الدخول ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand) 0%, #0b3d24 100%);
}

.login-card {
  background: var(--card-bg);
  padding: 40px 36px;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  width: 320px;
  text-align: center;
  animation: fadeUp 0.5s ease;
}

.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .subtitle { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.login-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #d7ddda;
  margin-bottom: 14px;
  font-size: 15px;
  text-align: center;
}

.login-card button {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}
.login-card button:hover { background: var(--brand-dark); }

.login-card .error {
  color: #c0392b;
  background: #fdecea;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- اللوحة ---------- */
.topbar {
  background: linear-gradient(135deg, var(--brand) 0%, #0b3d24 100%);
  color: white;
  padding: 22px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar h1 { margin: 0; font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.topbar .logout { color: white; opacity: 0.85; text-decoration: underline; }
.topbar .generated-at { opacity: 0.85; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 22px;
  padding: 28px;
}

.empty { color: var(--muted); padding: 40px; text-align: center; }

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 6px 20px rgba(20, 40, 35, 0.08);
  animation: fadeUp 0.5s ease;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.card-header h2 { margin: 0; font-size: 20px; }
.card-header .role { color: var(--muted); font-size: 13px; }

.badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.badge {
  background: #eef7f1;
  color: var(--brand-dark);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
}

.card-body {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.gauge-block { position: relative; text-align: center; flex-shrink: 0; }
.gauge-block canvas { display: block; }
.gauge-value {
  position: absolute;
  top: 62px;
  left: 0; right: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--brand-dark);
}
.gauge-label { display: block; font-size: 12px; color: var(--muted); margin-top: -4px; }

.stats-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  min-width: 180px;
}
.stat {
  background: #f7f9f8;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.stat-value { display: block; font-size: 16px; font-weight: 700; }
.stat-label { display: block; font-size: 11px; color: var(--muted); }

.charts-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.chart-box { flex: 1; min-width: 140px; height: 180px; position: relative; }
.chart-box.wide { flex: 2; min-width: 220px; }

.apps-list h3 { font-size: 14px; margin: 10px 0 8px; color: var(--muted); }
.apps-list ul { list-style: none; margin: 0; padding: 0; }
.apps-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f0f2f1;
  font-size: 13px;
}
.app-tag { border-radius: 999px; padding: 2px 8px; font-size: 11px; color: white; }
.app-tag.productive { background: var(--brand); }
.app-tag.neutral { background: #f4b942; }
.app-tag.distracting { background: #e0544c; }
.app-tag.unknown { background: #9aa5a3; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
