:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-soft: #f8f9fc;
  --text: #171a22;
  --muted: #6b7280;
  --line: #e4e8f0;
  --primary: #5b3df5;
  --primary-dark: #4326d8;
  --primary-soft: #eeeaff;
  --danger: #d14343;
  --danger-soft: #fff0f0;
  --warning: #a96800;
  --warning-soft: #fff5d9;
  --success: #24844c;
  --success-soft: #e8f7ee;
  --shadow: 0 18px 50px rgba(24, 31, 48, .12);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, textarea, select { font: inherit; }
button:disabled { opacity: .62; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 32px 14px;
}
.brand-area { display: flex; align-items: center; gap: 13px; }
.topbar h1, .login-card h1, .install-card h1 { margin: 2px 0 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; }
.eyebrow { font-size: 10px; letter-spacing: .19em; color: var(--primary); font-weight: 900; }
.top-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.user-pill { color: var(--muted); font-size: 13px; margin-right: 5px; }
.brand-mark {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--primary), #7a63ff);
  color: #fff;
  border-radius: 15px;
  font-size: 22px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(91, 61, 245, .25);
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 18px; }

.btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(91, 61, 245, .18); }
.btn.primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn.secondary { background: var(--primary-soft); color: var(--primary-dark); }
.btn.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { padding: 8px 11px; font-size: 12px; }
.btn.full { width: 100%; }

