:root {
  color-scheme: dark;
  --bg: #0f1117;
  --surface: #171a22;
  --surface-2: #202430;
  --surface-3: #282d3a;
  --fg: #f4f6fb;
  --muted: #aab3c5;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #31c7a2;
  --accent-2: #5aa7ff;
  --warn: #f5b84b;
  --danger: #f06f68;
  --success: #4fd17c;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

:root.light {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef2f6;
  --surface-3: #e4eaf1;
  --fg: #171a22;
  --muted: #657085;
  --line: rgba(23, 26, 34, 0.1);
  --accent: #087f68;
  --accent-2: #246bce;
  --warn: #b7791f;
  --danger: #c2413b;
  --success: #168447;
  --shadow: 0 18px 55px rgba(39, 48, 66, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(49, 199, 162, 0.13), transparent 28rem),
    radial-gradient(circle at top right, rgba(90, 167, 255, 0.12), transparent 26rem),
    var(--bg);
  color: var(--fg);
  font: 500 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

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

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 390px;
  gap: 18px;
  width: min(1060px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.auth-copy,
.auth-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.auth-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 520px;
  padding: clamp(24px, 6vw, 54px);
}

.auth-subtitle {
  max-width: 560px;
  color: var(--muted);
  font-size: 17px;
}

.auth-bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 520px;
  margin-top: 24px;
}

.auth-bento span {
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--fg);
  font-weight: 800;
}

.auth-panel {
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 24px;
}

.auth-logo {
  width: 52px;
  height: 52px;
}

.auth-message {
  min-height: 44px;
  margin: 0;
  color: var(--muted);
}

.auth-message.error {
  color: var(--danger);
}

.auth-message.success {
  color: var(--success);
}

.auth-btn {
  width: 100%;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.link-btn {
  justify-self: center;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.link-btn:hover {
  color: var(--accent);
}

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

button {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100vh - 36px);
  padding: 18px;
  overflow: auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
}

.logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061119;
  font-weight: 900;
}

.nav-stack,
.section-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.section-item,
.btn,
.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-item {
  width: 100%;
  padding: 11px 12px;
  color: var(--muted);
  text-align: left;
}

.nav-item:hover,
.nav-item.active,
.btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
}

.nav-item.active {
  color: var(--fg);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface-2));
}

.side-panel,
.panel,
.quick-add,
.stat-card {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side-panel {
  padding: 14px;
}

.panel-title,
.panel-head,
.topbar,
.quick-row,
.inline-controls,
.toolbar,
.task-actions,
.task-meta,
.cal-nav {
  display: flex;
  align-items: center;
}

.panel-title,
.panel-head,
.topbar {
  justify-content: space-between;
  gap: 14px;
}

.panel-title {
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.count-pill,
.chip,
.priority-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
  font-size: 12px;
}

.section-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  color: var(--muted);
}

.section-item strong {
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-actions {
  display: flex;
  gap: 4px;
}

.section-create,
.inline-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.topbar {
  min-height: 80px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.04;
}

h2 {
  font-size: 20px;
}

.toolbar,
.quick-row,
.task-actions,
.task-meta,
.cal-nav {
  gap: 8px;
  flex-wrap: wrap;
}

.btn,
.icon-btn {
  min-height: 40px;
  padding: 9px 13px;
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #061119;
  font-weight: 900;
}

.btn.danger {
  border-color: transparent;
  background: color-mix(in srgb, var(--danger) 88%, #111);
  color: #fff;
}

.btn.ghost,
.icon-btn.ghost {
  background: transparent;
}

.icon-btn {
  min-width: 40px;
}

.quick-add {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.quick-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  flex-wrap: wrap;
}

.quick-copy strong {
  color: var(--fg);
}

.quick-input {
  min-height: 48px;
  font-size: 16px;
}

.input {
  width: 100%;
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--fg);
  background: var(--surface-2);
}

textarea.input {
  resize: vertical;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.input.compact {
  min-height: 36px;
  padding: 8px 10px;
}

select.input option {
  color: #111827;
  background: #ffffff;
}

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

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

.report-card {
  min-height: 126px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 78%, transparent);
}

.report-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.report-card strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.community-panel {
  display: grid;
  gap: 12px;
}

.community-messages {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 64%, transparent);
}

