:root {
  --atix-navy: #0f172a;
  --atix-blue: #2563eb;
  --atix-teal: #0ea5a4;
  --soft-blue: #eff6ff;
  --panel: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 28px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Manrope, sans-serif;
  color: var(--text);
  background: #f5f7fb;
  line-height: 1.45;
}

.bg-glow {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px circle at 100% -15%, rgba(37, 99, 235, 0.1), transparent 52%),
    radial-gradient(760px circle at -15% 110%, rgba(14, 165, 164, 0.08), transparent 56%);
  pointer-events: none;
}

.hidden { display: none !important; }

.layout {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-shell { width: min(660px, 100%); display: grid; gap: 16px; }
.back-home { color: #1b2940; text-decoration: none; font-weight: 700; font-size: 16px; }
.auth-card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 36px;
  box-shadow: var(--shadow-md);
}
.brand-wrap { display: flex; justify-content: center; margin-bottom: 10px; }
.brand-logo { width: min(360px, 100%); height: auto; }
.modern-auth h1 {
  margin: 10px 0 0;
  text-align: center;
  font-family: Sora, sans-serif;
  font-size: clamp(42px, 5vw, 62px);
  line-height: 1;
  color: #0b1430;
}
.modern-auth p { margin: 8px 0 18px; text-align: center; color: #475569; font-size: 16px; }
.invite-notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #b9d7ea;
  border-radius: 10px;
  background: #f2f9ff;
  color: #173556;
  font-size: 14px;
  font-weight: 600;
}
form { display: grid; gap: 10px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 15px; font-weight: 700; color: #14243d; }
.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  padding: 0 10px;
}
.icon { width: 26px; color: #344760; font-weight: 700; text-align: center; font-size: 16px; }
input, button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
}
.input-wrap input {
  border: none;
  background: transparent;
  padding: 14px 10px;
  width: 100%;
  outline: none;
  font-size: 18px;
}
button {
  border: none;
  background: linear-gradient(135deg, var(--atix-blue), #1d4ed8);
  color: white;
  font-weight: 700;
  cursor: pointer;
}
#authSubmit { margin-top: 8px; height: 52px; border-radius: 11px; font-size: 17px; background: linear-gradient(135deg, #2563eb, #1e40af); }
button:hover { filter: brightness(1.04); }
button.ghost { margin-top: 10px; background: white; color: var(--text); border: 1px solid var(--border); }
.aux-link { margin-top: 14px; text-decoration: none; text-align: center; color: #0f78b2; font-weight: 700; display: block; }
.auth-switch { margin-top: 12px; }
.error { min-height: 22px; color: #b42318; text-align: center; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 62px 1fr;
}

.topbar {
  position: relative;
  background: #ffffffd9;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.top-logo { height: 34px; width: auto; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: white;
  border: 1px solid var(--border);
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.profile-menu {
  position: absolute;
  right: 14px;
  top: 54px;
  width: 260px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(20, 42, 66, 0.18);
  padding: 10px;
  z-index: 20;
  display: grid;
  gap: 8px;
}

.profile-menu p {
  margin: 0;
  font-size: 13px;
  color: #4f6178;
}

.app-body {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 0;
}

.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 16px 14px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 12px;
  min-height: 0;
}

.main-nav { display: grid; gap: 6px; }
.nav-item {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: #2b3a52;
  padding: 8px 10px;
  border-radius: 8px;
}
.nav-item.active,
.nav-item:hover {
  background: #eef2ff;
  border-color: #dbe3f4;
}

.workspace-block,
.boards-head {
  display: grid;
  gap: 8px;
}

.workspace-head,
.boards-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.boards-head-actions {
  display: flex;
  gap: 6px;
}

.workspace-head h3,
.boards-head h3 {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

.workspace-head button,
.boards-head button {
  width: auto;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
}

.selector-btn {
  width: 100%;
  text-align: left;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #dbe4ef;
  box-shadow: var(--shadow-sm);
}

.workspace-menu {
  border: 1px solid var(--border);
  background: white;
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.workspace-item {
  text-align: left;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e6edf6;
}
.workspace-item.active { background: #eef4ff; border-color: #bfdbfe; }

.workspace-actions {
  display: flex;
  gap: 6px;
}

.workspace-actions button {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
}

.board-tree {
  min-height: 0;
  overflow: auto;
  display: grid;
  gap: 6px;
}
.folder-row {
  font-size: 12px;
  color: #50647f;
  font-weight: 700;
  padding: 6px 8px;
}
.folder-root {
  margin-top: 4px;
  border-top: 1px dashed var(--border);
  padding-top: 10px;
}

.board-item {
  text-align: left;
  background: transparent;
  color: #2c3d56;
  border: 1px solid transparent;
  padding: 8px 10px;
  border-radius: 8px;
}
.board-item.active,
.board-item:hover {
  background: #f1f5ff;
  border-color: #d3def3;
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  align-self: end;
}

.mini-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mini-stats .stat {
  display: grid;
  gap: 2px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
}
.mini-stats .stat b { font-size: 18px; line-height: 1.1; }
.mini-stats .stat span {
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.content {
  padding: 18px;
  overflow: auto;
}

.home-view {
  display: grid;
  gap: 18px;
}
.home-view h2 { margin: 0; }
.dashboard-head h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-family: Sora, sans-serif;
}
.dashboard-head p {
  margin: 4px 0 0;
  color: #64748b;
}
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.kpi-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
}
.kpi-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.kpi-head i {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  padding: 3px 5px;
  border-radius: 6px;
}
.kpi-card span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}
.kpi-card b {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  color: #0f172a;
}
.kpi-card small {
  color: #64748b;
  font-size: 12px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.home-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.home-card h4 { margin: 0 0 4px; }
.home-card p { margin: 0; color: #5f7086; font-size: 13px; }
.board-meta-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}
.board-meta-row span {
  font-size: 11px;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 3px 8px;
  text-transform: lowercase;
}

.onboarding-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.onboarding-list button {
  text-align: left;
  background: #f1f6ff;
  color: #1f3250;
  border: 1px solid #d3e1f4;
}

.board-view { display: grid; gap: 12px; }
.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 2px 0 8px;
}
.board-header h1 { margin: 0; font-family: Sora, sans-serif; font-size: clamp(28px, 4vw, 40px); }
.board-header p { margin: 4px 0 0; color: #64748b; }

.toolbar { display: flex; gap: 10px; }
.toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.danger-btn {
  background: #c0372b;
}

.board-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.board-toolbar input {
  max-width: 280px;
  background: white;
}

.view-tabs {
  display: flex;
  gap: 8px;
}

.view-tab {
  background: #fff;
  color: #334155;
  border: 1px solid #dce5f2;
}

.view-tab.active {
  background: #eef4ff;
  border-color: #bfdbfe;
}

.table-wrap {
  border: 1px solid var(--border);
  background: white;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: auto;
}

.column-visibility-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px 12px;
}

.column-visibility-panel strong {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.column-visibility-list {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.column-visibility-list label {
  font-size: 13px;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding: 10px;
}

.kanban-col {
  border: 1px solid var(--border);
  background: #f8fbff;
  border-radius: 10px;
  padding: 8px;
}

.kanban-col h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.kanban-card {
  border: 1px solid #dbe5f3;
  background: white;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 6px;
}

.calendar-list {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.calendar-row {
  border: 1px solid #dce6f5;
  border-radius: 8px;
  background: #f8fbff;
  padding: 10px;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.task-table th,
.task-table td {
  border-bottom: 1px solid #e6edf7;
  padding: 10px;
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

.task-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  position: sticky;
  top: 0;
  z-index: 2;
}
.task-table tbody tr:hover { background: #f8fbff; }
.task-table.compact th,
.task-table.compact td {
  padding: 7px 8px;
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge.done { background: #d6f5e4; color: #0c7a4d; }
.badge.in_progress { background: #d9ebff; color: #0f5a9e; }
.badge.todo { background: #eceff5; color: #5d6f85; }

.priority {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
}
.priority.high { background: #ffe5e2; color: #ae2f1f; }
.priority.medium { background: #fff0c7; color: #ad6c00; }
.priority.low { background: #ddf8e8; color: #0f7d4f; }

.row-actions { display: flex; gap: 6px; }
.row-actions button {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  display: grid;
  place-items: center;
  z-index: 50;
}

.modal-card {
  width: min(760px, 94vw);
  max-height: 80vh;
  overflow: auto;
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 14px;
  box-shadow: var(--shadow-md);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  border-bottom: 1px solid #e6edf7;
  padding: 8px;
  text-align: left;
  font-size: 13px;
}

.users-table .user-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.users-table .user-actions button {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
}

.updates-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.update-item {
  border: 1px solid #dde8f5;
  border-radius: 8px;
  padding: 8px;
  background: #f9fbff;
}

.update-item p {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.subitem-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.subitem-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.subitem-title.done {
  text-decoration: line-through;
  color: #70829a;
}

.new-update-form {
  display: grid;
  gap: 8px;
}

.new-update-form textarea {
  border: 1px solid #cad8ec;
  border-radius: 8px;
  padding: 8px;
  min-height: 88px;
  font: inherit;
}

.form-modal-card {
  width: min(620px, 94vw);
}

.form-modal-form {
  display: grid;
  gap: 10px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  font-size: 13px;
  color: #415470;
  font-weight: 700;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  border: 1px solid #c6d5e8;
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

.form-row textarea {
  min-height: 100px;
  resize: vertical;
}

.form-error {
  min-height: 20px;
  margin: 0 0 6px;
  text-align: left;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1100px) {
  .app-body { grid-template-columns: 1fr; }
  .sidebar { grid-template-rows: auto auto auto auto; }
  .dashboard-kpis { grid-template-columns: 1fr 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
