:root {
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1c2330;
  --muted: #6b7587;
  --line: #e3e6ec;
  --primary: #2f6fed;
  --primary-dark: #2459c4;
  --danger: #d64545;
  --ok: #1f9d63;
  --warn: #d98a00;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b;
    --card: #1b2029;
    --text: #e8ebf1;
    --muted: #8d97a9;
    --line: #2b3240;
    --primary: #5b8dff;
    --primary-dark: #7aa2ff;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
.hidden { display: none !important; }
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.center-text { text-align: center; }
.muted { color: var(--muted); }
.error { color: var(--danger); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.login-card { max-width: 380px; width: 100%; text-align: center; padding: 32px 24px; }
.login-card h1 { margin-top: 0; }

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.big { padding: 12px 22px; font-size: 1.05rem; margin-top: 12px; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.danger { color: var(--danger); }
.btn.ok { color: var(--ok); }

input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 1.15rem; margin: 0; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: none; border: 0; color: var(--muted); font: inherit;
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.tab.active { background: var(--bg); color: var(--text); font-weight: 600; }
.badge {
  background: var(--danger); color: #fff; border-radius: 10px;
  padding: 0 7px; font-size: .75rem; margin-left: 4px;
}
.me { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--line); object-fit: cover; }

.container { max-width: 860px; margin: 20px auto; padding: 0 16px 60px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 160px 110px 150px;
  gap: 8px;
  margin-bottom: 14px;
}
.form-grid #nt-title { grid-column: 1; }
.form-grid #nt-desc { grid-column: 1 / 4; }
.form-grid button { grid-column: 4; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid #nt-title, .form-grid #nt-desc { grid-column: 1 / 3; }
  .form-grid button { grid-column: 1 / 3; }
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .9rem; cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.task {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  margin-bottom: 10px;
  border-left: 4px solid var(--line);
}
.task.p-high { border-left-color: var(--danger); }
.task.p-medium { border-left-color: var(--warn); }
.task.p-low { border-left-color: var(--ok); }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { font-weight: 600; word-break: break-word; }
.task-desc { color: var(--muted); font-size: .92rem; margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.task-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 6px; align-items: center; }
.task-meta .overdue { color: var(--danger); font-weight: 600; }
.task-actions { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.task-actions select { padding: 4px 6px; font-size: .88rem; }

.user-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: 0; }
.user-info { flex: 1; min-width: 0; }
.user-info .email { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.pending { color: var(--warn); border-color: var(--warn); }
.tag.approved { color: var(--ok); border-color: var(--ok); }
.tag.blocked { color: var(--danger); border-color: var(--danger); }

/* Notifications & Toasts */
.notif-wrapper { position: relative; }
.notif-btn { display: flex; align-items: center; gap: 4px; padding: 6px 10px; }
.notif-badge { background: var(--danger); color: #fff; font-size: 0.75rem; border-radius: 10px; padding: 0 6px; }
.notif-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-height: 420px;
  overflow-y: auto; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 12px;
}
.notif-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px;
  font-weight: 600;
}
.notif-prompt {
  background: rgba(47, 111, 237, 0.08);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}
.notif-list { display: flex; flex-direction: column; gap: 8px; }
.notif-item {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); font-size: 0.86rem; cursor: pointer; transition: background 0.15s;
  border-left: 3px solid var(--primary);
}
.notif-item:hover { opacity: 0.9; }
.notif-content { flex: 1; min-width: 0; }
.notif-cancel {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 0.95rem; line-height: 1; padding: 2px 5px; border-radius: 4px;
}
.notif-cancel:hover { color: var(--danger); background: rgba(214, 69, 69, 0.12); }
.notif-title { font-weight: 600; font-size: 0.88rem; margin-bottom: 2px; }
.notif-body { color: var(--text); }
.notif-time { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.notif-empty { text-align: center; color: var(--muted); padding: 16px 0; font-size: 0.88rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px; pointer-events: none;
}
.toast {
  pointer-events: auto; background: var(--card); color: var(--text);
  border: 1px solid var(--primary); border-left: 5px solid var(--primary);
  border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15); animation: toastIn 0.25s ease-out;
  cursor: pointer;
}
.toast-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.toast-body { font-size: 0.86rem; color: var(--muted); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
