:root {
  color-scheme: dark;
  --bg: #090d0c;
  --surface: #111816;
  --surface-strong: #18221f;
  --surface-soft: #0d1311;
  --text: #edf7f2;
  --muted: #9eb0a8;
  --line: #293832;
  --green: #38d18e;
  --green-dark: #22aa72;
  --orange: #f0a34a;
  --red: #ff7469;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, #0e1512 0%, var(--bg) 42%, #070a09 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex: 0 0 260px;
  flex-direction: column;
  width: 260px;
  min-height: 100vh;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(9, 14, 12, 0.96);
  backdrop-filter: blur(12px);
}

.app-main {
  flex: 1;
  min-width: 0;
}

.brand,
.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.sidebar-brand {
  min-height: 42px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  object-fit: cover;
}

.avatar {
  display: block;
  border: 1px solid rgba(56, 209, 142, 0.26);
  border-radius: 999px;
  background: var(--surface-strong);
  object-fit: cover;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
}

.nav-item:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.nav-item.is-active {
  border-color: rgba(56, 209, 142, 0.32);
  background: rgba(56, 209, 142, 0.12);
  color: var(--text);
}

.nav-icon {
  display: inline-grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
}

.nav-item.is-active .nav-icon {
  background: var(--green);
  color: #06110d;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.user-chip-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.user-chip-copy strong,
.user-chip-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip-copy span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ghost-button,
.primary-button,
.danger-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.ghost-button {
  padding: 0 16px;
  background: var(--surface-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-button:hover {
  background: #22302b;
}

.logout-button {
  width: 100%;
}

.primary-button {
  width: 100%;
  padding: 0 18px;
  background: var(--green);
  color: #06110d;
}

.primary-button:hover {
  background: var(--green-dark);
  color: #f6fffb;
}

.danger-button {
  background: rgba(255, 116, 105, 0.1);
  color: var(--red);
  border: 1px solid rgba(255, 116, 105, 0.3);
}

.danger-button:hover {
  background: rgba(255, 116, 105, 0.18);
}

.flash-stack {
  position: fixed;
  top: 78px;
  right: 22px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.flash {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 700;
}

.flash-error {
  border-color: rgba(255, 116, 105, 0.34);
  color: var(--red);
}

.flash-success {
  border-color: rgba(56, 209, 142, 0.32);
  color: var(--green);
}

.login-page {
  background:
    linear-gradient(135deg, rgba(56, 209, 142, 0.13), rgba(240, 163, 74, 0.09)),
    linear-gradient(180deg, #0f1714 0%, #090d0c 62%, #060908 100%),
    var(--bg);
}

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

.login-panel {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 28px 0 24px;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  line-height: 1.05;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
}

.login-form input:focus {
  border-color: var(--green);
  outline: 3px solid rgba(56, 209, 142, 0.18);
}

.login-form .primary-button {
  margin-top: 8px;
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.welcome-band {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.welcome-band h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

.status-pill {
  max-width: 160px;
  padding: 8px 12px;
  border: 1px solid rgba(56, 209, 142, 0.32);
  border-radius: 999px;
  background: rgba(56, 209, 142, 0.12);
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.work-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.metric-card {
  display: grid;
  min-height: 112px;
  align-content: space-between;
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.metric-card strong {
  font-size: 2.2rem;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-task-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.dashboard-note-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.dashboard-task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.dashboard-note-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--orange);
  border-radius: 8px;
  background: var(--surface-soft);
}

.dashboard-note-item:hover {
  border-color: rgba(240, 163, 74, 0.36);
  background: #161711;
}

.dashboard-note-item > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.dashboard-task-item:hover {
  border-color: rgba(56, 209, 142, 0.36);
  border-left-color: var(--green);
  background: #101916;
}

.dashboard-task-item.priority-low {
  border-left-color: #6f8790;
}

.dashboard-task-item.priority-normal {
  border-left-color: var(--green);
}

.dashboard-task-item.priority-high {
  border-left-color: var(--orange);
}

.dashboard-task-item.priority-urgent {
  border-left-color: var(--red);
}

.dashboard-task-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-task-main strong,
.dashboard-task-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-task-main span,
.dashboard-task-side span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.dashboard-task-side {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.dashboard-task-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.work-panel {
  min-height: 260px;
  padding: 20px;
}

.section-panel {
  min-height: 420px;
}

.work-panel:last-child {
  grid-column: 1 / -1;
}

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

.panel-heading h2 {
  margin: 0;
  font-size: 1.2rem;
}

.panel-heading span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.empty-state {
  display: grid;
  min-height: 170px;
  place-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.empty-state p {
  max-width: 320px;
  margin: 0;
  line-height: 1.45;
}

.profile-list {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.profile-list div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.profile-list dt {
  color: var(--muted);
  font-weight: 800;
}

.profile-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.team-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
}

.tasks-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.5fr);
  gap: 18px;
  align-items: start;
}

.notes-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.5fr);
  gap: 18px;
  align-items: start;
}

.team-create-panel {
  position: sticky;
  top: 22px;
  min-height: auto;
}

.task-create-panel {
  position: sticky;
  top: 22px;
  min-height: auto;
}

.note-create-panel {
  position: sticky;
  top: 22px;
  min-height: auto;
}

.users-list {
  display: grid;
  gap: 18px;
}

.tasks-list {
  display: grid;
  gap: 18px;
}

.notes-list {
  display: grid;
  gap: 18px;
}

.user-card {
  display: grid;
  gap: 18px;
  min-height: auto;
}

.task-card {
  display: grid;
  gap: 18px;
  min-height: auto;
  border-left: 4px solid var(--line);
}

.note-card {
  display: grid;
  gap: 18px;
  min-height: auto;
  border-left: 4px solid var(--orange);
}

.note-card.is-archived {
  border-left-color: #6f8790;
  opacity: 0.78;
}

.task-card.priority-low {
  border-left-color: #6f8790;
}

.task-card.priority-normal {
  border-left-color: var(--green);
}

.task-card.priority-high {
  border-left-color: var(--orange);
}

.task-card.priority-urgent {
  border-left-color: var(--red);
}

.user-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.note-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.task-title-group {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.note-title-group {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.note-title-group h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.18rem;
}

.task-title-group h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.18rem;
}

.task-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.task-badge.status-open {
  border-color: rgba(56, 209, 142, 0.3);
  background: rgba(56, 209, 142, 0.1);
  color: var(--green);
}

.task-badge.status-in_progress {
  border-color: rgba(240, 163, 74, 0.32);
  background: rgba(240, 163, 74, 0.1);
  color: var(--orange);
}

.task-badge.status-blocked {
  border-color: rgba(255, 116, 105, 0.32);
  background: rgba(255, 116, 105, 0.09);
  color: var(--red);
}

.task-badge.status-done {
  border-color: rgba(158, 176, 168, 0.25);
  background: rgba(158, 176, 168, 0.08);
  color: var(--muted);
}

.priority-badge {
  background: var(--surface-soft);
}

.note-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.note-badge.visibility-team {
  border-color: rgba(56, 209, 142, 0.3);
  background: rgba(56, 209, 142, 0.1);
  color: var(--green);
}

.note-badge.visibility-private {
  border-color: rgba(240, 163, 74, 0.34);
  background: rgba(240, 163, 74, 0.1);
  color: var(--orange);
}

.note-badge.archived {
  border-color: rgba(158, 176, 168, 0.25);
  background: rgba(158, 176, 168, 0.08);
  color: var(--muted);
}

.task-assignee {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 180px;
  text-align: right;
}

.task-assignee div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.task-assignee strong,
.task-assignee span,
.task-unassigned {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-assignee span,
.task-unassigned {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.task-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.task-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.note-content {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.note-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.task-edit-form {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.note-edit-form {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.user-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.user-heading > div {
  min-width: 0;
}

.user-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}

.user-card-header h2 {
  margin: 0 0 4px;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.user-card-header p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.account-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.account-badge.is-active {
  border-color: rgba(56, 209, 142, 0.32);
  background: rgba(56, 209, 142, 0.11);
  color: var(--green);
}

.account-badge.is-inactive {
  border-color: rgba(255, 116, 105, 0.3);
  background: rgba(255, 116, 105, 0.08);
  color: var(--red);
}

.admin-form {
  display: grid;
  gap: 14px;
}

.admin-form label {
  display: grid;
  gap: 7px;
}

.admin-form label span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
}

.admin-form input,
.admin-form select {
  min-height: 44px;
  padding: 0 12px;
}

.admin-form textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
}

.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  border-color: var(--green);
  outline: 3px solid rgba(56, 209, 142, 0.18);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.compact-button {
  width: fit-content;
  min-width: 150px;
  padding: 0 16px;
}

.password-form {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.account-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.account-meta div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.account-meta dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.account-meta dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-brand {
    padding-bottom: 14px;
  }

  .sidebar-nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 14px;
  }

  .nav-item {
    display: grid;
    min-height: 62px;
    justify-items: center;
    gap: 5px;
    padding: 8px 4px;
    font-size: 0.76rem;
    text-align: center;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
  }

  .user-chip {
    flex: 1;
    min-width: 0;
    padding: 9px 10px;
  }

  .logout-button {
    width: auto;
    min-width: 72px;
  }

  .workspace {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  .welcome-band,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-grid,
  .dashboard-grid,
  .tasks-layout,
  .notes-layout,
  .team-layout,
  .field-grid,
  .account-meta,
  .task-meta,
  .note-meta {
    grid-template-columns: 1fr;
  }

  .task-create-panel,
  .note-create-panel,
  .team-create-panel {
    position: static;
  }

  .compact-button {
    width: 100%;
  }

  .user-card-header {
    flex-direction: column;
  }

  .task-card-header {
    flex-direction: column;
  }

  .note-card-header {
    flex-direction: column;
  }

  .task-assignee {
    justify-content: flex-start;
    min-width: 0;
    text-align: left;
  }

  .task-actions {
    display: grid;
  }

  .dashboard-task-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-note-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-task-side {
    justify-content: flex-start;
  }

  .task-actions form,
  .task-actions button {
    width: 100%;
  }

  .work-panel:last-child {
    grid-column: auto;
  }

  .profile-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