.message {
  max-width: 78%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.message.mine {
  justify-self: end;
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}

.message strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}

.message p {
  margin: 0;
  overflow-wrap: anywhere;
}

.community-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.screen-preview {
  width: 100%;
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
}

.report-bar {
  height: 7px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.report-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.stat-card {
  padding: 15px;
  border-top: 3px solid var(--accent);
}

.stat-card.warning {
  border-top-color: var(--warn);
}

.stat-card.danger {
  border-top-color: var(--danger);
}

.stat-card.success {
  border-top-color: var(--success);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-card strong {
  display: block;
  margin-top: 7px;
  font-size: 28px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.35fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-head {
  margin-bottom: 15px;
}

.form-grid,
.filters {
  display: grid;
  gap: 11px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filters {
  grid-template-columns: 1.4fr repeat(4, minmax(120px, 1fr));
  margin-bottom: 12px;
}

.task-list,
.suggestion-grid {
  display: grid;
  gap: 10px;
}

.task-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 8px 2px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.task {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
}

.task[draggable="true"] {
  cursor: grab;
}

.task.completed {
  opacity: 0.62;
}

.task.completed .task-title {
  text-decoration: line-through;
}

.task-title {
  margin: 0 0 6px;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.task-notes {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.task-meta {
  color: var(--muted);
  font-size: 12px;
}

.priority-high {
  color: #fff;
  border-color: color-mix(in srgb, var(--danger) 70%, var(--line));
  background: color-mix(in srgb, var(--danger) 22%, var(--surface-2));
}

.priority-medium {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--warn) 70%, var(--line));
  background: color-mix(in srgb, var(--warn) 18%, var(--surface-2));
}

.priority-low {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--success) 62%, var(--line));
  background: color-mix(in srgb, var(--success) 14%, var(--surface-2));
}

.due-overdue {
  color: var(--danger);
  font-weight: 800;
}

.due-soon {
  color: var(--warn);
  font-weight: 800;
}

.empty-state,
.suggestion {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-2) 58%, transparent);
}

.suggestion strong {
  display: block;
  color: var(--fg);
  margin-bottom: 4px;
}

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

.calendar {
  display: grid;
  gap: 8px;
}

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

.cal-head .cal-cell {
  min-height: auto;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.cal-cell {
  min-height: 86px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 72%, transparent);
}

.cal-cell.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface-2));
}

.cal-day {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.cal-items {
  display: grid;
  gap: 4px;
}

.cal-item {
  overflow: hidden;
  padding: 2px 5px;
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent-2) 18%, var(--surface-3));
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: auto minmax(170px, 1fr) minmax(170px, 1fr);
  gap: 10px;
}

.mx-hd {
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quad {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 170px;
  max-height: 360px;
  padding: 10px;
  overflow: auto;
  border: 1px dashed color-mix(in srgb, var(--muted) 36%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-2) 68%, transparent);
}

.quad.dragover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
}

.quad-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quad .task {
  grid-template-columns: minmax(0, 1fr);
  padding: 10px;
}

.hidden {
  display: none !important;
}

.celebration {
  position: fixed;
  inset: auto 20px 20px auto;
  z-index: 40;
  width: min(380px, calc(100vw - 40px));
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--success) 44%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  animation: celebrate-in 420ms ease both;
  backdrop-filter: blur(18px);
}

.celebration strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.celebration p {
  margin: 0;
  color: var(--muted);
}

.celebration-bar {
  height: 4px;
  margin-top: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--success), var(--accent-2), var(--warn));
  transform-origin: left;
  animation: rest-timer 5s linear both;
}

@keyframes celebrate-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes rest-timer {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 1100px) {
  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .content-grid,
  .suggestion-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .auth-screen {
    padding: 10px;
  }

  .auth-card,
  .auth-copy,
  .auth-panel {
    padding: 14px;
  }

  .auth-bento,
  .auth-actions {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .report-grid,
  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

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

  .task-actions {
    grid-column: 1 / -1;
  }

  .cal-cell {
    min-height: 70px;
    padding: 6px;
  }

  .cal-item {
    display: none;
  }

  .matrix {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
}