.dashboard-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin: 0 32px 14px;
}
.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 67px;
  padding: 14px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
}
.metric span { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { font-size: 24px; }
.metric.danger-metric { border-color: #f1c5c5; background: #fff8f8; }
.metric.danger-metric strong { color: var(--danger); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 32px 15px;
  padding: 11px;
  background: rgba(255,255,255,.82);
  border: 1px solid var(--line);
  border-radius: 15px;
  backdrop-filter: blur(8px);
}
.search-box { position: relative; display: flex; align-items: center; flex: 1; min-width: 220px; }
.search-box > span { position: absolute; left: 13px; color: var(--muted); font-size: 19px; }
.search-box input { padding-left: 38px; }
.toolbar select { width: min(240px, 100%); }
.toggle-filter { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; white-space: nowrap; padding: 0 8px; color: var(--muted); font-size: 13px; }
.toggle-filter input { width: auto; }

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(300px, 1fr));
  gap: 16px;
  padding: 0 32px 32px;
  overflow-x: auto;
}
.kanban-column {
  min-height: calc(100vh - 270px);
  padding: 13px;
  background: #eaedf3;
  border: 1px solid #dde2eb;
  border-radius: 18px;
}
.column-header { display: flex; align-items: center; justify-content: space-between; padding: 5px 4px 13px; }
.column-header h2 { margin: 0; font-size: 17px; }
.column-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.count {
  min-width: 31px;
  height: 31px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
}
.task-list { min-height: 150px; border-radius: 14px; transition: .2s ease; }
.task-list.drag-over { background: rgba(91, 61, 245, .07); outline: 2px dashed rgba(91, 61, 245, .28); }
.task-card {
  position: relative;
  margin-bottom: 11px;
  padding: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 5px 16px rgba(25, 31, 45, .045);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.task-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(25, 31, 45, .09); border-color: #d6d0ff; }
.task-card:focus-visible { outline: 3px solid rgba(91, 61, 245, .2); border-color: var(--primary); }
.task-card.dragging { opacity: .48; transform: rotate(1deg); cursor: grabbing; }
.task-card.is-overdue { border-left: 4px solid var(--danger); }
.task-card.is-due-today { border-left: 4px solid #e7a11d; }
.task-card.filtered-out { display: none; }
.task-card h3 { margin: 11px 0 7px; font-size: 15px; line-height: 1.35; }
.card-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.priority { padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.priority.baixa { background: var(--success-soft); color: var(--success); }
.priority.media { background: var(--warning-soft); color: var(--warning); }
.priority.alta { background: var(--danger-soft); color: #b22e2e; }
.deadline-alert { padding: 5px 8px; border-radius: 999px; font-size: 10px; font-weight: 900; }
.deadline-alert.overdue { background: var(--danger-soft); color: var(--danger); }
.deadline-alert.today { background: var(--warning-soft); color: var(--warning); }
.check-progress { margin: 13px 0 2px; }
.progress-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.progress-label strong { color: #4b5261; }
.progress-track { height: 5px; margin-top: 7px; overflow: hidden; background: #eceff4; border-radius: 999px; }
.progress-track span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.avatar-stack { display: flex; align-items: center; min-width: 0; }
.avatar-stack .avatar + .avatar { margin-left: -7px; }
.avatar {
  width: 29px;
  height: 29px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 900;
}
.unassigned-label { color: #9098a7; font-size: 11px; font-weight: 700; }
.due-date { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.due-date.overdue { color: var(--danger); }
.due-date.no-date { color: #a0a7b3; font-weight: 600; }
.empty-state { display: none; padding: 28px 12px; border: 1px dashed #c8cfda; border-radius: 12px; color: #8d96a5; text-align: center; font-size: 12px; }
.kanban-column.is-empty .empty-state { display: block; }

.modal {
  width: min(700px, calc(100% - 24px));
  max-height: calc(100vh - 30px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(15, 18, 26, .62); backdrop-filter: blur(4px); }
.task-modal { width: min(980px, calc(100% - 24px)); }
.compact-modal { width: min(590px, calc(100% - 24px)); }
.modal-card { display: grid; gap: 17px; max-height: calc(100vh - 30px); padding: 23px; overflow-y: auto; background: #fff; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.modal-header h2 { margin: 3px 0 0; font-size: 23px; line-height: 1.2; }
.modal-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; border-radius: 8px; padding: 2px 7px; }
.icon-btn:hover { background: #f0f2f6; color: var(--text); }
.close-btn { font-size: 27px; }
.task-form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 20px; align-items: start; }
.task-main-fields { display: grid; gap: 16px; min-width: 0; }
.task-sidebar { display: grid; gap: 14px; padding: 16px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 15px; }
label { display: grid; gap: 7px; font-weight: 800; font-size: 12px; }
input, textarea, select {
  width: 100%;
  border: 1px solid #d8dde6;
  border-radius: 10px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 61, 245, .11); }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-actions { display: flex; justify-content: space-between; gap: 14px; padding-top: 3px; border-top: 1px solid var(--line); }
.actions-right { display: flex; gap: 9px; margin-left: auto; }

.checklist-section { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fbfcfe; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 13px; }
.section-heading h3 { margin: 0; font-size: 15px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.checklist-counter { padding: 5px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 11px; font-weight: 900; }
.checklist-input-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }
.checklist-editor { display: grid; gap: 8px; margin-top: 11px; }
.checklist-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.checklist-row > input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); }
.checklist-row > input[type="text"] { padding: 7px 8px; border-color: transparent; background: transparent; }
.checklist-row > input[type="text"]:focus { border-color: #d8dde6; background: #fff; }
.checklist-row.completed > input[type="text"] { color: #8d95a3; text-decoration: line-through; }
.remove-checklist { font-size: 18px; }
.checklist-empty { padding: 17px; border: 1px dashed #ccd2dc; border-radius: 10px; color: var(--muted); text-align: center; font-size: 12px; }

.assignees-field { display: grid; gap: 6px; }
.field-label-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.field-label-row span { color: var(--primary); font-weight: 900; }
.helper-text { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.assignee-options { display: grid; gap: 7px; max-height: 205px; overflow-y: auto; padding-right: 2px; }
.assignee-option { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.assignee-option input { width: auto; }
.assignee-option.selected { border-color: #b9afff; background: #f6f4ff; }
.assignee-option.disabled { opacity: .52; cursor: not-allowed; }
.sidebar-alert { padding: 10px 11px; border-radius: 10px; font-size: 11px; font-weight: 800; line-height: 1.4; }
.sidebar-alert.overdue { background: var(--danger-soft); color: var(--danger); }
.sidebar-alert.warning { background: var(--warning-soft); color: var(--warning); }

.inline-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }
.assignee-list { display: grid; gap: 9px; max-height: 330px; overflow-y: auto; padding-right: 3px; }
.assignee-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfc; }
.assignee-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.assignee-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.assignee-empty { padding: 20px 12px; border: 1px dashed #cbd1dc; border-radius: 12px; text-align: center; color: var(--muted); font-size: 12px; }

.toast {
  position: fixed;
  z-index: 1000;
  right: 22px;
  bottom: 22px;
  padding: 13px 16px;
  background: #191e29;
  color: #fff;
  border-radius: 11px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

.login-body { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #edeaff, #f4f5f9 46%); }
.login-card, .install-card { width: min(430px, 100%); padding: 31px; background: #fff; border-radius: 20px; box-shadow: var(--shadow); }
.install-card { width: min(650px, 100%); }
.muted { color: var(--muted); margin: 8px 0 24px; line-height: 1.55; }
.stack-form { display: grid; gap: 15px; }
.alert { padding: 12px; border-radius: 10px; margin-bottom: 16px; font-size: 13px; }
.alert.error { background: var(--danger-soft); color: #a42828; }
.login-hint { margin-top: 20px; padding: 13px; background: #f6f7fa; border-radius: 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
fieldset { display: grid; gap: 13px; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0; }
legend { padding: 0 7px; font-size: 12px; font-weight: 900; color: var(--muted); }
.radio-option { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 9px; font-weight: 700; }
.radio-option input { width: auto; }
.mysql-fields { padding: 15px; border-radius: 12px; background: #f7f8fb; }

@media (max-width: 980px) {
  .topbar { padding: 21px 18px 12px; }
  .dashboard-strip, .toolbar { margin-left: 18px; margin-right: 18px; }
  .board { padding: 0 18px 26px; grid-template-columns: repeat(3, 82vw); }
  .kanban-column { min-height: 68vh; }
  .task-form-layout { grid-template-columns: 1fr 240px; }
}
@media (max-width: 760px) {
  .dashboard-strip { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-wrap: wrap; }
  .toolbar select { width: calc(50% - 5px); }
  .toggle-filter { width: calc(50% - 5px); }
  .task-form-layout { grid-template-columns: 1fr; }
  .task-sidebar { order: -1; grid-template-columns: repeat(3, 1fr); }
  .assignees-field, .sidebar-alert { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; }
  .user-pill { width: 100%; }
  .dashboard-strip { margin: 0 14px 12px; gap: 8px; }
  .metric { min-height: 58px; padding: 11px 13px; }
  .metric strong { font-size: 20px; }
  .toolbar { margin: 0 14px 12px; }
  .search-box, .toolbar select, .toggle-filter { width: 100%; }
  .board { padding: 0 14px 22px; grid-template-columns: repeat(3, 88vw); }
  .modal-card { padding: 18px; }
  .task-sidebar { grid-template-columns: 1fr; }
  .assignees-field, .sidebar-alert { grid-column: auto; }
  .modal-actions { flex-direction: column-reverse; }
  .actions-right { width: 100%; margin-left: 0; }
  .actions-right .btn, .modal-actions > .btn { flex: 1; }
  .checklist-input-row, .inline-form { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}
