:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;
  --warn: #d97706;
  --high: #dc2626;
  --medium: #d97706;
  --low: #16a34a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: #111827; color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar nav a { color: #d1d5db; text-decoration: none; }
.topbar nav a:hover { color: #fff; }
.topbar .who { color: #9ca3af; font-size: 13px; }
.topbar .btn-link { color: #93c5fd; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 20px 80px; }

h1 { margin: 0 0 16px; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 18px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.form-narrow { max-width: 420px; }

form label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form select,
form textarea {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  margin-top: 4px;
  font-family: inherit;
}
form textarea { resize: vertical; min-height: 64px; }
form input:focus, form select:focus, form textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  border-color: var(--primary);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
.grid-full { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row label { margin-bottom: 0; }
.inline { display: inline-block; }
.checkbox { display: flex; align-items: center; gap: 6px; }
.checkbox input { width: auto; margin: 0; }
.filters label { min-width: 140px; }

.btn, button.btn, .btn-link {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-family: inherit;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-link { background: transparent; border-color: transparent; color: var(--primary); }
.btn-link:hover { text-decoration: underline; background: transparent; }
button[disabled] { opacity: 0.5; cursor: not-allowed; }

.table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); background: #f9fafb; }
.table tr:hover { background: #fafbfd; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #eef2ff;
  color: #3730a3;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-admin { background: #fee2e2; color: #991b1b; }
.badge-user  { background: #e0f2fe; color: #075985; }
.badge.prio-high   { background: #fee2e2; color: #991b1b; }
.badge.prio-medium { background: #fef3c7; color: #92400e; }
.badge.prio-low    { background: #dcfce7; color: #166534; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  margin: 0 2px 2px 0;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  text-decoration: none;
}
.tag:hover { background: #e5e7eb; }

.actions { white-space: nowrap; }
.actions .btn, .actions form, .actions details { margin-right: 4px; margin-bottom: 4px; }

details.inline summary { list-style: none; }
details.inline summary::-webkit-details-marker { display: none; }
details.inline[open] > summary { background: #eef2ff; }
details.inline[open] .row { margin-top: 6px; padding: 8px; background: #f9fafb; border: 1px solid var(--border); border-radius: 6px; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error   { background: #fee2e2; color: #991b1b; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.overdue { color: var(--danger); font-weight: 600; }

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

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 8px; align-items: flex-start; }
  .table th:nth-child(7), .table td:nth-child(7) { display: none; }
}
