:root {
  --green: #0f7f5f;
  --green-dark: #0a5d46;
  --green-soft: #dff4ed;
  --ink: #16211d;
  --muted: #63736d;
  --line: #dce5e1;
  --bg: #f6f8f7;
  --surface: #ffffff;
  --warning: #b7791f;
  --danger: #c92a2a;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  direction: rtl;
  font-family: Tahoma, Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(15, 127, 95, 0.08), rgba(246, 248, 247, 0) 260px),
    var(--bg);
  color: var(--ink);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
p { line-height: 1.8; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(15, 80, 60, .10);
}

.login-brand, .brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  font-size: 22px;
  flex: 0 0 auto;
}

.brand-mark.large {
  width: 96px;
  height: 96px;
  font-size: 40px;
}

.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field label { font-weight: 800; }
.field input, .field select, .field textarea,
.theme-card select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 15px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}
.btn.secondary { background: #fff; color: var(--green); border: 1px solid #88cdb4; }
.btn.warning { background: var(--warning); }
.btn.danger { background: var(--danger); }
.btn:hover { filter: brightness(.96); }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand-row h2 {
  font-size: 18px;
  font-weight: 900;
}

.profile-card, .theme-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfffd;
  margin-bottom: 16px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: #fff;
  font-weight: 900;
  border: 2px solid #fff;
  box-shadow: 0 6px 16px rgba(15, 127, 95, .22);
  flex: 0 0 auto;
}
.avatar.small { width: 44px; height: 44px; }

.nav {
  display: grid;
  gap: 6px;
  margin: 16px 0;
}
.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  text-align: right;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: #24443a;
  font-weight: 800;
}
.nav button span {
  width: 22px;
  text-align: center;
  color: inherit;
}
.nav button.active {
  background: var(--green);
  color: #fff;
}
.nav button:hover:not(.active) {
  background: #eef5f2;
}

.theme-card {
  display: grid;
  gap: 8px;
}
.theme-card label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.logout-btn {
  width: 100%;
  border: 1px solid #f0b8b8;
  background: #fff;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 900;
}

.main {
  padding: 28px;
  min-width: 0;
}

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

.topbar h1 {
  font-size: 32px;
  font-weight: 900;
}

.top-user {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.68);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 260px;
}

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.section + .section { margin-top: 18px; }

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.grid { display: grid; gap: 16px; }
.grid-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric span {
  font-weight: 900;
}
.metric strong {
  display: block;
  color: var(--green);
  font-size: 34px;
  font-weight: 900;
  margin-top: 8px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr);
  gap: 18px;
  margin-top: 18px;
}

.ndi-grid {
  grid-template-columns: 330px minmax(0, 1fr);
}

.bar-track {
  height: 8px;
  border-radius: 8px;
  background: #e6ece9;
  overflow: hidden;
  margin: 12px 0;
}
.bar-value {
  height: 100%;
  border-radius: 8px;
  background: var(--green);
}

.list { display: grid; gap: 8px; margin-top: 12px; }
.list button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  text-align: right;
  color: var(--ink);
}
.list button.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 900;
}
.list button:hover { background: #f7fbf9; }

.question-row, .upload-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfffd;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.chip, .status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #edf2ef;
  color: #405049;
  font-size: 13px;
  font-weight: 900;
}
.chip.success, .tone-good { background: #dff4ed; color: var(--green-dark); }
.chip.warn, .tone-warning { background: #fff2d8; color: #8a5208; }
.chip.danger, .tone-danger { background: #ffe3e3; color: #9b1c1c; }

.notice {
  margin: 12px 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: #e7f5ff;
  color: #1864ab;
}
.notice.error, .error { background: #ffe3e3; color: var(--danger); }

input[type="file"] {
  border: 1px dashed #9ecab9;
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-left: 0; border-bottom: 1px solid var(--line); }
  .content-grid, .grid-metrics, .ndi-grid { grid-template-columns: 1fr; }
  .main { padding: 18px; }
}

@media (max-width: 700px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-user { width: 100%; min-width: 0; }
  .hero-card { align-items: flex-start; flex-direction: column; }
}
