:root {
  --bg: #f6f7f8;
  --line: #d9dde3;
  --text: #1f2933;
  --muted: #667085;
  --red: #b42318;
  --red-bg: #fde7e4;
  --blue: #1f5fbf;
  --blue-bg: #e8f1ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

header {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: #111827;
  color: white;
  font-size: 16px;
  font-weight: 700;
  justify-content: space-between;
}

header a { color: white; text-decoration: none; }
.brand { font-size: 16px; }

nav { display: flex; align-self: stretch; gap: 6px; }

nav a {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #aeb7c5;
  font-size: 14px;
  font-weight: 600;
}

nav a:hover,
nav a.active { color: white; background: rgba(255, 255, 255, .09); }

main { padding: 18px 20px; }

.title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

h1 { margin: 0; font-size: 22px; }
p, .muted, small, .title span { color: var(--muted); }
p { margin: 5px 0 0; }
small { display: block; margin-top: 3px; }

.summary { display: flex; align-items: center; gap: 12px; }
.summary a { color: var(--blue); text-decoration: none; }
.summary a:hover { text-decoration: underline; }

.task-link {
  color: inherit;
  text-decoration: none;
}

.task-link:hover strong,
.task-link:hover small {
  color: var(--blue);
  text-decoration: underline;
}

.panel {
  overflow-x: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f9fafb; color: #475467; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f2f6ff; }

.before, .after {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.before { color: var(--red); background: var(--red-bg); }
.after { color: var(--blue); background: var(--blue-bg); }
.empty { padding: 48px; color: var(--muted); text-align: center; }

.settings-page { max-width: 1180px; margin: 0 auto; }

.notice {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 8px;
}

.notice.success { color: #067647; background: #ecfdf3; border-color: #abefc6; }
.notice.error { color: var(--red); background: var(--red-bg); border-color: #fecdca; }

.settings-panel {
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}

.team-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.settings-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-heading h2 { margin: 0; font-size: 16px; }
.settings-heading span { color: var(--muted); }

.users-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 16px;
}

.user-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.user-option:hover { border-color: #84adff; background: #f5f8ff; }
.user-option:has(input:checked) { border-color: #84adff; background: var(--blue-bg); }
.user-option input { width: 17px; height: 17px; margin: 0; accent-color: var(--blue); }
.user-option span { min-width: 0; }
.user-option strong, .user-option small { overflow: hidden; text-overflow: ellipsis; }
.user-option small { white-space: nowrap; }

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

.settings-actions {
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #f9fafb;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  padding: 9px 16px;
  border: 0;
  border-radius: 7px;
  background: var(--blue);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: #184e9f; }
button:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 720px) {
  header { padding: 0 8px; }
  header .brand { display: none; }
  nav { width: 100%; gap: 0; }
  nav a { flex: 1; justify-content: center; padding: 0 6px; font-size: 12px; }
  main { padding: 12px; }
  table { min-width: 760px; }
  .users-grid { grid-template-columns: 1fr; }
  .team-settings { grid-template-columns: 1fr; }
  .title { align-items: flex-start; gap: 12px; }
  .summary { align-items: flex-end; flex-direction: column; gap: 4px; }
}
