:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f1eee7;
  --surface-3: #fbfaf7;
  --ink: #24201a;
  --muted: #81776a;
  --line: #e3ded4;
  --accent: #295f58;
  --accent-2: #d86f45;
  --danger: #c64a43;
  --warn: #c88b2c;
  --easy: #4f789b;
  --shadow: 0 18px 44px rgba(64, 53, 40, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.is-locked {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 24px;
  background: #fffaf1;
  color: var(--ink);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #295f58;
  color: #fff;
  font-weight: 800;
}

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

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

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

.nav-item {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #e9f0ed;
  color: var(--accent);
}

.nav-item svg,
button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.mini-panel {
  margin-top: auto;
  padding: 16px;
  border-radius: 8px;
  background: #f0e9dc;
  border: 1px solid #e4d8c5;
}

.mini-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.shell {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
}

.date-picker,
.task-composer,
.panel,
.calendar-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.date-picker {
  height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-picker input,
.task-composer input,
.task-composer select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.task-composer {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 150px 140px auto;
  gap: 8px;
  padding: 10px;
  margin-bottom: 18px;
}

.task-composer input,
.task-composer select {
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  border-radius: 7px;
  background: var(--surface-3);
  border: 1px solid transparent;
}

.task-composer input:focus,
.task-composer select:focus,
.date-picker input:focus,
.auth-card input:focus {
  border-color: rgba(41, 95, 88, 0.36);
  box-shadow: 0 0 0 3px rgba(41, 95, 88, 0.1);
}

.task-composer button,
.calendar-toolbar button,
.icon-button {
  border: 0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
}

.task-composer button:hover,
.calendar-toolbar button:hover,
.icon-button:hover,
.auth-submit:hover {
  background: #214d47;
}

.task-composer button {
  padding: 0 16px;
}

.content-grid,
.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-head {
  min-height: 36px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segmented {
  height: 34px;
  padding: 3px;
  border-radius: 8px;
  background: #f0ece4;
  display: inline-flex;
}

.segmented button {
  min-width: 58px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(28, 36, 48, 0.08);
}

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

.empty {
  padding: 28px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.task-item {
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent-2);
  border-radius: 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: linear-gradient(180deg, #fff, #fffdf9);
}

.task-item.high {
  border-left-color: var(--danger);
}

.task-item.medium {
  border-left-color: var(--warn);
}

.task-item.low {
  border-left-color: var(--easy);
}

.check-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
}

.check-button:hover {
  border-color: var(--accent);
  background: #edf5f1;
}

.task-title {
  font-weight: 720;
  overflow-wrap: anywhere;
}

.task-meta {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1eee7;
}

.delete-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.delete-button:hover {
  background: #fff0ef;
  color: var(--danger);
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.overview div,
.stat-card {
  min-height: 100px;
  padding: 14px;
  border-radius: 8px;
  background: #f8f3ea;
}

.overview span,
.stat-card span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.overview strong,
.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
}

.priority-legend {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  display: inline-block;
}

.dot.high {
  background: var(--danger);
}

.dot.medium {
  background: var(--warn);
}

.dot.low {
  background: var(--easy);
}

.calendar-toolbar {
  height: 58px;
  padding: 8px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.calendar-toolbar button,
.icon-button {
  width: 36px;
  height: 36px;
}

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

.weekday,
.day-cell {
  border-radius: 8px;
}

.weekday {
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.day-cell {
  min-height: 122px;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.day-cell.is-muted {
  opacity: 0.45;
}

.day-cell.is-selected {
  outline: 2px solid var(--accent);
}

.day-number {
  font-weight: 800;
}

.day-task {
  margin-top: 7px;
  padding: 5px 6px;
  border-radius: 6px;
  background: #f0ece4;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-list {
  display: grid;
  gap: 10px;
}

.project-card {
  width: 100%;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
  text-align: left;
}

.project-card.active {
  border-color: var(--accent);
  box-shadow: inset 4px 0 0 var(--accent);
}

.project-card strong {
  display: block;
  margin-bottom: 6px;
}

.member-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.avatar {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: #e6f0ec;
  color: var(--accent);
  font-weight: 700;
}

.member-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  margin-bottom: 16px;
}

.member-composer input {
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #fffdf9;
}

.member-composer input:focus {
  border-color: rgba(41, 95, 88, 0.36);
  box-shadow: 0 0 0 3px rgba(41, 95, 88, 0.1);
}

.member-composer button {
  height: 40px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
}

.compact .task-item {
  min-height: 58px;
}

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

.bar-chart {
  height: 280px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.bar {
  min-height: 34px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #d86f45, #295f58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  padding-bottom: 6px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 20%, rgba(216, 111, 69, 0.16), transparent 32%),
    linear-gradient(135deg, #fbf7ef 0%, #eef4ef 100%);
}

.auth-screen.active {
  display: flex;
}

.auth-panel {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  overflow: hidden;
  border: 1px solid rgba(227, 222, 212, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 28px 80px rgba(64, 53, 40, 0.16);
  backdrop-filter: blur(18px);
}

.auth-copy {
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(160deg, #fffaf1 0%, #e7f0eb 100%);
}

.auth-copy h1 {
  max-width: 430px;
  font-size: 42px;
}

.auth-copy p {
  max-width: 460px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-brand {
  align-self: flex-start;
}

.auth-card {
  padding: 46px 34px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  background: #fff;
}

.auth-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-card input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: #fffdf9;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
}

.code-row button,
.auth-submit,
.account-panel button {
  height: 46px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
}

.code-row button {
  background: #efe5d7;
  color: var(--ink);
  font-weight: 700;
}

.code-row button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.auth-submit {
  margin-top: 4px;
  font-weight: 800;
}

.auth-hint {
  min-height: 22px;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.6;
}

.account-panel {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.account-panel strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.account-panel button {
  height: 36px;
  background: #efe5d7;
  color: var(--ink);
}

.bar-label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    padding: 14px;
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
    gap: 14px;
  }

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

  .nav-item {
    justify-content: center;
  }

  .mini-panel {
    display: none;
  }

  .account-panel {
    min-width: 170px;
  }

  .shell {
    padding: 18px;
  }

  .task-composer,
  .content-grid,
  .project-layout,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .auth-copy {
    padding: 28px;
    gap: 28px;
  }

  .auth-copy h1 {
    font-size: 32px;
  }

  .auth-card {
    padding: 28px;
  }
}

@media (max-width: 680px) {
  body {
    display: block;
    min-width: 0;
    background: #f7f2ea;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px 12px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 28px rgba(64, 53, 40, 0.08);
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    gap: 10px;
    min-width: 0;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .auth-brand span {
    max-width: none;
    white-space: normal;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 4px;
    border-radius: 10px;
    background: #f2eadf;
  }

  .nav-item {
    height: 50px;
    padding: 5px 2px;
    border-radius: 8px;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    line-height: 1.1;
    text-align: center;
  }

  .nav-item svg {
    width: 17px;
    height: 17px;
  }

  .account-panel {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    min-width: 0;
    width: 132px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px 8px;
    padding: 8px;
    background: #fffaf1;
  }

  .account-panel .muted {
    display: none;
  }

  .account-panel strong {
    font-size: 12px;
    line-height: 1.2;
    overflow-wrap: normal;
    white-space: nowrap;
  }

  .account-panel button {
    grid-column: 2;
    grid-row: 1;
    width: 38px;
    height: 36px;
    padding: 0;
  }

  .account-panel button span {
    display: none;
  }

  .shell {
    padding: 16px 12px 28px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
  }

  .eyebrow {
    font-size: 12px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 17px;
  }

  .date-picker {
    width: 100%;
    height: 46px;
  }

  .date-picker input {
    width: 100%;
  }

  .task-composer,
  .panel,
  .calendar-toolbar {
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(64, 53, 40, 0.07);
  }

  .task-composer {
    gap: 9px;
    padding: 10px;
    margin-bottom: 14px;
  }

  .task-composer input,
  .task-composer select {
    height: 46px;
    border-radius: 8px;
  }

  .task-composer button {
    height: 48px;
    border-radius: 8px;
    font-weight: 800;
  }

  .content-grid,
  .project-layout,
  .stats-grid {
    gap: 12px;
  }

  .panel {
    padding: 14px;
  }

  .panel-head {
    min-height: 34px;
    margin-bottom: 12px;
    align-items: flex-start;
  }

  .segmented {
    height: 32px;
    flex: 0 0 auto;
  }

  .segmented button {
    min-width: 50px;
    font-size: 13px;
  }

  .task-list {
    gap: 9px;
  }

  .task-item {
    min-height: 76px;
    padding: 11px 9px;
    grid-template-columns: 34px minmax(0, 1fr) 30px;
    gap: 8px;
    border-left-width: 4px;
  }

  .check-button,
  .delete-button {
    width: 30px;
    height: 30px;
  }

  .task-title {
    font-size: 15px;
    line-height: 1.35;
  }

  .task-meta {
    gap: 5px;
    font-size: 12px;
  }

  .pill {
    padding: 2px 7px;
  }

  .calendar {
    gap: 5px;
  }

  .calendar-toolbar {
    height: 52px;
    margin-bottom: 10px;
  }

  .day-cell {
    min-height: 74px;
    padding: 6px 4px;
  }

  .weekday {
    font-size: 12px;
    padding: 4px 2px;
  }

  .day-number {
    font-size: 13px;
  }

  .day-task {
    margin-top: 5px;
    padding: 4px;
    font-size: 10px;
    border-radius: 5px;
  }

  .overview {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .overview div,
  .stat-card {
    min-height: 84px;
    padding: 12px;
  }

  .overview strong,
  .stat-card strong {
    margin-top: 6px;
    font-size: 30px;
  }

  .priority-legend {
    margin-top: 12px;
  }

  .project-card {
    min-height: 66px;
  }

  .member-row {
    gap: 6px;
  }

  .avatar {
    max-width: 100%;
    height: 30px;
    font-size: 12px;
  }

  .member-composer input,
  .member-composer button {
    height: 44px;
  }

  .bar-chart {
    height: 220px;
    gap: 4px;
    overflow: hidden;
  }

  .bar {
    min-height: 28px;
    padding-bottom: 4px;
    font-size: 10px;
    border-radius: 5px 5px 0 0;
  }

  .bar-label {
    font-size: 10px;
  }

  .auth-screen {
    align-items: stretch;
    padding: 12px;
    overflow-y: auto;
  }

  .auth-panel {
    width: 100%;
    align-self: center;
    border-radius: 12px;
  }

  .auth-copy {
    padding: 22px;
    gap: 18px;
  }

  .auth-copy h1 {
    font-size: 28px;
  }

  .auth-copy p {
    font-size: 14px;
  }

  .auth-card {
    padding: 22px;
    gap: 14px;
  }

  .code-row {
    grid-template-columns: 1fr;
  }

  .member-composer {
    grid-template-columns: 1fr;
  }

  .sidebar {
    align-items: stretch;
  }
}

@media (max-width: 380px) {
  .nav-item {
    font-size: 11px;
  }

  .task-item {
    grid-template-columns: 30px minmax(0, 1fr) 28px;
  }

  .day-cell {
    min-height: 66px;
  }

  .day-task {
    display: none;
  }
}

@media (min-width: 420px) and (max-width: 680px) {
  .shell {
    padding-inline: 14px;
  }

  .panel,
  .task-composer,
  .date-picker,
  .calendar-toolbar {
    border-radius: 11px;
  }

  .task-item {
    padding: 12px 11px;
  }

  .day-cell {
    min-height: 82px;
  }

  .account-panel {
    width: 140px;
  }
}
