* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --primary: #4f46e5;
  --safe: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
}

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hero {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  text-align: center;
  padding: 48px 16px;
}

.hero h1 {
  font-size: 2.6rem;
}

.hero h1 span {
  color: #fde68a;
}

.hero p {
  margin-top: 8px;
  opacity: 0.9;
}

.container {
  max-width: 960px;
  margin: -24px auto 0;
  padding: 0 16px 40px;
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

h2 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.section-title {
  margin: 8px 0 12px;
}

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

/* Summary card */
.summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--primary) 0deg, #e5e7eb 0deg);
}

.ring span {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--card);
  display: grid;
  place-items: center;
  font-weight: bold;
  font-size: 1.2rem;
}

.target {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: var(--muted);
}

.target input {
  width: 90px;
  margin-top: 4px;
}

/* Form */
form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
}

input {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
}

input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.95rem;
  background: var(--primary);
  color: #fff;
}

button:hover {
  opacity: 0.9;
}

.error {
  color: var(--danger);
  margin-top: 8px;
  font-size: 0.9rem;
}

/* Subject cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.subject {
  border-left: 6px solid var(--safe);
}

.subject.warn {
  border-left-color: var(--warn);
}

.subject.danger {
  border-left-color: var(--danger);
}

.subject-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.subject-head h3 {
  font-size: 1.1rem;
}

.percent {
  font-size: 1.4rem;
  font-weight: bold;
}

.bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  margin: 10px 0;
  overflow: hidden;
}

.bar div {
  height: 100%;
  background: var(--safe);
}

.warn .bar div { background: var(--warn); }
.danger .bar div { background: var(--danger); }

.advice {
  font-size: 0.92rem;
  margin: 6px 0 12px;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions button {
  flex: 1;
  padding: 8px;
  font-size: 0.85rem;
}

.btn-present { background: var(--safe); }
.btn-absent { background: var(--warn); }
.btn-delete { background: #9ca3af; }

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

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 20px;
}

/* Mobile */
@media (max-width: 640px) {
  form {
    grid-template-columns: 1fr;
  }
  .summary {
    justify-content: center;
    text-align: center;
  }
}
