:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --blue: #0077ff;
  --blue-dark: #005fd1;
  --green: #067647;
  --green-bg: #ecfdf3;
  --orange: #b54708;
  --orange-bg: #fffaeb;
  --red: #b42318;
  --red-bg: #fef3f2;
  --shadow: 0 8px 28px rgba(16, 24, 40, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

.app {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 14px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 2px 12px;
  background: linear-gradient(180deg, var(--bg) 70%, rgba(242, 244, 248, 0));
}

.topbar__main {
  min-width: 0;
  flex: 1;
}

.brand {
  font-size: 25px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.topbar__meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dot {
  margin: 0 4px;
}

.refresh {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.06);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--blue);
  transition: transform 0.15s ease, background 0.15s ease;
}

.refresh:active {
  transform: scale(0.94);
  background: #eef4ff;
}

.refresh svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.refresh.is-busy svg {
  animation: spin 0.9s linear infinite;
}

.notice {
  margin: 8px 0 14px;
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 14px;
  line-height: 1.45;
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid #fedf89;
}

.notice.is-error {
  background: var(--red-bg);
  color: var(--red);
  border-color: #fecdca;
}

.notice.is-info {
  background: #eff8ff;
  color: #175cd3;
  border-color: #b2ddff;
}

.hidden {
  display: none !important;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42vh;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid #d0d5dd;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.content {
  padding-top: 4px;
}

.tabs {
  position: sticky;
  top: 74px;
  z-index: 19;
  display: flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 14px;
  background: #e9edf5;
  border-radius: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 0 auto;
  min-width: 78px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab.is-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(16, 24, 40, 0.1);
}

.tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 3px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e9edf5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  vertical-align: 1px;
}

.tab.is-active .tab__count {
  background: #e8f1ff;
  color: var(--blue);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: var(--shadow);
  animation: rise 0.22s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task__top {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.badge--date {
  background: var(--red-bg);
  color: var(--red);
}

.badge--today {
  background: #eff8ff;
  color: #175cd3;
}

.badge--recurring {
  background: var(--green-bg);
  color: var(--green);
}

.badge--source {
  background: #f2f4f7;
  color: var(--muted);
}

.task__text {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.42;
  font-weight: 650;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.task__bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.task__assignee {
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task__assignee strong {
  color: var(--text);
  font-weight: 700;
}

.task__source {
  margin-top: 3px;
  font-size: 11px;
  color: #98a2b3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.task__due {
  flex: 0 0 auto;
  text-align: right;
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}

.task__due small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: normal;
  max-width: 150px;
}

.empty {
  padding: 42px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed #d0d5dd;
  border-radius: var(--radius);
}

.empty__icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.empty__title {
  color: var(--text);
  font-weight: 750;
  margin-bottom: 4px;
}

.footer {
  margin-top: 18px;
  text-align: center;
  color: #98a2b3;
  font-size: 11px;
}

@media (max-width: 420px) {
  .brand {
    font-size: 22px;
  }
  .tabs {
    top: 70px;
  }
  .tab {
    font-size: 13px;
    padding: 8px 4px;
  }
  .task {
    padding: 13px 14px;
  }
  .task__text {
    font-size: 14px;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 50;
  transform: translateX(-50%);
  max-width: min(92vw, 520px);
  padding: 12px 16px;
  border-radius: 14px;
  background: #101828;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.28);
  animation: rise 0.2s ease both;
}

.toast.is-error {
  background: #b42318;
}

.task__assignee-line {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.task__assignee-line strong {
  color: var(--text);
  font-weight: 750;
}

.task__email {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.task__email.is-empty {
  color: #b42318;
}

.hint {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ecfdf3;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: 1px;
}

.task__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  border: 0;
  border-radius: 11px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.12s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  flex: 1;
  background: var(--blue);
  color: #fff;
}

.btn--primary:hover {
  background: var(--blue-dark);
}

.btn--ghost {
  background: #eef2f7;
  color: #344054;
}

.task__sent {
  margin-top: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 650;
}

.task__edit {
  margin-top: 4px;
  padding-top: 2px;
}

.field {
  display: block;
  margin-bottom: 10px;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.field input {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 11px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 119, 255, 0.14);
}

.task__edit-actions {
  display: flex;
  gap: 8px;
}

.task__edit-actions .btn {
  flex: 1;
}

.badge--done {
  background: #d1fadf;
  color: #05603a;
}

.task__completion {
  margin-top: 12px;
  padding: 12px 13px;
  border-radius: 12px;
  background: #ecfdf3;
  border: 1px solid #abefc6;
}

.task__completion-title {
  color: #05603a;
  font-size: 12px;
  font-weight: 800;
}

.task__completion-note {
  margin-top: 5px;
  color: #085d3a;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.subtabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  margin-bottom: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 13px;
}

.subtab {
  flex: 1;
  border: 0;
  border-radius: 9px;
  padding: 9px 6px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 750;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.subtab.is-active {
  background: #101828;
  color: #ffffff;
}

.subtab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  margin-left: 3px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  vertical-align: 1px;
}

.subtab.is-active .subtab__count {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.badge--overdue {
  background: #fef3f2;
  color: #b42318;
  border: 1px solid #fecdca;
}

.task__requester {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.task__requester strong {
  color: #344054;
  font-weight: 700;
}

.task {
  position: relative;
}

.task__top {
  padding-right: 34px;
}

.task__trash {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: #f2f4f7;
  color: #667085;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.task__trash:hover {
  background: #fee4e2;
  color: #b42318;
}

.task__trash:active {
  transform: scale(0.94);
}

.task__trash svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
