:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #18202b;
  --muted: #667085;
  --line: #d8dee8;
  --blue: #2563eb;
  --green: #15935d;
  --amber: #c77803;
  --red: #d23f31;
  --black: #2b2f38;
  --cyan: #087ea4;
  --shadow: 0 20px 60px rgba(22, 32, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #111827;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--ink);
}

.login-brand p {
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-card input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.login-card button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

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

.migration-card {
  display: grid;
  gap: 16px;
  width: min(760px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.migration-card h1,
.migration-card p {
  margin: 0;
}

.migration-card p {
  color: var(--muted);
}

.migration-card textarea {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.migration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.migration-actions button,
.migration-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.migration-actions a {
  background: var(--black);
}

.migration-message {
  min-height: 20px;
  color: var(--red);
  font-weight: 800;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  background: #111827;
  color: #fff;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--green);
  font-size: 24px;
  font-weight: 800;
}

.brand h1,
.brand p,
.day-header h2,
.day-header p,
.section-title h2,
.yesterday-summary h2 {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1.1;
}

.brand p {
  color: #b8c1cf;
  font-size: 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #7c8aa0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.today-card,
.account-card,
.calendar-panel,
.yesterday-summary {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.today-card {
  padding: 18px;
}

.account-card {
  padding: 16px;
}

.account-card strong {
  display: block;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}

.account-card button {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 800;
}

.today-card strong {
  display: block;
  margin-bottom: 14px;
  font-size: 22px;
}

.today-card button,
.task-entry button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
}

.today-card button {
  width: 100%;
}

.calendar-panel,
.yesterday-summary {
  padding: 16px;
}

.calendar-header {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-header strong {
  text-align: center;
  text-transform: capitalize;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

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

.weekdays {
  margin-bottom: 8px;
  color: #aab4c4;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-day {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-weight: 800;
}

.calendar-day.empty {
  visibility: hidden;
}

.calendar-day.today {
  border-color: #7dd3fc;
}

.calendar-day.selected {
  background: #fff;
  color: #111827;
}

.calendar-day.has-tasks::after {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  margin: 2px auto 0;
  border-radius: 999px;
  background: var(--green);
}

.compact-stats {
  display: grid;
  gap: 8px;
  color: #d6dce6;
  font-size: 14px;
}

.compact-stats strong {
  color: #fff;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 32px;
}

.day-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.day-header h2 {
  font-size: 36px;
  line-height: 1.05;
}

.day-header p {
  margin-top: 8px;
  color: var(--muted);
}

.level-badge {
  min-width: 148px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
  text-align: center;
  box-shadow: var(--shadow);
}

.level-badge.neutral {
  background: var(--black);
}

.level-badge.productive {
  background: var(--green);
}

.level-badge.sensitive {
  background: var(--amber);
}

.level-badge.critical {
  background: var(--red);
}

.level-badge.maximum {
  background: #111827;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(240px, 0.8fr);
  gap: 18px;
}

.chart-card,
.metric,
.month-tat,
.tat-card,
.tasks-panel,
.task-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(22, 32, 48, 0.06);
}

.chart-card {
  min-height: 300px;
  padding: 18px;
}

#status-chart {
  display: block;
  width: 100%;
  height: 280px;
}

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

.metric {
  min-height: 130px;
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 18px;
  font-size: 42px;
  line-height: 1;
}

.metric.complete {
  border-top: 5px solid var(--green);
}

.metric.rescheduled {
  border-top: 5px solid var(--amber);
}

.metric.canceled {
  border-top: 5px solid var(--red);
}

.metric.pending {
  border-top: 5px solid var(--black);
}

.metric.overdue {
  border-top: 5px solid #b42318;
}

.metric.intime {
  border-top: 5px solid var(--cyan);
}

.month-tat {
  padding: 18px;
}

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

.tat-card {
  min-height: 104px;
  padding: 16px;
  box-shadow: none;
}

.tat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tat-card strong {
  display: block;
  margin-top: 14px;
  font-size: 32px;
  line-height: 1;
}

.task-entry {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 170px 170px 130px;
  gap: 12px;
  padding: 14px;
}

.task-entry input,
.task-entry select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
}

.company-field,
.recurrence-field,
.due-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.due-field input {
  min-height: 44px;
}

.task-entry input:focus,
.task-entry select:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.tasks-panel {
  padding: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  font-size: 22px;
}

.section-title span {
  color: var(--muted);
  font-weight: 800;
}

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

.empty-state {
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

.task-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-item-overdue {
  border-color: #f0b4ae;
  background: #fff8f7;
}

.task-title,
.task-title-input {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.task-title-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.task-title-input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.task-edit-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 180px));
  gap: 8px;
  margin-top: 8px;
}

.task-edit-row select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.company-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.company-tag.agency {
  background: var(--blue);
}

.company-tag.condo {
  background: var(--green);
}

.company-tag.personal {
  background: #7c3aed;
}

.recurrence-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f9fc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.task-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.task-item-overdue .task-status {
  color: #b42318;
}

.task-date-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.task-date-row input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 8px;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-button,
.delete-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.status-button {
  padding: 0 10px;
}

.delete-button {
  width: 36px;
  color: var(--red);
}

.status-button.active {
  color: #fff;
}

.status-button[data-status="done"].active {
  border-color: var(--green);
  background: var(--green);
}

.status-button[data-status="rescheduled"].active {
  border-color: var(--amber);
  background: var(--amber);
}

.status-button[data-status="canceled"].active {
  border-color: var(--red);
  background: var(--red);
}

.status-button[data-status="pending"].active {
  border-color: var(--black);
  background: var(--black);
}

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

  .sidebar {
    min-height: auto;
  }

  .dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .sidebar,
  .workspace {
    padding: 18px;
  }

  .day-header {
    flex-direction: column;
  }

  .day-header h2 {
    font-size: 30px;
  }

  .level-badge {
    width: 100%;
  }

  .task-entry {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .tat-grid {
    grid-template-columns: 1fr;
  }

  .task-item {
    grid-template-columns: 1fr;
  }

  .task-actions {
    justify-content: flex-start;
  }

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